diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-07-25 22:08:43 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-03 11:39:05 -0500 |
| commit | dfbcf8ec4c6da4d2d098403a01e7ec19b587e836 (patch) | |
| tree | f911eb6a6ec4dfafb767ce8d2ddb7802f1a0ca05 | |
| parent | 0389688f3b30b9888bb94a08991bc1de00b89c59 (diff) | |
restart when finished, added launch instance checkbox
| -rw-r--r-- | src/createinstancedialog.cpp | 14 | ||||
| -rw-r--r-- | src/createinstancedialog.ui | 38 | ||||
| -rw-r--r-- | src/instancemanager.h | 3 |
3 files changed, 53 insertions, 2 deletions
diff --git a/src/createinstancedialog.cpp b/src/createinstancedialog.cpp index 4b9f24ae..63df9cd7 100644 --- a/src/createinstancedialog.cpp +++ b/src/createinstancedialog.cpp @@ -3,6 +3,7 @@ #include "createinstancedialogpages.h" #include "instancemanager.h" #include "settings.h" +#include "shared/util.h" #include "shared/appconfig.h" #include <iplugingame.h> #include <utility.h> @@ -27,6 +28,7 @@ CreateInstanceDialog::CreateInstanceDialog( m_pages.push_back(std::make_unique<ConfirmationPage>(*this)); ui->pages->setCurrentIndex(0); + ui->launch->setChecked(true); updateNavigation(); @@ -287,6 +289,14 @@ void CreateInstanceDialog::finish() } logCreation(tr("Done.")); + + if (ui->launch->isChecked()) { + InstanceManager::instance().setCurrentInstance(ci.instanceName); + ExitModOrganizer(Exit::Restart); + } else { + ui->next->setEnabled(false); + ui->cancel->setText(tr("Close")); + } } catch(Failed&) { @@ -328,6 +338,10 @@ void CreateInstanceDialog::updateNavigation() } else { ui->next->setText(m_originalNext); } + + // this may have been changed by finish() if the launch checkbox wasn't + // checked + ui->cancel->setText(tr("Cancel")); } CreateInstanceDialog::Types CreateInstanceDialog::instanceType() const diff --git a/src/createinstancedialog.ui b/src/createinstancedialog.ui index 41703f5e..bcd2eb03 100644 --- a/src/createinstancedialog.ui +++ b/src/createinstancedialog.ui @@ -910,6 +910,44 @@ </property> </widget> </item> + <item> + <widget class="QWidget" name="widget_20" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>304</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="launch"> + <property name="text"> + <string>Launch the new instance</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> </item> diff --git a/src/instancemanager.h b/src/instancemanager.h index 33a751c2..7467e2fa 100644 --- a/src/instancemanager.h +++ b/src/instancemanager.h @@ -45,6 +45,7 @@ public: void clearCurrentInstance(); QString currentInstance() const; + void setCurrentInstance(const QString &name); bool allowedToChangeInstance() const; static bool isPortablePath(const QString& dataPath); @@ -67,8 +68,6 @@ private: QString manageInstances(const QStringList &instanceList) const; - void setCurrentInstance(const QString &name); - QString queryInstanceName(const QStringList &instanceList) const; QString chooseInstance(const QStringList &instanceList) const; |
