CppTools/Editor: Use Utils::runAsync

Change-Id: Ifcc2a34e3478eb84f95221b79e39f7a670e6b2e0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Eike Ziller
2016-02-12 12:58:56 +01:00
parent 6dbbc96112
commit 6e5d4b892e
9 changed files with 15 additions and 16 deletions

View File

@@ -43,9 +43,9 @@
#include <utils/proxyaction.h> #include <utils/proxyaction.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/runextensions.h>
#include <utils/tooltip/tooltip.h> #include <utils/tooltip/tooltip.h>
#include <QtConcurrentRun>
#include <QVarLengthArray> #include <QVarLengthArray>
using namespace CPlusPlus; using namespace CPlusPlus;
@@ -256,7 +256,7 @@ void FunctionDeclDefLinkFinder::startFindLinkAt(
// handle the rest in a thread // handle the rest in a thread
m_watcher.reset(new QFutureWatcher<QSharedPointer<FunctionDeclDefLink> >()); m_watcher.reset(new QFutureWatcher<QSharedPointer<FunctionDeclDefLink> >());
connect(m_watcher.data(), SIGNAL(finished()), this, SLOT(onFutureDone())); connect(m_watcher.data(), SIGNAL(finished()), this, SLOT(onFutureDone()));
m_watcher->setFuture(QtConcurrent::run(&findLinkHelper, result, refactoringChanges)); m_watcher->setFuture(Utils::runAsync(findLinkHelper, result, refactoringChanges));
} }
FunctionDeclDefLink::FunctionDeclDefLink() FunctionDeclDefLink::FunctionDeclDefLink()

View File

