34
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
35
QVariant warnsetting = settings->value(GC_WARNCONVERT);
35
QVariant warnsetting = appsettings->value(NULL, GC_WARNCONVERT);
36
36
if (warnsetting.isNull()) setting = true;
37
37
else setting = warnsetting.toBool();
42
42
setWarnOnConvert(bool setting)
44
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
45
settings->setValue(GC_WARNCONVERT, setting);
44
appsettings->setValue(GC_WARNCONVERT, setting);
53
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
54
QVariant warnsetting = settings->value(GC_WARNEXIT);
55
if (warnsetting.isNull()) setting = true;
56
else setting = warnsetting.toBool();
50
return appsettings->value(NULL, GC_WARNEXIT, true).toBool();
61
54
setWarnExit(bool setting)
63
boost::shared_ptr<QSettings> settings = GetApplicationSettings();
64
settings->setValue(GC_WARNEXIT, setting);
56
appsettings->setValue(GC_WARNEXIT, setting);
67
59
//----------------------------------------------------------------------
143
135
.arg ( ridedatetime.time().minute(), 2, 10, zero )
144
136
.arg ( ridedatetime.time().second(), 2, 10, zero );
138
// if there is a notes file we need to rename it (cpi we will ignore)
139
QFile notesFile(currentFI.path() + QDir::separator() + currentFI.baseName() + ".notes");
140
if (notesFile.exists()) notesFile.remove();
146
142
// When datetime changes we need to update
147
143
// the filename & rename/delete old file
148
144
// we also need to preserve the notes file
149
145
if (currentFI.baseName() != targetnosuffix) {
151
// if there is a notes file we need to rename it (cpi we will ignore)
152
QFile notesFile(currentFI.path() + QDir::separator() + currentFI.baseName() + ".notes");
154
if (notesFile.exists())
155
notesFile.rename(notesFile.fileName(),
156
rideItem->path + QDir::separator() + targetnosuffix + ".notes");
158
// we also need to update the path to the notes filename
159
ride->notesFileName = targetnosuffix + ".notes";
161
147
// rename as backup current if converting, or just delete it if its already .gc
162
// delete old .bak file if it is there
148
// unlink previous .bak if it is already there
164
QFile::remove(currentFile.fileName() + ".bak");
150
QFile::remove(currentFile.fileName()+".bak"); // ignore errors if not there
165
151
currentFile.rename(currentFile.fileName(), currentFile.fileName() + ".bak");
166
152
} else currentFile.remove();
167
153
convert = false; // we just did it already!
169
155
// set the new filename & Start time everywhere
170
currentFile.setFileName(rideItem->path + QDir::separator() + targetnosuffix + ".gc");
156
currentFile.setFileName(rideItem->path + QDir::separator() + targetnosuffix + ".json");
171
157
rideItem->setFileName(QFileInfo(currentFile).path(), QFileInfo(currentFile).fileName());
174
160
// set target filename
176
162
// rename the source
177
savedFile.setFileName(currentFI.path() + QDir::separator() + currentFI.baseName() + ".gc");
163
savedFile.setFileName(currentFI.path() + QDir::separator() + currentFI.baseName() + ".json");
179
165
savedFile.setFileName(currentFile.fileName());
187
173
rideItem->ride()->setTag("Change History", log);
189
175
// save in GC format
191
reader.writeRideFile(rideItem->ride(), savedFile);
176
JsonFileReader reader;
177
reader.writeRideFile(this, rideItem->ride(), savedFile);
193
179
// rename the file and update the rideItem list to reflect the change
196
// rename on disk and delete old .bak if it is there
197
QFile::remove(currentFile.fileName() + ".bak");
183
QFile::remove(currentFile.fileName()+".bak"); // ignore errors if not there
198
184
currentFile.rename(currentFile.fileName(), currentFile.fileName() + ".bak");
200
186
// rename in memory
201
187
rideItem->setFileName(QFileInfo(savedFile).path(), QFileInfo(savedFile).fileName());
204
191
// mark clean as we have now saved the data
205
192
rideItem->ride()->emitSaved();
334
321
// whizz through the list and save one by one using
335
322
// singleSave to ensure warnings are given if neccessary
323
// use mainWindow->ismultisave to prevent refreshing stats
325
mainWindow->ismultisave = true;
336
326
for (int i=0; i<dirtyList.count(); i++) {
337
327
QCheckBox *c = (QCheckBox *)dirtyFiles->cellWidget(i,0);
338
328
if (c->isChecked()) {
329
if (i==dirtyList.count()-1) {
330
mainWindow->ismultisave = false;
339
332
mainWindow->saveRideSingleDialog(dirtyList.at(i));
336
mainWindow->ismultisave = false;