9a44c92211
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>
20 lines
523 B
C++
20 lines
523 B
C++
#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;
|
|
};
|