@@ -40,8 +40,8 @@
#include <cplusplus/TranslationUnit.h> #include <cplusplus/TranslationUnit.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/runextensions.h>
#include <QtConcurrentRun>
#include <QTextBlock> #include <QTextBlock>
#include <QTextCursor> #include <QTextCursor>
#include <QTextEdit> #include <QTextEdit>
@@ -350,7 +350,7 @@ void CppUseSelectionsUpdater::handleSymbolCaseAsynchronously(const Document::Ptr
m_findUsesCursorPosition = m_editorWidget->position(); m_findUsesCursorPosition = m_editorWidget->position();
const Params params = Params(m_editorWidget->textCursor(), document, snapshot); const Params params = Params(m_editorWidget->textCursor(), document, snapshot);
m_findUsesWatcher->setFuture(QtConcurrent::run(&findUses, params)); m_findUsesWatcher->setFuture(Utils::runAsync(findUses, params));
} }
void CppUseSelectionsUpdater::handleSymbolCaseSynchronously(const Document::Ptr document, void CppUseSelectionsUpdater::handleSymbolCaseSynchronously(const Document::Ptr document,

View File

@@ -203,7 +203,7 @@ BuiltinEditorDocumentProcessor::~BuiltinEditorDocumentProcessor()
void BuiltinEditorDocumentProcessor::run() void BuiltinEditorDocumentProcessor::run()
{ {
m_parserFuture = QtConcurrent::run(&runParser, m_parserFuture = Utils::runAsync(runParser,
parser(), parser(),
CppModelManager::instance()->workingCopy()); CppModelManager::instance()->workingCopy());
} }

View File

@@ -353,7 +353,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QSet<QString> &so
params.workingCopy = mgr->workingCopy(); params.workingCopy = mgr->workingCopy();
params.sourceFiles = sourceFiles; params.sourceFiles = sourceFiles;
QFuture<void> result = QtConcurrent::run(&parse, params); QFuture<void> result = Utils::runAsync(parse, params);
if (m_synchronizer.futures().size() > 10) { if (m_synchronizer.futures().size() > 10) {
QList<QFuture<void> > futures = m_synchronizer.futures(); QList<QFuture<void> > futures = m_synchronizer.futures();

View File

@@ -32,9 +32,9 @@
#include <cplusplus/TypeOfExpression.h> #include <cplusplus/TypeOfExpression.h>
#include <QSet>
#include <QFuture> #include <QFuture>
#include <QtConcurrentRun> #include <QSet>
#include <QThreadPool>
namespace CppTools { namespace CppTools {

View File

@@ -365,7 +365,7 @@ void CppFindReferences::findAll_helper(SearchResult *search, Symbol *symbol,
SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus); SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
const WorkingCopy workingCopy = m_modelManager->workingCopy(); const WorkingCopy workingCopy = m_modelManager->workingCopy();
QFuture<Usage> result; QFuture<Usage> result;
result = QtConcurrent::run(&find_helper, workingCopy, context, symbol); result = Utils::runAsync(find_helper, workingCopy, context, symbol);
createWatcher(result, search); createWatcher(result, search);
FutureProgress *progress = ProgressManager::addTask(result, tr("Searching for Usages"), FutureProgress *progress = ProgressManager::addTask(result, tr("Searching for Usages"),
@@ -669,7 +669,7 @@ void CppFindReferences::findMacroUses(const Macro &macro, const QString &replace
} }
QFuture<Usage> result; QFuture<Usage> result;
result = QtConcurrent::run(&findMacroUses_helper, workingCopy, snapshot, macro); result = Utils::runAsync(findMacroUses_helper, workingCopy, snapshot, macro);
createWatcher(result, search); createWatcher(result, search);
FutureProgress *progress = ProgressManager::addTask(result, tr("Searching for Usages"), FutureProgress *progress = ProgressManager::addTask(result, tr("Searching for Usages"),

View File

@@ -200,8 +200,7 @@ void SemanticInfoUpdater::updateDetached(const SemanticInfo::Source source)
return; return;
} }
d->m_future = QtConcurrent::run<SemanticInfoUpdaterPrivate, void, const SemanticInfo::Source> d->m_future = Utils::runAsync(&SemanticInfoUpdaterPrivate::update_helper, d.data(), source);
(&SemanticInfoUpdaterPrivate::update_helper, d.data(), source);
} }
SemanticInfo SemanticInfoUpdater::semanticInfo() const SemanticInfo SemanticInfoUpdater::semanticInfo() const

View File

@@ -106,7 +106,7 @@ public:
const QScopedPointer<SymbolSearcher> symbolSearcher( const QScopedPointer<SymbolSearcher> symbolSearcher(
indexingSupport->createSymbolSearcher(searchParameters, QSet<QString>() << testFile)); indexingSupport->createSymbolSearcher(searchParameters, QSet<QString>() << testFile));
QFuture<Core::SearchResultItem> search QFuture<Core::SearchResultItem> search
= QtConcurrent::run(&SymbolSearcher::runSearch, symbolSearcher.data()); = Utils::runAsync(&SymbolSearcher::runSearch, symbolSearcher.data());
search.waitForFinished(); search.waitForFinished();
ResultDataList results = ResultData::fromSearchResultList(search.results()); ResultDataList results = ResultData::fromSearchResultList(search.results());
QCOMPARE(results, expectedResults); QCOMPARE(results, expectedResults);

View File

@@ -145,7 +145,7 @@ void SymbolsFindFilter::startSearch(SearchResult *search)
SymbolSearcher *symbolSearcher = m_manager->indexingSupport()->createSymbolSearcher(parameters, projectFileNames); SymbolSearcher *symbolSearcher = m_manager->indexingSupport()->createSymbolSearcher(parameters, projectFileNames);
connect(watcher, SIGNAL(finished()), connect(watcher, SIGNAL(finished()),
symbolSearcher, SLOT(deleteLater())); symbolSearcher, SLOT(deleteLater()));
watcher->setFuture(QtConcurrent::run(&SymbolSearcher::runSearch, symbolSearcher)); watcher->setFuture(Utils::runAsync(&SymbolSearcher::runSearch, symbolSearcher));
FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching for Symbol"), FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching for Symbol"),
Core::Constants::TASK_SEARCH); Core::Constants::TASK_SEARCH);
connect(progress, SIGNAL(clicked()), search, SLOT(popup())); connect(progress, SIGNAL(clicked()), search, SLOT(popup()));