|
1 |
| -/** |
2 |
| - * \ingroup core |
3 |
| - * \class QgsTask |
4 |
| - * \brief Abstract base class for long running background tasks. Tasks can be controlled directly, |
5 |
| - * or added to a QgsTaskManager for automatic management. |
6 |
| - * |
7 |
| - * Derived classes should implement the process they want to execute in the background |
8 |
| - * within the run() method. This method will be called when the |
9 |
| - * task commences (ie via calling start() ). |
10 |
| - * |
11 |
| - * Long running tasks should periodically check the isCanceled() flag to detect if the task |
12 |
| - * has been canceled via some external event. If this flag is true then the task should |
13 |
| - * clean up and terminate at the earliest possible convenience. |
14 |
| - * |
15 |
| - * \note Added in version 3.0 |
16 |
| - */ |
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/qgstaskmanager.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +typedef QList< QgsTask * > QgsTaskList; |
| 15 | + |
17 | 16 | class QgsTask : QObject
|
18 | 17 | {
|
| 18 | +%Docstring |
| 19 | + Abstract base class for long running background tasks. Tasks can be controlled directly, |
| 20 | + or added to a QgsTaskManager for automatic management. |
| 21 | + |
| 22 | + Derived classes should implement the process they want to execute in the background |
| 23 | + within the run() method. This method will be called when the |
| 24 | + task commences (ie via calling run() ). |
| 25 | + |
| 26 | + Long running tasks should periodically check the isCanceled() flag to detect if the task |
| 27 | + has been canceled via some external event. If this flag is true then the task should |
| 28 | + clean up and terminate at the earliest possible convenience. |
| 29 | + |
| 30 | +.. versionadded:: 3.0 |
| 31 | +%End |
19 | 32 |
|
20 | 33 | %TypeHeaderCode
|
21 |
| -#include <qgstaskmanager.h> |
| 34 | +#include "qgstaskmanager.h" |
22 | 35 | %End
|
23 | 36 | public:
|
24 | 37 |
|
25 |
| - //! Status of tasks |
26 | 38 | enum TaskStatus
|
27 | 39 | {
|
28 |
| - Queued, /*!< Task is queued and has not begun */ |
29 |
| - OnHold, /*!< Task is queued but on hold and will not be started */ |
30 |
| - Running, /*!< Task is currently running */ |
31 |
| - Complete, /*!< Task successfully completed */ |
32 |
| - Terminated, /*!< Task was terminated or errored */ |
| 40 | + Queued, |
| 41 | + OnHold, |
| 42 | + Running, |
| 43 | + Complete, |
| 44 | + Terminated, |
33 | 45 | };
|
34 | 46 |
|
35 |
| - //! Task flags |
36 | 47 | enum Flag
|
37 | 48 | {
|
38 |
| - CanCancel, //!< Task can be canceled |
39 |
| - AllFlags, //!< Task supports all flags |
| 49 | + CanCancel, |
| 50 | + AllFlags, |
40 | 51 | };
|
41 | 52 | typedef QFlags<QgsTask::Flag> Flags;
|
42 | 53 |
|
43 |
| - /** |
44 |
| - * Constructor for QgsTask. |
45 |
| - * @param description text description of task |
46 |
| - * @param flags task flags |
47 |
| - */ |
| 54 | + |
48 | 55 | QgsTask( const QString &description = QString(), const Flags &flags = AllFlags );
|
| 56 | +%Docstring |
| 57 | + Constructor for QgsTask. |
| 58 | + \param description text description of task |
| 59 | + \param flags task flags |
| 60 | +%End |
| 61 | + |
| 62 | + ~QgsTask(); |
49 | 63 |
|
50 |
| - /** |
51 |
| - * Returns the flags associated with the task. |
52 |
| - */ |
53 | 64 | Flags flags() const;
|
| 65 | +%Docstring |
| 66 | + Returns the flags associated with the task. |
| 67 | + :rtype: Flags |
| 68 | +%End |
54 | 69 |
|
55 |
| - /** |
56 |
| - * Returns true if the task can be canceled. |
57 |
| - */ |
58 | 70 | bool canCancel() const;
|
| 71 | +%Docstring |
| 72 | + Returns true if the task can be canceled. |
| 73 | + :rtype: bool |
| 74 | +%End |
59 | 75 |
|
60 |
| - /** |
61 |
| - * Returns true if the task is active, ie it is not complete and has |
62 |
| - * not been canceled. |
63 |
| - */ |
64 | 76 | bool isActive() const;
|
| 77 | +%Docstring |
| 78 | + Returns true if the task is active, ie it is not complete and has |
| 79 | + not been canceled. |
| 80 | + :rtype: bool |
| 81 | +%End |
65 | 82 |
|
66 |
| - /** |
67 |
| - * Returns the current task status. |
68 |
| - */ |
69 | 83 | TaskStatus status() const;
|
| 84 | +%Docstring |
| 85 | + Returns the current task status. |
| 86 | + :rtype: TaskStatus |
| 87 | +%End |
70 | 88 |
|
71 |
| - /** |
72 |
| - * Returns the task's description. |
73 |
| - */ |
74 | 89 | QString description() const;
|
| 90 | +%Docstring |
| 91 | + Returns the task's description. |
| 92 | + :rtype: str |
| 93 | +%End |
75 | 94 |
|
76 |
| - /** |
77 |
| - * Returns the task's progress (between 0.0 and 100.0) |
78 |
| - */ |
79 | 95 | double progress() const;
|
| 96 | +%Docstring |
| 97 | + Returns the task's progress (between 0.0 and 100.0) |
| 98 | + :rtype: float |
| 99 | +%End |
80 | 100 |
|
81 | 101 | virtual void cancel();
|
| 102 | +%Docstring |
| 103 | + Notifies the task that it should terminate. Calling this is not guaranteed |
| 104 | + to immediately end the task, rather it sets the isCanceled() flag which |
| 105 | + task subclasses can check and terminate their operations at an appropriate |
| 106 | + time. Any subtasks owned by this task will also be canceled. |
| 107 | + Derived classes must ensure that the base class implementation is called |
| 108 | + from any overridden version. |
| 109 | +.. seealso:: isCanceled() |
| 110 | +%End |
82 | 111 |
|
83 |
| - /** |
84 |
| - * Places the task on hold. If the task in not queued |
85 |
| - * (ie it is already running or has finished) then calling this has no effect. |
86 |
| - * Calling this method only has an effect for tasks which are managed |
87 |
| - * by a QgsTaskManager. |
88 |
| - * @see unhold() |
89 |
| - */ |
90 | 112 | void hold();
|
| 113 | +%Docstring |
| 114 | + Places the task on hold. If the task in not queued |
| 115 | + (ie it is already running or has finished) then calling this has no effect. |
| 116 | + Calling this method only has an effect for tasks which are managed |
| 117 | + by a QgsTaskManager. |
| 118 | +.. seealso:: unhold() |
| 119 | +%End |
91 | 120 |
|
92 |
| - /** |
93 |
| - * Releases the task from being held. For tasks managed by a QgsTaskManager |
94 |
| - * calling this will re-add them to the queue. If the |
95 |
| - * task in not currently being held then calling this has no effect. |
96 |
| - * @see hold() |
97 |
| - */ |
98 | 121 | void unhold();
|
| 122 | +%Docstring |
| 123 | + Releases the task from being held. For tasks managed by a QgsTaskManager |
| 124 | + calling this will re-add them to the queue. If the |
| 125 | + task in not currently being held then calling this has no effect. |
| 126 | +.. seealso:: hold() |
| 127 | +%End |
99 | 128 |
|
100 |
| - //! Controls how subtasks relate to their parent task |
101 | 129 | enum SubTaskDependency
|
102 | 130 | {
|
103 |
| - SubTaskIndependent, //!< Subtask is independent of the parent, and can run before, after or at the same time as the parent. |
104 |
| - ParentDependsOnSubTask, //!< Subtask must complete before parent can begin |
| 131 | + SubTaskIndependent, |
| 132 | + ParentDependsOnSubTask, |
105 | 133 | };
|
106 | 134 |
|
107 |
| - /** |
108 |
| - * Adds a subtask to this task. |
109 |
| - * |
110 |
| - * Subtasks allow a single task to be created which |
111 |
| - * consists of multiple smaller tasks. Subtasks are not visible or indepedently |
112 |
| - * controllable by users. Ownership of the subtask is transferred. |
113 |
| - * Subtasks can have an optional list of dependent tasks, which must be completed |
114 |
| - * before the subtask can begin. By default subtasks are considered independent |
115 |
| - * of the parent task, ie they can be run either before, after, or at the same |
116 |
| - * time as the parent task. This behavior can be overridden through the subTaskDependency |
117 |
| - * argument. |
118 |
| - * |
119 |
| - * The parent task must be added to a QgsTaskManager for subtasks to be utilized. |
120 |
| - * Subtasks should not be added manually to a QgsTaskManager, rather, only the parent |
121 |
| - * task should be added to the manager. |
122 |
| - * |
123 |
| - * Subtasks can be nested, ie a subtask can legally be a parent task itself with |
124 |
| - * its own set of subtasks. |
125 |
| - */ |
126 |
| - void addSubTask( QgsTask* subTask /Transfer/, const QgsTaskList& dependencies = QgsTaskList(), |
| 135 | + void addSubTask( QgsTask *subTask /Transfer/, const QgsTaskList &dependencies = QgsTaskList(), |
127 | 136 | SubTaskDependency subTaskDependency = SubTaskIndependent );
|
| 137 | +%Docstring |
| 138 | + Adds a subtask to this task. |
| 139 | + |
| 140 | + Subtasks allow a single task to be created which |
| 141 | + consists of multiple smaller tasks. Subtasks are not visible or indepedently |
| 142 | + controllable by users. Ownership of the subtask is transferred. |
| 143 | + Subtasks can have an optional list of dependent tasks, which must be completed |
| 144 | + before the subtask can begin. By default subtasks are considered independent |
| 145 | + of the parent task, ie they can be run either before, after, or at the same |
| 146 | + time as the parent task. This behavior can be overridden through the subTaskDependency |
| 147 | + argument. Note that subtasks should NEVER be dependent on their parent task, and violating |
| 148 | + this constraint will prevent the task from completing successfully. |
| 149 | + |
| 150 | + The parent task must be added to a QgsTaskManager for subtasks to be utilized. |
| 151 | + Subtasks should not be added manually to a QgsTaskManager, rather, only the parent |
| 152 | + task should be added to the manager. |
| 153 | + |
| 154 | + Subtasks can be nested, ie a subtask can legally be a parent task itself with |
| 155 | + its own set of subtasks. |
| 156 | +%End |
| 157 | + |
| 158 | + void setDependentLayers( const QList<QgsMapLayer *> &dependentLayers ); |
| 159 | +%Docstring |
| 160 | + Sets a list of layers on which the task depends. The task will automatically |
| 161 | + be canceled if any of these layers are about to be removed. |
| 162 | +.. seealso:: dependentLayerIds() |
| 163 | +%End |
| 164 | + |
| 165 | + QList< QgsMapLayer * > dependentLayers() const; |
| 166 | +%Docstring |
| 167 | + Returns the list of layers on which the task depends. The task will automatically |
| 168 | + be canceled if any of these layers are about to be removed. |
| 169 | +.. seealso:: setDependentLayers() |
| 170 | + :rtype: list of QgsMapLayer |
| 171 | +%End |
128 | 172 |
|
129 |
| - void setDependentLayers( const QList<QgsMapLayer*> &dependentLayers ); |
| 173 | + bool waitForFinished( int timeout = 30000 ); |
| 174 | +%Docstring |
| 175 | + Blocks the current thread until the task finishes or a maximum of ``timeout`` milliseconds. |
| 176 | + If the ``timeout`` is ``-1`` the thread will be blocked forever. |
130 | 177 |
|
131 |
| - QList< QgsMapLayer* > dependentLayers() const; |
| 178 | + The result will be false if the wait timed out and true in any other case. |
| 179 | + :rtype: bool |
| 180 | +%End |
132 | 181 |
|
133 | 182 | signals:
|
134 | 183 |
|
135 |
| - /** |
136 |
| - * Will be emitted by task when its progress changes. |
137 |
| - * @param progress percent of progress, from 0.0 - 100.0 |
138 |
| - * @note derived classes should not emit this signal directly, instead they should call |
139 |
| - * setProgress() |
140 |
| - */ |
141 | 184 | void progressChanged( double progress );
|
| 185 | +%Docstring |
| 186 | + Will be emitted by task when its progress changes. |
| 187 | + \param progress percent of progress, from 0.0 - 100.0 |
| 188 | +.. note:: |
| 189 | + |
| 190 | + derived classes should not emit this signal directly, instead they should call |
| 191 | + setProgress() |
| 192 | +%End |
142 | 193 |
|
143 |
| - /** |
144 |
| - * Will be emitted by task when its status changes. |
145 |
| - * @param status new task status |
146 |
| - * @note derived classes should not emit this signal directly, it will automatically |
147 |
| - * be emitted |
148 |
| - */ |
149 | 194 | void statusChanged( int status );
|
| 195 | +%Docstring |
| 196 | + Will be emitted by task when its status changes. |
| 197 | + \param status new task status |
| 198 | +.. note:: |
| 199 | + |
| 200 | + derived classes should not emit this signal directly, it will automatically |
| 201 | + be emitted |
| 202 | +%End |
150 | 203 |
|
151 |
| - /** |
152 |
| - * Will be emitted by task to indicate its commencement. |
153 |
| - * @note derived classes should not emit this signal directly, it will automatically |
154 |
| - * be emitted when the task begins |
155 |
| - */ |
156 | 204 | void begun();
|
| 205 | +%Docstring |
| 206 | + Will be emitted by task to indicate its commencement. |
| 207 | +.. note:: |
| 208 | + |
| 209 | + derived classes should not emit this signal directly, it will automatically |
| 210 | + be emitted when the task begins |
| 211 | +%End |
157 | 212 |
|
158 |
| - /** |
159 |
| - * Will be emitted by task to indicate its successful completion. |
160 |
| - * @note derived classes should not emit this signal directly, it will automatically |
161 |
| - * be emitted |
162 |
| - */ |
163 | 213 | void taskCompleted();
|
| 214 | +%Docstring |
| 215 | + Will be emitted by task to indicate its successful completion. |
| 216 | +.. note:: |
| 217 | + |
| 218 | + derived classes should not emit this signal directly, it will automatically |
| 219 | + be emitted |
| 220 | +%End |
164 | 221 |
|
165 |
| - /** |
166 |
| - * Will be emitted by task if it has terminated for any reason |
167 |
| - * other then completion (e.g., when a task has been canceled or encountered |
168 |
| - * an internal error). |
169 |
| - * @note derived classes should not emit this signal directly, it will automatically |
170 |
| - * be emitted |
171 |
| - */ |
172 | 222 | void taskTerminated();
|
| 223 | +%Docstring |
| 224 | + Will be emitted by task if it has terminated for any reason |
| 225 | + other then completion (e.g., when a task has been canceled or encountered |
| 226 | + an internal error). |
| 227 | +.. note:: |
| 228 | + |
| 229 | + derived classes should not emit this signal directly, it will automatically |
| 230 | + be emitted |
| 231 | +%End |
173 | 232 |
|
174 | 233 | protected:
|
175 | 234 |
|
176 |
| - /** |
177 |
| - * Performs the task's operation. This method will be called when the task commences |
178 |
| - * (ie via calling start() ), and subclasses should implement the operation they |
179 |
| - * wish to perform in the background within this method. |
180 |
| - * |
181 |
| - * A task must return a boolean value to indicate whether the |
182 |
| - * task was completed successfully or terminated before completion. |
183 |
| - */ |
184 | 235 | virtual bool run() = 0;
|
| 236 | +%Docstring |
| 237 | + Performs the task's operation. This method will be called when the task commences |
| 238 | + (ie via calling start() ), and subclasses should implement the operation they |
| 239 | + wish to perform in the background within this method. |
| 240 | + |
| 241 | + A task must return a boolean value to indicate whether the |
| 242 | + task was completed successfully or terminated before completion. |
| 243 | + :rtype: bool |
| 244 | +%End |
185 | 245 |
|
186 |
| - /** |
187 |
| - * If the task is managed by a QgsTaskManager, this will be called after the |
188 |
| - * task has finished (whether through successful completion or via early |
189 |
| - * termination). The result argument reflects whether |
190 |
| - * the task was successfully completed or not. This method is always called |
191 |
| - * from the main thread, so it is safe to create widgets and perform other |
192 |
| - * operations which require the main thread. However, the GUI will be blocked |
193 |
| - * for the duration of this method so tasks should avoid performing any |
194 |
| - * lengthy operations here. |
195 |
| - */ |
196 | 246 | virtual void finished( bool result );
|
| 247 | +%Docstring |
| 248 | + If the task is managed by a QgsTaskManager, this will be called after the |
| 249 | + task has finished (whether through successful completion or via early |
| 250 | + termination). The result argument reflects whether |
| 251 | + the task was successfully completed or not. This method is always called |
| 252 | + from the main thread, so it is safe to create widgets and perform other |
| 253 | + operations which require the main thread. However, the GUI will be blocked |
| 254 | + for the duration of this method so tasks should avoid performing any |
| 255 | + lengthy operations here. |
| 256 | +%End |
197 | 257 |
|
198 |
| - /** |
199 |
| - * Will return true if task should terminate ASAP. If the task reports the CanCancel |
200 |
| - * flag, then derived classes' run() methods should periodically check this and |
201 |
| - * terminate in a safe manner. |
202 |
| - */ |
203 | 258 | bool isCanceled() const;
|
| 259 | +%Docstring |
| 260 | + Will return true if task should terminate ASAP. If the task reports the CanCancel |
| 261 | + flag, then derived classes' run() methods should periodically check this and |
| 262 | + terminate in a safe manner. |
| 263 | + :rtype: bool |
| 264 | +%End |
204 | 265 |
|
205 | 266 | protected slots:
|
206 | 267 |
|
207 |
| - /** |
208 |
| - * Sets the task's current progress. If task reports the CanReportProgress flag then |
209 |
| - * the derived class should call this method whenever the task wants to update its |
210 |
| - * progress. Calling will automatically emit the progressChanged signal. |
211 |
| - * @param progress percent of progress, from 0.0 - 100.0 |
212 |
| - */ |
213 | 268 | void setProgress( double progress );
|
| 269 | +%Docstring |
| 270 | + Sets the task's current progress. The derived class should call this method whenever |
| 271 | + the task wants to update its progress. Calling will automatically emit the progressChanged signal. |
| 272 | + \param progress percent of progress, from 0.0 - 100.0 |
| 273 | +%End |
214 | 274 |
|
215 | 275 | };
|
216 | 276 |
|
| 277 | + |
217 | 278 | QFlags<QgsTask::Flag> operator|(QgsTask::Flag f1, QFlags<QgsTask::Flag> f2);
|
218 | 279 |
|
219 |
| -//! List of QgsTask objects |
220 |
| -typedef QList< QgsTask* > QgsTaskList; |
221 | 280 |
|
222 |
| -/** \ingroup core |
223 |
| - * \class QgsTaskManager |
224 |
| - * \brief Task manager for managing a set of long-running QgsTask tasks. This class can be created directly, |
225 |
| - * or accessed via a global instance. |
226 |
| - * \note Added in version 2.16 |
227 |
| - */ |
228 | 281 | class QgsTaskManager : QObject
|
229 | 282 | {
|
| 283 | +%Docstring |
| 284 | + Task manager for managing a set of long-running QgsTask tasks. This class can be created directly, |
| 285 | + or accessed via QgsApplication.taskManager(). |
| 286 | +.. versionadded:: 3.0 |
| 287 | +%End |
| 288 | + |
230 | 289 | %TypeHeaderCode
|
231 |
| -#include <qgstaskmanager.h> |
| 290 | +#include "qgstaskmanager.h" |
232 | 291 | %End
|
233 | 292 | public:
|
234 | 293 |
|
235 |
| - /** Constructor for QgsTaskManager. |
236 |
| - * @param parent parent QObject |
237 |
| - */ |
238 | 294 | QgsTaskManager( QObject *parent /TransferThis/ = 0 );
|
| 295 | +%Docstring |
| 296 | + Constructor for QgsTaskManager. |
| 297 | + \param parent parent QObject |
| 298 | +%End |
239 | 299 |
|
240 | 300 | virtual ~QgsTaskManager();
|
241 | 301 |
|
242 |
| - /** |
243 |
| - * Definition of a task for inclusion within a task bundle. |
244 |
| - */ |
245 | 302 | struct TaskDefinition
|
246 | 303 | {
|
247 |
| - /** |
248 |
| - * Constructor for TaskDefinition. Ownership of the task is transferred to the definition. |
249 |
| - */ |
| 304 | + |
250 | 305 | explicit TaskDefinition( QgsTask *task, QgsTaskList dependentTasks = QgsTaskList() );
|
| 306 | +%Docstring |
| 307 | + Constructor for TaskDefinition. Ownership of the task is not transferred to the definition, |
| 308 | + but will be transferred to a QgsTaskManager. |
| 309 | +%End |
251 | 310 |
|
252 |
| - //! Task |
253 | 311 | QgsTask *task;
|
| 312 | +%Docstring |
| 313 | +Task |
| 314 | +%End |
254 | 315 |
|
255 |
| - /** |
256 |
| - * List of dependencies which must be completed before task can run. If any dependent tasks are |
257 |
| - * canceled this task will also be canceled. Dependent tasks must also be added |
258 |
| - * to the task manager for proper handling of dependencies. |
259 |
| - */ |
260 | 316 | QgsTaskList dependentTasks;
|
| 317 | +%Docstring |
| 318 | + List of dependent tasks which must be completed before task can run. If any dependent tasks are |
| 319 | + canceled this task will also be canceled. Dependent tasks must also be added |
| 320 | + to the task manager for proper handling of dependencies. |
| 321 | +%End |
| 322 | + |
261 | 323 | };
|
262 | 324 |
|
263 |
| - /** Adds a task to the manager. Ownership of the task is transferred |
264 |
| - * to the manager, and the task manager will be responsible for starting |
265 |
| - * the task. The priority argument can be used to control the run queue's |
266 |
| - * order of execution. |
267 |
| - * @returns unique task ID |
268 |
| - */ |
269 | 325 | long addTask( QgsTask *task /Transfer/, int priority = 0 );
|
| 326 | +%Docstring |
| 327 | + Adds a task to the manager. Ownership of the task is transferred |
| 328 | + to the manager, and the task manager will be responsible for starting |
| 329 | + the task. The priority argument can be used to control the run queue's |
| 330 | + order of execution, with larger numbers |
| 331 | + taking precedence over lower priority numbers. |
| 332 | + :return: unique task ID |
| 333 | + :rtype: long |
| 334 | +%End |
270 | 335 |
|
271 |
| - /** |
272 |
| - * Adds a task to the manager, using a full task definition (including dependency |
273 |
| - * handling). Ownership of the task is transferred to the manager, and the task |
274 |
| - * manager will be responsible for starting the task. The priority argument can |
275 |
| - * be used to control the run queue's order of execution. |
276 |
| - * @returns unique task ID |
277 |
| - */ |
278 | 336 | long addTask( const TaskDefinition &task /Transfer/, int priority = 0 );
|
| 337 | +%Docstring |
| 338 | + Adds a task to the manager, using a full task definition (including dependency |
| 339 | + handling). Ownership of the task is transferred to the manager, and the task |
| 340 | + manager will be responsible for starting the task. The priority argument can |
| 341 | + be used to control the run queue's order of execution, with larger numbers |
| 342 | + taking precedence over lower priority numbers. |
| 343 | + :return: unique task ID |
| 344 | + :rtype: long |
| 345 | +%End |
279 | 346 |
|
280 |
| - |
281 |
| - /** Returns the task with matching ID. |
282 |
| - * @param id task ID |
283 |
| - * @returns task if found, or nullptr |
284 |
| - */ |
285 | 347 | QgsTask *task( long id ) const;
|
| 348 | +%Docstring |
| 349 | + Returns the task with matching ID. |
| 350 | + \param id task ID |
| 351 | + :return: task if found, or None |
| 352 | + :rtype: QgsTask |
| 353 | +%End |
286 | 354 |
|
287 |
| - /** Returns all tasks tracked by the manager. |
288 |
| - */ |
289 |
| - QList<QgsTask*> tasks() const; |
| 355 | + QList<QgsTask *> tasks() const; |
| 356 | +%Docstring |
| 357 | + Returns all tasks tracked by the manager. |
| 358 | + :rtype: list of QgsTask |
| 359 | +%End |
290 | 360 |
|
291 |
| - //! Returns the number of tasks tracked by the manager. |
292 | 361 | int count() const;
|
| 362 | +%Docstring |
| 363 | +Returns the number of tasks tracked by the manager. |
| 364 | + :rtype: int |
| 365 | +%End |
293 | 366 |
|
294 |
| - /** Returns the unique task ID corresponding to a task managed by the class. |
295 |
| - * @param task task to find |
296 |
| - * @returns task ID, or -1 if task not found |
297 |
| - */ |
298 | 367 | long taskId( QgsTask *task ) const;
|
| 368 | +%Docstring |
| 369 | + Returns the unique task ID corresponding to a task managed by the class. |
| 370 | + \param task task to find |
| 371 | + :return: task ID, or -1 if task not found |
| 372 | + :rtype: long |
| 373 | +%End |
299 | 374 |
|
300 |
| - //! Instructs all tasks tracked by the manager to terminate. |
301 | 375 | void cancelAll();
|
| 376 | +%Docstring |
| 377 | + Instructs all tasks tracked by the manager to terminate. Individual tasks may take some time |
| 378 | + to cancel, or may totally ignore this instruction. Calling this does not block |
| 379 | + but will instead signal the tasks to cancel and then return immediately. |
| 380 | +%End |
302 | 381 |
|
303 |
| - //! Returns true if all dependencies for the specified task are satisfied |
304 | 382 | bool dependenciesSatisfied( long taskId ) const;
|
| 383 | +%Docstring |
| 384 | +Returns true if all dependencies for the specified task are satisfied |
| 385 | + :rtype: bool |
| 386 | +%End |
305 | 387 |
|
306 |
| - //! Returns the set of task IDs on which a task is dependent |
307 |
| - //! @note not available in Python bindings |
308 |
| - //QSet< long > dependencies( long taskId ) const; |
309 | 388 |
|
310 |
| - QList< QgsMapLayer* > dependentLayers( long taskId ) const; |
| 389 | + QList< QgsMapLayer * > dependentLayers( long taskId ) const; |
| 390 | +%Docstring |
| 391 | + Returns a list of layers on which as task is dependent. The task will automatically |
| 392 | + be canceled if any of these layers are above to be removed. |
| 393 | + \param taskId task ID |
| 394 | + :return: list of layers |
| 395 | +.. seealso:: tasksDependentOnLayer() |
| 396 | + :rtype: list of QgsMapLayer |
| 397 | +%End |
311 | 398 |
|
312 |
| - QList< QgsTask* > tasksDependentOnLayer( QgsMapLayer *layer ) const; |
| 399 | + QList< QgsTask * > tasksDependentOnLayer( QgsMapLayer *layer ) const; |
| 400 | +%Docstring |
| 401 | + Returns a list of tasks which depend on a layer. |
| 402 | +.. seealso:: dependentLayers() |
| 403 | + :rtype: list of QgsTask |
| 404 | +%End |
313 | 405 |
|
314 |
| - /** Returns a list of the active (queued or running) tasks. |
315 |
| - * @see countActiveTasks() |
316 |
| - */ |
317 |
| - QList< QgsTask* > activeTasks() const; |
| 406 | + QList< QgsTask * > activeTasks() const; |
| 407 | +%Docstring |
| 408 | + Returns a list of the active (queued or running) tasks. |
| 409 | +.. seealso:: countActiveTasks() |
| 410 | + :rtype: list of QgsTask |
| 411 | +%End |
318 | 412 |
|
319 |
| - /** Returns the number of active (queued or running) tasks. |
320 |
| - * @see activeTasks() |
321 |
| - * @see countActiveTasksChanged() |
322 |
| - */ |
323 | 413 | int countActiveTasks() const;
|
| 414 | +%Docstring |
| 415 | + Returns the number of active (queued or running) tasks. |
| 416 | +.. seealso:: activeTasks() |
| 417 | +.. seealso:: countActiveTasksChanged() |
| 418 | + :rtype: int |
| 419 | +%End |
324 | 420 |
|
325 | 421 | signals:
|
326 | 422 |
|
327 |
| - //! Will be emitted when a task reports a progress change |
328 |
| - //! @param taskId ID of task |
329 |
| - //! @param progress percent of progress, from 0.0 - 100.0 |
330 | 423 | void progressChanged( long taskId, double progress );
|
| 424 | +%Docstring |
| 425 | +\param progress percent of progress, from 0.0 - 100.0 |
| 426 | +%End |
331 | 427 |
|
332 |
| - //! Will be emitted when only a single task remains to complete |
333 |
| - //! and that task has reported a progress change |
334 |
| - //! @param progress percent of progress, from 0.0 - 100.0 |
335 | 428 | void finalTaskProgressChanged( double progress );
|
| 429 | +%Docstring |
| 430 | +\param progress percent of progress, from 0.0 - 100.0 |
| 431 | +%End |
336 | 432 |
|
337 |
| - //! Will be emitted when a task reports a status change |
338 |
| - //! @param taskId ID of task |
339 |
| - //! @param status new task status |
340 | 433 | void statusChanged( long taskId, int status );
|
| 434 | +%Docstring |
| 435 | +\param status new task status |
| 436 | +%End |
341 | 437 |
|
342 |
| - //! Emitted when a new task has been added to the manager |
343 |
| - //! @param taskId ID of task |
344 | 438 | void taskAdded( long taskId );
|
| 439 | +%Docstring |
| 440 | +\param taskId ID of task |
| 441 | +%End |
345 | 442 |
|
346 |
| - //! Emitted when a task is about to be deleted |
347 |
| - //! @param taskId ID of task |
348 | 443 | void taskAboutToBeDeleted( long taskId );
|
| 444 | +%Docstring |
| 445 | +\param taskId ID of task |
| 446 | +%End |
349 | 447 |
|
350 |
| - //! Emitted when all tasks are complete |
351 |
| - //! @see countActiveTasksChanged() |
352 | 448 | void allTasksFinished();
|
| 449 | +%Docstring |
| 450 | +.. seealso:: countActiveTasksChanged() |
| 451 | +%End |
353 | 452 |
|
354 |
| - //! Emitted when the number of active tasks changes |
355 |
| - //! @see countActiveTasks() |
356 | 453 | void countActiveTasksChanged( int count );
|
| 454 | +%Docstring |
| 455 | +.. seealso:: countActiveTasks() |
| 456 | +%End |
357 | 457 |
|
358 | 458 | };
|
| 459 | + |
| 460 | +/************************************************************************ |
| 461 | + * This file has been generated automatically from * |
| 462 | + * * |
| 463 | + * src/core/qgstaskmanager.h * |
| 464 | + * * |
| 465 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 466 | + ************************************************************************/ |
0 commit comments