2017-05-10 13:01:31 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgstaskmanager.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef QList< QgsTask * > QgsTaskList;
|
|
|
|
|
2016-12-05 12:20:06 +10:00
|
|
|
class QgsTask : QObject
|
2016-04-15 07:35:22 +10:00
|
|
|
{
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Abstract base class for long running background tasks. Tasks can be controlled directly,
|
|
|
|
or added to a QgsTaskManager for automatic management.
|
|
|
|
|
|
|
|
Derived classes should implement the process they want to execute in the background
|
|
|
|
within the run() method. This method will be called when the
|
|
|
|
task commences (ie via calling run() ).
|
|
|
|
|
|
|
|
Long running tasks should periodically check the isCanceled() flag to detect if the task
|
|
|
|
has been canceled via some external event. If this flag is true then the task should
|
|
|
|
clean up and terminate at the earliest possible convenience.
|
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
%TypeHeaderCode
|
2017-05-10 13:01:31 +02:00
|
|
|
#include "qgstaskmanager.h"
|
2016-04-15 07:35:22 +10:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum TaskStatus
|
|
|
|
{
|
2017-05-10 13:01:31 +02:00
|
|
|
Queued,
|
|
|
|
OnHold,
|
|
|
|
Running,
|
|
|
|
Complete,
|
|
|
|
Terminated,
|
2016-04-15 07:35:22 +10:00
|
|
|
};
|
|
|
|
|
2016-04-19 22:24:34 +10:00
|
|
|
enum Flag
|
|
|
|
{
|
2017-05-10 13:01:31 +02:00
|
|
|
CanCancel,
|
|
|
|
AllFlags,
|
2016-04-19 22:24:34 +10:00
|
|
|
};
|
|
|
|
typedef QFlags<QgsTask::Flag> Flags;
|
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsTask( const QString &description = QString(), const Flags &flags = AllFlags );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsTask.
|
|
|
|
\param description text description of task
|
|
|
|
\param flags task flags
|
|
|
|
%End
|
|
|
|
|
|
|
|
~QgsTask();
|
2016-04-19 22:24:34 +10:00
|
|
|
|
|
|
|
Flags flags() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the flags associated with the task.
|
|
|
|
:rtype: Flags
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-04-19 22:24:34 +10:00
|
|
|
bool canCancel() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns true if the task can be canceled.
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
bool isActive() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns true if the task is active, ie it is not complete and has
|
|
|
|
not been canceled.
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
TaskStatus status() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the current task status.
|
|
|
|
:rtype: TaskStatus
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
QString description() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the task's description.
|
|
|
|
:rtype: str
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
double progress() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the task's progress (between 0.0 and 100.0)
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2017-02-11 14:41:21 +10:00
|
|
|
virtual void cancel();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Notifies the task that it should terminate. Calling this is not guaranteed
|
|
|
|
to immediately end the task, rather it sets the isCanceled() flag which
|
|
|
|
task subclasses can check and terminate their operations at an appropriate
|
|
|
|
time. Any subtasks owned by this task will also be canceled.
|
|
|
|
Derived classes must ensure that the base class implementation is called
|
|
|
|
from any overridden version.
|
|
|
|
.. seealso:: isCanceled()
|
|
|
|
%End
|
2016-04-20 07:22:38 +10:00
|
|
|
|
2016-04-21 10:42:51 +10:00
|
|
|
void hold();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Places the task on hold. If the task in not queued
|
|
|
|
(ie it is already running or has finished) then calling this has no effect.
|
|
|
|
Calling this method only has an effect for tasks which are managed
|
|
|
|
by a QgsTaskManager.
|
|
|
|
.. seealso:: unhold()
|
|
|
|
%End
|
2016-04-21 10:42:51 +10:00
|
|
|
|
|
|
|
void unhold();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Releases the task from being held. For tasks managed by a QgsTaskManager
|
|
|
|
calling this will re-add them to the queue. If the
|
|
|
|
task in not currently being held then calling this has no effect.
|
|
|
|
.. seealso:: hold()
|
|
|
|
%End
|
2016-04-21 10:42:51 +10:00
|
|
|
|
2016-11-25 18:15:08 +10:00
|
|
|
enum SubTaskDependency
|
|
|
|
{
|
2017-05-10 13:01:31 +02:00
|
|
|
SubTaskIndependent,
|
|
|
|
ParentDependsOnSubTask,
|
2016-11-25 18:15:08 +10:00
|
|
|
};
|
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
void addSubTask( QgsTask *subTask /Transfer/, const QgsTaskList &dependencies = QgsTaskList(),
|
2016-11-25 18:15:08 +10:00
|
|
|
SubTaskDependency subTaskDependency = SubTaskIndependent );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Adds a subtask to this task.
|
|
|
|
|
|
|
|
Subtasks allow a single task to be created which
|
|
|
|
consists of multiple smaller tasks. Subtasks are not visible or indepedently
|
|
|
|
controllable by users. Ownership of the subtask is transferred.
|
|
|
|
Subtasks can have an optional list of dependent tasks, which must be completed
|
|
|
|
before the subtask can begin. By default subtasks are considered independent
|
|
|
|
of the parent task, ie they can be run either before, after, or at the same
|
|
|
|
time as the parent task. This behavior can be overridden through the subTaskDependency
|
|
|
|
argument. Note that subtasks should NEVER be dependent on their parent task, and violating
|
|
|
|
this constraint will prevent the task from completing successfully.
|
|
|
|
|
|
|
|
The parent task must be added to a QgsTaskManager for subtasks to be utilized.
|
|
|
|
Subtasks should not be added manually to a QgsTaskManager, rather, only the parent
|
|
|
|
task should be added to the manager.
|
|
|
|
|
|
|
|
Subtasks can be nested, ie a subtask can legally be a parent task itself with
|
|
|
|
its own set of subtasks.
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setDependentLayers( const QList<QgsMapLayer *> &dependentLayers );
|
|
|
|
%Docstring
|
|
|
|
Sets a list of layers on which the task depends. The task will automatically
|
|
|
|
be canceled if any of these layers are about to be removed.
|
|
|
|
.. seealso:: dependentLayerIds()
|
|
|
|
%End
|
|
|
|
|
|
|
|
QList< QgsMapLayer * > dependentLayers() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the list of layers on which the task depends. The task will automatically
|
|
|
|
be canceled if any of these layers are about to be removed.
|
|
|
|
.. seealso:: setDependentLayers()
|
|
|
|
:rtype: list of QgsMapLayer
|
|
|
|
%End
|
2016-11-25 18:15:08 +10:00
|
|
|
|
2017-09-21 10:02:20 +02:00
|
|
|
bool waitForFinished( unsigned long timeout = 30000 );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Blocks the current thread until the task finishes or a maximum of ``timeout`` milliseconds.
|
2017-09-21 10:02:20 +02:00
|
|
|
If ``timeout`` is ``0`` the thread will be blocked forever.
|
2017-05-11 09:05:02 +02:00
|
|
|
In case of a timeout, the task will still be running.
|
2017-05-12 10:46:40 +02:00
|
|
|
In case the task already is finished, the method will return immediately while
|
|
|
|
returning ``true``.
|
2016-12-06 20:02:34 +10:00
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
The result will be false if the wait timed out and true in any other case.
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-12-06 20:02:34 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void progressChanged( double progress );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Will be emitted by task when its progress changes.
|
|
|
|
\param progress percent of progress, from 0.0 - 100.0
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
derived classes should not emit this signal directly, instead they should call
|
|
|
|
setProgress()
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
void statusChanged( int status );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Will be emitted by task when its status changes.
|
|
|
|
\param status new task status
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
derived classes should not emit this signal directly, it will automatically
|
|
|
|
be emitted
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-04-15 20:49:02 +10:00
|
|
|
void begun();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Will be emitted by task to indicate its commencement.
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
derived classes should not emit this signal directly, it will automatically
|
|
|
|
be emitted when the task begins
|
|
|
|
%End
|
2016-04-15 20:49:02 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
void taskCompleted();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Will be emitted by task to indicate its successful completion.
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
derived classes should not emit this signal directly, it will automatically
|
|
|
|
be emitted
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-11-03 08:31:27 +10:00
|
|
|
void taskTerminated();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Will be emitted by task if it has terminated for any reason
|
|
|
|
other then completion (e.g., when a task has been canceled or encountered
|
|
|
|
an internal error).
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
derived classes should not emit this signal directly, it will automatically
|
|
|
|
be emitted
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-04-15 20:49:02 +10:00
|
|
|
protected:
|
|
|
|
|
2016-12-05 13:48:54 +10:00
|
|
|
virtual bool run() = 0;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Performs the task's operation. This method will be called when the task commences
|
|
|
|
(ie via calling start() ), and subclasses should implement the operation they
|
|
|
|
wish to perform in the background within this method.
|
|
|
|
|
|
|
|
A task must return a boolean value to indicate whether the
|
|
|
|
task was completed successfully or terminated before completion.
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-04-15 20:49:02 +10:00
|
|
|
|
2016-12-05 13:48:54 +10:00
|
|
|
virtual void finished( bool result );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
If the task is managed by a QgsTaskManager, this will be called after the
|
|
|
|
task has finished (whether through successful completion or via early
|
|
|
|
termination). The result argument reflects whether
|
|
|
|
the task was successfully completed or not. This method is always called
|
|
|
|
from the main thread, so it is safe to create widgets and perform other
|
|
|
|
operations which require the main thread. However, the GUI will be blocked
|
|
|
|
for the duration of this method so tasks should avoid performing any
|
|
|
|
lengthy operations here.
|
|
|
|
%End
|
Allow QgsTask subclasses to defined a finished function, which is
called when the task has completed (successfully or otherwise).
This allows for simpler task design when the signal/slot
based approach is not required. Just implement run() with your
heavy lifting, and finished() to do whatever follow up stuff
should happen after the task is complete. finished is always
called from the main thread, so it's safe to do GUI operations
here.
Python based tasks using the simplified QgsTask.fromFunction
approach can now set a on_finished argument to a function
to call when the task is complete.
eg:
def calculate(task):
# pretend this is some complex maths and stuff we want
# to run in the background
return 5*6
def calculation_finished(result, value=None):
if result == QgsTask.ResultSuccess:
iface.messageBar().pushMessage(
'the magic number is {}'.format(value))
elif result == QgsTask.ResultFail:
iface.messageBar().pushMessage(
'couldn\'t work it out, sorry')
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
Multiple values can also be returned, eg:
def calculate(task):
return (4, 8, 15)
def calculation_finished(result, count=None, max=None, sum=None):
# here:
# count = 4
# max = 8
# sum = 15
task = QgsTask.fromFunction('my task', calculate,
on_finished=calculation_finished)
QgsTaskManager.instance().addTask(task)
2016-11-09 10:10:57 +10:00
|
|
|
|
2017-01-16 22:27:14 +01:00
|
|
|
bool isCanceled() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Will return true if task should terminate ASAP. If the task reports the CanCancel
|
|
|
|
flag, then derived classes' run() methods should periodically check this and
|
|
|
|
terminate in a safe manner.
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-04-15 20:49:02 +10:00
|
|
|
|
2016-11-03 08:19:33 +10:00
|
|
|
protected slots:
|
|
|
|
|
|
|
|
void setProgress( double progress );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Sets the task's current progress. The derived class should call this method whenever
|
|
|
|
the task wants to update its progress. Calling will automatically emit the progressChanged signal.
|
|
|
|
\param progress percent of progress, from 0.0 - 100.0
|
|
|
|
%End
|
2016-11-03 08:19:33 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
};
|
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
|
2016-04-19 22:24:34 +10:00
|
|
|
QFlags<QgsTask::Flag> operator|(QgsTask::Flag f1, QFlags<QgsTask::Flag> f2);
|
|
|
|
|
2016-04-21 11:41:00 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
class QgsTaskManager : QObject
|
|
|
|
{
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Task manager for managing a set of long-running QgsTask tasks. This class can be created directly,
|
|
|
|
or accessed via QgsApplication.taskManager().
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
%TypeHeaderCode
|
2017-05-10 13:01:31 +02:00
|
|
|
#include "qgstaskmanager.h"
|
2016-04-15 07:35:22 +10:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2017-05-02 07:21:20 +02:00
|
|
|
QgsTaskManager( QObject *parent /TransferThis/ = 0 );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsTaskManager.
|
|
|
|
\param parent parent QObject
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
virtual ~QgsTaskManager();
|
|
|
|
|
2016-11-25 18:15:08 +10:00
|
|
|
struct TaskDefinition
|
|
|
|
{
|
2017-05-10 13:01:31 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
explicit TaskDefinition( QgsTask *task, QgsTaskList dependentTasks = QgsTaskList() );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Constructor for TaskDefinition. Ownership of the task is not transferred to the definition,
|
|
|
|
but will be transferred to a QgsTaskManager.
|
|
|
|
%End
|
2016-11-25 18:15:08 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsTask *task;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Task
|
|
|
|
%End
|
2016-11-25 18:15:08 +10:00
|
|
|
|
2016-12-05 14:03:55 +10:00
|
|
|
QgsTaskList dependentTasks;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
List of dependent tasks which must be completed before task can run. If any dependent tasks are
|
|
|
|
canceled this task will also be canceled. Dependent tasks must also be added
|
|
|
|
to the task manager for proper handling of dependencies.
|
|
|
|
%End
|
|
|
|
|
2016-11-25 18:15:08 +10:00
|
|
|
};
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
long addTask( QgsTask *task /Transfer/, int priority = 0 );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Adds a task to the manager. Ownership of the task is transferred
|
|
|
|
to the manager, and the task manager will be responsible for starting
|
|
|
|
the task. The priority argument can be used to control the run queue's
|
|
|
|
order of execution, with larger numbers
|
|
|
|
taking precedence over lower priority numbers.
|
|
|
|
:return: unique task ID
|
|
|
|
:rtype: long
|
|
|
|
%End
|
2016-11-25 18:15:08 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
long addTask( const TaskDefinition &task /Transfer/, int priority = 0 );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Adds a task to the manager, using a full task definition (including dependency
|
|
|
|
handling). Ownership of the task is transferred to the manager, and the task
|
|
|
|
manager will be responsible for starting the task. The priority argument can
|
|
|
|
be used to control the run queue's order of execution, with larger numbers
|
|
|
|
taking precedence over lower priority numbers.
|
|
|
|
:return: unique task ID
|
|
|
|
:rtype: long
|
|
|
|
%End
|
2016-11-29 13:30:17 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsTask *task( long id ) const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the task with matching ID.
|
|
|
|
\param id task ID
|
|
|
|
:return: task if found, or None
|
|
|
|
:rtype: QgsTask
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
QList<QgsTask *> tasks() const;
|
|
|
|
%Docstring
|
|
|
|
Returns all tasks tracked by the manager.
|
|
|
|
:rtype: list of QgsTask
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
int count() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the number of tasks tracked by the manager.
|
|
|
|
:rtype: int
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
long taskId( QgsTask *task ) const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the unique task ID corresponding to a task managed by the class.
|
|
|
|
\param task task to find
|
|
|
|
:return: task ID, or -1 if task not found
|
|
|
|
:rtype: long
|
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-04-19 22:24:34 +10:00
|
|
|
void cancelAll();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Instructs all tasks tracked by the manager to terminate. Individual tasks may take some time
|
|
|
|
to cancel, or may totally ignore this instruction. Calling this does not block
|
|
|
|
but will instead signal the tasks to cancel and then return immediately.
|
|
|
|
%End
|
2016-04-15 20:49:02 +10:00
|
|
|
|
2017-01-16 15:13:30 +01:00
|
|
|
bool dependenciesSatisfied( long taskId ) const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns true if all dependencies for the specified task are satisfied
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-04-21 11:41:00 +10:00
|
|
|
|
2016-04-21 21:56:31 +10:00
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
QList< QgsMapLayer * > dependentLayers( long taskId ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns a list of layers on which as task is dependent. The task will automatically
|
|
|
|
be canceled if any of these layers are above to be removed.
|
|
|
|
\param taskId task ID
|
|
|
|
:return: list of layers
|
|
|
|
.. seealso:: tasksDependentOnLayer()
|
|
|
|
:rtype: list of QgsMapLayer
|
|
|
|
%End
|
2016-04-22 07:53:22 +10:00
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
QList< QgsTask * > tasksDependentOnLayer( QgsMapLayer *layer ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns a list of tasks which depend on a layer.
|
|
|
|
.. seealso:: dependentLayers()
|
|
|
|
:rtype: list of QgsTask
|
|
|
|
%End
|
2016-12-06 20:02:34 +10:00
|
|
|
|
2017-05-10 13:01:31 +02:00
|
|
|
QList< QgsTask * > activeTasks() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a list of the active (queued or running) tasks.
|
|
|
|
.. seealso:: countActiveTasks()
|
|
|
|
:rtype: list of QgsTask
|
|
|
|
%End
|
2016-04-26 15:54:30 +10:00
|
|
|
|
|
|
|
int countActiveTasks() const;
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the number of active (queued or running) tasks.
|
|
|
|
.. seealso:: activeTasks()
|
|
|
|
.. seealso:: countActiveTasksChanged()
|
|
|
|
:rtype: int
|
|
|
|
%End
|
2016-04-26 15:54:30 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void progressChanged( long taskId, double progress );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Will be emitted when a task reports a progress change
|
|
|
|
\param taskId ID of task
|
|
|
|
\param progress percent of progress, from 0.0 - 100.0
|
2017-05-10 13:01:31 +02:00
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-11-03 17:40:38 +10:00
|
|
|
void finalTaskProgressChanged( double progress );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Will be emitted when only a single task remains to complete
|
|
|
|
and that task has reported a progress change
|
|
|
|
\param progress percent of progress, from 0.0 - 100.0
|
2017-05-10 13:01:31 +02:00
|
|
|
%End
|
2016-11-03 17:40:38 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
void statusChanged( long taskId, int status );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Will be emitted when a task reports a status change
|
|
|
|
\param taskId ID of task
|
|
|
|
\param status new task status
|
2017-05-10 13:01:31 +02:00
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
void taskAdded( long taskId );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Emitted when a new task has been added to the manager
|
|
|
|
\param taskId ID of task
|
2017-05-10 13:01:31 +02:00
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
|
|
|
void taskAboutToBeDeleted( long taskId );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Emitted when a task is about to be deleted
|
|
|
|
\param taskId ID of task
|
2017-05-10 13:01:31 +02:00
|
|
|
%End
|
2016-04-15 07:35:22 +10:00
|
|
|
|
2016-04-26 15:54:30 +10:00
|
|
|
void allTasksFinished();
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Emitted when all tasks are complete
|
2017-05-10 13:01:31 +02:00
|
|
|
.. seealso:: countActiveTasksChanged()
|
|
|
|
%End
|
2016-04-26 15:54:30 +10:00
|
|
|
|
|
|
|
void countActiveTasksChanged( int count );
|
2017-05-10 13:01:31 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Emitted when the number of active tasks changes
|
2017-05-10 13:01:31 +02:00
|
|
|
.. seealso:: countActiveTasks()
|
|
|
|
%End
|
2016-04-26 15:54:30 +10:00
|
|
|
|
2016-04-15 07:35:22 +10:00
|
|
|
};
|
2017-05-10 13:01:31 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgstaskmanager.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|