Skip to content

Commit f71c78e

Browse files
committedDec 5, 2016
Rename stopped to terminated for consistency
1 parent e01c306 commit f71c78e

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed
 

‎python/core/qgstaskmanager.sip

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class QgsTask : QObject
4949
};
5050
typedef QFlags<QgsTask::Flag> Flags;
5151

52-
/**
52+
/**
5353
* Constructor for QgsTask.
5454
* @param description text description of task
5555
* @param flags task flags
@@ -135,7 +135,7 @@ class QgsTask : QObject
135135
* Will be emitted by task when its status changes.
136136
* @param status new task status
137137
* @note derived classes should not emit this signal directly, instead they should call
138-
* completed() or stopped()
138+
* completed() or terminated()
139139
*/
140140
void statusChanged( int status );
141141

@@ -158,9 +158,9 @@ class QgsTask : QObject
158158
* other then completion (eg when a task has been cancelled or encountered
159159
* an internal error).
160160
* @note derived classes should not emit this signal directly, instead they should call
161-
* stopped()
161+
* terminated()
162162
*/
163-
void taskStopped();
163+
void taskTerminated();
164164

165165
protected:
166166

@@ -175,13 +175,13 @@ class QgsTask : QObject
175175
*
176176
* Alternatively, tasks can also return the ResultPending value
177177
* to indicate that the task is still operating and will manually report its
178-
* completion by calling completed() or stopped(). This may be useful for
178+
* completion by calling completed() or terminated(). This may be useful for
179179
* tasks which rely on external events for completion, eg downloading a
180180
* file. In this case Qt slots could be created which are connected to the
181-
* download completion or termination and which call completed() or stopped()
181+
* download completion or termination and which call completed() or terminated()
182182
* to indicate the task has finished operations.
183183
* @see completed()
184-
* @see stopped()
184+
* @see terminated()
185185
*/
186186
virtual TaskResult run() = 0;
187187

@@ -201,13 +201,13 @@ class QgsTask : QObject
201201
void completed();
202202

203203
/**
204-
* Sets the task as stopped. Calling this is only required for tasks which
204+
* Sets the task as terminated. Calling this is only required for tasks which
205205
* returned the ResultPending value as a result of run().
206206
* Should be called whenever the task ends for any reason other than successful
207-
* completion. Calling will automatically emit the statusChanged and taskStopped
207+
* completion. Calling will automatically emit the statusChanged and taskTerminated
208208
* signals.
209209
*/
210-
void stopped();
210+
void terminated();
211211

212212
protected slots:
213213

‎src/core/qgstaskmanager.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void QgsTask::start()
4646
break;
4747

4848
case ResultFail:
49-
stopped();
49+
terminated();
5050
break;
5151

5252
case ResultPending:
@@ -63,7 +63,7 @@ void QgsTask::cancel()
6363
if ( mStatus == Queued || mStatus == OnHold )
6464
{
6565
// immediately terminate unstarted jobs
66-
stopped();
66+
terminated();
6767
}
6868
}
6969

@@ -98,11 +98,11 @@ void QgsTask::completed()
9898
emit taskCompleted();
9999
}
100100

101-
void QgsTask::stopped()
101+
void QgsTask::terminated()
102102
{
103103
mStatus = Terminated;
104104
emit statusChanged( Terminated );
105-
emit taskStopped();
105+
emit taskTerminated();
106106
}
107107

108108

