From acdfb096870fdcb8e1b55c33e4ab844f1192c3bb Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 25 Jan 2016 15:03:00 +0100 Subject: [PATCH] QmlJS: Use Utils::runAsync and add some more progress information runAsync avoids the globally shared thread pool. updateCppQmlTypes missed some kind of progress information. Change-Id: I8739761326c2f2a5364c0c1552b3c43b00f1ff28 Reviewed-by: Marco Benelli Reviewed-by: Eike Ziller --- src/libs/qmljs/qmljsmodelmanagerinterface.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 655608b36e2..9430935ccf4 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -1095,9 +1095,9 @@ void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths) } if (pathToScan.length() > 1) { - QFuture result = QtConcurrent::run(&ModelManagerInterface::importScan, - workingCopyInternal(), pathToScan, - this, true, true); + QFuture result = Utils::runAsync(&ModelManagerInterface::importScan, + workingCopyInternal(), pathToScan, + this, true, true); cleanupFutures(); m_futures.append(result); @@ -1241,8 +1241,7 @@ void ModelManagerInterface::startCppQmlTypeUpdate() if (!cppModelManager) return; - m_cppQmlTypesUpdater = QtConcurrent::run( - &ModelManagerInterface::updateCppQmlTypes, + m_cppQmlTypesUpdater = Utils::runAsync(&ModelManagerInterface::updateCppQmlTypes, this, cppModelManager->snapshot(), m_queuedCppDocuments); m_queuedCppDocuments.clear(); } @@ -1262,6 +1261,8 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface &interface, CPlusPlus::Snapshot snapshot, QHash > documents) { + interface.setProgressRange(0, documents.size()); + interface.setProgressValue(0); CppDataHash newData = qmlModelManager->cppData(); FindExportedCppTypes finder(snapshot); @@ -1271,6 +1272,7 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface &interface, foreach (const DocScanPair &pair, documents) { if (interface.isCanceled()) return; + interface.setProgressValue(interface.progressValue() + 1); CPlusPlus::Document::Ptr doc = pair.first; const bool scan = pair.second;