Commit df361843 authored by hjk's avatar hjk
Browse files

Core: Static pattern for ProgressManager, clean up all users



Change-Id: I4af8793ca69a3af9e99baeb7c31dad3864266f91
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent ba1d8e2c
......@@ -38,7 +38,6 @@
#include <projectexplorer/session.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cpptoolsconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
......@@ -48,6 +47,8 @@
#include <QMutex>
#include <QMutexLocker>
using namespace Core;
namespace ClassView {
namespace Internal {
......@@ -234,9 +235,9 @@ void Manager::initialize()
SLOT(onProjectListChanged()), Qt::QueuedConnection);
// connect to the progress manager for signals about Parsing tasks
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),
connect(ProgressManager::instance(), SIGNAL(taskStarted(QString)),
SLOT(onTaskStarted(QString)), Qt::QueuedConnection);
connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)),
connect(ProgressManager::instance(), SIGNAL(allTasksFinished(QString)),
SLOT(onAllTasksFinished(QString)), Qt::QueuedConnection);
// when we signals that really document is updated - sent it to the parser
......@@ -440,7 +441,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc)
void Manager::gotoLocation(const QString &fileName, int line, int column)
{
Core::EditorManager::openEditorAt(fileName, line, column);
EditorManager::openEditorAt(fileName, line, column);
}
/*!
......@@ -462,9 +463,9 @@ void Manager::gotoLocations(const QList<QVariant> &list)
bool currentPositionAvailable = false;
// what is open now?
if (Core::IEditor *editor = Core::EditorManager::currentEditor()) {
if (IEditor *editor = EditorManager::currentEditor()) {
// get current file name
if (Core::IDocument *document = editor->document())
if (IDocument *document = editor->document())
fileName = document->filePath();
// if text file - what is current position?
......
This diff is collapsed.
......@@ -356,11 +356,6 @@ bool ICore::showWarningWithOptions(const QString &title, const QString &text,
settingsId, parent);
}
ProgressManager *ICore::progressManager()
{
return m_mainwindow->progressManager();
}
VcsManager *ICore::vcsManager()
{
return m_mainwindow->vcsManager();
......
......@@ -85,7 +85,6 @@ public:
Id settingsId = Id(),
QWidget *parent = 0);
static ProgressManager *progressManager();
static VcsManager *vcsManager();
static MimeDatabase *mimeDatabase();
......
......@@ -348,7 +348,7 @@ void ProgressManagerPrivate::init()
initInternal();
}
void ProgressManagerPrivate::cancelTasks(const QString &type)
void ProgressManagerPrivate::doCancelTasks(const QString &type)
{
bool found = false;
QMap<QFutureWatcher<void> *, QString>::iterator task = m_runningTasks.begin();
......@@ -412,7 +412,7 @@ void ProgressManagerPrivate::cancelAllRunningTasks()
updateSummaryProgressBar();
}
FutureProgress *ProgressManagerPrivate::addTask(const QFuture<void> &future, const QString &title,
FutureProgress *ProgressManagerPrivate::doAddTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags)
{
// watch
......@@ -717,3 +717,36 @@ void ToggleButton::paintEvent(QPaintEvent *event)
arrowOpt.rect = QRect(rect().center().x() - 3, rect().center().y() - 6, 9, 9);
s->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, &p, this);
}
static ProgressManager *m_instance = 0;
ProgressManager::ProgressManager(QObject *parent)
{
m_instance = this;
}
ProgressManager::~ProgressManager()
{
m_instance = 0;
}
QObject *ProgressManager::instance()
{
return m_instance;
}
FutureProgress *ProgressManager::addTask(const QFuture<void> &future, const QString &title, const QString &type, ProgressFlags flags)
{
return m_instance->doAddTask(future, title, type, flags);
}
void ProgressManager::setApplicationLabel(const QString &text)
{
m_instance->doSetApplicationLabel(text);
}
void ProgressManager::cancelTasks(const QString &type)
{
m_instance->doCancelTasks(type);
}
......@@ -50,20 +50,28 @@ public:
};
Q_DECLARE_FLAGS(ProgressFlags, ProgressFlag)
virtual FutureProgress *addTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags = 0) = 0;
virtual void setApplicationLabel(const QString &text) = 0;
static QObject *instance();
static FutureProgress *addTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags = 0);
static void setApplicationLabel(const QString &text);
public slots:
virtual void cancelTasks(const QString &type) = 0;
static void cancelTasks(const QString &type);
signals:
void taskStarted(const QString &type);
void allTasksFinished(const QString &type);
protected:
virtual void doCancelTasks(const QString &type) = 0;
virtual FutureProgress *doAddTask(const QFuture<void> &future, const QString &title,
const QString &type, ProgressFlags flags = 0) = 0;
virtual void doSetApplicationLabel(const QString &text) = 0;
private:
ProgressManager(QObject *parent = 0) : QObject(parent) {}
virtual ~ProgressManager() {}
ProgressManager(QObject *parent = 0);
~ProgressManager();
friend class Core::Internal::ProgressManagerPrivate;
};
......
......@@ -125,7 +125,7 @@ static ApplicationProgressView *sharedProgressView = nil;
@end
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
NSString *cocoaString = [[NSString alloc] initWithUTF8String:text.toUtf8().constData()];
[[NSApp dockTile] setBadgeLabel:cocoaString];
......
......@@ -58,14 +58,14 @@ public:
void init();
void cleanup();
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
FutureProgress *doAddTask(const QFuture<void> &future, const QString &title, const QString &type,
ProgressFlags flags);
void setApplicationLabel(const QString &text);
void doSetApplicationLabel(const QString &text);
ProgressView *progressView();
public slots:
void cancelTasks(const QString &type);
void doCancelTasks(const QString &type);
protected:
bool eventFilter(QObject *obj, QEvent *event);
......
......@@ -174,7 +174,7 @@ void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
Q_UNUSED(text)
}
......
......@@ -37,7 +37,7 @@ void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
void Core::Internal::ProgressManagerPrivate::doSetApplicationLabel(const QString &text)
{
Q_UNUSED(text)
}
......
......@@ -57,6 +57,7 @@
#include <QCoreApplication>
#include <QStringList>
using namespace Core;
using namespace CppEditor;
using namespace CppEditor::Internal;
......@@ -77,8 +78,8 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE);
if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) {
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase();
FileIconProvider *iconProvider = FileIconProvider::instance();
MimeDatabase *mimeDatabase = ICore::mimeDatabase();
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_cpp.png")),
mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)));
iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/cppeditor/images/qt_c.png")),
......@@ -88,7 +89,7 @@ CppEditorFactory::CppEditorFactory(CppEditorPlugin *owner) :
}
}
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
IEditor *CppEditorFactory::createEditor(QWidget *parent)
{
CPPEditorWidget *editor = new CPPEditorWidget(parent);
editor->setRevisionsVisible(true);
......@@ -153,7 +154,7 @@ CppQuickFixAssistProvider *CppEditorPlugin::quickFixProvider() const
bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
if (!ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
return false;
addAutoReleasedObject(new CppEditorFactory(this));
......@@ -167,19 +168,19 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
addAutoReleasedObject(m_quickFixProvider);
CppEditor::Internal::registerQuickFixes(this);
QObject *core = Core::ICore::instance();
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
QObject *core = ICore::instance();
CppFileWizard::BaseFileWizardParameters wizardParameters(IWizard::FileWizard);
wizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY));
wizardParameters.setDisplayCategory(QCoreApplication::translate(Constants::WIZARD_CATEGORY,
Constants::WIZARD_TR_CATEGORY));
wizardParameters.setDisplayName(tr("C++ Class"));
wizardParameters.setId(QLatin1String("A.Class"));
wizardParameters.setKind(Core::IWizard::ClassWizard);
wizardParameters.setKind(IWizard::ClassWizard);
wizardParameters.setDescription(tr("Creates a C++ header and a source file for a new class that you can add to a C++ project."));
addAutoReleasedObject(new CppClassWizard(wizardParameters, core));
wizardParameters.setKind(Core::IWizard::FileWizard);
wizardParameters.setKind(IWizard::FileWizard);
wizardParameters.setDescription(tr("Creates a C++ source file that you can add to a C++ project."));
wizardParameters.setDisplayName(tr("C++ Source File"));
wizardParameters.setId(QLatin1String("B.Source"));
......@@ -190,22 +191,22 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
wizardParameters.setId(QLatin1String("C.Header"));
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
Core::Context context(CppEditor::Constants::C_CPPEDITOR);
Context context(CppEditor::Constants::C_CPPEDITOR);
Core::ActionContainer *contextMenu= Core::ActionManager::createMenu(CppEditor::Constants::M_CONTEXT);
ActionContainer *contextMenu = ActionManager::createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd;
Core::ActionContainer *cppToolsMenu = Core::ActionManager::actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP));
Command *cmd;
ActionContainer *cppToolsMenu = ActionManager::actionContainer(CppTools::Constants::M_TOOLS_CPP);
cmd = Core::ActionManager::command(Core::Id(CppTools::Constants::SWITCH_HEADER_SOURCE));
cmd = ActionManager::command(CppTools::Constants::SWITCH_HEADER_SOURCE);
contextMenu->addAction(cmd);
cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR);
cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR);
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this);
cmd = Core::ActionManager::registerAction(switchDeclarationDefinition,
cmd = ActionManager::registerAction(switchDeclarationDefinition,
Constants::SWITCH_DECLARATION_DEFINITION, context, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2")));
connect(switchDeclarationDefinition, SIGNAL(triggered()),
......@@ -213,12 +214,12 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT);
cmd = ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT);
cppToolsMenu->addAction(cmd);
QAction *openDeclarationDefinitionInNextSplit =
new QAction(tr("Open Method Declaration/Definition in Next Split"), this);
cmd = Core::ActionManager::registerAction(openDeclarationDefinitionInNextSplit,
cmd = ActionManager::registerAction(openDeclarationDefinitionInNextSplit,
Constants::OPEN_DECLARATION_DEFINITION_IN_NEXT_SPLIT, context, true);
cmd->setDefaultKeySequence(QKeySequence(Utils::HostOsInfo::isMacHost()
? tr("Meta+E, Shift+F2")
......@@ -228,28 +229,28 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
cppToolsMenu->addAction(cmd);
m_findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = Core::ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd = ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this);
cmd = Core::ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context);
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+T") : tr("Ctrl+Shift+T")));
cmd = ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+Shift+T") : tr("Ctrl+Shift+T")));
connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy()));
contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd);
// Refactoring sub-menu
Core::Context globalContext(Core::Constants::C_GLOBAL);
Core::Command *sep = contextMenu->addSeparator(globalContext);
Context globalContext(Core::Constants::C_GLOBAL);
Command *sep = contextMenu->addSeparator(globalContext);
sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT));
contextMenu->addSeparator(globalContext);
m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"),
this);
cmd = Core::ActionManager::registerAction(m_renameSymbolUnderCursorAction,
cmd = ActionManager::registerAction(m_renameSymbolUnderCursorAction,
Constants::RENAME_SYMBOL_UNDER_CURSOR,
context);
cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R")));
......@@ -260,7 +261,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
// Update context in global context
cppToolsMenu->addSeparator(globalContext);
m_updateCodeModelAction = new QAction(tr("Update Code Model"), this);
cmd = Core::ActionManager::registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext);
cmd = ActionManager::registerAction(m_updateCodeModelAction, Constants::UPDATE_CODEMODEL, globalContext);
CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance();
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd);
......@@ -275,18 +276,19 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
contextMenu->addSeparator(context);
cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
cmd = ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
cmd = ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd);
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)));
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*)));
connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
SLOT(currentEditorChanged(Core::IEditor*)));
readSettings();
return true;
......@@ -294,12 +296,12 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
void CppEditorPlugin::readSettings()
{
m_sortedOutline = Core::ICore::settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool();
m_sortedOutline = ICore::settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool();
}
void CppEditorPlugin::writeSettings()
{
Core::ICore::settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline);
ICore::settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline);
}
void CppEditorPlugin::extensionsInitialized()
......@@ -314,28 +316,28 @@ ExtensionSystem::IPlugin::ShutdownFlag CppEditorPlugin::aboutToShutdown()
void CppEditorPlugin::switchDeclarationDefinition()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->switchDeclarationDefinition(/*inNextSplit*/ false);
}
void CppEditorPlugin::openDeclarationDefinitionInNextSplit()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->switchDeclarationDefinition(/*inNextSplit*/ true);
}
void CppEditorPlugin::renameSymbolUnderCursor()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->renameSymbolUnderCursor();
}
void CppEditorPlugin::findUsages()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor)
editor->findUsages();
}
......@@ -360,7 +362,7 @@ void CppEditorPlugin::onAllTasksFinished(const QString &type)
}
}
void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor)
void CppEditorPlugin::currentEditorChanged(IEditor *editor)
{
if (!editor)
return;
......@@ -371,10 +373,10 @@ void CppEditorPlugin::currentEditorChanged(Core::IEditor *editor)
void CppEditorPlugin::openTypeHierarchy()
{
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(Core::EditorManager::currentEditor()->widget());
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(EditorManager::currentEditor()->widget());
if (editor) {
Core::NavigationWidget *navigation = Core::NavigationWidget::instance();
navigation->activateSubWidget(Core::Id(Constants::TYPE_HIERARCHY_ID));
NavigationWidget *navigation = NavigationWidget::instance();
navigation->activateSubWidget(Constants::TYPE_HIERARCHY_ID);
emit typeHierarchyRequested();
}
}
......
......@@ -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 &macro, 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 &macro, 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()));