This code should now allow GC to be run off a USB stick.. or the Qollector. If GC finds a Library/GoldenCheetah next to the executable, it will use that location to store all of its settings and Libraries. Otherwise, it reverts to how GC handled settings previously.

This commit is contained in:
Justin F. Knotzke
2009-08-08 16:55:47 -04:00
committed by Justin Knotzke
parent 41063d069d
commit 622516b63d
17 changed files with 161 additions and 66 deletions

View File

@@ -189,8 +189,15 @@ QStringList RideFileFactory::listRideFiles(const QDir &dir) const
filters << ("*." + i.key());
}
// This will read the user preferences and change the file list order as necessary:
QSettings settings(GC_SETTINGS_CO, GC_SETTINGS_APP);
QVariant isAscending = settings.value(GC_ALLRIDES_ASCENDING,Qt::Checked);
//First check to see if the Library folder exists where the executable is (for USB sticks)
QDir home = QDir();
QSettings *settings;
if(!home.exists("Library/GoldenCheetah"))
settings = new QSettings(GC_SETTINGS_CO, GC_SETTINGS_APP);
else
settings = new QSettings(home.absolutePath()+"/gc", QSettings::IniFormat);
QVariant isAscending = settings->value(GC_ALLRIDES_ASCENDING,Qt::Checked);
if(isAscending.toInt()>0){
return dir.entryList(filters, QDir::Files, QDir::Name);
}