From da74ca5ce0242cfd107a98d7934835aba178024f Mon Sep 17 00:00:00 2001 From: Thunderforge Date: Mon, 5 Mar 2018 21:26:59 -0600 Subject: [PATCH] Add testing options to the Settings page --- apps/launcher/settingspage.cpp | 42 ++++ apps/launcher/settingspage.hpp | 1 + files/ui/settingspage.ui | 367 ++++++++++++++++++++------------- 3 files changed, 265 insertions(+), 145 deletions(-) diff --git a/apps/launcher/settingspage.cpp b/apps/launcher/settingspage.cpp index 843b51391..906459c23 100644 --- a/apps/launcher/settingspage.cpp +++ b/apps/launcher/settingspage.cpp @@ -177,6 +177,28 @@ void Launcher::SettingsPage::on_browseButton_clicked() } } +void Launcher::SettingsPage::on_runScriptAfterStartupBrowseButton_clicked() +{ + QString scriptFile = QFileDialog::getOpenFileName( + this, + QObject::tr("Select script file"), + QDir::currentPath(), + QString(tr("Text file (*.txt)"))); + + + if (scriptFile.isEmpty()) + return; + + QFileInfo info(scriptFile); + + if (!info.exists() || !info.isReadable()) + return; + + const QString path(QDir::toNativeSeparators(info.absoluteFilePath())); + + runScriptAfterStartupField->setText(path); +} + void Launcher::SettingsPage::wizardStarted() { mMain->hide(); // Hide the launcher @@ -260,6 +282,19 @@ void Launcher::SettingsPage::saveSettings() } else { mGameSettings.setValue(QLatin1String("encoding"), QLatin1String("win1252")); } + + // Testing + int skipMenu = skipMenuCheckBox->checkState() == Qt::Checked; + if (skipMenu != mGameSettings.value("skip-menu").toInt()) + mGameSettings.setValue("skip-menu", QString::number(skipMenu)); + + QString startCell = startDefaultCharacterAtField->text(); + if (startCell != mGameSettings.value("start")) { + mGameSettings.setValue("start", startCell); + } + QString scriptRun = runScriptAfterStartupField->text(); + if (scriptRun != mGameSettings.value("script-run")) + mGameSettings.setValue("script-run", scriptRun); } bool Launcher::SettingsPage::loadSettings() @@ -271,5 +306,12 @@ bool Launcher::SettingsPage::loadSettings() if (index != -1) languageComboBox->setCurrentIndex(index); + // Testing + if (mGameSettings.value("skip-menu").toInt() == 1) + skipMenuCheckBox->setCheckState(Qt::Checked); + + startDefaultCharacterAtField->setText(mGameSettings.value("start")); + runScriptAfterStartupField->setText(mGameSettings.value("script-run")); + return true; } diff --git a/apps/launcher/settingspage.hpp b/apps/launcher/settingspage.hpp index ccc2061dd..12539a0fc 100644 --- a/apps/launcher/settingspage.hpp +++ b/apps/launcher/settingspage.hpp @@ -38,6 +38,7 @@ namespace Launcher void on_wizardButton_clicked(); void on_importerButton_clicked(); void on_browseButton_clicked(); + void on_runScriptAfterStartupBrowseButton_clicked(); void wizardStarted(); void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus); diff --git a/files/ui/settingspage.ui b/files/ui/settingspage.ui index f4f41f839..eed723adb 100644 --- a/files/ui/settingspage.ui +++ b/files/ui/settingspage.ui @@ -7,7 +7,7 @@ 0 0 514 - 397 + 532 @@ -15,153 +15,230 @@ - - - Morrowind Content Language + + + true - - - - - - 250 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 0 + 0 + 473 + 510 + + + + + + + Morrowind Content Language + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 250 + 0 + + + + + + + + + + + Morrowind Installation Wizard + + + + + + Run &Installation Wizard + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Morrowind Settings Importer + + + + + + + + File to import settings from: + + + + + + + + + + Browse... + + + + + + + + + Import add-on and plugin selection (creates a new Content List) + + + true + + + + + + + + + Run &Settings Importer + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 4 + + + false + + + + + + + + + + Testing + + + + + + Skip menu and generate default character + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Start default character at + + + + + + + default cell + + + + + + + + + Run script after startup: + + + + + + + + + + + + Browse… + + + + + + + + + + - - - - Morrowind Installation Wizard - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Run &Installation Wizard - - - - - - - - - - Morrowind Settings Importer - - - - - - - - File to import settings from: - - - - - - - - - - Browse... - - - - - - - - - Import add-on and plugin selection (creates a new Content List) - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Run &Settings Importer - - - - - - - - - 4 - - - false - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - -