An abstract base class for objects that represent tasks to be executed by a TaskProcessor.
More...
#include <Task.h++>
|
| virtual | ~Task () |
| | Destructor. More...
|
| |
| int | id () const |
| | Returns the unique ID that was assigned to this task. More...
|
| |
| bool | isRunning () const |
| | Tests if the task is currently executing. More...
|
| |
| bool | isCancelling () const |
| | Tests if the task is currently cancelling. More...
|
| |
| bool | isCancelled () const |
| | Tests if the task has been cancelled. More...
|
| |
| bool | isFailed () const |
| | Tests if the task has failed. More...
|
| |
| bool | isBackground () const |
| | Tests if the task is a background task. More...
|
| |
| QString | error () const |
| | Returns the error message reported by this task upon failure, if any. More...
|
| |
| void | setTimeout (int seconds) |
| | Sets the task's timeout, in seconds. More...
|
| |
| qint64 | executionTime () const |
| | Returns the amount of time the task spent executing, or 0 if the task has not finished executing. More...
|
| |
An abstract base class for objects that represent tasks to be executed by a TaskProcessor.
- Author
- Mark Lindner
◆ ~Task()
◆ Task()
| Task |
( |
bool |
background = false | ) |
|
|
protected |
Constructs a new Task of the given type.
- Parameters
-
| background | Whether this is a "background" task that continues executing indefinitely. |
◆ cancel()
Attempts to cancel the task.
Some tasks may not be cancellable. The default implementation is a no-op that returns false.
- Parameters
-
| <b>true</b> | if the task was successfully cancelled, false otherwise. |
Reimplemented in ExternalCommandTask.
◆ cancelled
Emitted when the task has been cancelled.
◆ error()
Returns the error message reported by this task upon failure, if any.
◆ execute()
Executes the task.
The actual work of the task must be implemented in this method.
Implemented in ExternalCommandTask.
◆ executionTime()
| qint64 executionTime |
( |
| ) |
const |
Returns the amount of time the task spent executing, or 0 if the task has not finished executing.
◆ fail()
| void fail |
( |
QString |
error = QString() | ) |
|
|
protected |
Marks the task as failed, with an optional error message.
◆ finished
Emitted when the task has finished executing.
◆ id()
Returns the unique ID that was assigned to this task.
◆ isBackground()
| bool isBackground |
( |
| ) |
const |
|
inline |
Tests if the task is a background task.
◆ isCancelled()
| bool isCancelled |
( |
| ) |
const |
|
inline |
Tests if the task has been cancelled.
◆ isCancelling()
| bool isCancelling |
( |
| ) |
const |
|
inline |
Tests if the task is currently cancelling.
◆ isFailed()
Tests if the task has failed.
◆ isRunning()
Tests if the task is currently executing.
◆ setCancelled()
Marks the task as cancelled.
◆ setTimeout()
| void setTimeout |
( |
int |
seconds | ) |
|
Sets the task's timeout, in seconds.
◆ statusUpdated
| void statusUpdated |
( |
const QString & |
status | ) |
|
|
signal |
◆ updateStatus()
| void updateStatus |
( |
const QString & |
text | ) |
|
|
protected |
◆ TaskProcessor
◆ DEFAULT_TIMEOUT
| const int DEFAULT_TIMEOUT |
|
static |
The default timeout interval, in seconds.
The documentation for this class was generated from the following file: