diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-09-18 00:00:35 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-09-18 00:00:35 +0200 |
commit | b979d0ce5da515793a02802a6421ef607a498323 (patch) | |
tree | 1431d15e7a3e89e87708564a5be9fea05a5647ab /logic/tasks/Task.h | |
parent | d38b90530b3ba3a49c4eb072eb344ae2b0836913 (diff) | |
download | MultiMC-b979d0ce5da515793a02802a6421ef607a498323.tar MultiMC-b979d0ce5da515793a02802a6421ef607a498323.tar.gz MultiMC-b979d0ce5da515793a02802a6421ef607a498323.tar.lz MultiMC-b979d0ce5da515793a02802a6421ef607a498323.tar.xz MultiMC-b979d0ce5da515793a02802a6421ef607a498323.zip |
Implement legacy forge button!
Many refactors of the task system.
Progress dialog now accepts generic ProgressProvider objects
Diffstat (limited to 'logic/tasks/Task.h')
-rw-r--r-- | logic/tasks/Task.h | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/logic/tasks/Task.h b/logic/tasks/Task.h index 91852b0f..cfe71c51 100644 --- a/logic/tasks/Task.h +++ b/logic/tasks/Task.h @@ -13,53 +13,37 @@ * limitations under the License. */ -#ifndef TASK_H -#define TASK_H +#pragma once #include <QObject> #include <QString> +#include "ProgressProvider.h" -class Task : public QObject +class Task : public ProgressProvider { Q_OBJECT public: explicit Task(QObject *parent = 0); - QString getStatus() const; - int getProgress() const; - bool isRunning() const; + virtual QString getStatus() const; + virtual void getProgress(qint64& current, qint64& total); + virtual bool isRunning() const; public slots: - void startTask(); - -protected slots: - void setStatus(const QString& status); - void setProgress(int progress); - -signals: - void started(); - void failed(QString reason); - void succeeded(); - - void statusChanged(Task* task, const QString& status); - void progressChanged(Task* task, int progress); - - void statusChanged(const QString& status); - void progressChanged(int progress); + virtual void start(); protected: virtual void executeTask() = 0; - virtual void emitStarted(); - virtual void emitFailed(QString reason); virtual void emitSucceeded(); + virtual void emitFailed(QString reason); + +protected slots: + void setStatus(const QString& status); + void setProgress(int progress); - virtual void emitStatusChange(const QString &status); - virtual void emitProgressChange(int progress); - - QString status; - int progress; - bool running = false; +protected: + QString m_status; + int m_progress = 0; + bool m_running = false; }; - -#endif // TASK_H |