TaskTree: Rename stop() -> cancel()

This better corresponds to done handlers called
in this case with DoneWith::Cancel.

By the way, get rid of unused LocatorFilter::stop().

Change-Id: Ie4246b8d888fff95940a2ed41367d2817bd6339c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2024-01-24 22:52:36 +01:00
parent a525949a2c
commit 983fc4bcf6
9 changed files with 9 additions and 16 deletions

View File

@@ -2852,7 +2852,7 @@ void TaskTree::start()
\sa ~TaskTree()
*/
void TaskTree::stop()
void TaskTree::cancel()
{
QT_ASSERT(!d->m_guard.isLocked(), qWarning("The stop() is called from one of the"
"TaskTree handlers, ignoring..."); return);
@@ -2907,7 +2907,7 @@ DoneWith TaskTree::runBlocking(const QFuture<void> &future)
QMetaObject::invokeMethod(&loop, [&loop] { loop.quit(); }, Qt::QueuedConnection);
});
QFutureWatcher<void> watcher;
connect(&watcher, &QFutureWatcherBase::canceled, this, &TaskTree::stop);
connect(&watcher, &QFutureWatcherBase::canceled, this, &TaskTree::cancel);
watcher.setFuture(future);
QTimer::singleShot(0, this, &TaskTree::start);

View File

@@ -514,7 +514,7 @@ public:
void setRecipe(const Group &recipe);
void start();
void stop();
void cancel();
bool isRunning() const;
// Helper methods. They execute a local event loop with ExcludeUserInputEvents.

View File

@@ -26,10 +26,10 @@ void TaskTreeRunner::start(const Group &recipe,
m_taskTree->start();
}
void TaskTreeRunner::stop()
void TaskTreeRunner::cancel()
{
if (m_taskTree)
m_taskTree->stop();
m_taskTree->cancel();
}
void TaskTreeRunner::reset()

View File

@@ -27,9 +27,8 @@ public:
const SetupHandler &setupHandler = {},
const DoneHandler &doneHandler = {});
// TODO: rename to cancel(), also in TaskTree API, adapt docs.
// When task tree is running it emits done(DoneWith::Cancel) synchronously.
void stop();
void cancel();
// No done() signal is emitted.
void reset();

View File

@@ -486,11 +486,6 @@ void LocatorMatcher::start()
});
}
void LocatorMatcher::stop()
{
d->m_taskTreeRunner.stop();
}
bool LocatorMatcher::isRunning() const
{
return d->m_taskTreeRunner.isRunning();

View File

@@ -167,7 +167,6 @@ public:
void setInputData(const QString &inputData);
void setParallelLimit(int limit); // by default 0 = parallel
void start();
void stop();
bool isRunning() const;
// Total data collected so far, even when running.

View File

@@ -110,7 +110,7 @@ TaskProgress::TaskProgress(TaskTree *taskTree)
connect(&d->m_watcher, &QFutureWatcher<void>::canceled, this, [this] {
emit canceled();
if (d->m_isAutoStopOnCancel)
d->m_taskTree->stop();
d->m_taskTree->cancel();
});
connect(d->m_taskTree, &TaskTree::started, this, [this] {
d->m_futureInterface = QFutureInterface<void>();

View File

@@ -3159,7 +3159,7 @@ void tst_Tasking::restart()
TaskTree taskTree({TestTask([](TaskObject &taskObject) { taskObject = 1000ms; })});
taskTree.start();
QVERIFY(taskTree.isRunning());
taskTree.stop();
taskTree.cancel();
QVERIFY(!taskTree.isRunning());
taskTree.start();
QVERIFY(taskTree.isRunning());

View File

@@ -251,7 +251,7 @@ int main(int argc, char *argv[])
const auto stopTaskTree = [&] {
if (taskTreeRunner.isRunning())
taskTreeRunner.stop();
taskTreeRunner.cancel();
};
const auto resetTaskTree = [&] {