@@ -413,7 +413,7 @@ bool QgsTaskManager::cleanupAndDeleteTask( QgsTask *task )
413413
task->cancel();
414414
// delete task when it's terminated
415415
connect( task, &QgsTask::taskCompleted, task, &QgsTask::deleteLater );
416-
connect( task, &QgsTask::taskStopped, task, &QgsTask::deleteLater );
416+
connect( task, &QgsTask::taskTerminated, task, &QgsTask::deleteLater );
417417
}
418418
else
419419
{

‎src/core/qgstaskmanager.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class CORE_EXPORT QgsTask : public QObject
157157
* Will be emitted by task when its status changes.
158158
* @param status new task status
159159
* @note derived classes should not emit this signal directly, instead they should call
160-
* completed() or stopped()
160+
* completed() or terminated()
161161
*/
162162
void statusChanged( int status );
163163

@@ -180,9 +180,9 @@ class CORE_EXPORT QgsTask : public QObject
180180
* other then completion (eg when a task has been cancelled or encountered
181181
* an internal error).
182182
* @note derived classes should not emit this signal directly, instead they should call
183-
* stopped()
183+
* terminated()
184184
*/
185-
void taskStopped();
185+
void taskTerminated();
186186

187187
protected:
188188

@@ -197,13 +197,13 @@ class CORE_EXPORT QgsTask : public QObject
197197
*
198198
* Alternatively, tasks can also return the ResultPending value
199199
* to indicate that the task is still operating and will manually report its
200-
* completion by calling completed() or stopped(). This may be useful for
200+
* completion by calling completed() or terminated(). This may be useful for
201201
* tasks which rely on external events for completion, eg downloading a
202202
* file. In this case Qt slots could be created which are connected to the
203-
* download completion or termination and which call completed() or stopped()
203+
* download completion or termination and which call completed() or terminated()
204204
* to indicate the task has finished operations.
205205
* @see completed()
206-
* @see stopped()
206+
* @see terminated()
207207
*/
208208
virtual TaskResult run() = 0;
209209

@@ -223,13 +223,13 @@ class CORE_EXPORT QgsTask : public QObject
223223
void completed();
224224

225225
/**
226-
* Sets the task as stopped. Calling this is only required for tasks which
226+
* Sets the task as terminated. Calling this is only required for tasks which
227227
* returned the ResultPending value as a result of run().
228228
* Should be called whenever the task ends for any reason other than successful
229-
* completion. Calling will automatically emit the statusChanged and taskStopped
229+
* completion. Calling will automatically emit the statusChanged and taskTerminated
230230
* signals.
231231
*/
232-
void stopped();
232+
void terminated();
233233

234234
protected slots:
235235

‎tests/src/core/testqgstaskmanager.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TestTask : public QgsTask
3333
TestTask( const QString& desc, const QgsTask::Flags& flags ) : QgsTask( desc, flags ), runCalled( false ) {}
3434

3535
void emitProgressChanged( double progress ) { setProgress( progress ); }
36-
void emitTaskStopped() { stopped(); }
36+
void emitTaskStopped() { terminated(); }
3737
void emitTaskCompleted() { completed(); }
3838

3939
bool runCalled;
@@ -153,8 +153,8 @@ void TestQgsTaskManager::task()
153153
QVERIFY( task->canCancel() );
154154
QVERIFY( task->flags() & QgsTask::CanReportProgress );
155155

156-
QSignalSpy startedSpy( task.data(), SIGNAL( begun() ) );
157-
QSignalSpy statusSpy( task.data(), SIGNAL( statusChanged( int ) ) );
156+
QSignalSpy startedSpy( task.data(), &QgsTask::begun );
157+
QSignalSpy statusSpy( task.data(), &QgsTask::statusChanged );
158158

159159
task->start();
160160
QCOMPARE( task->status(), QgsTask::Running );
@@ -165,7 +165,7 @@ void TestQgsTaskManager::task()
165165
QCOMPARE( static_cast< QgsTask::TaskStatus >( statusSpy.last().at( 0 ).toInt() ), QgsTask::Running );
166166

167167
//test that calling stopped sets correct state
168-
QSignalSpy stoppedSpy( task.data(), SIGNAL( taskStopped() ) );
168+
QSignalSpy stoppedSpy( task.data(), &QgsTask::taskTerminated );
169169
task->emitTaskStopped();
170170
QCOMPARE( task->status(), QgsTask::Terminated );
171171
QVERIFY( !task->isActive() );
@@ -175,8 +175,8 @@ void TestQgsTaskManager::task()
175175

176176
//test that calling completed sets correct state
177177
task.reset( new TestTask() );
178-
QSignalSpy completeSpy( task.data(), SIGNAL( taskCompleted() ) );
179-
QSignalSpy statusSpy2( task.data(), SIGNAL( statusChanged( int ) ) );
178+
QSignalSpy completeSpy( task.data(), &QgsTask::taskCompleted );
179+
QSignalSpy statusSpy2( task.data(), &QgsTask::statusChanged );
180180
task->emitTaskCompleted();
181181
QCOMPARE( task->status(), QgsTask::Complete );
182182
QVERIFY( !task->isActive() );
@@ -208,7 +208,7 @@ void TestQgsTaskManager::taskResult()
208208
{
209209
QScopedPointer< TestTask > task( new SuccessTask() );
210210
QCOMPARE( task->status(), QgsTask::Queued );
211-
QSignalSpy statusSpy( task.data(), SIGNAL( statusChanged( int ) ) );
211+
QSignalSpy statusSpy( task.data(), &QgsTask::statusChanged );
212212

213213
task->start();
214214
QCOMPARE( statusSpy.count(), 2 );
@@ -218,7 +218,7 @@ void TestQgsTaskManager::taskResult()
218218

219219
task.reset( new FailTask() );
220220
QCOMPARE( task->status(), QgsTask::Queued );
221-
QSignalSpy statusSpy2( task.data(), SIGNAL( statusChanged( int ) ) );
221+
QSignalSpy statusSpy2( task.data(), &QgsTask::statusChanged );
222222

223223
task->start();
224224
QCOMPARE( statusSpy2.count(), 2 );
@@ -243,7 +243,7 @@ void TestQgsTaskManager::addTask()
243243
QCOMPARE( manager.count(), 0 );
244244
QVERIFY( !manager.task( 0L ) );
245245

246-
QSignalSpy spy( &manager, SIGNAL( taskAdded( long ) ) );
246+
QSignalSpy spy( &manager, &QgsTaskManager::taskAdded );
247247

248248
//add a task
249249
TestTask* task = new TestTask();
@@ -284,7 +284,7 @@ void TestQgsTaskManager::deleteTask()
284284
manager.addTask( task2 );
285285
manager.addTask( task3 );
286286

287-
QSignalSpy spy( &manager, SIGNAL( taskAboutToBeDeleted( long ) ) );
287+
QSignalSpy spy( &manager, &QgsTaskManager::taskAboutToBeDeleted );
288288

289289
//try deleting a non-existant task
290290
QVERIFY( !manager.deleteTask( 56 ) );
@@ -407,7 +407,7 @@ void TestQgsTaskManager::statusChanged()
407407
manager.addTask( task );
408408
manager.addTask( task2 );
409409

410-
QSignalSpy spy( &manager, SIGNAL( statusChanged( long, int ) ) );
410+
QSignalSpy spy( &manager, &QgsTaskManager::statusChanged );
411411

412412
task->start();
413413
QCOMPARE( spy.count(), 1 );
@@ -435,7 +435,7 @@ void TestQgsTaskManager::allTasksFinished()
435435
manager.addTask( task2 );
436436
while ( task2->status() != QgsTask::Running ) { }
437437

438-
QSignalSpy spy( &manager, SIGNAL( allTasksFinished() ) );
438+
QSignalSpy spy( &manager, &QgsTaskManager::allTasksFinished );
439439

440440
task->emitTaskStopped();
441441
while ( task->status() == QgsTask::Running ) { }
@@ -470,7 +470,7 @@ void TestQgsTaskManager::activeTasks()
470470
QgsTaskManager manager;
471471
TestTask* task = new TestTask();
472472
TestTask* task2 = new TestTask();
473-
QSignalSpy spy( &manager, SIGNAL( countActiveTasksChanged( int ) ) );
473+
QSignalSpy spy( &manager, &QgsTaskManager::countActiveTasksChanged );
474474
manager.addTask( task );
475475
QCOMPARE( manager.activeTasks().toSet(), ( QList< QgsTask* >() << task ).toSet() );
476476
QCOMPARE( manager.countActiveTasks(), 1 );

0 commit comments

Comments
 (0)
Please sign in to comment.