diff options
Diffstat (limited to 'api/logic/tasks/Task.h')
-rw-r--r-- | api/logic/tasks/Task.h | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/api/logic/tasks/Task.h b/api/logic/tasks/Task.h index 47c4a13e..9bc2781f 100644 --- a/api/logic/tasks/Task.h +++ b/api/logic/tasks/Task.h @@ -24,6 +24,16 @@ class MULTIMC_LOGIC_EXPORT Task : public QObject { Q_OBJECT public: + enum class Status + { + NotStarted, + InProgress, + Finished, + Failed, + Aborted, + Failed_Proceed + }; +public: explicit Task(QObject *parent = 0); virtual ~Task() {}; @@ -43,19 +53,22 @@ public: */ virtual QString failReason() const; - virtual bool canAbort() const { return false; } + virtual bool canAbort() const + { + return false; + } - QString getStatus() + QString getStatusText() { - return m_status; + return m_statusText; } - qint64 getProgress() + virtual qint64 getProgress() { return m_progress; } - qint64 getTotalProgress() + virtual qint64 getTotalProgress() { return m_progressTotal; } @@ -68,10 +81,12 @@ signals: void failed(QString reason); void status(QString status); -public -slots: +public slots: virtual void start(); - virtual bool abort() { return false; }; + virtual bool abort() + { + return false; + }; protected: virtual void executeTask() = 0; @@ -81,7 +96,7 @@ protected slots: virtual void emitFailed(QString reason); public slots: - void setStatus(const QString &status); + void setStatusText(const QString &status); void setProgress(qint64 current, qint64 total); protected: @@ -89,8 +104,9 @@ protected: bool m_finished = false; bool m_succeeded = false; QString m_failReason = ""; - QString m_status; - int m_progress = 0; - int m_progressTotal = 100; + QString m_statusText; + + qint64 m_progress = 0; + qint64 m_progressTotal = 1; }; |