diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-03 12:10:41 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-03 12:10:41 -0500 |
| commit | a4747a1ecc9f4fe56700c64933cc3c6cebd04734 (patch) | |
| tree | daddf9542d5bb5e686d2d628abec83fd8c46a20f | |
| parent | 7b1e30b4649bc9ed8844cbc0d330aaf150957373 (diff) | |
show create instance dialog on startup if there are no instances
| -rw-r--r-- | src/createinstancedialog.cpp | 12 | ||||
| -rw-r--r-- | src/main.cpp | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/createinstancedialog.cpp b/src/createinstancedialog.cpp index d2846367..c976ee13 100644 --- a/src/createinstancedialog.cpp +++ b/src/createinstancedialog.cpp @@ -333,11 +333,17 @@ void CreateInstanceDialog::finish() if (ui->launch->isChecked()) { InstanceManager::instance().setCurrentInstance(ci.instanceName); - ExitModOrganizer(Exit::Restart); + + if (m_settings) { + // don't restart without settings, it happens on startup when there are + // no instances + ExitModOrganizer(Exit::Restart); + } + m_switching = true; - } else { - accept(); } + + accept(); } catch(Failed&) { diff --git a/src/main.cpp b/src/main.cpp index bfc074ec..bd7f8303 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -277,10 +277,20 @@ void openInstanceManager(PluginContainer& pc, QWidget* parent); std::optional<Instance> selectInstance() { NexusInterface ni(nullptr); - PluginContainer pc(nullptr); pc.loadPlugins(); + if (InstanceManager::instance().instancePaths().empty()) { + // no instances configured + CreateInstanceDialog dlg(pc, nullptr); + if (dlg.exec() != QDialog::Accepted) { + return {}; + } + + return InstanceManager::instance().currentInstance(); + } + + InstanceManagerDialog dlg(pc); dlg.setRestartOnSelect(false); |
