taskdialog: created ProgressDialog-based dialog for modal tasks
This commit is contained in:
+2
-8
@@ -21,8 +21,7 @@
|
||||
#include "task.h"
|
||||
|
||||
Task::Task() :
|
||||
title_(tr("Task")),
|
||||
cancelled_(false)
|
||||
title_(tr("Task"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,7 +39,7 @@ const QString &Task::GetTitle()
|
||||
|
||||
void Task::Cancel()
|
||||
{
|
||||
cancelled_ = true;
|
||||
CancelableObject::Cancel();
|
||||
}
|
||||
|
||||
void Task::SetErrorText(const QString &s)
|
||||
@@ -52,8 +51,3 @@ void Task::SetTitle(const QString &s)
|
||||
{
|
||||
title_ = s;
|
||||
}
|
||||
|
||||
bool Task::IsCancelled()
|
||||
{
|
||||
return cancelled_;
|
||||
}
|
||||
|
||||
+4
-9
@@ -24,6 +24,8 @@
|
||||
#include <memory>
|
||||
#include <QObject>
|
||||
|
||||
#include "common/cancelableobject.h"
|
||||
|
||||
/**
|
||||
* @brief A base class for background tasks running in Olive.
|
||||
*
|
||||
@@ -41,7 +43,7 @@
|
||||
*
|
||||
* Tasks support "dependency tasks", i.e. a Task that should be complete before another Task begins.
|
||||
*/
|
||||
class Task : public QObject
|
||||
class Task : public QObject, public CancelableObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -111,11 +113,6 @@ protected:
|
||||
*/
|
||||
void SetTitle(const QString& s);
|
||||
|
||||
/**
|
||||
* @brief Returns whether the thread has been explicitly cancelled or not
|
||||
*/
|
||||
bool IsCancelled();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted whenever progress is made
|
||||
@@ -128,7 +125,7 @@ signals:
|
||||
*/
|
||||
void ProgressChanged(int p);
|
||||
|
||||
void Succeeeded();
|
||||
void Succeeded();
|
||||
|
||||
void Failed(const QString& error);
|
||||
|
||||
@@ -144,8 +141,6 @@ private:
|
||||
|
||||
QString error_;
|
||||
|
||||
QAtomicInt cancelled_;
|
||||
|
||||
};
|
||||
|
||||
#endif // TASK_H
|
||||
|
||||
Reference in New Issue
Block a user