diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-26 18:06:08 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-26 18:06:08 +0100 |
commit | 66ffab71ae6bd4731ba02987c108561ab90be75c (patch) | |
tree | 7fa46da1daf4845f37a449197f324dc7dc3599e6 /api | |
parent | ce70407363b9bdd8d7901467f2bdb91179a9ac22 (diff) | |
download | MultiMC-66ffab71ae6bd4731ba02987c108561ab90be75c.tar MultiMC-66ffab71ae6bd4731ba02987c108561ab90be75c.tar.gz MultiMC-66ffab71ae6bd4731ba02987c108561ab90be75c.tar.lz MultiMC-66ffab71ae6bd4731ba02987c108561ab90be75c.tar.xz MultiMC-66ffab71ae6bd4731ba02987c108561ab90be75c.zip |
NOISSUE allow killing the instance from main window
Diffstat (limited to 'api')
-rw-r--r-- | api/logic/launch/LaunchTask.cpp | 20 | ||||
-rw-r--r-- | api/logic/launch/LaunchTask.h | 4 |
2 files changed, 23 insertions, 1 deletions
diff --git a/api/logic/launch/LaunchTask.cpp b/api/logic/launch/LaunchTask.cpp index ea4ed43e..8d9596ec 100644 --- a/api/logic/launch/LaunchTask.cpp +++ b/api/logic/launch/LaunchTask.cpp @@ -150,6 +150,26 @@ void LaunchTask::proceed() m_steps[currentStep]->proceed(); } +bool LaunchTask::canAbort() const +{ + switch(state) + { + case LaunchTask::Aborted: + case LaunchTask::Failed: + case LaunchTask::Finished: + return false; + case LaunchTask::NotStarted: + return true; + case LaunchTask::Running: + case LaunchTask::Waiting: + { + auto step = m_steps[currentStep]; + return step->canAbort(); + } + } + return false; +} + bool LaunchTask::abort() { switch(state) diff --git a/api/logic/launch/LaunchTask.h b/api/logic/launch/LaunchTask.h index 981e25cf..e74620c7 100644 --- a/api/logic/launch/LaunchTask.h +++ b/api/logic/launch/LaunchTask.h @@ -80,7 +80,9 @@ public: /* methods */ /** * @brief abort launch */ - virtual bool abort() override; + bool abort() override; + + bool canAbort() const override; shared_qobject_ptr<LogModel> getLogModel(); |