summaryrefslogtreecommitdiffstats
path: root/api/logic/tasks/Task.h
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/tasks/Task.h')
-rw-r--r--api/logic/tasks/Task.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/api/logic/tasks/Task.h b/api/logic/tasks/Task.h
index 47c4a13e..643f8510 100644
--- a/api/logic/tasks/Task.h
+++ b/api/logic/tasks/Task.h
@@ -1,4 +1,4 @@
-/* Copyright 2013-2017 MultiMC Contributors
+/* Copyright 2013-2018 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
#include <QObject>
#include <QString>
+#include <QStringList>
#include "multimc_logic_export.h"
@@ -27,21 +28,17 @@ public:
explicit Task(QObject *parent = 0);
virtual ~Task() {};
- virtual bool isRunning() const;
-
- virtual bool isFinished() const;
-
- /*!
- * True if this task was successful.
- * If the task failed or is still running, returns false.
- */
- virtual bool successful() const;
+ bool isRunning() const;
+ bool isFinished() const;
+ bool wasSuccessful() const;
/*!
* Returns the string that was passed to emitFailed as the error message when the task failed.
* If the task hasn't failed, returns an empty string.
*/
- virtual QString failReason() const;
+ QString failReason() const;
+
+ virtual QStringList warnings() const;
virtual bool canAbort() const { return false; }
@@ -60,6 +57,12 @@ public:
return m_progressTotal;
}
+protected:
+ void logWarning(const QString & line);
+
+private:
+ QString describe();
+
signals:
void started();
void progress(qint64 current, qint64 total);
@@ -68,8 +71,7 @@ signals:
void failed(QString reason);
void status(QString status);
-public
-slots:
+public slots:
virtual void start();
virtual bool abort() { return false; };
@@ -78,16 +80,18 @@ protected:
protected slots:
virtual void emitSucceeded();
+ virtual void emitAborted();
virtual void emitFailed(QString reason);
public slots:
void setStatus(const QString &status);
void setProgress(qint64 current, qint64 total);
-protected:
+private:
bool m_running = false;
bool m_finished = false;
bool m_succeeded = false;
+ QStringList m_Warnings;
QString m_failReason = "";
QString m_status;
int m_progress = 0;