aboutsummaryrefslogtreecommitdiff
path: root/launcher/tasks/MultipleOptionsTask.h
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-06-02 19:34:08 -0300
committerflow <flowlnlnln@gmail.com>2022-07-17 11:33:41 -0300
commit9a44c9221139428fa4e3bdf560f6bfdc6fcbe75d (patch)
tree08713b50e73a3facf164aca8ada358773a8dec1c /launcher/tasks/MultipleOptionsTask.h
parentdd6aabf9ab2c974816aef4e889e059fa0cdad53b (diff)
downloadPrismLauncher-9a44c9221139428fa4e3bdf560f6bfdc6fcbe75d.tar.gz
PrismLauncher-9a44c9221139428fa4e3bdf560f6bfdc6fcbe75d.tar.bz2
PrismLauncher-9a44c9221139428fa4e3bdf560f6bfdc6fcbe75d.zip
feat: add MultipleOptionsTask
This is a variation of a Sequential Task, in which a subtask failing will prompt the next one to execute, and a subtask being successful will stop the task. This way, this can be used for easily managing fallbacks with tasks. :D Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/tasks/MultipleOptionsTask.h')
-rw-r--r--launcher/tasks/MultipleOptionsTask.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/launcher/tasks/MultipleOptionsTask.h b/launcher/tasks/MultipleOptionsTask.h
new file mode 100644
index 00000000..7c508b00
--- /dev/null
+++ b/launcher/tasks/MultipleOptionsTask.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "SequentialTask.h"
+
+/* This task type will attempt to do run each of it's subtasks in sequence,
+ * until one of them succeeds. When that happens, the remaining tasks will not run.
+ * */
+class MultipleOptionsTask : public SequentialTask
+{
+ Q_OBJECT
+public:
+ explicit MultipleOptionsTask(QObject *parent = nullptr, const QString& task_name = "");
+ virtual ~MultipleOptionsTask() = default;
+
+private
+slots:
+ void startNext() override;
+ void subTaskFailed(const QString &msg) override;
+};