diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-12 03:15:14 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-12 03:15:14 -0500 |
| commit | 6ae27224b0dcc860b882bebff3149828d874c832 (patch) | |
| tree | 0eb2c9b5dcc26a1b658ef49c28c09af39728df09 /src/moapplication.cpp | |
| parent | a0c26517028a25ccd39dc92f9da8539f25db85fc (diff) | |
fixed a bunch of instance and command line stuff
- clear instance manager overrides when restarting, or switching instances after starting MO with moshortcut://instance: won't do anything
- clear overrides when the last selected instance can't be opened; MO would keep trying to open shortcuts even after selecting a different instance
- command line was cleared too early, before the first run, so shortcuts were broken
- the instance manager dialog can be opened without an instance loaded if the last selected instance doesn't exist, createNew() would throw because it tried to access the global Settings
- fixed some problems with parts of MO wanting to restart and others expecting flow to continue
- fixed create instance dialog using settings pointer to decide whether to restart; it restarts when it's the first created instance, which is not always the case even if the settings are null, so just check whether there are instances
Diffstat (limited to 'src/moapplication.cpp')
| -rw-r--r-- | src/moapplication.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/moapplication.cpp b/src/moapplication.cpp index 9139acbb..e7ac3926 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -170,12 +170,13 @@ int MOApplication::run(MOMultiProcess& multiProcess) {
try
{
- // resets things when MO is "restarted"
- resetForRestart();
-
tt.stop();
+
const auto r = doOneRun(multiProcess);
+
if (r == RestartExitCode) {
+ // resets things when MO is "restarted"
+ resetForRestart();
continue;
}
@@ -396,6 +397,10 @@ std::optional<Instance> MOApplication::getCurrentInstance() if (!currentInstance)
{
+ // clear any overrides that might have been given on the command line
+ m.clearOverrides();
+ m_cl.clear();
+
currentInstance = selectInstance();
}
else
@@ -403,6 +408,10 @@ std::optional<Instance> MOApplication::getCurrentInstance() if (!QDir(currentInstance->directory()).exists()) {
// the previously used instance doesn't exist anymore
+ // clear any overrides that might have been given on the command line
+ m.clearOverrides();
+ m_cl.clear();
+
if (m.hasAnyInstances()) {
MOShared::criticalOnTop(QObject::tr(
"Instance at '%1' not found. Select another instance.")
@@ -466,6 +475,9 @@ void MOApplication::resetForRestart() // don't reprocess command line
m_cl.clear();
+
+ // clear instance and profile overrides
+ InstanceManager::singleton().clearOverrides();
}
bool MOApplication::setStyleFile(const QString& styleName)
|
