summaryrefslogtreecommitdiffstats
path: root/api/logic/launch
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-15 02:51:22 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-17 01:00:15 +0100
commit12f6534e77d28ba5dc5fd5f555d43e7cd9da9336 (patch)
tree677c82d8d1a50c7027610e9602e423a568ae7762 /api/logic/launch
parent3769897be19308ada8b975ecf541a3b200b5eb14 (diff)
downloadMultiMC-12f6534e77d28ba5dc5fd5f555d43e7cd9da9336.tar
MultiMC-12f6534e77d28ba5dc5fd5f555d43e7cd9da9336.tar.gz
MultiMC-12f6534e77d28ba5dc5fd5f555d43e7cd9da9336.tar.lz
MultiMC-12f6534e77d28ba5dc5fd5f555d43e7cd9da9336.tar.xz
MultiMC-12f6534e77d28ba5dc5fd5f555d43e7cd9da9336.zip
NOISSUE mark used accounts/sessions in selection menus
Diffstat (limited to 'api/logic/launch')
-rw-r--r--api/logic/launch/LaunchStep.h2
-rw-r--r--api/logic/launch/LaunchTask.cpp20
-rw-r--r--api/logic/launch/LaunchTask.h3
3 files changed, 23 insertions, 2 deletions
diff --git a/api/logic/launch/LaunchStep.h b/api/logic/launch/LaunchStep.h
index ea472c0d..4df4673c 100644
--- a/api/logic/launch/LaunchStep.h
+++ b/api/logic/launch/LaunchStep.h
@@ -42,6 +42,8 @@ signals:
public slots:
virtual void proceed() {};
+ // called in the opposite order than the Task launch(), used to clean up or otherwise undo things after the launch ends
+ virtual void finalize() {};
protected: /* data */
LaunchTask *m_parent;
diff --git a/api/logic/launch/LaunchTask.cpp b/api/logic/launch/LaunchTask.cpp
index a006e519..8b9da398 100644
--- a/api/logic/launch/LaunchTask.cpp
+++ b/api/logic/launch/LaunchTask.cpp
@@ -88,7 +88,7 @@ void LaunchTask::onStepFinished()
// end?
if(currentStep == m_steps.size() - 1)
{
- emitSucceeded();
+ finalizeSteps(true, QString());
}
else
{
@@ -99,7 +99,23 @@ void LaunchTask::onStepFinished()
}
else
{
- emitFailed(step->failReason());
+ finalizeSteps(false, step->failReason());
+ }
+}
+
+void LaunchTask::finalizeSteps(bool successful, const QString& error)
+{
+ for(auto step = currentStep; step >= 0; step--)
+ {
+ m_steps[step]->finalize();
+ }
+ if(successful)
+ {
+ emitSucceeded();
+ }
+ else
+ {
+ emitFailed(error);
}
}
diff --git a/api/logic/launch/LaunchTask.h b/api/logic/launch/LaunchTask.h
index f2fb3a2c..981e25cf 100644
--- a/api/logic/launch/LaunchTask.h
+++ b/api/logic/launch/LaunchTask.h
@@ -109,6 +109,9 @@ public slots:
void onStepFinished();
void onProgressReportingRequested();
+private: /*methods */
+ void finalizeSteps(bool successful, const QString & error);
+
protected: /* data */
InstancePtr m_instance;
shared_qobject_ptr<LogModel> m_logModel;