TaskTree: Rename setupRoot into setRecipe

The passed Group root element is a recipe with
a full description on how to execute the tasks
and how to handle finished tasks.

We have already virtual methods / setters called like:
deployRecipe, refreshRecipe, reloadRecipe. So, the
common "recipe" is kind of consistent.

Fix typos in warnings.

Addresses the 11th point in the task below.

Task-number: QTCREATORBUG-28741
Change-Id: I1c80f4838b6a3e5ed113eaf8e42b59746d098efe
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Jarek Kobus
2023-06-06 11:37:27 +02:00
parent cab81a5d03
commit 003b43aee7
9 changed files with 18 additions and 18 deletions

View File

@@ -1750,9 +1750,9 @@ TaskTree::TaskTree()
{ {
} }
TaskTree::TaskTree(const Group &root) : TaskTree() TaskTree::TaskTree(const Group &recipe) : TaskTree()
{ {
setupRoot(root); setRecipe(recipe);
} }
TaskTree::~TaskTree() TaskTree::~TaskTree()
@@ -1763,27 +1763,27 @@ TaskTree::~TaskTree()
delete d; delete d;
} }
void TaskTree::setupRoot(const Group &root) void TaskTree::setRecipe(const Group &recipe)
{ {
QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return); QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return);
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The setupRoot() is called from one of the" QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The setRecipe() is called from one of the"
"TaskTree handlers, ingoring..."); return); "TaskTree handlers, ignoring..."); return);
d->m_storages.clear(); d->m_storages.clear();
d->m_root.reset(new TaskNode(d, root, nullptr)); d->m_root.reset(new TaskNode(d, recipe, nullptr));
} }
void TaskTree::start() void TaskTree::start()
{ {
QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return); QTC_ASSERT(!isRunning(), qWarning("The TaskTree is already running, ignoring..."); return);
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The start() is called from one of the" QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The start() is called from one of the"
"TaskTree handlers, ingoring..."); return); "TaskTree handlers, ignoring..."); return);
d->start(); d->start();
} }
void TaskTree::stop() void TaskTree::stop()
{ {
QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The stop() is called from one of the" QTC_ASSERT(!d->m_guard.isLocked(), qWarning("The stop() is called from one of the"
"TaskTree handlers, ingoring..."); return); "TaskTree handlers, ignoring..."); return);
d->stop(); d->stop();
} }

View File

@@ -378,10 +378,10 @@ class TASKING_EXPORT TaskTree final : public QObject
public: public:
TaskTree(); TaskTree();
TaskTree(const Group &root); TaskTree(const Group &recipe);
~TaskTree(); ~TaskTree();
void setupRoot(const Group &root); void setRecipe(const Group &recipe);
void start(); void start();
void stop(); void stop();

View File

@@ -490,7 +490,7 @@ void LocatorMatcher::start()
} }
}; };
d->m_taskTree->setupRoot(root); d->m_taskTree->setRecipe(root);
const auto onFinish = [this](bool success) { const auto onFinish = [this](bool success) {
return [this, success] { return [this, success] {

View File

@@ -257,7 +257,7 @@ void AttachCoreDialog::accepted()
[=](const auto &task) { d->symbolFileResult = task.result(); }}, [=](const auto &task) { d->symbolFileResult = task.result(); }},
}; };
d->taskTree.setupRoot(root); d->taskTree.setRecipe(root);
d->taskTree.start(); d->taskTree.start();
d->progressLabel->setText(Tr::tr("Copying files to device...")); d->progressLabel->setText(Tr::tr("Copying files to device..."));

View File

@@ -133,7 +133,7 @@ DiffFilesController::DiffFilesController(IDocument *document)
tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)), tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
std::bind(onDiffDone, _1, i))); std::bind(onDiffDone, _1, i)));
} }
taskTree.setupRoot(tasks); taskTree.setRecipe(tasks);
}; };
const auto onTreeDone = [this, storage] { const auto onTreeDone = [this, storage] {
const QList<std::optional<FileData>> &results = *storage; const QList<std::optional<FileData>> &results = *storage;

View File

@@ -446,7 +446,7 @@ ShowController::ShowController(IDocument *document, const QString &id)
tasks.append(ProcessTask(std::bind(setupFollow, _1, parents.at(i)), tasks.append(ProcessTask(std::bind(setupFollow, _1, parents.at(i)),
std::bind(onFollowDone, _1, i))); std::bind(onFollowDone, _1, i)));
} }
taskTree.setupRoot(tasks); taskTree.setRecipe(tasks);
}; };
const auto setupDiff = [this, id](Process &process) { const auto setupDiff = [this, id](Process &process) {

View File

@@ -228,7 +228,7 @@ GroupItem QnxDeployQtLibrariesDialogPrivate::chmodTree()
QTC_ASSERT(file.isValid(), continue); QTC_ASSERT(file.isValid(), continue);
chmodList.append(chmodTask(file)); chmodList.append(chmodTask(file));
} }
tree.setupRoot(chmodList); tree.setRecipe(chmodList);
}; };
return TaskTreeTask{setupChmodHandler}; return TaskTreeTask{setupChmodHandler};
} }

View File

@@ -184,7 +184,7 @@ GroupItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &st
QTC_ASSERT(file.isValid(), continue); QTC_ASSERT(file.isValid(), continue);
statList.append(statTask(storagePtr, file, statEndHandler)); statList.append(statTask(storagePtr, file, statEndHandler));
} }
tree.setupRoot({statList}); tree.setRecipe({statList});
}; };
return TaskTreeTask(setupHandler); return TaskTreeTask(setupHandler);
} }
@@ -261,7 +261,7 @@ GroupItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &s
QTC_ASSERT(file.isValid(), continue); QTC_ASSERT(file.isValid(), continue);
chmodList.append(chmodTask(file)); chmodList.append(chmodTask(file));
} }
tree.setupRoot({chmodList}); tree.setRecipe({chmodList});
}; };
return TaskTreeTask(setupChmodHandler); return TaskTreeTask(setupChmodHandler);
} }

View File

@@ -509,7 +509,7 @@ void tst_Tasking::testTree_data()
createSuccessTask(3), createSuccessTask(3),
createSuccessTask(4) createSuccessTask(4)
}; };
taskTree.setupRoot(nestedRoot); taskTree.setRecipe(nestedRoot);
CustomStorage *activeStorage = storage.activeStorage(); CustomStorage *activeStorage = storage.activeStorage();
auto collectSubLog = [activeStorage](CustomStorage *subTreeStorage){ auto collectSubLog = [activeStorage](CustomStorage *subTreeStorage){
activeStorage->m_log += subTreeStorage->m_log; activeStorage->m_log += subTreeStorage->m_log;