TaskTree: Introduce CallDoneIf enum

Get rid of CustomTask c'tor taking 3 handlers.
If the done handler needs to be called only on
success or an error, add explicit 3rd arg of CallDoneIf type.

Task-number: QTCREATORBUG-29834
Change-Id: I10e55415587e6cac46620dd5177ad8269584583c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-11-02 18:47:38 +01:00
parent 63bfeba87f
commit 6e6aa7102c
29 changed files with 148 additions and 127 deletions

View File

@@ -109,7 +109,7 @@ GroupItem GenericDeployStep::mkdirTask(const TreeStorage<FilesToTransfer> &stora
}
};
return AsyncTask<ResultType>(onSetup, {}, onError);
return AsyncTask<ResultType>(onSetup, onError, CallDoneIf::Error);
}
static FileTransferMethod supportedTransferMethodFor(const FileToTransfer &fileToTransfer)
@@ -135,7 +135,7 @@ static FileTransferMethod supportedTransferMethodFor(const FileToTransfer &fileT
GroupItem GenericDeployStep::transferTask(const TreeStorage<FilesToTransfer> &storage)
{
const auto setupHandler = [this, storage](FileTransfer &transfer) {
const auto onSetup = [this, storage](FileTransfer &transfer) {
FileTransferMethod preferredTransferMethod = FileTransferMethod::Rsync;
if (method() == 0)
preferredTransferMethod = FileTransferMethod::Rsync;
@@ -164,7 +164,7 @@ GroupItem GenericDeployStep::transferTask(const TreeStorage<FilesToTransfer> &st
transfer.setFilesToTransfer(*storage);
connect(&transfer, &FileTransfer::progress, this, &GenericDeployStep::handleStdOutData);
};
const auto errorHandler = [this](const FileTransfer &transfer) {
const auto onError = [this](const FileTransfer &transfer) {
const ProcessResultData result = transfer.resultData();
if (result.m_error == QProcess::FailedToStart) {
addErrorMessage(Tr::tr("rsync failed to start: %1").arg(result.m_errorString));
@@ -175,7 +175,7 @@ GroupItem GenericDeployStep::transferTask(const TreeStorage<FilesToTransfer> &st
+ "\n" + result.m_errorString);
}
};
return FileTransferTask(setupHandler, {}, errorHandler);
return FileTransferTask(onSetup, onError, CallDoneIf::Error);
}
GroupItem GenericDeployStep::deployRecipe()