Some fixes to the way data paths are saved and settings are handled

pull/37/head
pvdk 12 years ago
parent dad66cd968
commit 52e5dcc7f0

@ -213,8 +213,6 @@ bool MainDialog::showFirstRunDialog()
return false;
// Re-read the game settings
mGameSettings.clear();
if (!setupGameSettings())
return false;
@ -389,7 +387,7 @@ bool MainDialog::setupGameSettings()
QFileInfo info(selectedFile);
// Add the new dir to the settings file and to the data dir container
mGameSettings.setValue(QString("data"), info.absolutePath());
mGameSettings.setMultiValue(QString("data"), info.absolutePath());
mGameSettings.addDataDir(info.absolutePath());
}
@ -478,7 +476,7 @@ void MainDialog::saveSettings()
}
void MainDialog::writeSettings()
bool MainDialog::writeSettings()
{
// Now write all config files
saveSettings();
@ -498,7 +496,7 @@ void MainDialog::writeSettings()
Please make sure you have the right permissions \
and try again.<br>").arg(userPath));
msgBox.exec();
return;
return false;
}
}
@ -515,7 +513,7 @@ void MainDialog::writeSettings()
Please make sure you have the right permissions \
and try again.<br>").arg(file.fileName()));
msgBox.exec();
return;
return false;
}
QTextStream stream(&file);
@ -537,7 +535,7 @@ void MainDialog::writeSettings()
Please make sure you have the right permissions \
and try again.<br>").arg(file.fileName()));
msgBox.exec();
return;
return false;
}
stream.setDevice(&file);
@ -559,7 +557,7 @@ void MainDialog::writeSettings()
Please make sure you have the right permissions \
and try again.<br>").arg(file.fileName()));
msgBox.exec();
return;
return false;
}
stream.setDevice(&file);
@ -567,19 +565,20 @@ void MainDialog::writeSettings()
mLauncherSettings.writeFile(stream);
file.close();
return true;
}
void MainDialog::closeEvent(QCloseEvent *event)
{
saveSettings();
writeSettings();
event->accept();
}
void MainDialog::play()
{
saveSettings();
writeSettings();
if (!writeSettings())
qApp->quit();
// Launch the game detached
startProgram(QString("openmw"), true);

@ -45,7 +45,7 @@ private:
void loadSettings();
void saveSettings();
void writeSettings();
bool writeSettings();
inline bool startProgram(const QString &name, bool detached = false) { return startProgram(name, QStringList(), detached); }
bool startProgram(const QString &name, const QStringList &arguments, bool detached = false);

@ -40,11 +40,6 @@ public:
mSettings.remove(key);
}
inline void clear()
{
mSettings.clear();
}
inline QStringList getDataDirs() { return mDataDirs; }
inline void addDataDir(const QString &dir) { if(!dir.isEmpty()) mDataDirs.append(dir); }
inline QString getDataLocal() {return mDataLocal; }

Loading…
Cancel
Save