AttachCoreDialog: Use QPromise for async calls

Change-Id: Ib0dd9ceb21711a786dc84acc815d1a5afb557de7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2023-02-12 02:12:54 +01:00
parent beabb53422
commit 58abb397e7

View File

@@ -243,18 +243,18 @@ void AttachCoreDialog::accepted()
using ResultType = expected_str<FilePath>; using ResultType = expected_str<FilePath>;
const auto copyFileAsync = [=](QFutureInterface<ResultType> &fi, const FilePath &srcPath) { const auto copyFileAsync = [=](QPromise<ResultType> &promise, const FilePath &srcPath) {
fi.reportResult(copyFile(srcPath)); promise.addResult(copyFile(srcPath));
}; };
const Group root = { const Group root = {
parallel, parallel,
Async<ResultType>{[=](auto &task) { Async<ResultType>{[=](auto &task) {
task.setAsyncCallData(copyFileAsync, this->coreFile()); task.setConcurrentCallData(copyFileAsync, this->coreFile());
}, },
[=](const auto &task) { d->coreFileResult = task.result(); }}, [=](const auto &task) { d->coreFileResult = task.result(); }},
Async<ResultType>{[=](auto &task) { Async<ResultType>{[=](auto &task) {
task.setAsyncCallData(copyFileAsync, this->symbolFile()); task.setConcurrentCallData(copyFileAsync, this->symbolFile());
}, },
[=](const auto &task) { d->symbolFileResult = task.result(); }}, [=](const auto &task) { d->symbolFileResult = task.result(); }},
}; };