From fd25616cab06903425eabb09157dc865e015e594 Mon Sep 17 00:00:00 2001 From: darkf Date: Tue, 11 Jun 2013 20:10:43 -0700 Subject: [PATCH 1/3] launcher: Properly quit if settings write fails. --- apps/launcher/maindialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index e5da3431a..d0b3a2def 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -608,8 +608,10 @@ void MainDialog::closeEvent(QCloseEvent *event) void MainDialog::play() { - if (!writeSettings()) + if (!writeSettings()) { qApp->quit(); + return; + } // Launch the game detached startProgram(QString("openmw"), true); From fb462f1b1af68ca441f3179441b316d12ba299cb Mon Sep 17 00:00:00 2001 From: darkf Date: Tue, 11 Jun 2013 20:12:22 -0700 Subject: [PATCH 2/3] launcher: Throw error if no data files are selected --- apps/launcher/maindialog.cpp | 11 +++++++++++ apps/launcher/settings/gamesettings.hpp | 1 + 2 files changed, 12 insertions(+) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index d0b3a2def..a5fe8dcae 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -531,6 +531,17 @@ bool MainDialog::writeSettings() } } + if(!mGameSettings.hasMaster()) { + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error writing OpenMW configuration file")); + msgBox.setIcon(QMessageBox::Critical); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
You do not have any master files selected.

\ + Please select one and try again.
")); + msgBox.exec(); + return false; + } + // Game settings QFile file(userPath + QString("openmw.cfg")); diff --git a/apps/launcher/settings/gamesettings.hpp b/apps/launcher/settings/gamesettings.hpp index 7a17ef9af..55b2107e2 100644 --- a/apps/launcher/settings/gamesettings.hpp +++ b/apps/launcher/settings/gamesettings.hpp @@ -43,6 +43,7 @@ public: inline QStringList getDataDirs() { return mDataDirs; } inline void addDataDir(const QString &dir) { if(!dir.isEmpty()) mDataDirs.append(dir); } inline QString getDataLocal() {return mDataLocal; } + inline bool hasMaster() { return mSettings.count(QString("master")) > 0; } QStringList values(const QString &key, const QStringList &defaultValues = QStringList()); bool readFile(QTextStream &stream); From 43455129d0211eac758532047067e6c50ee2825a Mon Sep 17 00:00:00 2001 From: darkf Date: Mon, 17 Jun 2013 08:58:48 +0000 Subject: [PATCH 3/3] launcher: Instead of killing config writing due to no master files being selected, instead display a warning when Play is pressed. --- apps/launcher/maindialog.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index a5fe8dcae..1fa6a6480 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -531,17 +531,6 @@ bool MainDialog::writeSettings() } } - if(!mGameSettings.hasMaster()) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error writing OpenMW configuration file")); - msgBox.setIcon(QMessageBox::Critical); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setText(tr("
You do not have any master files selected.

\ - Please select one and try again.
")); - msgBox.exec(); - return false; - } - // Game settings QFile file(userPath + QString("openmw.cfg")); @@ -624,6 +613,17 @@ void MainDialog::play() return; } + if(!mGameSettings.hasMaster()) { + QMessageBox msgBox; + msgBox.setWindowTitle(tr("No master file selected")); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setText(tr("
You do not have any master files selected.

\ + OpenMW will not start without a master file selected.
")); + msgBox.exec(); + return; + } + // Launch the game detached startProgram(QString("openmw"), true); qApp->quit();