diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2023-08-14 18:16:53 +0200 |
---|---|---|
committer | Sefa Eyeoglu <contact@scrumplex.net> | 2023-08-14 18:16:53 +0200 |
commit | 91ba4cf75ee30c64779edb5b7644e5a830de5026 (patch) | |
tree | aa8c2433bfc3a54577aceeb706c4c2cd0986c95d /launcher/tasks/Task.h | |
parent | 779f70057b021e285afd60cc650a14cd5feacffd (diff) | |
download | PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.gz PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.tar.bz2 PrismLauncher-91ba4cf75ee30c64779edb5b7644e5a830de5026.zip |
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Diffstat (limited to 'launcher/tasks/Task.h')
-rw-r--r-- | launcher/tasks/Task.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/launcher/tasks/Task.h b/launcher/tasks/Task.h index 25c7f8be..a6f039de 100644 --- a/launcher/tasks/Task.h +++ b/launcher/tasks/Task.h @@ -36,25 +36,20 @@ #pragma once +#include <QLoggingCategory> #include <QRunnable> #include <QUuid> -#include <QLoggingCategory> #include "QObjectPtr.h" Q_DECLARE_LOGGING_CATEGORY(taskLogC) -enum class TaskStepState { - Waiting, - Running, - Failed, - Succeeded -}; +enum class TaskStepState { Waiting, Running, Failed, Succeeded }; Q_DECLARE_METATYPE(TaskStepState) struct TaskStepProgress { - QUuid uid; + QUuid uid; qint64 current = 0; qint64 total = -1; @@ -64,15 +59,14 @@ struct TaskStepProgress { QString status = ""; QString details = ""; TaskStepState state = TaskStepState::Waiting; - - TaskStepProgress() { - this->uid = QUuid::createUuid(); - } - TaskStepProgress(QUuid uid_): uid(uid_) {} + TaskStepProgress() { this->uid = QUuid::createUuid(); } + + TaskStepProgress(QUuid uid_) : uid(uid_) {} bool isDone() const { return (state == TaskStepState::Failed) || (state == TaskStepState::Succeeded); } - void update(qint64 new_current, qint64 new_total) { + void update(qint64 new_current, qint64 new_total) + { this->old_current = this->current; this->old_total = this->total; @@ -101,8 +95,8 @@ class Task : public QObject, public QRunnable { bool isFinished() const; bool wasSuccessful() const; - /*! - * MultiStep tasks are combinations of multiple tasks into a single logical task. + /*! + * MultiStep tasks are combinations of multiple tasks into a single logical task. * The main usage of this is in SequencialTask. */ virtual auto isMultiStep() const -> bool { return false; } @@ -126,8 +120,6 @@ class Task : public QObject, public QRunnable { qint64 getTotalProgress() { return m_progressTotal; } virtual auto getStepProgress() const -> TaskStepProgressList { return {}; } - - QUuid getUid() { return m_uid; } protected: @@ -156,9 +148,18 @@ class Task : public QObject, public QRunnable { void run() override { start(); } virtual void start(); - virtual bool abort() { if(canAbort()) emitAborted(); return canAbort(); } + virtual bool abort() + { + if (canAbort()) + emitAborted(); + return canAbort(); + } - void setAbortable(bool can_abort) { m_can_abort = can_abort; emit abortStatusChanged(can_abort); } + void setAbortable(bool can_abort) + { + m_can_abort = can_abort; + emit abortStatusChanged(can_abort); + } protected: virtual void executeTask() = 0; @@ -191,5 +192,4 @@ class Task : public QObject, public QRunnable { // Change using setAbortStatus bool m_can_abort = false; QUuid m_uid; - }; |