summaryrefslogtreecommitdiffstats
path: root/api/logic
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic')
-rw-r--r--api/logic/launch/LaunchTask.cpp20
-rw-r--r--api/logic/launch/LaunchTask.h4
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();