forked from qt-creator/qt-creator
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 <marco.benelli@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -1095,9 +1095,9 @@ void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pathToScan.length() > 1) {
|
if (pathToScan.length() > 1) {
|
||||||
QFuture<void> result = QtConcurrent::run(&ModelManagerInterface::importScan,
|
QFuture<void> result = Utils::runAsync<void>(&ModelManagerInterface::importScan,
|
||||||
workingCopyInternal(), pathToScan,
|
workingCopyInternal(), pathToScan,
|
||||||
this, true, true);
|
this, true, true);
|
||||||
cleanupFutures();
|
cleanupFutures();
|
||||||
m_futures.append(result);
|
m_futures.append(result);
|
||||||
|
|
||||||
@@ -1241,8 +1241,7 @@ void ModelManagerInterface::startCppQmlTypeUpdate()
|
|||||||
if (!cppModelManager)
|
if (!cppModelManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_cppQmlTypesUpdater = QtConcurrent::run(
|
m_cppQmlTypesUpdater = Utils::runAsync<void>(&ModelManagerInterface::updateCppQmlTypes,
|
||||||
&ModelManagerInterface::updateCppQmlTypes,
|
|
||||||
this, cppModelManager->snapshot(), m_queuedCppDocuments);
|
this, cppModelManager->snapshot(), m_queuedCppDocuments);
|
||||||
m_queuedCppDocuments.clear();
|
m_queuedCppDocuments.clear();
|
||||||
}
|
}
|
||||||
@@ -1262,6 +1261,8 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
|
|||||||
CPlusPlus::Snapshot snapshot,
|
CPlusPlus::Snapshot snapshot,
|
||||||
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents)
|
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents)
|
||||||
{
|
{
|
||||||
|
interface.setProgressRange(0, documents.size());
|
||||||
|
interface.setProgressValue(0);
|
||||||
CppDataHash newData = qmlModelManager->cppData();
|
CppDataHash newData = qmlModelManager->cppData();
|
||||||
|
|
||||||
FindExportedCppTypes finder(snapshot);
|
FindExportedCppTypes finder(snapshot);
|
||||||
@@ -1271,6 +1272,7 @@ void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &interface,
|
|||||||
foreach (const DocScanPair &pair, documents) {
|
foreach (const DocScanPair &pair, documents) {
|
||||||
if (interface.isCanceled())
|
if (interface.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
interface.setProgressValue(interface.progressValue() + 1);
|
||||||
|
|
||||||
CPlusPlus::Document::Ptr doc = pair.first;
|
CPlusPlus::Document::Ptr doc = pair.first;
|
||||||
const bool scan = pair.second;
|
const bool scan = pair.second;
|
||||||
|
Reference in New Issue
Block a user