forked from qt-creator/qt-creator
Core: Static pattern for ProgressManager, clean up all users
Change-Id: I4af8793ca69a3af9e99baeb7c31dad3864266f91 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -192,8 +192,7 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sour
|
||||
m_synchronizer.addFuture(result);
|
||||
|
||||
if (mode == CppModelManagerInterface::ForcedProgressNotification || sourceFiles.count() > 1) {
|
||||
Core::ICore::progressManager()->addTask(result,
|
||||
QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing"),
|
||||
Core::ProgressManager::addTask(result, QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing"),
|
||||
QLatin1String(CppTools::Constants::TASK_INDEX));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace Core;
|
||||
using namespace CppTools::Internal;
|
||||
using namespace CppTools;
|
||||
using namespace CPlusPlus;
|
||||
@@ -61,7 +62,7 @@ static QString getSource(const QString &fileName,
|
||||
QString fileContents;
|
||||
Utils::TextFileFormat format;
|
||||
QString error;
|
||||
QTextCodec *defaultCodec = Core::EditorManager::defaultTextCodec();
|
||||
QTextCodec *defaultCodec = EditorManager::defaultTextCodec();
|
||||
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
|
||||
fileName, defaultCodec, &fileContents, &format, &error);
|
||||
if (result != Utils::TextFileFormat::ReadSuccess)
|
||||
@@ -272,15 +273,14 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search)
|
||||
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
|
||||
Find::SearchResultWindow::instance()->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
|
||||
Find::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
|
||||
const CppModelManagerInterface::WorkingCopy workingCopy = _modelManager->workingCopy();
|
||||
QFuture<Usage> result;
|
||||
result = QtConcurrent::run(&find_helper, workingCopy,
|
||||
parameters.context, this, parameters.symbol);
|
||||
createWatcher(result, search);
|
||||
|
||||
Core::ProgressManager *progressManager = Core::ICore::progressManager();
|
||||
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
|
||||
FutureProgress *progress = ProgressManager::addTask(result, tr("Searching"),
|
||||
QLatin1String(CppTools::Constants::TASK_SEARCH));
|
||||
|
||||
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
|
||||
@@ -512,10 +512,10 @@ void CppFindReferences::setPaused(bool paused)
|
||||
void CppFindReferences::openEditor(const Find::SearchResultItem &item)
|
||||
{
|
||||
if (item.path.size() > 0) {
|
||||
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
||||
EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
||||
item.lineNumber, item.textMarkPos);
|
||||
} else {
|
||||
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
|
||||
EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ void CppFindReferences::findMacroUses(const Macro ¯o, const QString &replace
|
||||
connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)),
|
||||
SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>,bool)));
|
||||
|
||||
Find::SearchResultWindow::instance()->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
|
||||
Find::SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
|
||||
|
||||
connect(search, SIGNAL(activated(Find::SearchResultItem)),
|
||||
this, SLOT(openEditor(Find::SearchResultItem)));
|
||||
@@ -663,8 +663,7 @@ void CppFindReferences::findMacroUses(const Macro ¯o, const QString &replace
|
||||
result = QtConcurrent::run(&findMacroUses_helper, workingCopy, snapshot, this, macro);
|
||||
createWatcher(result, search);
|
||||
|
||||
Core::ProgressManager *progressManager = Core::ICore::progressManager();
|
||||
Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"),
|
||||
FutureProgress *progress = ProgressManager::addTask(result, tr("Searching"),
|
||||
QLatin1String(CppTools::Constants::TASK_SEARCH));
|
||||
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
|
||||
}
|
||||
|
||||
@@ -828,8 +828,8 @@ void CppModelManager::onAboutToLoadSession()
|
||||
|
||||
void CppModelManager::onAboutToUnloadSession()
|
||||
{
|
||||
if (Core::ProgressManager *pm = Core::ICore::progressManager())
|
||||
pm->cancelTasks(QLatin1String(CppTools::Constants::TASK_INDEX));
|
||||
if (Core::ProgressManager::instance())
|
||||
Core::ProgressManager::cancelTasks(QLatin1String(CppTools::Constants::TASK_INDEX));
|
||||
do {
|
||||
QMutexLocker locker(&m_projectMutex);
|
||||
m_projectToProjectsInfo.clear();
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
#include <QLabel>
|
||||
#include <QButtonGroup>
|
||||
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
using namespace Core;
|
||||
|
||||
namespace {
|
||||
const char * const SETTINGS_GROUP = "CppSymbols";
|
||||
const char * const SETTINGS_SYMBOLTYPES = "SymbolsToSearchFor";
|
||||
const char * const SETTINGS_SEARCHSCOPE = "SearchScope";
|
||||
} // anonymous namespace
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
|
||||
const char SETTINGS_GROUP[] = "CppSymbols";
|
||||
const char SETTINGS_SYMBOLTYPES[] = "SymbolsToSearchFor";
|
||||
const char SETTINGS_SEARCHSCOPE[] = "SearchScope";
|
||||
|
||||
SymbolsFindFilter::SymbolsFindFilter(CppModelManager *manager)
|
||||
: m_manager(manager),
|
||||
@@ -61,9 +61,9 @@ SymbolsFindFilter::SymbolsFindFilter(CppModelManager *manager)
|
||||
m_scope(SymbolSearcher::SearchProjectsOnly)
|
||||
{
|
||||
// for disabling while parser is running
|
||||
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
|
||||
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
|
||||
this, SLOT(onTaskStarted(QString)));
|
||||
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
|
||||
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
|
||||
this, SLOT(onAllTasksFinished(QString)));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void SymbolsFindFilter::findAll(const QString &txt, Find::FindFlags findFlags)
|
||||
connect(search, SIGNAL(paused(bool)), this, SLOT(setPaused(bool)));
|
||||
connect(search, SIGNAL(searchAgainRequested()), this, SLOT(searchAgain()));
|
||||
connect(this, SIGNAL(enabledChanged(bool)), search, SLOT(setSearchAgainEnabled(bool)));
|
||||
window->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus);
|
||||
window->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
|
||||
|
||||
SymbolSearcher::Parameters parameters;
|
||||
parameters.text = txt;
|
||||
@@ -149,8 +149,7 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search)
|
||||
connect(watcher, SIGNAL(finished()),
|
||||
symbolSearcher, SLOT(deleteLater()));
|
||||
watcher->setFuture(QtConcurrent::run(&SymbolSearcher::runSearch, symbolSearcher));
|
||||
Core::FutureProgress *progress = Core::ICore::progressManager()->addTask(watcher->future(),
|
||||
tr("Searching"),
|
||||
FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching"),
|
||||
QLatin1String(Find::Constants::TASK_SEARCH));
|
||||
connect(progress, SIGNAL(clicked()), search, SLOT(popup()));
|
||||
}
|
||||
@@ -187,9 +186,7 @@ void SymbolsFindFilter::openEditor(const Find::SearchResultItem &item)
|
||||
if (!item.userData.canConvert<ModelItemInfo>())
|
||||
return;
|
||||
ModelItemInfo info = item.userData.value<ModelItemInfo>();
|
||||
Core::EditorManager::openEditorAt(info.fileName,
|
||||
info.line,
|
||||
info.column);
|
||||
EditorManager::openEditorAt(info.fileName, info.line, info.column);
|
||||
}
|
||||
|
||||
QWidget *SymbolsFindFilter::createConfigWidget()
|
||||
@@ -346,3 +343,6 @@ void SymbolsFindFilterConfigWidget::setState() const
|
||||
else
|
||||
m_filter->setSearchScope(SymbolSearcher::SearchGlobal);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
Reference in New Issue
Block a user