diff options
Diffstat (limited to 'src/libs/qmljs/qmljsplugindumper.cpp')
-rw-r--r-- | src/libs/qmljs/qmljsplugindumper.cpp | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp index a7bafdde94..761df90ddc 100644 --- a/src/libs/qmljs/qmljsplugindumper.cpp +++ b/src/libs/qmljs/qmljsplugindumper.cpp @@ -7,14 +7,13 @@ #include "qmljsmodelmanagerinterface.h" #include "qmljstr.h" #include "qmljsutils.h" -#include "qmljsviewercontext.h" #include <utils/algorithm.h> +#include <utils/async.h> #include <utils/filesystemwatcher.h> #include <utils/fileutils.h> #include <utils/hostosinfo.h> -#include <utils/qtcprocess.h> -#include <utils/runextensions.h> +#include <utils/process.h> #include <QDir> #include <QDirIterator> @@ -204,7 +203,7 @@ static void printParseWarnings(const FilePath &libraryPath, const QString &warni "%2").arg(libraryPath.toUserOutput(), warning)); } -static QString qmlPluginDumpErrorMessage(QtcProcess *process) +static QString qmlPluginDumpErrorMessage(Process *process) { QString errorMessage; const QString binary = process->commandLine().executable().toUserOutput(); @@ -238,7 +237,7 @@ static QString qmlPluginDumpErrorMessage(QtcProcess *process) return errorMessage; } -void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process) +void PluginDumper::qmlPluginTypeDumpDone(Process *process) { process->deleteLater(); @@ -273,14 +272,13 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process) QStringList dependencies; }; - auto future = Utils::runAsync(m_modelManager->threadPool(), - [output, libraryPath](QFutureInterface<CppQmlTypesInfo>& future) - { + auto future = Utils::asyncRun(m_modelManager->threadPool(), + [output, libraryPath](QPromise<CppQmlTypesInfo> &promise) { CppQmlTypesInfo infos; - CppQmlTypesLoader::parseQmlTypeDescriptions(output, &infos.objectsList, &infos.moduleApis, &infos.dependencies, - &infos.error, &infos.warning, - "<dump of " + libraryPath.toUserOutput() + '>'); - future.reportFinished(&infos); + CppQmlTypesLoader::parseQmlTypeDescriptions(output, &infos.objectsList, + &infos.moduleApis, &infos.dependencies, &infos.error, &infos.warning, + "<dump of " + libraryPath.toUserOutput() + '>'); + promise.addResult(infos); }); m_modelManager->addFuture(future); @@ -327,8 +325,8 @@ void PluginDumper::pluginChanged(const QString &pluginLibrary) QFuture<PluginDumper::QmlTypeDescription> PluginDumper::loadQmlTypeDescription(const FilePaths &paths) const { - auto future = Utils::runAsync(m_modelManager->threadPool(), [=](QFutureInterface<PluginDumper::QmlTypeDescription> &future) - { + auto future = Utils::asyncRun(m_modelManager->threadPool(), + [=](QPromise<PluginDumper::QmlTypeDescription> &promise) { PluginDumper::QmlTypeDescription result; for (const FilePath &p: paths) { @@ -355,8 +353,7 @@ QFuture<PluginDumper::QmlTypeDescription> PluginDumper::loadQmlTypeDescription(c if (!warning.isEmpty()) result.warnings += warning; } - - future.reportFinished(&result); + promise.addResult(result); }); m_modelManager->addFuture(future); @@ -600,11 +597,11 @@ void PluginDumper::loadQmltypesFile(const FilePaths &qmltypesFilePaths, void PluginDumper::runQmlDump(const ModelManagerInterface::ProjectInfo &info, const QStringList &arguments, const FilePath &importPath) { - auto process = new QtcProcess(this); + auto process = new Process(this); process->setEnvironment(info.qmlDumpEnvironment); process->setWorkingDirectory(importPath); process->setCommand({info.qmlDumpPath, arguments}); - connect(process, &QtcProcess::done, this, [this, process] { qmlPluginTypeDumpDone(process); }); + connect(process, &Process::done, this, [this, process] { qmlPluginTypeDumpDone(process); }); process->start(); m_runningQmldumps.insert(process, importPath); } |