mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Add deleteAllTasks to manager
This commit is contained in:
parent
b64025df5c
commit
95dbb3a7e3
@ -187,6 +187,11 @@ class QgsTaskManager : QObject
|
|||||||
*/
|
*/
|
||||||
bool deleteTask( QgsTask* task );
|
bool deleteTask( QgsTask* task );
|
||||||
|
|
||||||
|
/** Deletes all tasks in the manager, first terminating them if they are currently
|
||||||
|
* running.
|
||||||
|
*/
|
||||||
|
void deleteAllTasks();
|
||||||
|
|
||||||
/** Returns the task with matching ID.
|
/** Returns the task with matching ID.
|
||||||
* @param id task ID
|
* @param id task ID
|
||||||
* @returns task if found, or nullptr
|
* @returns task if found, or nullptr
|
||||||
|
@ -184,7 +184,20 @@ bool QgsTaskManager::deleteTask( QgsTask *task )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsTask*QgsTaskManager::task( long id ) const
|
void QgsTaskManager::deleteAllTasks()
|
||||||
|
{
|
||||||
|
//first tell all tasks to cancel
|
||||||
|
cancelAll();
|
||||||
|
|
||||||
|
QMutexLocker ml( mTaskMutex );
|
||||||
|
Q_FOREACH ( QgsTask* task, tasks() )
|
||||||
|
{
|
||||||
|
deleteTask( task );
|
||||||
|
}
|
||||||
|
emit allTasksFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsTask* QgsTaskManager::task( long id ) const
|
||||||
{
|
{
|
||||||
QMutexLocker ml( mTaskMutex );
|
QMutexLocker ml( mTaskMutex );
|
||||||
return mTasks.value( id ).task;
|
return mTasks.value( id ).task;
|
||||||
|
@ -218,6 +218,11 @@ class CORE_EXPORT QgsTaskManager : public QObject
|
|||||||
*/
|
*/
|
||||||
bool deleteTask( QgsTask* task );
|
bool deleteTask( QgsTask* task );
|
||||||
|
|
||||||
|
/** Deletes all tasks in the manager, first terminating them if they are currently
|
||||||
|
* running.
|
||||||
|
*/
|
||||||
|
void deleteAllTasks();
|
||||||
|
|
||||||
/** Returns the task with matching ID.
|
/** Returns the task with matching ID.
|
||||||
* @param id task ID
|
* @param id task ID
|
||||||
* @returns task if found, or nullptr
|
* @returns task if found, or nullptr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user