1 #ifndef __libquark_util_Task_hxx 2 #define __libquark_util_Task_hxx 41 {
return(_cancelling); }
45 {
return(_cancelled); }
53 {
return(_background); }
60 void setTimeout(
int seconds);
66 qint64 executionTime()
const;
74 void statusUpdated(
const QString& status);
89 Task(
bool background =
false);
95 virtual void execute() = 0;
104 virtual bool cancel();
110 void fail(QString error = QString());
113 void updateStatus(
const QString& text);
119 void notifyFinished();
120 void notifyCancelled();
121 bool isTimedOut(
const qint64 &now)
const;
123 inline void setRunning(
bool running)
124 { _running = running; }
137 static QAtomicInt _idCounter;
139 Q_DISABLE_COPY(
Task);
145 #endif // __libquark_util_Task_hxx bool isCancelled() const
Tests if the task has been cancelled.
Definition: Task.h++:44
bool isFailed() const
Tests if the task has failed.
Definition: Task.h++:48
bool isCancelling() const
Tests if the task is currently cancelling.
Definition: Task.h++:40
bool isBackground() const
Tests if the task is a background task.
Definition: Task.h++:52
static const int DEFAULT_TIMEOUT
The default timeout interval, in seconds.
Definition: Task.h++:69
An object that executes Tasks in a queue on a dedicated thread.
Definition: TaskProcessor.h++:23
Definition: BarChartView.h++:6
An abstract base class for objects that represent tasks to be executed by a TaskProcessor.
Definition: Task.h++:20
int id() const
Returns the unique ID that was assigned to this task.
Definition: Task.h++:32
#define LIBQUARK_API
Definition: Quark.h++:18
bool isRunning() const
Tests if the task is currently executing.
Definition: Task.h++:36
QString error() const
Returns the error message reported by this task upon failure, if any.
Definition: Task.h++:56