diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-06-30 02:02:57 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-06-30 02:02:57 +0200 |
commit | 421a46e3d3036ea0dea4889125ee58309d0ed21e (patch) | |
tree | b3665ec5c94c991c7dba5436580ffd4047395aa8 /logic | |
parent | 5179aed3a066dfc9885a75d36a0e64c48aa448f7 (diff) | |
download | MultiMC-421a46e3d3036ea0dea4889125ee58309d0ed21e.tar MultiMC-421a46e3d3036ea0dea4889125ee58309d0ed21e.tar.gz MultiMC-421a46e3d3036ea0dea4889125ee58309d0ed21e.tar.lz MultiMC-421a46e3d3036ea0dea4889125ee58309d0ed21e.tar.xz MultiMC-421a46e3d3036ea0dea4889125ee58309d0ed21e.zip |
Redo the console window. Log is now a page. Console window has relevant pages.
Dirty fix for screenshot thumbnail generation. Needs more QTimer.
Diffstat (limited to 'logic')
-rw-r--r-- | logic/BaseInstance.cpp | 12 | ||||
-rw-r--r-- | logic/BaseInstance.h | 3 | ||||
-rw-r--r-- | logic/BaseInstance_p.h | 1 | ||||
-rw-r--r-- | logic/LegacyInstance.cpp | 6 | ||||
-rw-r--r-- | logic/MinecraftProcess.cpp | 11 | ||||
-rw-r--r-- | logic/OneSixInstance.cpp | 6 |
6 files changed, 33 insertions, 6 deletions
diff --git a/logic/BaseInstance.cpp b/logic/BaseInstance.cpp index 0088530f..15bf5ab6 100644 --- a/logic/BaseInstance.cpp +++ b/logic/BaseInstance.cpp @@ -106,6 +106,18 @@ QString BaseInstance::id() const return QFileInfo(instanceRoot()).fileName(); } +bool BaseInstance::isRunning() const +{ + I_D(BaseInstance); + return d->m_isRunning; +} + +void BaseInstance::setRunning(bool running) const +{ + I_D(BaseInstance); + d->m_isRunning = running; +} + QString BaseInstance::instanceType() const { I_D(BaseInstance); diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h index 9598549b..5f5378e7 100644 --- a/logic/BaseInstance.h +++ b/logic/BaseInstance.h @@ -65,6 +65,9 @@ public: /// be unique. virtual QString id() const; + virtual void setRunning(bool running) const; + virtual bool isRunning() const; + /// get the type of this instance QString instanceType() const; diff --git a/logic/BaseInstance_p.h b/logic/BaseInstance_p.h index 999ff545..6498454f 100644 --- a/logic/BaseInstance_p.h +++ b/logic/BaseInstance_p.h @@ -32,4 +32,5 @@ public: QString m_group; std::shared_ptr<SettingsObject> m_settings; QSet<BaseInstance::InstanceFlag> m_flags; + bool m_isRunning = false; }; diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index dd6c0719..5c15616a 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -52,14 +52,14 @@ QList<BasePage *> LegacyInstance::getPages() QList<BasePage *> values; values.append(new LegacyUpgradePage(this)); values.append(new LegacyJarModPage(this)); - values.append(new ModFolderPage(loaderModList(), "mods", "plugin-blue", tr("Loader mods"), + values.append(new ModFolderPage(this, loaderModList(), "mods", "plugin-blue", tr("Loader mods"), "Loader-mods")); - values.append(new ModFolderPage(coreModList(), "coremods", "plugin-green", tr("Core mods"), + values.append(new ModFolderPage(this, coreModList(), "coremods", "plugin-green", tr("Core mods"), "Core-mods")); values.append(new TexturePackPage(this)); values.append(new NotesPage(this)); values.append(new ScreenshotsPage(this)); - values.append(new InstanceSettingsPage(&settings())); + values.append(new InstanceSettingsPage(this)); return values; } diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp index b268a4cc..a3ffedba 100644 --- a/logic/MinecraftProcess.cpp +++ b/logic/MinecraftProcess.cpp @@ -71,6 +71,9 @@ MinecraftProcess::MinecraftProcess(InstancePtr inst) : m_instance(inst) connect(&m_prepostlaunchprocess, &QProcess::readyReadStandardOutput, this, &MinecraftProcess::on_prepost_stdOut); } + + // a process has been constructed for the instance. It is running from MultiMC POV + m_instance->setRunning(true); } void MinecraftProcess::setWorkdir(QString path) @@ -254,6 +257,8 @@ void MinecraftProcess::finish(int code, ExitStatus status) // run post-exit postLaunch(); m_instance->cleanupAfterRun(); + // no longer running... + m_instance->setRunning(false); emit ended(m_instance, code, status); } @@ -304,6 +309,8 @@ bool MinecraftProcess::preLaunch() m_instance->cleanupAfterRun(); emit prelaunch_failed(m_instance, m_prepostlaunchprocess.exitCode(), m_prepostlaunchprocess.exitStatus()); + // not running, failed + m_instance->setRunning(false); return false; } else @@ -343,6 +350,8 @@ bool MinecraftProcess::postLaunch() MessageLevel::Error); emit postlaunch_failed(m_instance, m_prepostlaunchprocess.exitCode(), m_prepostlaunchprocess.exitStatus()); + // not running, failed + m_instance->setRunning(false); } else emit log(tr("Post-Launch command ran successfully.\n\n")); @@ -460,6 +469,8 @@ void MinecraftProcess::arm() emit log(tr("Could not launch minecraft!"), MessageLevel::Error); m_instance->cleanupAfterRun(); emit launch_failed(m_instance); + // not running, failed + m_instance->setRunning(false); return; } // send the launch script to the launcher part diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index 2069faad..7bac3424 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -63,15 +63,15 @@ QList<BasePage *> OneSixInstance::getPages() { QList<BasePage *> values; values.append(new VersionPage(this)); - values.append(new ModFolderPage(loaderModList(), "mods", "plugin-blue", tr("Loader mods"), + values.append(new ModFolderPage(this, loaderModList(), "mods", "plugin-blue", tr("Loader mods"), "Loader-mods")); - values.append(new ModFolderPage(coreModList(), "coremods", "plugin-green", tr("Core mods"), + values.append(new ModFolderPage(this, coreModList(), "coremods", "plugin-green", tr("Core mods"), "Core-mods")); values.append(new ResourcePackPage(this)); values.append(new TexturePackPage(this)); values.append(new NotesPage(this)); values.append(new ScreenshotsPage(this)); - values.append(new InstanceSettingsPage(&settings())); + values.append(new InstanceSettingsPage(this)); return values; } |