summaryrefslogtreecommitdiffstats
path: root/api/logic/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/tasks')
-rw-r--r--api/logic/tasks/SequentialTask.cpp2
-rw-r--r--api/logic/tasks/Task.cpp8
-rw-r--r--api/logic/tasks/Task.h41
-rw-r--r--api/logic/tasks/ThreadTask.cpp2
4 files changed, 18 insertions, 35 deletions
diff --git a/api/logic/tasks/SequentialTask.cpp b/api/logic/tasks/SequentialTask.cpp
index bcf69a0d..ac0e7820 100644
--- a/api/logic/tasks/SequentialTask.cpp
+++ b/api/logic/tasks/SequentialTask.cpp
@@ -42,7 +42,7 @@ void SequentialTask::subTaskFailed(const QString &msg)
}
void SequentialTask::subTaskStatus(const QString &msg)
{
- setStatusText(msg);
+ setStatus(msg);
}
void SequentialTask::subTaskProgress(qint64 current, qint64 total)
{
diff --git a/api/logic/tasks/Task.cpp b/api/logic/tasks/Task.cpp
index 4e468b04..23ee08e4 100644
--- a/api/logic/tasks/Task.cpp
+++ b/api/logic/tasks/Task.cpp
@@ -21,12 +21,12 @@ Task::Task(QObject *parent) : QObject(parent)
{
}
-void Task::setStatusText(const QString &new_status)
+void Task::setStatus(const QString &new_status)
{
- if(m_statusText != new_status)
+ if(m_status != new_status)
{
- m_statusText = new_status;
- emit status(m_statusText);
+ m_status = new_status;
+ emit status(m_status);
}
}
diff --git a/api/logic/tasks/Task.h b/api/logic/tasks/Task.h
index 17ea87f3..47c4a13e 100644
--- a/api/logic/tasks/Task.h
+++ b/api/logic/tasks/Task.h
@@ -24,16 +24,6 @@ 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() {};
@@ -53,22 +43,19 @@ public:
*/
virtual QString failReason() const;
- virtual bool canAbort() const
- {
- return false;
- }
+ virtual bool canAbort() const { return false; }
- QString getStatusText()
+ QString getStatus()
{
- return m_statusText;
+ return m_status;
}
- virtual qint64 getProgress()
+ qint64 getProgress()
{
return m_progress;
}
- virtual qint64 getTotalProgress()
+ qint64 getTotalProgress()
{
return m_progressTotal;
}
@@ -81,12 +68,10 @@ 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;
@@ -96,18 +81,16 @@ protected slots:
virtual void emitFailed(QString reason);
public slots:
- void setStatusText(const QString &status);
+ void setStatus(const QString &status);
void setProgress(qint64 current, qint64 total);
protected:
- // FIXME: replace these with the m_status from NetAction
bool m_running = false;
bool m_finished = false;
bool m_succeeded = false;
QString m_failReason = "";
- QString m_statusText;
-
- qint64 m_progress = 0;
- qint64 m_progressTotal = 1;
+ QString m_status;
+ int m_progress = 0;
+ int m_progressTotal = 100;
};
diff --git a/api/logic/tasks/ThreadTask.cpp b/api/logic/tasks/ThreadTask.cpp
index 6f9ce13e..ddd1dee5 100644
--- a/api/logic/tasks/ThreadTask.cpp
+++ b/api/logic/tasks/ThreadTask.cpp
@@ -32,7 +32,7 @@ void ThreadTask::iternal_started()
void ThreadTask::iternal_status(QString status)
{
- setStatusText(status);
+ setStatus(status);
}
void ThreadTask::iternal_succeeded()