diff options
author | flow <thiagodonato300@gmail.com> | 2022-04-01 09:10:51 -0300 |
---|---|---|
committer | flow <thiagodonato300@gmail.com> | 2022-04-01 09:32:00 -0300 |
commit | 9b8493c30499e06bbef7b96ff415f80c140c1a7f (patch) | |
tree | f56773d7f046def84a98e45f741457767d3fb4e4 /launcher/tasks/SequentialTask.h | |
parent | e22d54abd35560213377bb41f2bc902f67c8de64 (diff) | |
download | PrismLauncher-9b8493c30499e06bbef7b96ff415f80c140c1a7f.tar.gz PrismLauncher-9b8493c30499e06bbef7b96ff415f80c140c1a7f.tar.bz2 PrismLauncher-9b8493c30499e06bbef7b96ff415f80c140c1a7f.zip |
feat: Use a single progress dialog when doing multiple tasks
This puts all mod downloading tasks inside a SequentialTask, which is,
for more than one task, a multi step task. This is handled by the
ProgressDialog by showing both the global progress of tasks executed,
and the individual progress of each of them.
Diffstat (limited to 'launcher/tasks/SequentialTask.h')
-rw-r--r-- | launcher/tasks/SequentialTask.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/launcher/tasks/SequentialTask.h b/launcher/tasks/SequentialTask.h index 027744f3..5b3c0111 100644 --- a/launcher/tasks/SequentialTask.h +++ b/launcher/tasks/SequentialTask.h @@ -9,13 +9,21 @@ class SequentialTask : public Task { Q_OBJECT public: - explicit SequentialTask(QObject *parent = 0); - virtual ~SequentialTask() {}; + explicit SequentialTask(QObject *parent = nullptr, const QString& task_name = ""); + virtual ~SequentialTask(); + + inline auto isMultiStep() const -> bool override { return m_queue.size() > 1; }; + auto getStepProgress() const -> qint64 override; + auto getStepTotalProgress() const -> qint64 override; + + inline auto getStepStatus() const -> QString override { return m_step_status; } void addTask(Task::Ptr task); -protected: - void executeTask(); +protected slots: + void executeTask() override; +public slots: + bool abort() override; private slots: @@ -24,7 +32,19 @@ slots: void subTaskStatus(const QString &msg); void subTaskProgress(qint64 current, qint64 total); +signals: + void stepStatus(QString status); + private: + void setStepStatus(QString status) { m_step_status = status; }; + +private: + QString m_name; + QString m_step_status; + QQueue<Task::Ptr > m_queue; int m_currentIndex; + + qint64 m_stepProgress = 0; + qint64 m_stepTotalProgress = 100; }; |