forked from qt-creator/qt-creator
PluginInstallWizard: Use QtConcurrent invocation for async run
Change-Id: I82fad61c765af283e5d5cee4d7262e13a6843a84 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include <extensionsystem/pluginspec.h>
|
#include <extensionsystem/pluginspec.h>
|
||||||
|
|
||||||
#include <utils/archive.h>
|
#include <utils/archive.h>
|
||||||
|
#include <utils/asynctask.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/infolabel.h>
|
#include <utils/infolabel.h>
|
||||||
@@ -221,8 +222,8 @@ public:
|
|||||||
m_label->setText(Tr::tr("There was an error while unarchiving."));
|
m_label->setText(Tr::tr("There was an error while unarchiving."));
|
||||||
}
|
}
|
||||||
} else { // unarchiving was successful, run a check
|
} else { // unarchiving was successful, run a check
|
||||||
m_archiveCheck = Utils::runAsync(
|
m_archiveCheck = Utils::asyncRun([this](QPromise<ArchiveIssue> &promise)
|
||||||
[this](QFutureInterface<ArchiveIssue> &fi) { return checkContents(fi); });
|
{ return checkContents(promise); });
|
||||||
Utils::onFinished(m_archiveCheck, this, [this](const QFuture<ArchiveIssue> &f) {
|
Utils::onFinished(m_archiveCheck, this, [this](const QFuture<ArchiveIssue> &f) {
|
||||||
m_cancelButton->setVisible(false);
|
m_cancelButton->setVisible(false);
|
||||||
m_cancelButton->disconnect();
|
m_cancelButton->disconnect();
|
||||||
@@ -248,7 +249,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Async. Result is set if any issue was found.
|
// Async. Result is set if any issue was found.
|
||||||
void checkContents(QFutureInterface<ArchiveIssue> &fi)
|
void checkContents(QPromise<ArchiveIssue> &promise)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_tempDir.get(), return );
|
QTC_ASSERT(m_tempDir.get(), return );
|
||||||
|
|
||||||
@@ -260,7 +261,7 @@ public:
|
|||||||
QDir::Files | QDir::NoSymLinks,
|
QDir::Files | QDir::NoSymLinks,
|
||||||
QDirIterator::Subdirectories);
|
QDirIterator::Subdirectories);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
if (fi.isCanceled())
|
if (promise.isCanceled())
|
||||||
return;
|
return;
|
||||||
it.next();
|
it.next();
|
||||||
PluginSpec *spec = PluginSpec::read(it.filePath());
|
PluginSpec *spec = PluginSpec::read(it.filePath());
|
||||||
@@ -275,9 +276,9 @@ public:
|
|||||||
});
|
});
|
||||||
if (found != dependencies.constEnd()) {
|
if (found != dependencies.constEnd()) {
|
||||||
if (!coreplugin->provides(found->name, found->version)) {
|
if (!coreplugin->provides(found->name, found->version)) {
|
||||||
fi.reportResult({Tr::tr("Plugin requires an incompatible version of %1 (%2).")
|
promise.addResult(ArchiveIssue{
|
||||||
.arg(Constants::IDE_DISPLAY_NAME)
|
Tr::tr("Plugin requires an incompatible version of %1 (%2).")
|
||||||
.arg(found->version),
|
.arg(Constants::IDE_DISPLAY_NAME).arg(found->version),
|
||||||
InfoLabel::Error});
|
InfoLabel::Error});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -285,8 +286,8 @@ public:
|
|||||||
return; // successful / no error
|
return; // successful / no error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fi.reportResult({Tr::tr("Did not find %1 plugin.").arg(Constants::IDE_DISPLAY_NAME),
|
promise.addResult(ArchiveIssue{Tr::tr("Did not find %1 plugin.")
|
||||||
InfoLabel::Error});
|
.arg(Constants::IDE_DISPLAY_NAME), InfoLabel::Error});
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupPage() final
|
void cleanupPage() final
|
||||||
|
|||||||
Reference in New Issue
Block a user