forked from qt-creator/qt-creator
It enables the access to the internal TaskTree. Emitted by TaskTreeRunner::start(), after the task tree is instantiated and before it is started. The lifetime of the passed task tree is controlled by the TaskTreeRunner and is limited to the one particular execution. Don't store pointer to the passed task tree. If unvoidable, store the QPointer instead. It may be used e.g. for connecting to the TaskProgress. Change-Id: If0af11eb136c9cbff2e4c6e91f8b18a114880f74 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
35 lines
741 B
C++
35 lines
741 B
C++
// Copyright (C) 2024 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#include "tasktreerunner.h"
|
|
|
|
#include "tasktree.h"
|
|
|
|
namespace Tasking {
|
|
|
|
TaskTreeRunner::~TaskTreeRunner() = default;
|
|
|
|
void TaskTreeRunner::start(const Group &recipe)
|
|
{
|
|
m_taskTree.reset(new TaskTree(recipe));
|
|
connect(m_taskTree.get(), &TaskTree::done, this, [this](DoneWith result) {
|
|
m_taskTree.release()->deleteLater();
|
|
emit done(result);
|
|
});
|
|
emit aboutToStart(m_taskTree.get());
|
|
m_taskTree->start();
|
|
}
|
|
|
|
void TaskTreeRunner::stop()
|
|
{
|
|
if (m_taskTree)
|
|
m_taskTree->stop();
|
|
}
|
|
|
|
void TaskTreeRunner::reset()
|
|
{
|
|
m_taskTree.reset();
|
|
}
|
|
|
|
} // namespace Tasking
|