forked from qt-creator/qt-creator
TaskTree: Add Task c'tor taking one handler for done and error
The overloaded c'tor takes one done handler with an additional "bool success" argument. Task-number: QTCREATORBUG-29834 Change-Id: Id579d055721a2a07a5a9f0900aa4a73655f21610 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -497,23 +497,21 @@ ShowController::ShowController(IDocument *document, const QString &id)
|
||||
data->m_follows = {busyMessage};
|
||||
data->m_follows.resize(parents.size());
|
||||
|
||||
const auto setupFollow = [this](Process &process, const QString &parent) {
|
||||
setupCommand(process, {"describe", "--tags", "--abbrev=0", parent});
|
||||
};
|
||||
const auto onFollowDone = [data, updateDescription](const Process &process, int index) {
|
||||
data->m_follows[index] = process.cleanedStdOut().trimmed();
|
||||
updateDescription(*data);
|
||||
};
|
||||
const auto onFollowsError = [data, updateDescription] {
|
||||
data->m_follows.clear();
|
||||
updateDescription(*data);
|
||||
};
|
||||
|
||||
using namespace std::placeholders;
|
||||
QList<GroupItem> tasks {parallel, continueOnDone, onGroupError(onFollowsError)};
|
||||
QList<GroupItem> tasks { parallel, continueOnDone, onGroupError(onFollowsError) };
|
||||
for (int i = 0, total = parents.size(); i < total; ++i) {
|
||||
tasks.append(ProcessTask(std::bind(setupFollow, _1, parents.at(i)),
|
||||
std::bind(onFollowDone, _1, i)));
|
||||
const auto setupFollow = [this, parent = parents.at(i)](Process &process) {
|
||||
setupCommand(process, {"describe", "--tags", "--abbrev=0", parent});
|
||||
};
|
||||
const auto onFollowDone = [data, updateDescription, i](const Process &process) {
|
||||
data->m_follows[i] = process.cleanedStdOut().trimmed();
|
||||
updateDescription(*data);
|
||||
};
|
||||
tasks.append(ProcessTask(setupFollow, onFollowDone));
|
||||
}
|
||||
taskTree.setRecipe(tasks);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user