diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index 6a3965cc91..5d11421d0f 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -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.
").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.
").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.
").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.
").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);
diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp
index 643206ab6c..7e818a74ab 100644
--- a/apps/launcher/maindialog.hpp
+++ b/apps/launcher/maindialog.hpp
@@ -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);
diff --git a/apps/launcher/settings/gamesettings.hpp b/apps/launcher/settings/gamesettings.hpp
index 6c296711f8..7a17ef9af0 100644
--- a/apps/launcher/settings/gamesettings.hpp
+++ b/apps/launcher/settings/gamesettings.hpp
@@ -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; }