11 Commits

Author SHA1 Message Date
Nyall Dawson
e01c306edb Simplify reporting completion of tasks
QgsTask subclasses can now return a result (success or fail)
directly from QgsTask::run. If they do so then there's no
need for them to manually call completed() or stopped()
to report their completion.

Alternatively, tasks can also return the ResultPending value
to indicate that the task is still operating and will
manually report its completion by calling completed() or
stopped(). This may be useful for tasks which rely on external
events for completion, eg downloading a file. In this case
Qt slots could be created which are connected to the download
completion or termination and which call completed() or
stopped() to indicate the task has finished operations.
2016-12-05 14:08:11 +10:00
Nyall Dawson
95dbb3a7e3 Add deleteAllTasks to manager 2016-12-05 14:08:11 +10:00
Nyall Dawson
d270b4f9c2 Improvements to task manager ui 2016-12-05 14:08:11 +10:00
Nyall Dawson
55e9d32671 Add handling of dependent layers to task manager
If a task has dependent layers which are about to be removed,
the task will automatically be cancelled
2016-12-05 14:08:11 +10:00
Nyall Dawson
4c0f4ee6f0 Resolve circular dependencies 2016-12-05 14:08:11 +10:00
Nyall Dawson
4291904c8d Support for dependent tasks
Cancelling a task on which others depend leads to all these other
tasks getting cancelled as well.
2016-12-05 14:08:11 +10:00
Nyall Dawson
dcecf4476f Add support for placing queued tasks on hold 2016-12-05 14:08:10 +10:00
Nyall Dawson
cf5eeb758b API cleanups 2016-12-05 14:08:10 +10:00
Nyall Dawson
e29dd79432 Api + test cleanups 2016-12-05 14:08:10 +10:00
Nyall Dawson
6021d7806e Make QgsTaskManager handle threading of tasks 2016-12-05 14:08:10 +10:00
Nyall Dawson
ebae15f23a Framework for task manager
Adds new classes:
- QgsTask. An interface for long-running background tasks
- QgsTaskManager. Handles groups of tasks - also available as a global
instance for tracking application wide tasks
- QgsTaskManagerWidget. A list view for showing active tasks and their
progress, and for cancelling them

A new dock widget has been added with a task manager widget showing
global tasks
2016-12-05 14:08:10 +10:00