diff options
254 files changed, 848 insertions, 1007 deletions
diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.cpp b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.cpp index 87a426e31e..b5e959efd8 100644 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.cpp +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.cpp @@ -39,7 +39,7 @@ bool %PluginName%Plugin::initialize(const QStringList &arguments, QString *error Q_UNUSED(arguments) Q_UNUSED(errorString) - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QAction *action = new QAction(tr("%PluginName% action"), this); Core::Command *cmd = am->registerAction(action, Constants::ACTION_ID, @@ -72,7 +72,7 @@ ExtensionSystem::IPlugin::ShutdownFlag %PluginName%Plugin::aboutToShutdown() void %PluginName%Plugin::triggerAction() { - QMessageBox::information(Core::ICore::instance()->mainWindow(), + QMessageBox::information(Core::ICore::mainWindow(), tr("Action triggered"), tr("This is an action from %PluginName%.")); } diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index bc5d58b9db..91c563abe8 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -261,8 +261,7 @@ AnalyzerManagerPrivate::~AnalyzerManagerPrivate() void AnalyzerManagerPrivate::setupActions() { - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); const Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Command *command = 0; @@ -340,7 +339,7 @@ void AnalyzerManagerPrivate::delayedInit() // Populate Windows->Views menu with standard actions. Core::Context analyzerContext(Constants::C_ANALYZEMODE); - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); ActionContainer *viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); Command *cmd = am->registerAction(m_mainWindow->menuSeparator1(), @@ -435,7 +434,7 @@ void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget * Context globalContext(Core::Constants::C_GLOBAL); - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); toggleViewAction->setText(dockWidget->windowTitle()); Command *cmd = am->registerAction(toggleViewAction, @@ -449,7 +448,7 @@ void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget * void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget) { - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); am->unregisterAction(toggleViewAction, Core::Id("Analyzer." + dockWidget->objectName())); m_mainWindow->removeDockWidget(dockWidget); @@ -477,7 +476,7 @@ bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode, bool AnalyzerManagerPrivate::showPromptDialog(const QString &title, const QString &text, const QString &stopButtonText, const QString &cancelButtonText) const { - Utils::CheckableMessageBox messageBox(Core::ICore::instance()->mainWindow()); + Utils::CheckableMessageBox messageBox(Core::ICore::mainWindow()); messageBox.setWindowTitle(title); messageBox.setText(text); messageBox.setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::Cancel); @@ -523,7 +522,7 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool) const QString currentMode = buildType == BuildConfiguration::Debug ? tr("Debug") : tr("Release"); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); const QString configKey = QLatin1String("Analyzer.AnalyzeCorrectMode"); int ret; if (settings->contains(configKey)) { @@ -547,7 +546,7 @@ void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool) const QString checkBoxText = tr("&Do not ask again"); bool checkBoxSetting = false; const QDialogButtonBox::StandardButton button = - Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(), + Utils::CheckableMessageBox::question(Core::ICore::mainWindow(), title, message, checkBoxText, &checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel, QDialogButtonBox::Cancel); @@ -605,7 +604,7 @@ QAction *AnalyzerManagerPrivate::actionFromToolAndMode(IAnalyzerTool *tool, Star void AnalyzerManagerPrivate::selectSavedTool() { - const QSettings *settings = Core::ICore::instance()->settings(); + const QSettings *settings = Core::ICore::settings(); const Core::Id lastActiveAction(settings->value(QLatin1String(LAST_ACTIVE_TOOL)).toString()); foreach (QAction *action, m_actions) { IAnalyzerTool *tool = m_toolFromAction.value(action); @@ -688,7 +687,7 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode delayedInit(); // Make sure that there is a valid IMode instance. const bool blocked = m_toolBox->blockSignals(true); // Do not make current. - ActionManager *am = Core::ICore::instance()->actionManager(); + ActionManager *am = Core::ICore::actionManager(); foreach (StartMode mode, modes) { QString actionName = tool->actionName(mode); Id menuGroup = tool->menuGroup(mode); @@ -725,7 +724,7 @@ void AnalyzerManagerPrivate::handleToolFinished() void AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *tool) { QTC_ASSERT(m_mainWindow, return); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id().toString()); if (settings->value("ToolSettingsSaved", false).toBool()) m_mainWindow->restoreSettings(settings); @@ -740,7 +739,7 @@ void AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool, StartMode mod return; // no active tool, do nothing QTC_ASSERT(m_mainWindow, return); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id().toString()); m_mainWindow->saveSettings(settings); settings->setValue("ToolSettingsSaved", true); diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp index e9cb39ee04..a2d0abbca0 100644 --- a/src/plugins/analyzerbase/analyzersettings.cpp +++ b/src/plugins/analyzerbase/analyzersettings.cpp @@ -119,7 +119,7 @@ AnalyzerGlobalSettings::~AnalyzerGlobalSettings() void AnalyzerGlobalSettings::readSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); QVariantMap map; @@ -136,7 +136,7 @@ void AnalyzerGlobalSettings::readSettings() void AnalyzerGlobalSettings::writeSettings() const { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String(groupC)); const QVariantMap map = toMap(); for (QVariantMap::ConstIterator it = map.begin(); it != map.end(); ++it) diff --git a/src/plugins/analyzerbase/startremotedialog.cpp b/src/plugins/analyzerbase/startremotedialog.cpp index 5b90a8d41b..2174f16bee 100644 --- a/src/plugins/analyzerbase/startremotedialog.cpp +++ b/src/plugins/analyzerbase/startremotedialog.cpp @@ -49,7 +49,7 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent) m_ui->keyFile->setExpectedKind(Utils::PathChooser::File); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup("AnalyzerStartRemoteDialog"); m_ui->host->setText(settings->value("host").toString()); m_ui->port->setValue(settings->value("port", 22).toInt()); @@ -91,7 +91,7 @@ StartRemoteDialog::~StartRemoteDialog() void StartRemoteDialog::accept() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup("AnalyzerStartRemoteDialog"); settings->setValue("host", m_ui->host->text()); settings->setValue("port", m_ui->port->value()); diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp index 3b36754115..663aae7992 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp @@ -63,8 +63,7 @@ bool AutotoolsProjectPlugin::initialize(const QStringList &arguments, { Q_UNUSED(arguments); - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":autotoolsproject/AutotoolsProject.mimetypes.xml"), errorString)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":autotoolsproject/AutotoolsProject.mimetypes.xml"), errorString)) return false; addAutoReleasedObject(new AutotoolsTargetFactory); diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp index 80ddfa25da..2514f7ee9f 100644 --- a/src/plugins/bazaar/bazaarplugin.cpp +++ b/src/plugins/bazaar/bazaarplugin.cpp @@ -124,7 +124,6 @@ BazaarPlugin::BazaarPlugin() : VcsBase::VcsBasePlugin(QLatin1String(Constants::COMMIT_ID)), m_optionsPage(0), m_client(0), - m_core(0), m_commandLocator(0), m_changeLog(0), m_addAction(0), @@ -156,12 +155,11 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag m_client = new BazaarClient(&m_bazaarSettings); initializeVcs(new BazaarControl(m_client)); - m_core = Core::ICore::instance(); - m_actionManager = m_core->actionManager(); + m_actionManager = Core::ICore::actionManager(); m_optionsPage = new OptionsPage(); addAutoReleasedObject(m_optionsPage); - m_bazaarSettings.readSettings(m_core->settings()); + m_bazaarSettings.readSettings(Core::ICore::settings()); connect(m_client, SIGNAL(changed(QVariant)), versionControl(), SLOT(changed(QVariant))); @@ -571,7 +569,7 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusIt return; } - Core::IEditor *editor = m_core->editorManager()->openEditor(m_changeLog->fileName(), + Core::IEditor *editor = Core::ICore::editorManager()->openEditor(m_changeLog->fileName(), Constants::COMMIT_ID, Core::EditorManager::ModeSwitch); if (!editor) { @@ -612,7 +610,7 @@ void BazaarPlugin::commitFromEditor() return; //use the same functionality than if the user closes the file without completing the commit - m_core->editorManager()->closeEditors(m_core->editorManager()->editorsForFileName(m_changeLog->fileName())); + Core::ICore::editorManager()->closeEditors(Core::ICore::editorManager()->editorsForFileName(m_changeLog->fileName())); } bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor) @@ -643,7 +641,7 @@ bool BazaarPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submit QStringList files = commitEditor->checkedFiles(); if (!files.empty()) { //save the commit message - if (!m_core->fileManager()->saveFile(editorFile)) + if (!Core::ICore::fileManager()->saveFile(editorFile)) return false; //rewrite entries of the form 'file => newfile' to 'newfile' because diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h index 446914f7fd..e22588d1bd 100644 --- a/src/plugins/bazaar/bazaarplugin.h +++ b/src/plugins/bazaar/bazaarplugin.h @@ -52,7 +52,6 @@ QT_END_NAMESPACE namespace Core { class ActionManager; class ActionContainer; -class ICore; class Id; class IVersionControl; class IEditorFactory; @@ -138,7 +137,6 @@ private: OptionsPage *m_optionsPage; BazaarClient *m_client; - Core::ICore *m_core; Locator::CommandLocator *m_commandLocator; Core::ActionManager *m_actionManager; Core::ActionContainer *m_bazaarContainer; diff --git a/src/plugins/bazaar/optionspage.cpp b/src/plugins/bazaar/optionspage.cpp index 7cc4de0399..48515718bb 100644 --- a/src/plugins/bazaar/optionspage.cpp +++ b/src/plugins/bazaar/optionspage.cpp @@ -126,7 +126,7 @@ void OptionsPage::apply() if (newSettings != plugin->settings()) { //assume success and emit signal that settings are changed; plugin->setSettings(newSettings); - newSettings.writeSettings(Core::ICore::instance()->settings()); + newSettings.writeSettings(Core::ICore::settings()); emit settingsChanged(); } } diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 6d5315394e..807dcc73c6 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -245,7 +245,7 @@ public: if (errorString) *errorString = errStr; else - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("File Error"), errStr); + QMessageBox::critical(Core::ICore::mainWindow(), tr("File Error"), errStr); return false; } @@ -264,7 +264,7 @@ private slots: m_editor->addData(block, data); file.close(); } else { - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("File Error"), + QMessageBox::critical(Core::ICore::mainWindow(), tr("File Error"), tr("Cannot open %1: %2").arg( QDir::toNativeSeparators(m_fileName), file.errorString())); } @@ -477,7 +477,7 @@ BinEditorPlugin::~BinEditorPlugin() QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title) { QAction *result = new QAction(title, this); - Core::ICore::instance()->actionManager()->registerAction(result, Core::Id(id), m_context); + Core::ICore::actionManager()->registerAction(result, Core::Id(id), m_context); return result; } @@ -535,8 +535,7 @@ bool BinEditorPlugin::initialize(const QStringList &arguments, QString *errorMes Q_UNUSED(arguments) Q_UNUSED(errorMessage) - Core::ICore *core = Core::ICore::instance(); - connect(core, SIGNAL(contextAboutToChange(Core::IContext *)), + connect(Core::ICore::instance(), SIGNAL(contextAboutToChange(Core::IContext *)), this, SLOT(updateCurrentEditor(Core::IContext *))); addAutoReleasedObject(new BinEditorFactory(this)); diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 0ef8ee5ad3..3c7d7b854e 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -215,7 +215,7 @@ BookmarkView::BookmarkView(QWidget *parent) : connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(gotoBookmark(const QModelIndex &))); - ICore::instance()->addContextObject(m_bookmarkContext); + ICore::addContextObject(m_bookmarkContext); setItemDelegate(new BookmarkDelegate(this)); setFrameStyle(QFrame::NoFrame); @@ -225,7 +225,7 @@ BookmarkView::BookmarkView(QWidget *parent) : BookmarkView::~BookmarkView() { - ICore::instance()->removeContextObject(m_bookmarkContext); + ICore::removeContextObject(m_bookmarkContext); } void BookmarkView::contextMenuEvent(QContextMenuEvent *event) diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index 19d9cb5b24..b3e3d3a2d7 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -70,8 +70,7 @@ void BookmarksPlugin::extensionsInitialized() bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) { - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Context textcontext(TextEditor::Constants::C_TEXTEDITOR); Core::Context globalcontext(Core::Constants::C_GLOBAL); @@ -148,7 +147,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) this, SLOT(bookmarkMarginActionTriggered())); // EditorManager - QObject *editorManager = core->editorManager(); + QObject *editorManager = Core::ICore::editorManager(); connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), this, SLOT(editorAboutToClose(Core::IEditor*))); connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index ab9d11e8a4..091eb2b6eb 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -150,12 +150,10 @@ void Manager::initialize() connect(sessionManager, SIGNAL(projectRemoved(ProjectExplorer::Project*)), SLOT(onProjectListChanged()), Qt::QueuedConnection); - Core::ICore *core = Core::ICore::instance(); - // connect to the progress manager for signals about Parsing tasks - connect(core->progressManager(), SIGNAL(taskStarted(QString)), + connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)), SLOT(onTaskStarted(QString)), Qt::QueuedConnection); - connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), + connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)), SLOT(onAllTasksFinished(QString)), Qt::QueuedConnection); // when we signals that really document is updated - sent it to the parser diff --git a/src/plugins/classview/classviewnavigationwidgetfactory.cpp b/src/plugins/classview/classviewnavigationwidgetfactory.cpp index 0849a1cd2f..aca61b8bfd 100644 --- a/src/plugins/classview/classviewnavigationwidgetfactory.cpp +++ b/src/plugins/classview/classviewnavigationwidgetfactory.cpp @@ -111,7 +111,7 @@ void NavigationWidgetFactory::saveSettings(int position, QWidget *widget) NavigationWidget *pw = qobject_cast<NavigationWidget *>(widget); QTC_ASSERT(pw, return); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); QTC_ASSERT(settings, return); // .beginGroup is not used - to prevent simultaneous access @@ -126,7 +126,7 @@ void NavigationWidgetFactory::restoreSettings(int position, QWidget *widget) NavigationWidget *pw = qobject_cast<NavigationWidget *>(widget); QTC_ASSERT(pw, return); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); QTC_ASSERT(settings, return); // .beginGroup is not used - to prevent simultaneous access diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 7a1ba0818a..a960a4fe04 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -67,7 +67,7 @@ CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage) connect(projectExplorer, SIGNAL(aboutToShowContextMenu(ProjectExplorer::Project*, ProjectExplorer::Node*)), this, SLOT(updateContextMenu(ProjectExplorer::Project*, ProjectExplorer::Node*))); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mbuild = am->actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); @@ -252,8 +252,7 @@ CMakeSettingsPage::CMakeSettingsPage() m_pathCmake.process = 0; m_userCmake.hasCodeBlocksMsvcGenerator = false; m_pathCmake.hasCodeBlocksMsvcGenerator = false; - Core::ICore *core = Core::ICore::instance(); - QSettings * settings = core->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("CMakeSettings")); m_userCmake.executable = settings->value(QLatin1String("cmakeExecutable")).toString(); settings->endGroup(); @@ -404,7 +403,7 @@ void CMakeSettingsPage::updateInfo(CMakeValidator *cmakeValidator) void CMakeSettingsPage::saveSettings() const { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("CMakeSettings")); settings->setValue(QLatin1String("cmakeExecutable"), m_userCmake.executable); settings->endGroup(); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index 6f1243088a..fe3d548d36 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -59,8 +59,7 @@ CMakeProjectPlugin::~CMakeProjectPlugin() bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage)) return false; CMakeSettingsPage *cmp = new CMakeSettingsPage(); addAutoReleasedObject(cmp); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index 1473863087..5c401bef79 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -64,7 +64,7 @@ namespace { You get the only implementation of this class from the core interface ICore::actionManager() method, e.g. \code - Core::ICore::instance()->actionManager() + Core::ICore::actionManager() \endcode The main reasons for the need of this class is to provide a central place where the user @@ -99,7 +99,7 @@ namespace { To register a globally active action "My Action" put the following in your plugin's IPlugin::initialize method: \code - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QAction *myAction = new QAction(tr("My Action"), this); Core::Command *cmd = am->registerAction(myAction, "myplugin.myaction", @@ -505,7 +505,7 @@ static const char sequenceKey[] = "Keysequence"; void ActionManagerPrivate::initialize() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); const int shortcuts = settings->beginReadArray(QLatin1String(settingsGroup)); for (int i = 0; i < shortcuts; ++i) { settings->setArrayIndex(i); diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp index 9f35f5c09f..47171bb004 100644 --- a/src/plugins/coreplugin/basefilewizard.cpp +++ b/src/plugins/coreplugin/basefilewizard.cpp @@ -737,7 +737,7 @@ QString BaseFileWizard::buildFileName(const QString &path, QString BaseFileWizard::preferredSuffix(const QString &mimeType) { - const QString rc = Core::ICore::instance()->mimeDatabase()->preferredSuffixByType(mimeType); + const QString rc = Core::ICore::mimeDatabase()->preferredSuffixByType(mimeType); if (rc.isEmpty()) qWarning("%s: WARNING: Unable to find a preferred suffix for %s.", Q_FUNC_INFO, mimeType.toUtf8().constData()); diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp index d7d72398f5..cd5bff462e 100644 --- a/src/plugins/coreplugin/designmode.cpp +++ b/src/plugins/coreplugin/designmode.cpp @@ -260,10 +260,10 @@ void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode) { if (newMode == this) { // Apply active context - Core::ICore::instance()->updateAdditionalContexts(Context(), d->m_activeContext); + Core::ICore::updateAdditionalContexts(Context(), d->m_activeContext); } else if (oldMode == this) { // Remove active context - Core::ICore::instance()->updateAdditionalContexts(d->m_activeContext, Context()); + Core::ICore::updateAdditionalContexts(d->m_activeContext, Context()); } } @@ -273,7 +273,7 @@ void DesignMode::setActiveContext(const Context &context) return; if (ModeManager::instance()->currentMode() == this) - Core::ICore::instance()->updateAdditionalContexts(d->m_activeContext, context); + Core::ICore::updateAdditionalContexts(d->m_activeContext, context); d->m_activeContext = context; } diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index 02db0fa4e4..cbbbbfb6ae 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -332,7 +332,7 @@ void SettingsDialog::showPage(const QString &categoryId, const QString &pageId) QString initialCategory = categoryId; QString initialPage = pageId; if (initialCategory.isEmpty() && initialPage.isEmpty()) { - QSettings *settings = ICore::instance()->settings(); + QSettings *settings = ICore::settings(); initialCategory = settings->value(QLatin1String(categoryKeyC), QVariant(QString())).toString(); initialPage = settings->value(QLatin1String(pageKeyC), QVariant(QString())).toString(); } @@ -540,7 +540,7 @@ void SettingsDialog::apply() void SettingsDialog::done(int val) { - QSettings *settings = ICore::instance()->settings(); + QSettings *settings = ICore::settings(); settings->setValue(QLatin1String(categoryKeyC), m_currentCategory); settings->setValue(QLatin1String(pageKeyC), m_currentPage); diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 2a770589ce..046d9a5f0f 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -219,7 +219,7 @@ void ShortcutSettings::removeTargetIdentifier() void ShortcutSettings::importAction() { QString fileName = QFileDialog::getOpenFileName(0, tr("Import Keyboard Mapping Scheme"), - ICore::instance()->resourcePath() + QLatin1String("/schemes/"), + ICore::resourcePath() + QLatin1String("/schemes/"), tr("Keyboard Mapping Scheme (*.kms)")); if (!fileName.isEmpty()) { @@ -268,7 +268,7 @@ void ShortcutSettings::exportAction() { QString fileName = FileManager::instance()->getSaveFileNameWithExtension( tr("Export Keyboard Mapping Scheme"), - ICore::instance()->resourcePath() + QLatin1String("/schemes/"), + ICore::resourcePath() + QLatin1String("/schemes/"), tr("Keyboard Mapping Scheme (*.kms)")); if (!fileName.isEmpty()) { CommandsFile cf(fileName); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 9a10447a9d..9809c6e4f5 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -186,8 +186,9 @@ EditorManagerPlaceHolder* EditorManagerPlaceHolder::current() namespace Core { -struct EditorManagerPrivate { - explicit EditorManagerPrivate(ICore *core, QWidget *parent); +struct EditorManagerPrivate +{ + explicit EditorManagerPrivate(QWidget *parent); ~EditorManagerPrivate(); Internal::EditorView *m_view; Internal::SplitterOrView *m_splitter; @@ -195,9 +196,6 @@ struct EditorManagerPrivate { QPointer<SplitterOrView> m_currentView; QTimer *m_autoSaveTimer; - ICore *m_core; - - // actions QAction *m_revertToSavedAction; QAction *m_saveAction; @@ -239,11 +237,10 @@ struct EditorManagerPrivate { }; } -EditorManagerPrivate::EditorManagerPrivate(ICore *core, QWidget *parent) : +EditorManagerPrivate::EditorManagerPrivate(QWidget *parent) : m_view(0), m_splitter(0), m_autoSaveTimer(0), - m_core(core), m_revertToSavedAction(new QAction(EditorManager::tr("Revert to Saved"), parent)), m_saveAction(new QAction(parent)), m_saveAsAction(new QAction(parent)), @@ -286,20 +283,20 @@ static Command *createSeparator(ActionManager *am, QObject *parent, return cmd; } -EditorManager::EditorManager(ICore *core, QWidget *parent) : +EditorManager::EditorManager(QWidget *parent) : QWidget(parent), - d(new EditorManagerPrivate(core, parent)) + d(new EditorManagerPrivate(parent)) { m_instance = this; - connect(d->m_core, SIGNAL(contextAboutToChange(Core::IContext *)), + connect(ICore::instance(), SIGNAL(contextAboutToChange(Core::IContext *)), this, SLOT(handleContextChange(Core::IContext *))); const Context editManagerContext(Constants::C_EDITORMANAGER); // combined context for edit & design modes const Context editDesignContext(Constants::C_EDITORMANAGER, Constants::C_DESIGN_MODE); - ActionManager *am = d->m_core->actionManager(); + ActionManager *am = ICore::actionManager(); ActionContainer *mfile = am->actionContainer(Constants::M_FILE); // Revert to saved @@ -488,7 +485,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) : EditorManager::~EditorManager() { m_instance = 0; - if (d->m_core) { + if (ICore::instance()) { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); if (d->m_coreListener) { pm->removeObject(d->m_coreListener); @@ -540,7 +537,7 @@ void EditorManager::removeEditor(IEditor *editor) d->m_editorModel->removeEditor(editor); if (!isDuplicate) FileManager::instance()->removeFile(editor->file()); - d->m_core->removeContextObject(editor); + ICore::removeContextObject(editor); } void EditorManager::handleContextChange(Core::IContext *context) @@ -817,7 +814,7 @@ void EditorManager::closeOtherEditorsFromContextMenu() void EditorManager::showInGraphicalShell() { const QString path = d->m_contextMenuEditorIndex.data(Qt::UserRole + 1).toString(); - Core::FileUtils::showInGraphicalShell(ICore::instance()->mainWindow(), path); + Core::FileUtils::showInGraphicalShell(ICore::mainWindow(), path); } void EditorManager::openTerminal() @@ -873,7 +870,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask //ask whether to save modified files if (askAboutModifiedEditors) { bool cancelled = false; - QList<IFile*> list = d->m_core->fileManager()-> + QList<IFile*> list = ICore::fileManager()-> saveModifiedFiles(filesForEditors(acceptedEditors), &cancelled); if (cancelled) return false; @@ -1132,7 +1129,7 @@ EditorManager::EditorFactoryList { EditorFactoryList rc; const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>(); - mimeTypeFactoryRecursion(d->m_core->mimeDatabase(), mimeType, allFactories, bestMatchOnly, &rc); + mimeTypeFactoryRecursion(ICore::mimeDatabase(), mimeType, allFactories, bestMatchOnly, &rc); if (debugEditorManager) qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc; return rc; @@ -1143,7 +1140,7 @@ EditorManager::ExternalEditorList { ExternalEditorList rc; const ExternalEditorList allEditors = pluginManager()->getObjects<IExternalEditor>(); - mimeTypeFactoryRecursion(d->m_core->mimeDatabase(), mimeType, allEditors, bestMatchOnly, &rc); + mimeTypeFactoryRecursion(ICore::mimeDatabase(), mimeType, allEditors, bestMatchOnly, &rc); if (debugEditorManager) qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc; return rc; @@ -1170,15 +1167,15 @@ IEditor *EditorManager::createEditor(const Id &editorId, const QString &fileName if (!editorId.isValid()) { const QFileInfo fileInfo(fileName); // Find by mime type - MimeType mimeType = d->m_core->mimeDatabase()->findByFile(fileInfo); + MimeType mimeType = ICore::mimeDatabase()->findByFile(fileInfo); if (!mimeType) { qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain", Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.name().constData()); - mimeType = d->m_core->mimeDatabase()->findByType(QLatin1String("text/plain")); + mimeType = ICore::mimeDatabase()->findByType(QLatin1String("text/plain")); } // open text files > 48 MB in binary editor if (fileInfo.size() > maxTextFileSize() && mimeType.type().startsWith(QLatin1String("text"))) - mimeType = d->m_core->mimeDatabase()->findByType(QLatin1String("application/octet-stream")); + mimeType = ICore::mimeDatabase()->findByType(QLatin1String("application/octet-stream")); factories = editorFactories(mimeType, true); } else { // Find by editor id @@ -1203,15 +1200,15 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate) { if (!editor) return; - d->m_core->addContextObject(editor); + ICore::addContextObject(editor); d->m_editorModel->addEditor(editor, isDuplicate); if (!isDuplicate) { const bool isTemporary = editor->isTemporary(); const bool addWatcher = !isTemporary; - d->m_core->fileManager()->addFile(editor->file(), addWatcher); + ICore::fileManager()->addFile(editor->file(), addWatcher); if (!isTemporary) - d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName(), + ICore::fileManager()->addToRecentFiles(editor->file()->fileName(), editor->id()); } emit editorOpened(editor); @@ -1223,7 +1220,7 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName, bool *isExternalEditor) const { // Collect editors that can open the file - const MimeType mt = d->m_core->mimeDatabase()->findByFile(fileName); + const MimeType mt = ICore::mimeDatabase()->findByFile(fileName); if (!mt) return Id(); QStringList allEditorIds; @@ -1244,7 +1241,7 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName, if (allEditorIds.empty()) return Id(); // Run dialog. - OpenWithDialog dialog(fileName, d->m_core->mainWindow()); + OpenWithDialog dialog(fileName, ICore::mainWindow()); dialog.setEditors(allEditorIds); dialog.setCurrentEditor(0); if (dialog.exec() != QDialog::Accepted) @@ -1330,7 +1327,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri QString errorString; if (!editor->open(&errorString, fn, realFn)) { QApplication::restoreOverrideCursor(); - QMessageBox::critical(d->m_core->mainWindow(), tr("File Error"), errorString); + QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString); delete editor; return 0; } @@ -1362,15 +1359,15 @@ bool EditorManager::openExternalEditor(const QString &fileName, const Core::Id & const bool ok = ee->startEditor(fileName, &errorMessage); QApplication::restoreOverrideCursor(); if (!ok) - QMessageBox::critical(d->m_core->mainWindow(), tr("Opening File"), errorMessage); + QMessageBox::critical(ICore::mainWindow(), tr("Opening File"), errorMessage); return ok; } QStringList EditorManager::getOpenFileNames() const { QString selectedFilter; - const QString &fileFilters = d->m_core->mimeDatabase()->allFiltersString(&selectedFilter); - return ICore::instance()->fileManager()->getOpenFileNames(fileFilters, + const QString &fileFilters = ICore::mimeDatabase()->allFiltersString(&selectedFilter); + return ICore::fileManager()->getOpenFileNames(fileFilters, QString(), &selectedFilter); } @@ -1488,7 +1485,7 @@ bool EditorManager::saveFile(IFile *fileParam) bool isReadOnly; // try saving, no matter what isReadOnly tells us - success = d->m_core->fileManager()->saveFile(file, QString(), &isReadOnly); + success = ICore::fileManager()->saveFile(file, QString(), &isReadOnly); if (!success && isReadOnly) { MakeWritableResult answer = @@ -1500,7 +1497,7 @@ bool EditorManager::saveFile(IFile *fileParam) file->checkPermissions(); - success = d->m_core->fileManager()->saveFile(file); + success = ICore::fileManager()->saveFile(file); } if (success) { @@ -1525,7 +1522,7 @@ void EditorManager::autoSave() errors << errorString; } if (!errors.isEmpty()) - QMessageBox::critical(d->m_core->mainWindow(), tr("File Error"), + QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errors.join(QLatin1String("\n"))); } @@ -1534,13 +1531,13 @@ MakeWritableResult EditorManager::makeFileWritable(IFile *file) if (!file) return Failed; QString directory = QFileInfo(file->fileName()).absolutePath(); - IVersionControl *versionControl = d->m_core->vcsManager()->findVersionControlForDirectory(directory); + IVersionControl *versionControl = ICore::vcsManager()->findVersionControlForDirectory(directory); const QString &fileName = file->fileName(); - switch (FileManager::promptReadOnlyFile(fileName, versionControl, d->m_core->mainWindow(), file->isSaveAsAllowed())) { + switch (FileManager::promptReadOnlyFile(fileName, versionControl, ICore::mainWindow(), file->isSaveAsAllowed())) { case FileManager::RO_OpenVCS: if (!versionControl->vcsOpen(fileName)) { - QMessageBox::warning(d->m_core->mainWindow(), tr("Cannot Open File"), tr("Cannot open the file for editing with SCC.")); + QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"), tr("Cannot open the file for editing with SCC.")); return Failed; } file->checkPermissions(); @@ -1548,7 +1545,7 @@ MakeWritableResult EditorManager::makeFileWritable(IFile *file) case FileManager::RO_MakeWriteable: { const bool permsOk = QFile::setPermissions(fileName, QFile::permissions(fileName) | QFile::WriteUser); if (!permsOk) { - QMessageBox::warning(d->m_core->mainWindow(), tr("Cannot Set Permissions"), tr("Cannot set permissions to writable.")); + QMessageBox::warning(ICore::mainWindow(), tr("Cannot Set Permissions"), tr("Cannot set permissions to writable.")); return Failed; } } @@ -1570,11 +1567,11 @@ bool EditorManager::saveFileAs(IFile *fileParam) if (!file) return false; - const QString &filter = d->m_core->mimeDatabase()->allFiltersString(); + const QString &filter = ICore::mimeDatabase()->allFiltersString(); QString selectedFilter = - d->m_core->mimeDatabase()->findByFile(QFileInfo(file->fileName())).filterString(); + ICore::mimeDatabase()->findByFile(QFileInfo(file->fileName())).filterString(); const QString &absoluteFilePath = - d->m_core->fileManager()->getSaveAsFileName(file, filter, &selectedFilter); + ICore::fileManager()->getSaveAsFileName(file, filter, &selectedFilter); if (absoluteFilePath.isEmpty()) return false; @@ -1587,7 +1584,7 @@ bool EditorManager::saveFileAs(IFile *fileParam) } } - const bool success = d->m_core->fileManager()->saveFile(file, absoluteFilePath); + const bool success = ICore::fileManager()->saveFile(file, absoluteFilePath); file->checkPermissions(); // @todo: There is an issue to be treated here. The new file might be of a different mime @@ -1617,7 +1614,7 @@ void EditorManager::addFileToRecentFiles(IFile *file) } } if (!isTemporary) - d->m_core->fileManager()->addToRecentFiles(file->fileName(), editorId); + ICore::fileManager()->addToRecentFiles(file->fileName(), editorId); } void EditorManager::gotoNextDocHistory() @@ -1659,12 +1656,12 @@ void EditorManager::vcsOpenCurrentEditor() return; const QString directory = QFileInfo(curEditor->file()->fileName()).absolutePath(); - IVersionControl *versionControl = d->m_core->vcsManager()->findVersionControlForDirectory(directory); + IVersionControl *versionControl = ICore::vcsManager()->findVersionControlForDirectory(directory); if (!versionControl || !versionControl->supportsOperation(IVersionControl::OpenOperation)) return; if (!versionControl->vcsOpen(curEditor->file()->fileName())) { - QMessageBox::warning(d->m_core->mainWindow(), tr("Cannot Open File"), + QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"), tr("Cannot open the file for editing with VCS.")); } } @@ -1683,11 +1680,11 @@ void EditorManager::updateWindowTitle() windowTitle.prepend(editorName + dashSep); QString filePath = QFileInfo(curEditor->file()->fileName()).absoluteFilePath(); if (!filePath.isEmpty()) - d->m_core->mainWindow()->setWindowFilePath(filePath); + ICore::mainWindow()->setWindowFilePath(filePath); } else { - d->m_core->mainWindow()->setWindowFilePath(QString()); + ICore::mainWindow()->setWindowFilePath(QString()); } - d->m_core->mainWindow()->setWindowTitle(windowTitle); + ICore::mainWindow()->setWindowTitle(windowTitle); } void EditorManager::handleEditorStateChange() @@ -1729,7 +1726,7 @@ void EditorManager::updateActions() // if we do not really show a warning. bool promptVCS = false; const QString directory = QFileInfo(curEditor->file()->fileName()).absolutePath(); - IVersionControl *versionControl = d->m_core->vcsManager()->findVersionControlForDirectory(directory); + IVersionControl *versionControl = ICore::vcsManager()->findVersionControlForDirectory(directory); if (versionControl && versionControl->supportsOperation(IVersionControl::OpenOperation)) { if (versionControl->settingsFlags() & IVersionControl::AutoOpen) { vcsOpenCurrentEditor(); @@ -1883,7 +1880,7 @@ void EditorManager::showPopupOrSelectDocument() const // EditorManager is invisible when invoked from Design Mode. const QPoint p = isVisible() ? mapToGlobal(QPoint(0, 0)) : - d->m_core->mainWindow()->mapToGlobal(QPoint(0, 0)); + ICore::mainWindow()->mapToGlobal(QPoint(0, 0)); windowPopup()->move((width()-d->m_windowPopup->width())/2 + p.x(), (height()-d->m_windowPopup->height())/2 + p.y()); windowPopup()->setVisible(true); @@ -1995,7 +1992,7 @@ static const char autoSaveIntervalKey[] = "EditorManager/AutoSaveInterval"; void EditorManager::saveSettings() { - SettingsDatabase *settings = d->m_core->settingsDatabase(); + SettingsDatabase *settings = ICore::settingsDatabase(); settings->setValue(QLatin1String(documentStatesKey), d->m_editorStates); settings->setValue(QLatin1String(reloadBehaviorKey), d->m_reloadSetting); settings->setValue(QLatin1String(autoSaveEnabledKey), d->m_autoSaveEnabled); @@ -2005,14 +2002,14 @@ void EditorManager::saveSettings() void EditorManager::readSettings() { // Backward compatibility to old locations for these settings - QSettings *qs = d->m_core->settings(); + QSettings *qs = ICore::settings(); if (qs->contains(QLatin1String(documentStatesKey))) { d->m_editorStates = qs->value(QLatin1String(documentStatesKey)) .value<QMap<QString, QVariant> >(); qs->remove(QLatin1String(documentStatesKey)); } - SettingsDatabase *settings = d->m_core->settingsDatabase(); + SettingsDatabase *settings = ICore::settingsDatabase(); if (settings->contains(QLatin1String(documentStatesKey))) d->m_editorStates = settings->value(QLatin1String(documentStatesKey)) .value<QMap<QString, QVariant> >(); @@ -2039,7 +2036,7 @@ void EditorManager::revertToSaved() if (currEditor->file()->isModified()) { QMessageBox msgBox(QMessageBox::Question, tr("Revert to Saved"), tr("You will lose your current changes if you proceed reverting %1.").arg(QDir::toNativeSeparators(fileName)), - QMessageBox::Yes|QMessageBox::No, d->m_core->mainWindow()); + QMessageBox::Yes|QMessageBox::No, ICore::mainWindow()); msgBox.button(QMessageBox::Yes)->setText(tr("Proceed")); msgBox.button(QMessageBox::No)->setText(tr("Cancel")); msgBox.setDefaultButton(QMessageBox::No); @@ -2050,7 +2047,7 @@ void EditorManager::revertToSaved() } QString errorString; if (!currEditor->file()->reload(&errorString, IFile::FlagReload, IFile::TypeContents)) - QMessageBox::critical(d->m_core->mainWindow(), tr("File Error"), errorString); + QMessageBox::critical(ICore::mainWindow(), tr("File Error"), errorString); } void EditorManager::showEditorStatusBar(const QString &id, @@ -2101,7 +2098,7 @@ int EditorManager::autoSaveInterval() const QTextCodec *EditorManager::defaultTextCodec() const { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); if (QTextCodec *candidate = QTextCodec::codecForName( settings->value(QLatin1String(Constants::SETTINGS_DEFAULTTEXTENCODING)).toByteArray())) return candidate; diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 5368a98f5a..66503c0ae4 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -49,7 +49,6 @@ QT_END_NAMESPACE namespace Core { class IContext; -class ICore; class IEditor; class IEditorFactory; class IExternalEditor; @@ -103,7 +102,7 @@ public: typedef QList<IEditorFactory *> EditorFactoryList; typedef QList<IExternalEditor *> ExternalEditorList; - explicit EditorManager(ICore *core, QWidget *parent); + explicit EditorManager(QWidget *parent); virtual ~EditorManager(); void init(); static EditorManager *instance(); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 2abcae13da..eb868e8b8c 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -139,7 +139,7 @@ EditorView::~EditorView() void EditorView::closeView() { - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); IEditor *editor = currentEditor(); if (editor) em->closeEditor(editor); @@ -406,7 +406,7 @@ void EditorView::updateCurrentPositionInNavigationHistory() void EditorView::goBackInNavigationHistory() { - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); updateCurrentPositionInNavigationHistory(); while (m_currentNavigationHistoryPosition > 0) { --m_currentNavigationHistoryPosition; @@ -431,7 +431,7 @@ void EditorView::goBackInNavigationHistory() void EditorView::goForwardInNavigationHistory() { - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); updateCurrentPositionInNavigationHistory(); if (m_currentNavigationHistoryPosition >= m_navigationHistory.size()-1) return; @@ -490,12 +490,12 @@ void SplitterOrView::mousePressEvent(QMouseEvent *e) if (e->button() != Qt::LeftButton) return; setFocus(Qt::MouseFocusReason); - ICore::instance()->editorManager()->setCurrentView(this); + ICore::editorManager()->setCurrentView(this); } void SplitterOrView::paintEvent(QPaintEvent *) { - if (ICore::instance()->editorManager()->currentSplitterOrView() != this) + if (ICore::editorManager()->currentSplitterOrView() != this) return; if (!m_view || hasEditors()) @@ -657,7 +657,7 @@ void SplitterOrView::split(Qt::Orientation orientation) m_splitter = new MiniSplitter(this); m_splitter->setOrientation(orientation); m_layout->addWidget(m_splitter); - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); Core::IEditor *e = m_view->currentEditor(); SplitterOrView *view = 0; @@ -710,7 +710,7 @@ void SplitterOrView::unsplitAll() void SplitterOrView::unsplitAll_helper() { if (!m_isRoot && m_view) - ICore::instance()->editorManager()->emptyView(m_view); + ICore::editorManager()->emptyView(m_view); if (m_splitter) { for (int i = 0; i < m_splitter->count(); ++i) { if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) { @@ -726,7 +726,7 @@ void SplitterOrView::unsplit() return; Q_ASSERT(m_splitter->count() == 1); - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); SplitterOrView *childSplitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0)); QSplitter *oldSplitter = m_splitter; m_splitter = 0; @@ -771,7 +771,7 @@ QByteArray SplitterOrView::saveState() const << static_cast<SplitterOrView*>(m_splitter->widget(1))->saveState(); } else { IEditor* e = editor(); - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); // don't save state of temporary or ad-hoc editors if (e && (e->isTemporary() || e->file()->fileName().isEmpty())) { @@ -812,7 +812,7 @@ void SplitterOrView::restoreState(const QByteArray &state) static_cast<SplitterOrView*>(m_splitter->widget(0))->restoreState(first); static_cast<SplitterOrView*>(m_splitter->widget(1))->restoreState(second); } else if (mode == "editor" || mode == "currenteditor") { - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); QString fileName; QString id; QByteArray editorState; diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index a4eacd159a..145a62620b 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -203,7 +203,7 @@ EditorToolBar::EditorToolBar(QWidget *parent) : this, SIGNAL(closeSplitClicked()), Qt::QueuedConnection); - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); connect(am->command(Constants::CLOSE), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); connect(am->command(Constants::GO_BACK), SIGNAL(keySequenceChanged()), @@ -246,7 +246,7 @@ void EditorToolBar::closeEditor() return; if (d->m_isStandalone) { - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); if (IEditor *editor = currentEditor()) { em->closeEditor(editor); } @@ -321,7 +321,7 @@ void EditorToolBar::updateEditorListSelection(IEditor *newSelection) void EditorToolBar::changeActiveEditor(int row) { - EditorManager *em = ICore::instance()->editorManager(); + EditorManager *em = ICore::editorManager(); QAbstractItemModel *model = d->m_editorList->model(); em->activateEditorForIndex(model->index(row, 0), EditorManager::ModeSwitch); } @@ -347,7 +347,7 @@ void EditorToolBar::listContextMenu(QPoint pos) void EditorToolBar::makeEditorWritable() { if (currentEditor()) - ICore::instance()->editorManager()->makeFileWritable(currentEditor()->file()); + ICore::editorManager()->makeFileWritable(currentEditor()->file()); } void EditorToolBar::setCanGoBack(bool canGoBack) @@ -362,7 +362,7 @@ void EditorToolBar::setCanGoForward(bool canGoForward) void EditorToolBar::updateActionShortcuts() { - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); d->m_closeEditorButton->setToolTip(am->command(Constants::CLOSE)->stringWithAppendedShortcut(EditorManager::tr("Close"))); d->m_goBackAction->setToolTip(am->command(Constants::GO_BACK)->action()->toolTip()); d->m_goForwardAction->setToolTip(am->command(Constants::GO_FORWARD)->action()->toolTip()); @@ -370,7 +370,7 @@ void EditorToolBar::updateActionShortcuts() IEditor *EditorToolBar::currentEditor() const { - return ICore::instance()->editorManager()->currentEditor(); + return ICore::editorManager()->currentEditor(); } void EditorToolBar::checkEditorStatus() diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index 15ef7f1c54..85633db296 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -620,7 +620,7 @@ void ExternalToolRunner::run() if (!m_resolvedWorkingDirectory.isEmpty()) m_process->setWorkingDirectory(m_resolvedWorkingDirectory); m_process->setCommand(m_resolvedExecutable, m_resolvedArguments); - ICore::instance()->messageManager()->printToOutputPane( + ICore::messageManager()->printToOutputPane( tr("Starting external tool '%1' %2").arg(m_resolvedExecutable, m_resolvedArguments), false); m_process->start(); } @@ -644,7 +644,7 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status) FileManager::instance()->unexpectFileChange(m_expectedFileName); } } - ICore::instance()->messageManager()->printToOutputPane( + ICore::messageManager()->printToOutputPane( tr("'%1' finished").arg(m_resolvedExecutable), false); deleteLater(); } @@ -666,7 +666,7 @@ void ExternalToolRunner::readStandardOutput() QByteArray data = m_process->readAllStandardOutput(); QString output = m_outputCodec->toUnicode(data.constData(), data.length(), &m_outputCodecState); if (m_tool->outputHandling() == ExternalTool::ShowInPane) { - ICore::instance()->messageManager()->printToOutputPane(output, true); + ICore::messageManager()->printToOutputPane(output, true); } else if (m_tool->outputHandling() == ExternalTool::ReplaceSelection) { m_processOutput.append(output); } @@ -679,7 +679,7 @@ void ExternalToolRunner::readStandardError() QByteArray data = m_process->readAllStandardError(); QString output = m_outputCodec->toUnicode(data.constData(), data.length(), &m_errorCodecState); if (m_tool->errorHandling() == ExternalTool::ShowInPane) { - ICore::instance()->messageManager()->printToOutputPane(output, true); + ICore::messageManager()->printToOutputPane(output, true); } else if (m_tool->errorHandling() == ExternalTool::ReplaceSelection) { m_processOutput.append(output); } @@ -689,8 +689,8 @@ void ExternalToolRunner::readStandardError() ExternalToolManager *ExternalToolManager::m_instance = 0; -ExternalToolManager::ExternalToolManager(Core::ICore *core) - : QObject(core), m_core(core) +ExternalToolManager::ExternalToolManager() + : QObject(ICore::instance()) { m_instance = this; initialize(); @@ -711,7 +711,7 @@ void ExternalToolManager::initialize() connect(m_configureAction, SIGNAL(triggered()), this, SLOT(openPreferences())); // add the external tools menu - ActionManager *am = m_core->actionManager(); + ActionManager *am = ICore::actionManager(); ActionContainer *mexternaltools = am->createMenu(Id(Constants::M_TOOLS_EXTERNAL)); mexternaltools->menu()->setTitle(tr("&External")); ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS); @@ -719,10 +719,10 @@ void ExternalToolManager::initialize() QMap<QString, QMultiMap<int, ExternalTool*> > categoryPriorityMap; QMap<QString, ExternalTool *> tools; - parseDirectory(m_core->userResourcePath() + QLatin1String("/externaltools"), + parseDirectory(ICore::userResourcePath() + QLatin1String("/externaltools"), &categoryPriorityMap, &tools); - parseDirectory(m_core->resourcePath() + QLatin1String("/externaltools"), + parseDirectory(ICore::resourcePath() + QLatin1String("/externaltools"), &categoryPriorityMap, &tools, true); @@ -750,7 +750,7 @@ void ExternalToolManager::parseDirectory(const QString &directory, foreach (const QFileInfo &info, dir.entryInfoList()) { const QString &fileName = info.absoluteFilePath(); QString error; - ExternalTool *tool = ExternalTool::createFromFile(fileName, &error, m_core->userInterfaceLanguage()); + ExternalTool *tool = ExternalTool::createFromFile(fileName, &error, ICore::userInterfaceLanguage()); if (!tool) { qWarning() << tr("Error while parsing external tool %1: %2").arg(fileName, error); continue; @@ -783,7 +783,7 @@ void ExternalToolManager::menuActivated() QTC_ASSERT(tool, return); ExternalToolRunner *runner = new ExternalToolRunner(tool); if (runner->hasError()) { - ICore::instance()->messageManager()->printToOutputPane(runner->errorString(), true); + ICore::messageManager()->printToOutputPane(runner->errorString(), true); } } @@ -800,7 +800,7 @@ QMap<QString, ExternalTool *> ExternalToolManager::toolsById() const void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal::ExternalTool *> > &tools) { // clear menu - ActionManager *am = m_core->actionManager(); + ActionManager *am = ICore::actionManager(); ActionContainer *mexternaltools = am->actionContainer(Id(Constants::M_TOOLS_EXTERNAL)); mexternaltools->clear(); @@ -890,7 +890,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal: void ExternalToolManager::readSettings(const QMap<QString, ExternalTool *> &tools, QMap<QString, QList<ExternalTool *> > *categoryMap) { - QSettings *settings = m_core->settings(); + QSettings *settings = ICore::settings(); settings->beginGroup(QLatin1String("ExternalTools")); if (categoryMap) { @@ -923,7 +923,7 @@ void ExternalToolManager::readSettings(const QMap<QString, ExternalTool *> &tool void ExternalToolManager::writeSettings() { - QSettings *settings = m_core->settings(); + QSettings *settings = ICore::settings(); settings->beginGroup(QLatin1String("ExternalTools")); settings->remove(QLatin1String("")); @@ -950,6 +950,6 @@ void ExternalToolManager::writeSettings() void ExternalToolManager::openPreferences() { - ICore::instance()->showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE), + ICore::showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE), QLatin1String(Core::Constants::SETTINGS_ID_TOOLS)); } diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h index cc0f96f33f..e709e68109 100644 --- a/src/plugins/coreplugin/externaltool.h +++ b/src/plugins/coreplugin/externaltool.h @@ -44,7 +44,6 @@ namespace Utils { class QtcProcess; } namespace Core { -class ActionContainer; namespace Internal { class ExternalTool : public QObject diff --git a/src/plugins/coreplugin/externaltoolmanager.h b/src/plugins/coreplugin/externaltoolmanager.h index 4b4b088951..8a7f98a567 100644 --- a/src/plugins/coreplugin/externaltoolmanager.h +++ b/src/plugins/coreplugin/externaltoolmanager.h @@ -43,7 +43,6 @@ QT_FORWARD_DECLARE_CLASS(QAction) namespace Core { -class ICore; class ActionContainer; namespace Internal { @@ -58,7 +57,7 @@ class CORE_EXPORT ExternalToolManager : public QObject public: static ExternalToolManager *instance() { return m_instance; } - ExternalToolManager(Core::ICore *core); + ExternalToolManager(); ~ExternalToolManager(); QMap<QString, QList<Internal::ExternalTool *> > toolsByCategory() const; @@ -84,7 +83,6 @@ private: void writeSettings(); static ExternalToolManager *m_instance; - Core::ICore *m_core; QMap<QString, Internal::ExternalTool *> m_tools; QMap<QString, QList<Internal::ExternalTool *> > m_categoryMap; QMap<QString, QAction *> m_actions; diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index 7e7417f03a..6ed6546b0d 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -210,10 +210,9 @@ FileManager::FileManager(QMainWindow *mw) : QObject(mw), d(new Internal::FileManagerPrivate(this, mw)) { - Core::ICore *core = Core::ICore::instance(); connect(d->m_mainWindow, SIGNAL(windowActivated()), this, SLOT(mainWindowActivated())); - connect(core, SIGNAL(contextChanged(Core::IContext*,Core::Context)), + connect(ICore::instance(), SIGNAL(contextChanged(Core::IContext*,Core::Context)), this, SLOT(syncWithEditor(Core::IContext*))); readSettings(); @@ -740,7 +739,7 @@ QString FileManager::getSaveAsFileName(IFile *file, const QString &filter, QStri QString filterString; if (filter.isEmpty()) { - if (const MimeType &mt = Core::ICore::instance()->mimeDatabase()->findByFile(fi)) + if (const MimeType &mt = Core::ICore::mimeDatabase()->findByFile(fi)) filterString = mt.filterString(); selectedFilter = &filterString; } else { @@ -1126,7 +1125,7 @@ void FileManager::saveSettings() recentEditorIds.append(file.second.toString()); } - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); s->beginGroup(QLatin1String(settingsGroupC)); s->setValue(QLatin1String(filesKeyC), recentFiles); s->setValue(QLatin1String(editorsKeyC), recentEditorIds); @@ -1139,7 +1138,7 @@ void FileManager::saveSettings() void FileManager::readSettings() { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); d->m_recentFiles.clear(); s->beginGroup(QLatin1String(settingsGroupC)); QStringList recentFiles = s->value(QLatin1String(filesKeyC)).toStringList(); @@ -1302,10 +1301,9 @@ void FileManager::populateOpenWithMenu(QMenu *menu, const QString &fileName) bool anyMatches = false; - ICore *core = ICore::instance(); - if (const MimeType mt = core->mimeDatabase()->findByFile(QFileInfo(fileName))) { - const EditorFactoryList factories = core->editorManager()->editorFactories(mt, false); - const ExternalEditorList externalEditors = core->editorManager()->externalEditors(mt, false); + if (const MimeType mt = ICore::mimeDatabase()->findByFile(QFileInfo(fileName))) { + const EditorFactoryList factories = ICore::editorManager()->editorFactories(mt, false); + const ExternalEditorList externalEditors = ICore::editorManager()->externalEditors(mt, false); anyMatches = !factories.empty() || !externalEditors.empty(); if (anyMatches) { // Add all suitable editors @@ -1361,13 +1359,13 @@ void FileManager::executeOpenWithMenuAction(QAction *action) FileChangeBlocker::FileChangeBlocker(const QString &fileName) : m_fileName(fileName) { - Core::FileManager *fm = Core::ICore::instance()->fileManager(); + Core::FileManager *fm = Core::ICore::fileManager(); fm->expectFileChange(fileName); } FileChangeBlocker::~FileChangeBlocker() { - Core::FileManager *fm = Core::ICore::instance()->fileManager(); + Core::FileManager *fm = Core::ICore::fileManager(); fm->unexpectFileChange(m_fileName); } diff --git a/src/plugins/coreplugin/fileutils.cpp b/src/plugins/coreplugin/fileutils.cpp index f5bd4ed56a..19327a5f97 100644 --- a/src/plugins/coreplugin/fileutils.cpp +++ b/src/plugins/coreplugin/fileutils.cpp @@ -72,7 +72,7 @@ static inline void showGraphicalShellError(QWidget *parent, QMessageBox::ActionRole); mbox.exec(); if (mbox.clickedButton() == settingsButton) - Core::ICore::instance()->showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE), + Core::ICore::showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE), QLatin1String(Core::Constants::SETTINGS_ID_ENVIRONMENT)); } #endif @@ -110,7 +110,7 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn) // we cannot select a file here, because no file browser really supports it... const QFileInfo fileInfo(pathIn); const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.filePath(); - const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings()); + const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::settings()); QProcess browserProc; const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder); bool success = browserProc.startDetached(browserArgs); @@ -128,12 +128,12 @@ void FileUtils::openTerminal(const QString &path) const QString terminalEmulator = QString::fromLocal8Bit(qgetenv("COMSPEC")); const QStringList args; // none #elif defined(Q_WS_MAC) - const QString terminalEmulator = Core::ICore::instance()->resourcePath() + const QString terminalEmulator = Core::ICore::resourcePath() + QLatin1String("/scripts/openTerminal.command"); QStringList args; #else QStringList args = Utils::QtcProcess::splitArgs( - Utils::ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings())); + Utils::ConsoleProcess::terminalEmulator(Core::ICore::settings())); const QString terminalEmulator = args.takeFirst(); const QString shell = QString::fromLocal8Bit(qgetenv("SHELL")); args.append(shell); diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 5e13c0fa9a..72f2e33896 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -105,7 +105,7 @@ void GeneralSettings::fillLanguageBox() const m_page->languageBox->setCurrentIndex(m_page->languageBox->count() - 1); const QString creatorTrPath = - Core::ICore::instance()->resourcePath() + QLatin1String("/translations"); + Core::ICore::resourcePath() + QLatin1String("/translations"); const QStringList languageFiles = QDir(creatorTrPath).entryList(QStringList(QLatin1String("qtcreator*.qm"))); Q_FOREACH(const QString &languageFile, languageFiles) @@ -128,7 +128,7 @@ QWidget *GeneralSettings::createPage(QWidget *parent) m_widget = new QWidget(parent); m_page->setupUi(m_widget); - QSettings* settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); Q_UNUSED(settings) // Windows fillLanguageBox(); @@ -197,10 +197,10 @@ void GeneralSettings::apply() StyleHelper::setBaseColor(m_page->colorButton->color()); EditorManager::instance()->setReloadSetting(IFile::ReloadSetting(m_page->reloadBehavior->currentIndex())); #ifdef Q_OS_UNIX - ConsoleProcess::setTerminalEmulator(Core::ICore::instance()->settings(), + ConsoleProcess::setTerminalEmulator(Core::ICore::settings(), m_page->terminalEdit->text()); #ifndef Q_OS_MAC - Utils::UnixUtils::setFileBrowser(Core::ICore::instance()->settings(), m_page->externalFileBrowserEdit->text()); + Utils::UnixUtils::setFileBrowser(Core::ICore::settings(), m_page->externalFileBrowserEdit->text()); #endif #endif EditorManager::instance()->setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked()); @@ -272,16 +272,16 @@ void GeneralSettings::resetLanguage() QString GeneralSettings::language() const { - QSettings* settings = Core::ICore::instance()->settings(); + QSettings* settings = Core::ICore::settings(); return settings->value(QLatin1String("General/OverrideLanguage")).toString(); } void GeneralSettings::setLanguage(const QString &locale) { - QSettings* settings = Core::ICore::instance()->settings(); + QSettings* settings = Core::ICore::settings(); if (settings->value(QLatin1String("General/OverrideLanguage")).toString() != locale) { - QMessageBox::information(Core::ICore::instance()->mainWindow(), tr("Restart required"), + QMessageBox::information(Core::ICore::mainWindow(), tr("Restart required"), tr("The language change will take effect after a restart of Qt Creator.")); } if (locale.isEmpty()) diff --git a/src/plugins/coreplugin/helpmanager.cpp b/src/plugins/coreplugin/helpmanager.cpp index d68c56a718..55d7017bcd 100644 --- a/src/plugins/coreplugin/helpmanager.cpp +++ b/src/plugins/coreplugin/helpmanager.cpp @@ -109,7 +109,7 @@ HelpManager *HelpManager::instance() QString HelpManager::collectionFilePath() { - return QDir::cleanPath(Core::ICore::instance()->userResourcePath() + return QDir::cleanPath(Core::ICore::userResourcePath() + QLatin1String("/helpcollection.qhc")); } @@ -437,7 +437,7 @@ void HelpManager::verifyDocumenation() QStringList HelpManagerPrivate::documentationFromInstaller() { - QSettings *installSettings = Core::ICore::instance()->settings(); + QSettings *installSettings = Core::ICore::settings(); QStringList documentationPaths = installSettings->value(QLatin1String("Help/InstalledDocumentation")) .toStringList(); QStringList documentationFiles; diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 59dde6cf54..156d74afe5 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -379,6 +379,7 @@ ICore::ICore(MainWindow *mainwindow) ICore::~ICore() { m_instance = 0; + m_mainwindow = 0; } void ICore::showNewItemDialog(const QString &title, diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index dadcc0df91..d15d657d33 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -74,6 +74,9 @@ class CORE_EXPORT ICore : public QObject ~ICore(); public: + // This should only be used to acccess the signals, so it could + // theoretically return an QObject *. For source compatibility + // it returns a ICore. static ICore *instance(); static void showNewItemDialog(const QString &title, diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c6271f6a18..11ba5fbe82 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -114,7 +114,7 @@ extern "C" void handleSigInt(int sig) { Q_UNUSED(sig) - Core::ICore::instance()->exit(); + Core::ICore::exit(); qDebug() << "SIGINT caught. Shutting down."; } #endif @@ -210,9 +210,9 @@ MainWindow::MainWindow() : m_modeManager->addWidget(m_progressManager->progressView()); m_statusBarManager = new StatusBarManager(this); m_messageManager = new MessageManager; - m_editorManager = new EditorManager(m_coreImpl, this); + m_editorManager = new EditorManager(this); m_editorManager->hide(); - m_externalToolManager = new ExternalToolManager(m_coreImpl); + m_externalToolManager = new ExternalToolManager(); setCentralWidget(m_modeStack); connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), diff --git a/src/plugins/coreplugin/mimedatabase.cpp b/src/plugins/coreplugin/mimedatabase.cpp index 2422ef6ca3..58624f143e 100644 --- a/src/plugins/coreplugin/mimedatabase.cpp +++ b/src/plugins/coreplugin/mimedatabase.cpp @@ -1296,7 +1296,7 @@ MimeDatabasePrivate::MimeDatabasePrivate() : m_maxLevel(-1) { // Assign here to avoid non-local static data initialization issues. - kModifiedMimeTypesPath = ICore::instance()->userResourcePath() + QLatin1String("/mimetypes/"); + kModifiedMimeTypesPath = ICore::userResourcePath() + QLatin1String("/mimetypes/"); } /*! diff --git a/src/plugins/coreplugin/mimetypesettings.cpp b/src/plugins/coreplugin/mimetypesettings.cpp index 0532606572..e25e4ae468 100644 --- a/src/plugins/coreplugin/mimetypesettings.cpp +++ b/src/plugins/coreplugin/mimetypesettings.cpp @@ -73,7 +73,7 @@ class MimeTypeSettingsModel : public QAbstractTableModel public: MimeTypeSettingsModel(QObject *parent = 0) - : QAbstractTableModel(parent), m_core(ICore::instance()) {} + : QAbstractTableModel(parent) {} virtual ~MimeTypeSettingsModel() {} virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; @@ -86,7 +86,6 @@ public: void validatePatterns(QStringList *candidates, const MimeType &mimeType) const; void updateKnownPatterns(const QStringList &oldPatterns, const QStringList &newPatterns); - ICore *m_core; QList<MimeType> m_mimeTypes; QSet<QString> m_knownPatterns; QHash<QString, QString> m_handlersByMimeType; @@ -134,20 +133,20 @@ QVariant MimeTypeSettingsModel::data(const QModelIndex &modelIndex, int role) co void MimeTypeSettingsModel::load() { - m_mimeTypes = m_core->mimeDatabase()->mimeTypes(); + m_mimeTypes = ICore::mimeDatabase()->mimeTypes(); qSort(m_mimeTypes.begin(), m_mimeTypes.end(), MimeTypeComp()); m_knownPatterns = QSet<QString>::fromList( - MimeDatabase::fromGlobPatterns(m_core->mimeDatabase()->globPatterns())); + MimeDatabase::fromGlobPatterns(ICore::mimeDatabase()->globPatterns())); foreach (const MimeType &mimeType, m_mimeTypes) { QString value; const QList<IEditorFactory *> factories = - m_core->editorManager()->editorFactories(mimeType); + ICore::editorManager()->editorFactories(mimeType); if (!factories.isEmpty()) { value = factories.front()->displayName(); } else { const QList<IExternalEditor *> externalEditors = - m_core->editorManager()->externalEditors(mimeType); + ICore::editorManager()->externalEditors(mimeType); if (!externalEditors.isEmpty()) value = externalEditors.front()->displayName(); else @@ -257,7 +256,7 @@ public: const QChar MimeTypeSettingsPrivate::kSemiColon(QLatin1Char(';')); MimeTypeSettingsPrivate::MimeTypeSettingsPrivate() - : m_mimeDatabase(ICore::instance()->mimeDatabase()) + : m_mimeDatabase(ICore::mimeDatabase()) , m_model(new MimeTypeSettingsModel) , m_mimeForPatternSync(-1) , m_mimeForMagicSync(-1) @@ -518,7 +517,7 @@ void MimeTypeSettingsPrivate::updateMimeDatabase() m_modifiedMimeTypes.erase(std::unique(m_modifiedMimeTypes.begin(), m_modifiedMimeTypes.end()), m_modifiedMimeTypes.end()); - MimeDatabase *db = ICore::instance()->mimeDatabase(); + MimeDatabase *db = ICore::mimeDatabase(); QList<MimeType> allModified; foreach (int index, m_modifiedMimeTypes) { const MimeType &mimeType = m_model->m_mimeTypes.at(index); @@ -615,7 +614,7 @@ void MimeTypeSettings::finish() { if (d->m_persist) { if (d->m_reset) - ICore::instance()->mimeDatabase()->clearUserModifiedMimeTypes(); + ICore::mimeDatabase()->clearUserModifiedMimeTypes(); else d->updateMimeDatabase(); } diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 7d25425092..243dbd4e84 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -315,7 +315,7 @@ void ModeManager::currentTabChanged(int index) // FIXME: This hardcoded context update is required for the Debug and Edit modes, since // they use the editor widget, which is already a context widget so the main window won't // go further up the parent tree to find the mode context. - ICore::instance()->updateAdditionalContexts(d->m_addedContexts, mode->context()); + ICore::updateAdditionalContexts(d->m_addedContexts, mode->context()); d->m_addedContexts = mode->context(); IMode *oldMode = 0; diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 5a70b3c099..427e708167 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -187,8 +187,7 @@ NavigationWidget *NavigationWidget::instance() void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> factories) { - ICore *core = ICore::instance(); - ActionManager *am = core->actionManager(); + ActionManager *am = ICore::actionManager(); Context navicontext(Core::Constants::C_NAVIGATION_PANE); foreach (INavigationWidgetFactory *factory, factories) { diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 94a283d3d6..71380d3570 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -194,7 +194,7 @@ static inline int paneShortCut(int number) void OutputPaneManager::init() { - ActionManager *am = Core::ICore::instance()->actionManager(); + ActionManager *am = Core::ICore::actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); const Context globalcontext(Core::Constants::C_GLOBAL); diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index c8159728aa..290f8453b1 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -63,12 +63,10 @@ OutputWindow::OutputWindow(Core::Context context, QWidget *parent) setFrameShape(QFrame::NoFrame); setMouseTracking(true); - Core::ICore *core = Core::ICore::instance(); - m_outputWindowContext = new Core::IContext; m_outputWindowContext->setContext(context); m_outputWindowContext->setWidget(this); - core->addContextObject(m_outputWindowContext); + ICore::addContextObject(m_outputWindowContext); QAction *undoAction = new QAction(this); QAction *redoAction = new QAction(this); @@ -77,7 +75,7 @@ OutputWindow::OutputWindow(Core::Context context, QWidget *parent) QAction *pasteAction = new QAction(this); QAction *selectAllAction = new QAction(this); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = ICore::actionManager(); am->registerAction(undoAction, Core::Constants::UNDO, context); am->registerAction(redoAction, Core::Constants::REDO, context); am->registerAction(cutAction, Core::Constants::CUT, context); @@ -105,7 +103,7 @@ OutputWindow::OutputWindow(Core::Context context, QWidget *parent) OutputWindow::~OutputWindow() { - Core::ICore::instance()->removeContextObject(m_outputWindowContext); + Core::ICore::removeContextObject(m_outputWindowContext); delete m_outputWindowContext; } diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 0e92ce7f32..11d40cfbae 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -146,7 +146,7 @@ using namespace Core::Internal; // We are already running in a different thread here QFutureInterface<void> *progressObject = new QFutureInterface<void>; progressObject->setProgressRange(0, MAX); - Core::ICore::instance()->progressManager()->addTask( + Core::ICore::progressManager()->addTask( progressObject->future(), tr("DoIt"), MYTASKTYPE); progressObject->reportStarted(); @@ -250,8 +250,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent) m_applicationTask(0) { m_progressView = new ProgressView; - ICore *core = ICore::instance(); - connect(core, SIGNAL(coreAboutToClose()), this, SLOT(cancelAllRunningTasks())); + connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(cancelAllRunningTasks())); } ProgressManagerPrivate::~ProgressManagerPrivate() diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp index a5f28571ba..8ce8f3b776 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp @@ -117,7 +117,7 @@ void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString & if (!pITask) return; - const HWND winId = hwndOfWidget(Core::ICore::instance()->mainWindow()); + const HWND winId = hwndOfWidget(Core::ICore::mainWindow()); if (text.isEmpty()) { pITask->SetOverlayIcon(winId, NULL, NULL); } else { @@ -145,7 +145,7 @@ void Core::Internal::ProgressManagerPrivate::setApplicationProgressRange(int min void Core::Internal::ProgressManagerPrivate::setApplicationProgressValue(int value) { if (pITask) { - const HWND winId = hwndOfWidget(Core::ICore::instance()->mainWindow()); + const HWND winId = hwndOfWidget(Core::ICore::mainWindow()); pITask->SetProgressValue(winId, value, total); } } @@ -155,7 +155,7 @@ void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool if (!pITask) return; - const HWND winId = hwndOfWidget(Core::ICore::instance()->mainWindow()); + const HWND winId = hwndOfWidget(Core::ICore::mainWindow()); if (visible) pITask->SetProgressState(winId, TBPF_NORMAL); else diff --git a/src/plugins/coreplugin/toolsettings.cpp b/src/plugins/coreplugin/toolsettings.cpp index 776b43d926..bce56f3d62 100644 --- a/src/plugins/coreplugin/toolsettings.cpp +++ b/src/plugins/coreplugin/toolsettings.cpp @@ -108,12 +108,12 @@ QWidget *ToolSettings::createPage(QWidget *parent) static QString getUserFilePath(const QString &proposalFileName) { static bool seeded = false; - QDir resourceDir(ICore::instance()->userResourcePath()); + QDir resourceDir(ICore::userResourcePath()); if (!resourceDir.exists(QLatin1String("externaltools"))) resourceDir.mkpath(QLatin1String("externaltools")); QFileInfo fi(proposalFileName); const QString &suffix = QLatin1String(".") + fi.completeSuffix(); - const QString &newFilePath = ICore::instance()->userResourcePath() + const QString &newFilePath = ICore::userResourcePath() + QLatin1String("/externaltools/") + fi.baseName(); int count = 0; QString tryPath = newFilePath + suffix; diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index b3a4c5134a..eece2cf9ad 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -179,7 +179,7 @@ VcsManager::~VcsManager() void VcsManager::extensionsInitialized() { // Change signal connections - FileManager *fileManager = ICore::instance()->fileManager(); + FileManager *fileManager = ICore::fileManager(); foreach (IVersionControl *versionControl, allVersionControls()) { connect(versionControl, SIGNAL(filesChanged(QStringList)), fileManager, SIGNAL(filesChangedInternally(QStringList))); diff --git a/src/plugins/cpaster/codepasterprotocol.cpp b/src/plugins/cpaster/codepasterprotocol.cpp index 35572cb82d..d3fd0cf9b7 100644 --- a/src/plugins/cpaster/codepasterprotocol.cpp +++ b/src/plugins/cpaster/codepasterprotocol.cpp @@ -210,7 +210,7 @@ void CodePasterProtocol::fetchFinished() void CodePasterProtocol::listFinished() { if (m_listReply->error()) { - Core::ICore::instance()->messageManager()->printToOutputPane(m_listReply->errorString(), true); + Core::ICore::messageManager()->printToOutputPane(m_listReply->errorString(), true); } else { const QByteArray data = m_listReply->readAll(); const QStringList lines = QString::fromAscii(data).split(QLatin1Char('\n')); diff --git a/src/plugins/cpaster/codepastersettings.cpp b/src/plugins/cpaster/codepastersettings.cpp index 1653a3ee78..2d89043058 100644 --- a/src/plugins/cpaster/codepastersettings.cpp +++ b/src/plugins/cpaster/codepastersettings.cpp @@ -54,7 +54,7 @@ namespace CodePaster { CodePasterSettingsPage::CodePasterSettingsPage() { - m_settings = Core::ICore::instance()->settings(); + m_settings = Core::ICore::settings(); if (m_settings) { const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/'); m_host = m_settings->value(keyRoot + QLatin1String(serverKeyC), QString()).toString(); diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index 568cf1a5a2..b206e2ece2 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -129,7 +129,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe Core::Context globalcontext(Core::Constants::C_GLOBAL); // Create the settings Page - m_settings->fromSettings(Core::ICore::instance()->settings()); + m_settings->fromSettings(Core::ICore::settings()); SettingsPage *settingsPage = new SettingsPage(m_settings); addAutoReleasedObject(settingsPage); @@ -153,7 +153,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe } //register actions - Core::ActionManager *actionManager = ICore::instance()->actionManager(); + Core::ActionManager *actionManager = ICore::actionManager(); Core::ActionContainer *toolsContainer = actionManager->actionContainer(Core::Constants::M_TOOLS); @@ -264,13 +264,13 @@ void CodepasterPlugin::post(QString data, const QString &mimeType) if (dialogResult == QDialog::Accepted && m_settings->protocol != view.protocol()) { m_settings->protocol = view.protocol(); - m_settings->toSettings(Core::ICore::instance()->settings()); + m_settings->toSettings(Core::ICore::settings()); } } void CodepasterPlugin::fetch() { - PasteSelectDialog dialog(m_protocols, ICore::instance()->mainWindow()); + PasteSelectDialog dialog(m_protocols, ICore::mainWindow()); dialog.setProtocol(m_settings->protocol); if (dialog.exec() != QDialog::Accepted) @@ -278,7 +278,7 @@ void CodepasterPlugin::fetch() // Save new protocol in case user changed it. if (m_settings->protocol != dialog.protocol()) { m_settings->protocol = dialog.protocol(); - m_settings->toSettings(Core::ICore::instance()->settings()); + m_settings->toSettings(Core::ICore::settings()); } const QString pasteID = dialog.pasteId(); @@ -293,8 +293,7 @@ void CodepasterPlugin::finishPost(const QString &link) { if (m_settings->copyToClipboard) QApplication::clipboard()->setText(link); - ICore::instance()->messageManager()->printToOutputPane(link, - m_settings->displayOutput); + ICore::messageManager()->printToOutputPane(link, m_settings->displayOutput); } // Extract the characters that can be used for a file name from a title @@ -334,7 +333,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription, const QString &content, bool error) { - Core::MessageManager *messageManager = ICore::instance()->messageManager(); + Core::MessageManager *messageManager = ICore::messageManager(); // Failure? if (error) { messageManager->printToOutputPane(content, true); @@ -351,7 +350,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription, // Default to "txt". QByteArray byteContent = content.toUtf8(); QString suffix; - if (const Core::MimeType mimeType = Core::ICore::instance()->mimeDatabase()->findByData(byteContent)) + if (const Core::MimeType mimeType = Core::ICore::mimeDatabase()->findByData(byteContent)) suffix = mimeType.preferredSuffix(); if (suffix.isEmpty()) suffix = QLatin1String("txt"); diff --git a/src/plugins/cpaster/fileshareprotocol.cpp b/src/plugins/cpaster/fileshareprotocol.cpp index 148f24db34..0795ab1ecd 100644 --- a/src/plugins/cpaster/fileshareprotocol.cpp +++ b/src/plugins/cpaster/fileshareprotocol.cpp @@ -62,7 +62,7 @@ FileShareProtocol::FileShareProtocol() : m_settings(new FileShareProtocolSettings), m_settingsPage(new FileShareProtocolSettingsPage(m_settings)) { - m_settings->fromSettings(Core::ICore::instance()->settings()); + m_settings->fromSettings(Core::ICore::settings()); } FileShareProtocol::~FileShareProtocol() @@ -214,11 +214,11 @@ void FileShareProtocol::paste(const QString &text, saver.setResult(&writer); } if (!saver.finalize()) { - Core::ICore::instance()->messageManager()->printToOutputPanePopup(saver.errorString()); + Core::ICore::messageManager()->printToOutputPanePopup(saver.errorString()); return; } const QString msg = tr("Pasted: %1").arg(saver.fileName()); - Core::ICore::instance()->messageManager()->printToOutputPanePopup(msg); + Core::ICore::messageManager()->printToOutputPanePopup(msg); } } // namespace CodePaster diff --git a/src/plugins/cpaster/fileshareprotocolsettingspage.cpp b/src/plugins/cpaster/fileshareprotocolsettingspage.cpp index 3a7aefdd2d..1f3c7d6d27 100644 --- a/src/plugins/cpaster/fileshareprotocolsettingspage.cpp +++ b/src/plugins/cpaster/fileshareprotocolsettingspage.cpp @@ -142,7 +142,7 @@ void FileShareProtocolSettingsPage::apply() const FileShareProtocolSettings newSettings = m_widget->settings(); if (newSettings != *m_settings) { *m_settings = newSettings; - m_settings->toSettings(Core::ICore::instance()->settings()); + m_settings->toSettings(Core::ICore::settings()); } } } // namespace CodePaster diff --git a/src/plugins/cpaster/pastebindotcomsettings.cpp b/src/plugins/cpaster/pastebindotcomsettings.cpp index 064fb2ae29..d890a93f8e 100644 --- a/src/plugins/cpaster/pastebindotcomsettings.cpp +++ b/src/plugins/cpaster/pastebindotcomsettings.cpp @@ -44,7 +44,7 @@ static const char prefixKeyC[] = "Prefix"; namespace CodePaster { PasteBinDotComSettings::PasteBinDotComSettings() { - m_settings = Core::ICore::instance()->settings(); + m_settings = Core::ICore::settings(); if (m_settings) { const QString rootKey = QLatin1String(groupC) + QLatin1Char('/'); m_hostPrefix = m_settings->value(rootKey + QLatin1String(prefixKeyC), QString()).toString(); diff --git a/src/plugins/cpaster/pasteview.cpp b/src/plugins/cpaster/pasteview.cpp index 454d54653a..db11091dd3 100644 --- a/src/plugins/cpaster/pasteview.cpp +++ b/src/plugins/cpaster/pasteview.cpp @@ -137,7 +137,7 @@ int PasteView::showDialog() m_ui.uiDescription->selectAll(); // (Re)store dialog size - const QSettings *settings = Core::ICore::instance()->settings(); + const QSettings *settings = Core::ICore::settings(); const QString rootKey = QLatin1String(groupC) + QLatin1Char('/'); const int h = settings->value(rootKey + QLatin1String(heightKeyC), height()).toInt(); const int defaultWidth = m_ui.uiPatchView->columnIndicator() + 50; @@ -198,7 +198,7 @@ void PasteView::accept() const Protocol::ContentType ct = Protocol::contentType(m_mimeType); protocol->paste(data, ct, user(), comment(), description()); // Store settings and close - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String(groupC)); settings->setValue(QLatin1String(heightKeyC), height()); settings->setValue(QLatin1String(widthKeyC), width()); diff --git a/src/plugins/cpaster/protocol.cpp b/src/plugins/cpaster/protocol.cpp index 2edc210426..02854e144d 100644 --- a/src/plugins/cpaster/protocol.cpp +++ b/src/plugins/cpaster/protocol.cpp @@ -150,7 +150,7 @@ bool Protocol::showConfigurationError(const Protocol *p, showConfig = false; if (!parent) - parent = Core::ICore::instance()->mainWindow(); + parent = Core::ICore::mainWindow(); const QString title = tr("%1 - Configuration Error").arg(p->name()); QMessageBox mb(QMessageBox::Warning, title, message, QMessageBox::Cancel, parent); QPushButton *settingsButton = 0; @@ -159,7 +159,7 @@ bool Protocol::showConfigurationError(const Protocol *p, mb.exec(); bool rc = false; if (mb.clickedButton() == settingsButton) - rc = Core::ICore::instance()->showOptionsDialog(p->settingsPage()->category(), + rc = Core::ICore::showOptionsDialog(p->settingsPage()->category(), p->settingsPage()->id(), parent); return rc; @@ -224,7 +224,7 @@ bool NetworkProtocol::httpStatus(QString url, QString *errorMessage) tr("Checking connection"), tr("Connecting to %1...").arg(url), QMessageBox::Cancel, - Core::ICore::instance()->mainWindow()); + Core::ICore::mainWindow()); connect(reply.data(), SIGNAL(finished()), &box, SLOT(close())); QApplication::setOverrideCursor(Qt::WaitCursor); box.exec(); diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp index 4ee70cc27d..81f22bca81 100644 --- a/src/plugins/cpaster/settingspage.cpp +++ b/src/plugins/cpaster/settingspage.cpp @@ -129,7 +129,7 @@ void SettingsPage::apply() const Settings newSettings = m_widget->settings(); if (newSettings != *m_settings) { *m_settings = newSettings; - m_settings->toSettings(Core::ICore::instance()->settings()); + m_settings->toSettings(Core::ICore::settings()); } } diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp index 3bdc3a1f6a..f50006d6b8 100644 --- a/src/plugins/cppeditor/cppclasswizard.cpp +++ b/src/plugins/cppeditor/cppclasswizard.cpp @@ -91,23 +91,22 @@ ClassNamePage::ClassNamePage(QWidget *parent) : } // Retrieve settings of CppTools plugin. -static inline bool lowerCaseFiles(const Core::ICore *core) +static bool lowerCaseFiles() { QString lowerCaseSettingsKey = QLatin1String(CppTools::Constants::CPPTOOLS_SETTINGSGROUP); lowerCaseSettingsKey += QLatin1Char('/'); lowerCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY); const bool lowerCaseDefault = CppTools::Constants::lowerCaseFilesDefault; - return core->settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); + return Core::ICore::settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); } // Set up new class widget from settings void ClassNamePage::initParameters() { - Core::ICore *core = Core::ICore::instance(); - const Core::MimeDatabase *mdb = core->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); m_newClassWidget->setHeaderExtension(mdb->preferredSuffixByType(QLatin1String(Constants::CPP_HEADER_MIMETYPE))); m_newClassWidget->setSourceExtension(mdb->preferredSuffixByType(QLatin1String(Constants::CPP_SOURCE_MIMETYPE))); - m_newClassWidget->setLowerCaseFiles(lowerCaseFiles(core)); + m_newClassWidget->setLowerCaseFiles(lowerCaseFiles()); } void ClassNamePage::slotValidChanged() diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index a6ceaa17de..34c44ec6ce 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -149,7 +149,7 @@ public: void adjustWidth() { - const int w = Core::ICore::instance()->mainWindow()->geometry().width(); + const int w = Core::ICore::mainWindow()->geometry().width(); setMaximumWidth(w); setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), w)); } @@ -1536,7 +1536,7 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e) QMenu *menu = new QMenu; - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mcontext = am->actionContainer(Constants::M_CONTEXT); QMenu *contextMenu = mcontext->menu(); @@ -1684,7 +1684,7 @@ Core::Id CPPEditor::id() const bool CPPEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) { bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName); - editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); + editorWidget()->setMimeType(Core::ICore::mimeDatabase()->findByFile(QFileInfo(fileName)).type()); return b; } diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index a71cbe888e..19098117d9 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -368,7 +368,7 @@ void FunctionDeclDefLink::showMarker(CPPEditorWidget *editor) else message = tr("Apply changes to declaration"); - Core::ActionManager *actionManager = Core::ICore::instance()->actionManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Command *quickfixCommand = actionManager->command(TextEditor::Constants::QUICKFIX_THIS); if (quickfixCommand) message = Utils::ProxyAction::stringWithAppendedShortcut(message, quickfixCommand->keySequence()); diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 74649c660a..5cd7b3e124 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -88,7 +88,7 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) : #if !defined(Q_WS_MAC) && !defined(Q_WS_WIN) Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); - Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *mimeDatabase = Core::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")), @@ -195,9 +195,7 @@ CppQuickFixAssistProvider *CppPlugin::quickFixProvider() const bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - Core::ICore *core = Core::ICore::instance(); - - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) return false; addAutoReleasedObject(new CppEditorFactory(this)); @@ -210,6 +208,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess addAutoReleasedObject(m_quickFixProvider); registerQuickFixes(this); + QObject *core = Core::ICore::instance(); CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); wizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY)); @@ -234,7 +233,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess Core::Context context(CppEditor::Constants::C_CPPEDITOR); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; @@ -317,12 +316,12 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); - connect(core->progressManager(), SIGNAL(taskStarted(QString)), + connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)), this, SLOT(onTaskStarted(QString))); - connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), + connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)), this, SLOT(onAllTasksFinished(QString))); - connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); + connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); readSettings(); return true; @@ -330,12 +329,12 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess void CppPlugin::readSettings() { - m_sortedOutline = Core::ICore::instance()->settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool(); + m_sortedOutline = Core::ICore::settings()->value(QLatin1String("CppTools/SortedMethodOverview"), false).toBool(); } void CppPlugin::writeSettings() { - Core::ICore::instance()->settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline); + Core::ICore::settings()->setValue(QLatin1String("CppTools/SortedMethodOverview"), m_sortedOutline); } void CppPlugin::extensionsInitialized() diff --git a/src/plugins/cpptools/completionsettingspage.cpp b/src/plugins/cpptools/completionsettingspage.cpp index dbb5cb33de..e60500e93b 100644 --- a/src/plugins/cpptools/completionsettingspage.cpp +++ b/src/plugins/cpptools/completionsettingspage.cpp @@ -49,7 +49,7 @@ CompletionSettingsPage::CompletionSettingsPage(QObject *parent) : TextEditor::TextEditorOptionsPage(parent) , m_page(0) { - if (QSettings *s = Core::ICore::instance()->settings()) + if (QSettings *s = Core::ICore::settings()) m_commentsSettings.fromSettings(QLatin1String(CPPTOOLS_SETTINGSGROUP), s); } @@ -151,7 +151,7 @@ void CompletionSettingsPage::apply() m_commentsSettings.m_enableDoxygen = m_page->enableDoxygenCheckBox->isChecked(); m_commentsSettings.m_generateBrief = m_page->generateBriefCheckBox->isChecked(); m_commentsSettings.m_leadingAsterisks = m_page->leadingAsterisksCheckBox->isChecked(); - if (QSettings *s = Core::ICore::instance()->settings()) + if (QSettings *s = Core::ICore::settings()) m_commentsSettings.toSettings(QLatin1String(CPPTOOLS_SETTINGSGROUP), s); emit commentsSettingsChanged(m_commentsSettings); diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp index 11d236dc52..39cd087ff8 100644 --- a/src/plugins/cpptools/cppcodestylesettingspage.cpp +++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp @@ -535,7 +535,7 @@ QWidget *CppCodeStyleSettingsPage::createPage(QWidget *parent) void CppCodeStyleSettingsPage::apply() { if (m_widget) { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); CppCodeStylePreferences *originalCppCodeStylePreferences = CppToolsSettings::instance()->cppCodeStyle(); if (originalCppCodeStylePreferences->codeStyleSettings() != m_pageCppCodeStylePreferences->codeStyleSettings()) { diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index 57f2d3e2d6..4468d746e3 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -1174,7 +1174,7 @@ bool CppCompletionAssistProcessor::completeInclude(const QTextCursor &cursor) includePaths.append(currentFilePath); const Core::MimeType mimeType = - Core::ICore::instance()->mimeDatabase()->findByType(QLatin1String("text/x-c++hdr")); + Core::ICore::mimeDatabase()->findByType(QLatin1String("text/x-c++hdr")); const QStringList suffixes = mimeType.suffixes(); foreach (const QString &includePath, includePaths) { @@ -1233,7 +1233,7 @@ bool CppCompletionAssistProcessor::objcKeywordsWanted() const const Core::IFile *file = m_interface->file(); QString fileName = file->fileName(); - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); return mdb->findByFile(fileName).type() == CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE; } diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index 71d5451a4f..36250452e5 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -99,7 +99,7 @@ void CppFileSettings::fromSettings(QSettings *s) bool CppFileSettings::applySuffixesToMimeDB() { - Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); return mdb->setPreferredSuffix(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE), sourceSuffix) && mdb->setPreferredSuffix(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE), headerSuffix); } @@ -202,7 +202,7 @@ static void parseLicenseTemplatePlaceholders(QString *t, const QString &file, co QString CppFileSettings::licenseTemplate(const QString &fileName, const QString &className) { - const QSettings *s = Core::ICore::instance()->settings(); + const QSettings *s = Core::ICore::settings(); QString key = QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP); key += QLatin1Char('/'); key += QLatin1String(licenseTemplatePathKeyC); @@ -237,7 +237,7 @@ CppFileSettingsWidget::CppFileSettingsWidget(QWidget *parent) : m_ui(new Internal::Ui::CppFileSettingsPage) { m_ui->setupUi(this); - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); // populate suffix combos if (const Core::MimeType sourceMt = mdb->findByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))) foreach (const QString &suffix, sourceMt.suffixes()) @@ -372,7 +372,7 @@ void CppFileSettingsPage::apply() const CppFileSettings newSettings = m_widget->settings(); if (newSettings != *m_settings) { *m_settings = newSettings; - m_settings->toSettings(Core::ICore::instance()->settings()); + m_settings->toSettings(Core::ICore::settings()); m_settings->applySuffixesToMimeDB(); } } diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 7317348dd3..cff55da9ad 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -289,7 +289,7 @@ void CppFindReferences::findAll_helper(Find::SearchResult *search) parameters.context, this, parameters.symbol); createWatcher(result, search); - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::progressManager(); Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"), CppTools::Constants::TASK_SEARCH); @@ -652,7 +652,7 @@ void CppFindReferences::findMacroUses(const Macro ¯o) result = QtConcurrent::run(&findMacroUses_helper, workingCopy, snapshot, this, macro); createWatcher(result, search); - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::progressManager(); Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"), CppTools::Constants::TASK_SEARCH); connect(progress, SIGNAL(clicked()), Find::SearchResultWindow::instance(), SLOT(popup())); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index bf676e26e3..08445b8ae2 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -665,7 +665,6 @@ CppModelManager::CppModelManager(QObject *parent) m_revision = 0; m_synchronizer.setCancelOnWait(true); - m_core = Core::ICore::instance(); // FIXME m_dirty = true; ProjectExplorer::ProjectExplorerPlugin *pe = @@ -700,10 +699,10 @@ CppModelManager::CppModelManager(QObject *parent) this, SLOT(onExtraDiagnosticsUpdated(QString))); // Listen for editor closed and opened events so that we can keep track of changing files - connect(m_core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), + connect(Core::ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); - connect(m_core->editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)), + connect(Core::ICore::editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)), this, SLOT(editorAboutToClose(Core::IEditor *))); } @@ -901,8 +900,8 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles m_synchronizer.addFuture(result); if (sourceFiles.count() > 1) { - m_core->progressManager()->addTask(result, tr("Parsing"), - CppTools::Constants::TASK_INDEX); + Core::ICore::progressManager()->addTask(result, tr("Parsing"), + CppTools::Constants::TASK_INDEX); } return result; @@ -988,7 +987,7 @@ void CppModelManager::updateEditor(Document::Ptr doc) { const QString fileName = doc->fileName(); - QList<Core::IEditor *> openedEditors = m_core->editorManager()->openedEditors(); + QList<Core::IEditor *> openedEditors = Core::ICore::editorManager()->openedEditors(); foreach (Core::IEditor *editor, openedEditors) { if (editor->file()->fileName() == fileName) { TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); @@ -1177,8 +1176,8 @@ void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project) void CppModelManager::onAboutToUnloadSession() { - if (m_core->progressManager()) { - m_core->progressManager()->cancelTasks(CppTools::Constants::TASK_INDEX); + if (Core::ProgressManager *pm = Core::ICore::progressManager()) { + pm->cancelTasks(CppTools::Constants::TASK_INDEX); } do { QMutexLocker locker(&mutex); @@ -1196,7 +1195,7 @@ void CppModelManager::parse(QFutureInterface<void> &future, if (files.isEmpty()) return; - const Core::MimeDatabase *mimeDb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mimeDb = Core::ICore::mimeDatabase(); Core::MimeType cSourceTy = mimeDb->findByType(QLatin1String("text/x-csrc")); Core::MimeType cppSourceTy = mimeDb->findByType(QLatin1String("text/x-c++src")); Core::MimeType mSourceTy = mimeDb->findByType(QLatin1String("text/x-objcsrc")); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 6bfaf82cf4..7fbe52181f 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -58,7 +58,6 @@ #endif namespace Core { -class ICore; class IEditor; } @@ -106,8 +105,6 @@ public: QFuture<void> refreshSourceFiles(const QStringList &sourceFiles); - inline Core::ICore *core() const { return m_core; } - virtual bool isCppEditor(Core::IEditor *editor) const; CppEditorSupport *editorSupport(TextEditor::ITextEditor *editor) const @@ -197,7 +194,6 @@ private: QStringList files); private: - Core::ICore *m_core; CPlusPlus::Snapshot m_snapshot; // cache diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index c21cb9b5ed..7c686adaae 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -103,15 +103,14 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); m_settings = new CppToolsSettings(this); // force registration of cpp tools settings // Objects m_modelManager = new CppModelManager(this); - Core::VcsManager *vcsManager = core->vcsManager(); - Core::FileManager *fileManager = core->fileManager(); + Core::VcsManager *vcsManager = Core::ICore::vcsManager(); + Core::FileManager *fileManager = Core::ICore::fileManager(); connect(vcsManager, SIGNAL(repositoryChanged(QString)), m_modelManager, SLOT(updateModifiedSourceFiles())); connect(fileManager, SIGNAL(filesChangedInternally(QStringList)), @@ -122,7 +121,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) addAutoReleasedObject(new CppLocatorFilter(m_modelManager)); addAutoReleasedObject(new CppClassesFilter(m_modelManager)); addAutoReleasedObject(new CppFunctionsFilter(m_modelManager)); - addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager())); + addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, Core::ICore::editorManager())); addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings)); addAutoReleasedObject(new SymbolsFindFilter(m_modelManager)); addAutoReleasedObject(new CppCodeStyleSettingsPage); @@ -151,7 +150,7 @@ void CppToolsPlugin::extensionsInitialized() { // The Cpp editor plugin, which is loaded later on, registers the Cpp mime types, // so, apply settings here - m_fileSettings->fromSettings(Core::ICore::instance()->settings()); + m_fileSettings->fromSettings(Core::ICore::settings()); if (!m_fileSettings->applySuffixesToMimeDB()) qWarning("Unable to apply cpp suffixes to mime database (cpp mime types not found).\n"); } @@ -266,8 +265,7 @@ QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) co if (m_headerSourceMapping.contains(fi.absoluteFilePath())) return m_headerSourceMapping.value(fi.absoluteFilePath()); - const Core::ICore *core = Core::ICore::instance(); - const Core::MimeDatabase *mimeDatase = core->mimeDatabase(); + const Core::MimeDatabase *mimeDatase = Core::ICore::mimeDatabase(); ProjectExplorer::ProjectExplorerPlugin *explorer = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::Project *project = (explorer ? explorer->currentProject() : 0); diff --git a/src/plugins/cpptools/cpptoolssettings.cpp b/src/plugins/cpptools/cpptoolssettings.cpp index 08b68e5c93..0986e42c1e 100644 --- a/src/plugins/cpptools/cpptoolssettings.cpp +++ b/src/plugins/cpptools/cpptoolssettings.cpp @@ -173,7 +173,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent) pool->loadCustomCodeStyles(); // load global settings (after built-in settings are added to the pool) - if (QSettings *s = Core::ICore::instance()->settings()) { + if (QSettings *s = Core::ICore::settings()) { d->m_globalCodeStyle->fromSettings(CppTools::Constants::CPP_SETTINGS_ID, s); // legacy handling start (Qt Creator Version < 2.4) diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp index 0e7da3ea21..0b65b7f892 100644 --- a/src/plugins/cpptools/insertionpointlocator.cpp +++ b/src/plugins/cpptools/insertionpointlocator.cpp @@ -311,7 +311,7 @@ InsertionLocation InsertionPointLocator::methodDeclarationInClass( static bool isSourceFile(const QString &fileName) { - const Core::MimeDatabase *mimeDb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mimeDb = Core::ICore::mimeDatabase(); Core::MimeType cSourceTy = mimeDb->findByType(QLatin1String("text/x-csrc")); Core::MimeType cppSourceTy = mimeDb->findByType(QLatin1String("text/x-c++src")); Core::MimeType mSourceTy = mimeDb->findByType(QLatin1String("text/x-objcsrc")); diff --git a/src/plugins/cpptools/symbolsfindfilter.cpp b/src/plugins/cpptools/symbolsfindfilter.cpp index e29528ad81..d47b2a3d1d 100644 --- a/src/plugins/cpptools/symbolsfindfilter.cpp +++ b/src/plugins/cpptools/symbolsfindfilter.cpp @@ -114,9 +114,9 @@ SymbolsFindFilter::SymbolsFindFilter(CppModelManager *manager) m_scope(SearchProjectsOnly) { // for disabling while parser is running - connect(Core::ICore::instance()->progressManager(), SIGNAL(taskStarted(QString)), + connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)), this, SLOT(onTaskStarted(QString))); - connect(Core::ICore::instance()->progressManager(), SIGNAL(allTasksFinished(QString)), + connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)), this, SLOT(onAllTasksFinished(QString))); } @@ -190,7 +190,7 @@ void SymbolsFindFilter::startSearch(Find::SearchResult *search) watcher->setFuture(QtConcurrent::run<Find::SearchResultItem, SymbolsFindParameters, CPlusPlus::Snapshot, QSet<QString> >(runSearch, parameters, m_manager->snapshot(), projectFileNames)); - Core::ICore::instance()->progressManager()->addTask(watcher->future(), + Core::ICore::progressManager()->addTask(watcher->future(), tr("Searching"), Find::Constants::TASK_SEARCH); } diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 31ab9af265..7b8ff0ad90 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -246,12 +246,11 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) initializeVcs(new CvsControl(this)); m_cvsPluginInstance = this; - ICore *core = ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"), errorMessage)) + if (!ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"), errorMessage)) return false; - if (QSettings *settings = core->settings()) + if (QSettings *settings = ICore::settings()) m_settings.fromSettings(settings); addAutoReleasedObject(new SettingsPage); @@ -270,7 +269,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(m_commandLocator); // Register actions - ActionManager *ami = core->actionManager(); + ActionManager *ami = ICore::actionManager(); ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); ActionContainer *cvsMenu = ami->createMenu(Id(CMD_ID_CVS_MENU)); @@ -505,7 +504,7 @@ bool CvsPlugin::submitEditorAboutToClose(VcsBaseSubmitEditor *submitEditor) bool closeEditor = true; if (!fileList.empty()) { // get message & commit - closeEditor = ICore::instance()->fileManager()->saveFile(fileIFace); + closeEditor = ICore::fileManager()->saveFile(fileIFace); if (closeEditor) closeEditor = commit(m_commitMessageFileName, fileList); } @@ -1321,7 +1320,7 @@ void CvsPlugin::setSettings(const CvsSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = ICore::instance()->settings()) + if (QSettings *settings = ICore::settings()) m_settings.toSettings(settings); cvsVersionControl()->emitConfigurationChanged(); } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 57f42b652d..158ba8899c 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -682,7 +682,7 @@ void CdbEngine::setupEngine() // Nag to add symbol server if (CdbSymbolPathListEditor::promptToAddSymbolServer(CdbOptions::settingsGroup(), &(m_options->symbolPaths))) - m_options->toSettings(Core::ICore::instance()->settings()); + m_options->toSettings(Core::ICore::settings()); init(); if (!m_logTime.elapsed()) diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index 1e327a109d..c7a445ca50 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -229,7 +229,7 @@ CdbOptionsPage::CdbOptionsPage() : m_options(new CdbOptions) { CdbOptionsPage::m_instance = this; - m_options->fromSettings(Core::ICore::instance()->settings()); + m_options->fromSettings(Core::ICore::settings()); } CdbOptionsPage::~CdbOptionsPage() @@ -278,7 +278,7 @@ void CdbOptionsPage::apply() const CdbOptions newOptions = m_widget->options(); if (*m_options != newOptions) { *m_options = newOptions; - m_options->toSettings(Core::ICore::instance()->settings()); + m_options->toSettings(Core::ICore::settings()); } } diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index b257a16fae..6e82fcbdbe 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -180,7 +180,7 @@ void CommonOptionsPage::apply() { QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return; ) - QSettings *settings = ICore::instance()->settings(); + QSettings *settings = ICore::settings(); m_group->apply(settings); const GlobalDebuggerOptions newGlobalOptions = m_widget->globalOptions(); @@ -245,7 +245,7 @@ QIcon DebuggingHelperOptionPage::categoryIcon() const void DebuggingHelperOptionPage::apply() { - m_group.apply(ICore::instance()->settings()); + m_group.apply(ICore::settings()); } void DebuggingHelperOptionPage::finish() diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 4927e128ae..06186b0d6a 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -444,7 +444,7 @@ void AttachExternalDialog::accept() StartExternalDialog::StartExternalDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::StartExternalDialog) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->setupUi(this); m_ui->toolChainComboBox->init(true); @@ -916,7 +916,7 @@ StartRemoteEngineDialog::StartRemoteEngineDialog(QWidget *parent) : QDialog(parent) , m_ui(new Ui::StartRemoteEngineDialog) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->setupUi(this); m_ui->host->setCompleter(new HistoryCompleter(settings, m_ui->host)); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index ff84710434..320ca95af4 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -538,7 +538,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) QTC_ASSERT(!d->m_runControl, notifyEngineSetupFailed(); return); d->m_progress.setProgressRange(0, 1000); - Core::FutureProgress *fp = Core::ICore::instance()->progressManager() + Core::FutureProgress *fp = Core::ICore::progressManager() ->addTask(d->m_progress.future(), tr("Launching"), _("Debugger.Launcher")); fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish); diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 44fc4249b5..50350ed43e 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -305,8 +305,7 @@ void DebuggerMainWindow::onModeChanged(IMode *mode) void DebuggerMainWindowPrivate::createViewsMenuItems() { - ICore *core = ICore::instance(); - ActionManager *am = core->actionManager(); + ActionManager *am = ICore::actionManager(); Context debugcontext(Constants::C_DEBUGMODE); m_viewsMenu = am->actionContainer(Id(Core::Constants::M_WINDOW_VIEWS)); QTC_ASSERT(m_viewsMenu, return) @@ -352,7 +351,6 @@ void DebuggerMainWindowPrivate::addLanguage(DebuggerLanguage languageId, void DebuggerMainWindowPrivate::activateQmlCppLayout() { - ICore *core = ICore::instance(); Context qmlCppContext = m_contextsForLanguage.value(QmlLanguage); qmlCppContext.add(m_contextsForLanguage.value(CppLanguage)); if (m_toolBars.value(QmlLanguage)) @@ -360,37 +358,36 @@ void DebuggerMainWindowPrivate::activateQmlCppLayout() if (m_previousDebugLanguages & QmlLanguage) { m_dockWidgetActiveStateQmlCpp = q->saveSettings(); - core->updateAdditionalContexts(qmlCppContext, Context()); + ICore::updateAdditionalContexts(qmlCppContext, Context()); } else if (m_previousDebugLanguages & CppLanguage) { m_dockWidgetActiveStateCpp = q->saveSettings(); - core->updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage), + ICore::updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage), Context()); } q->restoreSettings(m_dockWidgetActiveStateQmlCpp); - core->updateAdditionalContexts(Context(), qmlCppContext); + ICore::updateAdditionalContexts(Context(), qmlCppContext); } void DebuggerMainWindowPrivate::activateCppLayout() { - ICore *core = ICore::instance(); Context qmlCppContext = m_contextsForLanguage.value(QmlLanguage); qmlCppContext.add(m_contextsForLanguage.value(CppLanguage)); m_toolBarStack->setCurrentWidget(m_toolBars.value(CppLanguage)); if (m_previousDebugLanguages & QmlLanguage) { m_dockWidgetActiveStateQmlCpp = q->saveSettings(); - core->updateAdditionalContexts(qmlCppContext, Context()); + ICore::updateAdditionalContexts(qmlCppContext, Context()); } else if (m_previousDebugLanguages & CppLanguage) { m_dockWidgetActiveStateCpp = q->saveSettings(); - core->updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage), + ICore::updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage), Context()); } q->restoreSettings(m_dockWidgetActiveStateCpp); const Context &cppContext = m_contextsForLanguage.value(CppLanguage); - core->updateAdditionalContexts(Context(), cppContext); + ICore::updateAdditionalContexts(Context(), cppContext); } void DebuggerMainWindow::setToolBar(DebuggerLanguage language, QWidget *widget) @@ -426,7 +423,7 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua Context globalContext(Core::Constants::C_GLOBAL); - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); Command *cmd = am->registerAction(toggleViewAction, Core::Id(QLatin1String("Debugger.") + widget->objectName()), globalContext); @@ -460,8 +457,7 @@ void DebuggerMainWindow::addStagedMenuEntries() QWidget *DebuggerMainWindow::createContents(IMode *mode) { - ICore *core = ICore::instance(); - ActionManager *am = core->actionManager(); + ActionManager *am = ICore::actionManager(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), d, SLOT(updateUiForProject(ProjectExplorer::Project*))); @@ -543,9 +539,7 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) void DebuggerMainWindow::writeSettings() const { - ICore *core = ICore::instance(); - QTC_ASSERT(core, return); - QSettings *settings = core->settings(); + QSettings *settings = ICore::settings(); QTC_ASSERT(settings, return); settings->beginGroup(QLatin1String("DebugMode.CppMode")); @@ -567,9 +561,7 @@ void DebuggerMainWindow::writeSettings() const void DebuggerMainWindow::readSettings() { - ICore *core = ICore::instance(); - QTC_ASSERT(core, return); - QSettings *settings = core->settings(); + QSettings *settings = ICore::settings(); QTC_ASSERT(settings, return); d->m_dockWidgetActiveStateCpp.clear(); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index e0ec8d4d77..b58a2ac49d 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -2449,7 +2449,7 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode) void DebuggerPluginPrivate::showSettingsDialog() { - ICore::instance()->showOptionsDialog( + ICore::showOptionsDialog( _(DEBUGGER_SETTINGS_CATEGORY), _(DEBUGGER_COMMON_SETTINGS_ID)); } @@ -2655,7 +2655,7 @@ void DebuggerPluginPrivate::showQtDumperLibraryWarning(const QString &details) dialog.setDetailedText(details); dialog.exec(); if (dialog.clickedButton() == qtPref) { - ICore::instance()->showOptionsDialog( + ICore::showOptionsDialog( _(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), _(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID)); } else if (dialog.clickedButton() == helperOff) { @@ -2852,16 +2852,14 @@ QMessageBox *showMessageBox(int icon, const QString &title, void DebuggerPluginPrivate::extensionsInitialized() { - ICore *core = ICore::instance(); - QTC_ASSERT(core, return); - m_coreSettings = core->settings(); + m_coreSettings = ICore::settings(); m_debuggerSettings = new DebuggerSettings(m_coreSettings); m_debuggerSettings->readSettings(); - connect(core, SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown())); + connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown())); - ActionManager *am = core->actionManager(); + ActionManager *am = ICore::actionManager(); QTC_ASSERT(am, return); m_plugin->addObject(this); @@ -3404,7 +3402,7 @@ void DebuggerPluginPrivate::extensionsInitialized() // // Core - connect(core, SIGNAL(saveSettingsRequested()), SLOT(writeSettings())); + connect(ICore::instance(), SIGNAL(saveSettingsRequested()), SLOT(writeSettings())); // TextEditor connect(TextEditorSettings::instance(), @@ -3422,7 +3420,7 @@ void DebuggerPluginPrivate::extensionsInitialized() SLOT(updateDebugActions())); // EditorManager - QObject *editorManager = core->editorManager(); + QObject *editorManager = ICore::editorManager(); connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), SLOT(editorOpened(Core::IEditor*))); connect(editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)), @@ -3572,13 +3570,10 @@ DebuggerPlugin::~DebuggerPlugin() bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage) { - ICore *core = ICore::instance(); - QTC_ASSERT(core, return false); - // Menu groups const Context globalcontext(CC::C_GLOBAL); - ActionManager *am = core->actionManager(); + ActionManager *am = ICore::actionManager(); ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING); mstart->appendGroup(Constants::G_START_LOCAL); diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 0af3de506a..8be9f17246 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -200,7 +200,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration, DebuggerToolTipManager::instance()->registerEngine(d->m_engine); } else { debuggingFinished(); - Core::ICore::instance()->showWarningWithOptions(DebuggerRunControl::tr("Debugger"), errorMessage); + Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), errorMessage); } } @@ -600,7 +600,7 @@ DEBUGGER_EXPORT ConfigurationCheck checkDebugConfiguration(const DebuggerStartPa // Filter out disables types, command line + current settings. unsigned cmdLineEnabledEngines = debuggerCore()->enabledEngines(); #ifdef WITH_LLDB - if (!Core::ICore::instance()->settings()->value(QLatin1String("LLDB/enabled")).toBool()) + if (!Core::ICore::settings()->value(QLatin1String("LLDB/enabled")).toBool()) cmdLineEnabledEngines &= ~LldbEngineType; #else cmdLineEnabledEngines &= ~LldbEngineType; @@ -807,7 +807,7 @@ DebuggerRunControl *DebuggerRunControlFactory::create if (!check) { //appendMessage(errorMessage, true); - Core::ICore::instance()->showWarningWithOptions(DebuggerRunControl::tr("Debugger"), + Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), check.errorMessage, check.errorDetailsString(), check.settingsCategory, check.settingsPage); return 0; } diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index f716014873..74aab681a8 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -1394,7 +1394,7 @@ void DebuggerToolTipManager::debugModeEntered() // Hook up all signals in debug mode. if (!m_debugModeActive) { m_debugModeActive = true; - QWidget *topLevel = ICore::instance()->mainWindow()->topLevelWidget(); + QWidget *topLevel = ICore::mainWindow()->topLevelWidget(); topLevel->installEventFilter(this); EditorManager *em = EditorManager::instance(); connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), @@ -1418,7 +1418,7 @@ void DebuggerToolTipManager::leavingDebugMode() if (m_debugModeActive) { m_debugModeActive = false; hide(); - if (QWidget *topLevel = ICore::instance()->mainWindow()->topLevelWidget()) + if (QWidget *topLevel = ICore::mainWindow()->topLevelWidget()) topLevel->removeEventFilter(this); if (EditorManager *em = EditorManager::instance()) { foreach (IEditor *e, em->openedEditors()) { diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp index 674eea73a6..97e236e30f 100644 --- a/src/plugins/debugger/disassembleragent.cpp +++ b/src/plugins/debugger/disassembleragent.cpp @@ -259,7 +259,7 @@ void DisassemblerAgentPrivate::configureMimeType() qobject_cast<TextEditor::PlainTextEditorWidget *>(editor->widget()); QTC_ASSERT(pe, return); - MimeType mtype = ICore::instance()->mimeDatabase()->findByType(mimeType); + MimeType mtype = ICore::mimeDatabase()->findByType(mimeType); if (mtype) pe->configure(mtype); else diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 8f41a77dd9..338ea71c33 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4701,7 +4701,7 @@ void GdbEngine::loadInitScript() void GdbEngine::loadPythonDumpers() { const QByteArray dumperSourcePath = - Core::ICore::instance()->resourcePath().toLocal8Bit() + "/dumper/"; + Core::ICore::resourcePath().toLocal8Bit() + "/dumper/"; postCommand("python execfile('" + dumperSourcePath + "bridge.py')", ConsoleCommand|NonCriticalResponse); @@ -4791,9 +4791,9 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, if (!msg.isEmpty()) { const QString title = tr("Adapter start failed"); if (settingsIdHint.isEmpty()) { - Core::ICore::instance()->showWarningWithOptions(title, msg); + Core::ICore::showWarningWithOptions(title, msg); } else { - Core::ICore::instance()->showWarningWithOptions(title, msg, QString(), + Core::ICore::showWarningWithOptions(title, msg, QString(), _(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY), settingsIdHint); } } diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index 5dd3b83bfb..6609b50812 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -337,7 +337,7 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent) void GdbOptionsPage::apply() { - m_group.apply(Core::ICore::instance()->settings()); + m_group.apply(Core::ICore::settings()); } void GdbOptionsPage::finish() diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp index 4ad17d8048..74cd6c79c1 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.cpp +++ b/src/plugins/debugger/gdb/termgdbadapter.cpp @@ -70,7 +70,7 @@ TermGdbAdapter::TermGdbAdapter(GdbEngine *engine) } #else m_stubProc.setMode(Utils::ConsoleProcess::Debug); - m_stubProc.setSettings(Core::ICore::instance()->settings()); + m_stubProc.setSettings(Core::ICore::settings()); #endif connect(&m_stubProc, SIGNAL(processError(QString)), SLOT(stubError(QString))); diff --git a/src/plugins/debugger/lldb/lldbenginehost.cpp b/src/plugins/debugger/lldb/lldbenginehost.cpp index 5f6892891b..84402f551b 100644 --- a/src/plugins/debugger/lldb/lldbenginehost.cpp +++ b/src/plugins/debugger/lldb/lldbenginehost.cpp @@ -165,7 +165,7 @@ LldbEngineHost::LldbEngineHost(const DebuggerStartParameters &startParameters) SLOT(stderrReady())); - QString a = Core::ICore::instance()->resourcePath() + QLatin1String("/qtcreator-lldb"); + QString a = Core::ICore::resourcePath() + QLatin1String("/qtcreator-lldb"); if(getenv("QTC_LLDB_GUEST") != 0) a = QString::fromLocal8Bit(getenv("QTC_LLDB_GUEST")); diff --git a/src/plugins/debugger/lldb/lldboptionspage.cpp b/src/plugins/debugger/lldb/lldboptionspage.cpp index 55d805f60b..ee93ea86f3 100644 --- a/src/plugins/debugger/lldb/lldboptionspage.cpp +++ b/src/plugins/debugger/lldb/lldboptionspage.cpp @@ -72,7 +72,7 @@ void LldbOptionsPageWidget::load() // ---------- LldbOptionsPage LldbOptionsPage::LldbOptionsPage() { -// m_options->fromSettings(Core::ICore::instance()->settings()); +// m_options->fromSettings(Core::ICore::settings()); } LldbOptionsPage::~LldbOptionsPage() @@ -106,7 +106,7 @@ QIcon LldbOptionsPage::categoryIcon() const QWidget *LldbOptionsPage::createPage(QWidget *parent) { - m_widget = new LldbOptionsPageWidget(parent, Core::ICore::instance()->settings()); + m_widget = new LldbOptionsPageWidget(parent, Core::ICore::settings()); return m_widget; } diff --git a/src/plugins/debugger/logwindow.cpp b/src/plugins/debugger/logwindow.cpp index 151ec45328..24733c2ad9 100644 --- a/src/plugins/debugger/logwindow.cpp +++ b/src/plugins/debugger/logwindow.cpp @@ -338,7 +338,7 @@ LogWindow::LogWindow(QWidget *parent) m_commandEdit->setFrame(false); m_commandEdit->setObjectName(QLatin1String("DebuggerInput")); m_commandEdit->setCompleter(new Utils::HistoryCompleter( - Core::ICore::instance()->settings(), m_commandEdit)); + Core::ICore::settings(), m_commandEdit)); QHBoxLayout *commandBox = new QHBoxLayout; commandBox->addWidget(m_commandLabel); commandBox->addWidget(m_commandEdit); diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 94ec5f0533..e0916747af 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -185,7 +185,7 @@ void PdbEngine::setupEngine() showMessage(_("ADAPTER START FAILED")); if (!msg.isEmpty()) { const QString title = tr("Adapter start failed"); - Core::ICore::instance()->showWarningWithOptions(title, msg); + Core::ICore::showWarningWithOptions(title, msg); } notifyEngineSetupFailed(); return; @@ -214,7 +214,7 @@ void PdbEngine::runEngine() QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); showStatusMessage(tr("Running requested..."), 5000); const QByteArray dumperSourcePath = - Core::ICore::instance()->resourcePath().toLocal8Bit() + "/dumper/"; + Core::ICore::resourcePath().toLocal8Bit() + "/dumper/"; QString fileName = QFileInfo(startParameters().executable).absoluteFilePath(); postDirectCommand("import sys"); postDirectCommand("sys.argv.append('" + fileName.toLocal8Bit() + "')"); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 55d43860e1..9d7ad675d0 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -234,8 +234,7 @@ void QmlEngine::connectionStartupFailed() } } - Core::ICore * const core = Core::ICore::instance(); - QMessageBox *infoBox = new QMessageBox(core->mainWindow()); + QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow()); infoBox->setIcon(QMessageBox::Critical); infoBox->setWindowTitle(tr("Qt Creator")); infoBox->setText(tr("Could not connect to the in-process QML debugger.\n" @@ -278,8 +277,7 @@ void QmlEngine::wrongSetupMessageBox(const QString &errorMessage) d->m_noDebugOutputTimer.stop(); notifyEngineRunFailed(); - Core::ICore * const core = Core::ICore::instance(); - QMessageBox *infoBox = new QMessageBox(core->mainWindow()); + QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow()); infoBox->setIcon(QMessageBox::Critical); infoBox->setWindowTitle(tr("Qt Creator")); //: %1 is detailed error message diff --git a/src/plugins/debugger/qml/qmljsscriptconsole.cpp b/src/plugins/debugger/qml/qmljsscriptconsole.cpp index 5e3bf5f6a8..1f42f8a3e2 100644 --- a/src/plugins/debugger/qml/qmljsscriptconsole.cpp +++ b/src/plugins/debugger/qml/qmljsscriptconsole.cpp @@ -167,9 +167,7 @@ QmlJSScriptConsoleWidget::QmlJSScriptConsoleWidget(QWidget *parent) vbox->addWidget(statusbarContainer); vbox->addWidget(m_console); - Core::ICore *core = Core::ICore::instance(); - QTC_ASSERT(core, return); - QSettings *settings = core->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(_(SCRIPT_CONSOLE)); m_showLog->setChecked(settings->value(_(SHOW_LOG), true).toBool()); m_showWarning->setChecked(settings->value(_(SHOW_WARNING), true).toBool()); @@ -179,9 +177,7 @@ QmlJSScriptConsoleWidget::QmlJSScriptConsoleWidget(QWidget *parent) QmlJSScriptConsoleWidget::~QmlJSScriptConsoleWidget() { - Core::ICore *core = Core::ICore::instance(); - QTC_ASSERT(core, return); - QSettings *settings = core->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(_(SCRIPT_CONSOLE)); settings->setValue(_(SHOW_LOG), QVariant(m_showLog->isChecked())); settings->setValue(_(SHOW_WARNING), QVariant(m_showWarning->isChecked())); diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp index 0daedbf247..734eb0aaa9 100644 --- a/src/plugins/debugger/script/scriptengine.cpp +++ b/src/plugins/debugger/script/scriptengine.cpp @@ -245,7 +245,7 @@ void ScriptEngine::setupEngine() QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); showMessage(_("STARTING SCRIPT DEBUGGER"), LogMisc); if (m_scriptEngine.isNull()) - m_scriptEngine = Core::ICore::instance()->scriptManager()->scriptEngine(); + m_scriptEngine = Core::ICore::scriptManager()->scriptEngine(); QTC_CHECK(!m_scriptAgent); m_scriptAgent.reset(new ScriptAgent(this, m_scriptEngine.data())); m_scriptEngine->setAgent(m_scriptAgent.data()); diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp index ed8a23c846..ab8d772ec5 100644 --- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp +++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp @@ -177,9 +177,8 @@ bool CdbSymbolPathListEditor::promptToAddSymbolServer(const QString &settingsGro || CdbSymbolPathListEditor::indexOfSymbolServerPath(*symbolPaths) != -1) return false; // Prompt to use Symbol server unless the user checked "No nagging". - Core::ICore *core = Core::ICore::instance(); const QString nagSymbolServerKey = settingsGroup + QLatin1String("/NoPromptSymbolServer"); - bool noFurtherNagging = core->settings()->value(nagSymbolServerKey, false).toBool(); + bool noFurtherNagging = Core::ICore::settings()->value(nagSymbolServerKey, false).toBool(); if (noFurtherNagging) return false; @@ -192,13 +191,13 @@ bool CdbSymbolPathListEditor::promptToAddSymbolServer(const QString &settingsGro "<p>Would you like to set it up?</p></br>" "</body></html>").arg(symServUrl); const QDialogButtonBox::StandardButton answer = - Utils::CheckableMessageBox::question(core->mainWindow(), tr("Symbol Server"), msg, + Utils::CheckableMessageBox::question(Core::ICore::mainWindow(), tr("Symbol Server"), msg, tr("Do not ask again"), &noFurtherNagging); - core->settings()->setValue(nagSymbolServerKey, noFurtherNagging); + Core::ICore::settings()->setValue(nagSymbolServerKey, noFurtherNagging); if (answer == QDialogButtonBox::No) return false; // Prompt for path and add it. Synchronize QSetting and debugger. - const QString cacheDir = CdbSymbolPathListEditor::promptCacheDirectory(core->mainWindow()); + const QString cacheDir = CdbSymbolPathListEditor::promptCacheDirectory(Core::ICore::mainWindow()); if (cacheDir.isEmpty()) return false; diff --git a/src/plugins/designer/cpp/cppsettingspage.cpp b/src/plugins/designer/cpp/cppsettingspage.cpp index 07f0354372..bd60d48b63 100644 --- a/src/plugins/designer/cpp/cppsettingspage.cpp +++ b/src/plugins/designer/cpp/cppsettingspage.cpp @@ -103,7 +103,7 @@ QString CppSettingsPageWidget::searchKeywords() const // ---------- CppSettingsPage CppSettingsPage::CppSettingsPage(QObject *parent) : Core::IOptionsPage(parent) { - m_parameters.fromSettings(Core::ICore::instance()->settings()); + m_parameters.fromSettings(Core::ICore::settings()); } QString CppSettingsPage::id() const @@ -146,7 +146,7 @@ void CppSettingsPage::apply() const FormClassWizardGenerationParameters newParameters = m_widget->parameters(); if (newParameters != m_parameters) { m_parameters = newParameters; - m_parameters.toSettings(Core::ICore::instance()->settings()); + m_parameters.toSettings(Core::ICore::settings()); } } } diff --git a/src/plugins/designer/cpp/formclasswizardpage.cpp b/src/plugins/designer/cpp/formclasswizardpage.cpp index 282bfce233..768be05cef 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.cpp +++ b/src/plugins/designer/cpp/formclasswizardpage.cpp @@ -79,14 +79,13 @@ bool FormClassWizardPage::lowercaseHeaderFiles() lowerCaseSettingsKey += QLatin1Char('/'); lowerCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY); const bool lowerCaseDefault = CppTools::Constants::lowerCaseFilesDefault; - return Core::ICore::instance()->settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); + return Core::ICore::settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); } // Set up new class widget from settings void FormClassWizardPage::initFileGenerationSettings() { - Core::ICore *core = Core::ICore::instance(); - const Core::MimeDatabase *mdb = core->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); m_ui->newClassWidget->setHeaderExtension(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))); m_ui->newClassWidget->setSourceExtension(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))); m_ui->newClassWidget->setLowerCaseFiles(lowercaseHeaderFiles()); diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index f63a0fe3a1..f6d1540201 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -83,8 +83,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error)) return false; initializeTemplates(); @@ -93,11 +92,11 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) addAutoReleasedObject(new SettingsPageProvider); addAutoReleasedObject(new QtDesignerFormClassCodeGenerator); // Ensure that loading designer translations is done before FormEditorW is instantiated - const QString locale = Core::ICore::instance()->userInterfaceLanguage(); + const QString locale = Core::ICore::userInterfaceLanguage(); if (!locale.isEmpty()) { QTranslator *qtr = new QTranslator(this); const QString &creatorTrPath = - Core::ICore::instance()->resourcePath() + QLatin1String("/translations"); + Core::ICore::resourcePath() + QLatin1String("/translations"); const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); const QString &trFile = QLatin1String("designer_") + locale; if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath)) diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 901c0a3683..7eae798b02 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -159,7 +159,6 @@ FormEditorW::FormEditorW() : m_formeditor(QDesignerComponents::createFormEditor(0)), m_integration(0), m_fwm(0), - m_core(Core::ICore::instance()), m_initStage(RegisterPlugins), m_actionGroupEditMode(0), m_actionPrint(0), @@ -180,12 +179,11 @@ FormEditorW::FormEditorW() : qDebug() << Q_FUNC_INFO; QTC_ASSERT(!m_self, return); m_self = this; - QTC_ASSERT(m_core, return); qFill(m_designerSubWindows, m_designerSubWindows + Designer::Constants::DesignerSubWindowCount, static_cast<QWidget *>(0)); - m_formeditor->setTopLevel(qobject_cast<QWidget *>(m_core->editorManager())); + m_formeditor->setTopLevel(Core::ICore::editorManager()); m_formeditor->setSettingsManager(new SettingsManager()); #if QT_VERSION >= 0x050000 @@ -204,7 +202,7 @@ FormEditorW::FormEditorW() : m_settingsPages.append(settingsPage); } - connect(m_core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor *)), + connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor *)), this, SLOT(currentEditorChanged(Core::IEditor *))); connect(m_shortcutMapper, SIGNAL(mapped(QObject *)), this, SLOT(updateShortcut(QObject *))); @@ -213,10 +211,10 @@ FormEditorW::FormEditorW() : FormEditorW::~FormEditorW() { if (m_context) - m_core->removeContextObject(m_context); + Core::ICore::removeContextObject(m_context); if (m_initStage == FullyInitialized) { - if (QSettings *s = m_core->settings()) { - m_core->settings()->beginGroup(QLatin1String(settingsGroupC)); + if (QSettings *s = Core::ICore::settings()) { + s->beginGroup(QLatin1String(settingsGroupC)); m_editorWidget->saveSettings(s); s->endGroup(); } @@ -251,7 +249,7 @@ void FormEditorW::addDockViewAction(Core::ActionManager *am, void FormEditorW::setupViewActions() { // Populate "View" menu of form editor menu - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *viewMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); QTC_ASSERT(viewMenu, return) @@ -327,11 +325,11 @@ void FormEditorW::fullInit() delete initTime; } - connect(m_core->editorManager()->instance(), SIGNAL(editorsClosed(QList<Core::IEditor*>)), + connect(Core::ICore::editorManager(), SIGNAL(editorsClosed(QList<Core::IEditor*>)), SLOT(closeFormEditorsForXmlEditors(QList<Core::IEditor*>))); // Nest toolbar and editor widget m_editorWidget = new EditorWidget(this); - QSettings *settings = m_core->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String(settingsGroupC)); m_editorWidget->restoreSettings(settings); settings->endGroup(); @@ -362,7 +360,7 @@ void FormEditorW::fullInit() Core::Context designerContexts = m_contexts; designerContexts.add(Core::Constants::C_EDITORMANAGER); m_context = new DesignerContext(designerContexts, m_modeWidget, this); - m_core->addContextObject(m_context); + Core::ICore::addContextObject(m_context); m_designMode->registerDesignWidget(m_modeWidget, QStringList(QLatin1String(FORM_MIMETYPE)), m_contexts); @@ -436,7 +434,7 @@ void FormEditorW::deleteInstance() void FormEditorW::setupActions() { - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Command *command; //menus @@ -614,7 +612,7 @@ void FormEditorW::setupActions() QToolBar *FormEditorW::createEditorToolBar() const { QToolBar *editorToolBar = new QToolBar; - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); const QList<Core::Id>::const_iterator cend = m_toolActionIds.constEnd(); for (QList<Core::Id>::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) { Core::Command *cmd = am->command(*it); @@ -681,7 +679,7 @@ void FormEditorW::saveSettings(QSettings *s) void FormEditorW::critical(const QString &errorMessage) { - QMessageBox::critical(m_core->mainWindow(), tr("Designer"), errorMessage); + QMessageBox::critical(Core::ICore::mainWindow(), tr("Designer"), errorMessage); } // Apply the command shortcut to the action and connects to the command's keySequenceChanged signal @@ -852,9 +850,10 @@ void FormEditorW::print() if (!fw) return; - const bool oldFullPage = m_core->printer()->fullPage(); - const QPrinter::Orientation oldOrientation = m_core->printer()->orientation (); - m_core->printer()->setFullPage(false); + QPrinter *printer = Core::ICore::printer(); + const bool oldFullPage = printer->fullPage(); + const QPrinter::Orientation oldOrientation = printer->orientation (); + printer->setFullPage(false); do { // Grab the image to be able to a suggest suitable orientation QString errorMessage; @@ -869,19 +868,20 @@ void FormEditorW::print() } const QSizeF pixmapSize = pixmap.size(); - m_core->printer()->setOrientation( pixmapSize.width() > pixmapSize.height() ? QPrinter::Landscape : QPrinter::Portrait); + printer->setOrientation( pixmapSize.width() > pixmapSize.height() ? QPrinter::Landscape : QPrinter::Portrait); // Printer parameters - QPrintDialog dialog(m_core->printer(), fw); + QPrintDialog dialog(printer, fw); if (!dialog.exec()) break; - const QCursor oldCursor = m_core->mainWindow()->cursor(); - m_core->mainWindow()->setCursor(Qt::WaitCursor); + QWidget *mainWindow = Core::ICore::mainWindow(); + const QCursor oldCursor = mainWindow->cursor(); + mainWindow->setCursor(Qt::WaitCursor); // Estimate of required scaling to make form look the same on screen and printer. - const double suggestedScaling = static_cast<double>(m_core->printer()->physicalDpiX()) / static_cast<double>(fw->physicalDpiX()); + const double suggestedScaling = static_cast<double>(printer->physicalDpiX()) / static_cast<double>(fw->physicalDpiX()); - QPainter painter(m_core->printer()); + QPainter painter(printer); painter.setRenderHint(QPainter::SmoothPixmapTransform); // Clamp to page @@ -896,17 +896,17 @@ void FormEditorW::print() painter.translate(xOffset, yOffset); painter.scale(scaling, scaling); painter.drawPixmap(0, 0, pixmap); - m_core->mainWindow()->setCursor(oldCursor); + mainWindow->setCursor(oldCursor); } while (false); - m_core->printer()->setFullPage(oldFullPage); - m_core->printer()->setOrientation(oldOrientation); + printer->setFullPage(oldFullPage); + printer->setOrientation(oldOrientation); } // Find out current existing editor file -static QString currentFile(const Core::EditorManager *em) +static QString currentFile() { - if (Core::IEditor *editor = em->currentEditor()) + if (Core::IEditor *editor = Core::EditorManager::instance()->currentEditor()) if (const Core::IFile *file = editor->file()) { const QString fileName = file->fileName(); if (!fileName.isEmpty() && QFileInfo(fileName).isFile()) @@ -917,13 +917,13 @@ static QString currentFile(const Core::EditorManager *em) // Switch between form ('ui') and source file ('cpp'): // Find corresponding 'other' file, simply assuming it is in the same directory. -static QString otherFile(const Core::EditorManager *em) +static QString otherFile() { // Determine mime type of current file. - const QString current = currentFile(em); + const QString current = currentFile(); if (current.isEmpty()) return QString(); - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); const Core::MimeType currentMimeType = mdb->findByFile(current); if (!currentMimeType) return QString(); @@ -952,10 +952,9 @@ static QString otherFile(const Core::EditorManager *em) void FormEditorW::switchSourceForm() { - Core::EditorManager *em = Core::EditorManager::instance(); - const QString fileToOpen = otherFile(em); + const QString fileToOpen = otherFile(); if (!fileToOpen.isEmpty()) - em->openEditor(fileToOpen, Core::Id(), Core::EditorManager::ModeSwitch); + Core::ICore::editorManager()->openEditor(fileToOpen, Core::Id(), Core::EditorManager::ModeSwitch); } } // namespace Internal diff --git a/src/plugins/designer/formeditorw.h b/src/plugins/designer/formeditorw.h index 2f525230f8..fbf98d2a60 100644 --- a/src/plugins/designer/formeditorw.h +++ b/src/plugins/designer/formeditorw.h @@ -69,7 +69,6 @@ namespace Core { class ActionManager; class ActionContainer; class Command; -class ICore; class IEditor; class Id; class DesignMode; @@ -183,7 +182,6 @@ private: #else qdesigner_internal::QDesignerFormWindowManager *m_fwm; #endif - Core::ICore *m_core; InitializationStage m_initStage; QWidget *m_designerSubWindows[Designer::Constants::DesignerSubWindowCount]; diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index fd426bd48c..4a1ff7225d 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -654,7 +654,7 @@ void QtCreatorIntegration::slotSyncSettingsToDesigner() { #if QT_VERSION > 0x040800 // Set promotion-relevant parameters on integration. - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); setHeaderSuffix(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))); setHeaderLowercase(FormClassWizardPage::lowercaseHeaderFiles()); #endif diff --git a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp index bbf94f9f3b..959fbf2a57 100644 --- a/src/plugins/designer/qtdesignerformclasscodegenerator.cpp +++ b/src/plugins/designer/qtdesignerformclasscodegenerator.cpp @@ -118,7 +118,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete QString *header, QString *source, int indentation) { Internal::FormClassWizardGenerationParameters generationParameters; - generationParameters.fromSettings(Core::ICore::instance()->settings()); + generationParameters.fromSettings(Core::ICore::settings()); const QString indent = QString(indentation, QLatin1Char(' ')); QString formBaseClass; diff --git a/src/plugins/designer/settingsmanager.cpp b/src/plugins/designer/settingsmanager.cpp index a88bbc7965..09b06e6e1a 100644 --- a/src/plugins/designer/settingsmanager.cpp +++ b/src/plugins/designer/settingsmanager.cpp @@ -43,8 +43,8 @@ using namespace Designer::Internal; static inline QSettings *coreSettings() { - if (const Core::ICore *core = Core::ICore::instance()) - return core->settings(); + if (Core::ICore::instance()) + return Core::ICore::settings(); return 0; } diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 0e77d487a5..b1f6a64c15 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -194,7 +194,7 @@ public: { return QIcon(_(Constants::SETTINGS_CATEGORY_FAKEVIM_ICON)); } QWidget *createPage(QWidget *parent); - void apply() { m_group.apply(ICore::instance()->settings()); } + void apply() { m_group.apply(ICore::settings()); } void finish() { m_group.finish(); } virtual bool matches(const QString &) const; @@ -380,7 +380,7 @@ QWidget *FakeVimExCommandsPage::createPage(QWidget *parent) void FakeVimExCommandsPage::initialize() { - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); QTC_ASSERT(am, return); QMap<QString, QTreeWidgetItem *> sections; @@ -929,7 +929,7 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate() void FakeVimPluginPrivate::onCoreAboutToClose() { // Don't attach to editors anymore. - disconnect(ICore::instance()->editorManager(), SIGNAL(editorOpened(Core::IEditor*)), + disconnect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)), this, SLOT(editorOpened(Core::IEditor*))); } @@ -939,9 +939,8 @@ void FakeVimPluginPrivate::aboutToShutdown() bool FakeVimPluginPrivate::initialize() { - Core::ICore *core = Core::ICore::instance(); - EditorManager *editorManager = core->editorManager(); - ActionManager *actionManager = core->actionManager(); + EditorManager *editorManager = ICore::editorManager(); + ActionManager *actionManager = ICore::actionManager(); QTC_ASSERT(actionManager, return false); //m_wordCompletion = new WordCompletion; @@ -991,7 +990,7 @@ bool FakeVimPluginPrivate::initialize() connect(act, SIGNAL(triggered()), SLOT(userActionTriggered())); } - connect(core, SIGNAL(coreAboutToClose()), this, SLOT(onCoreAboutToClose())); + connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(onCoreAboutToClose())); // EditorManager connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), @@ -1024,9 +1023,7 @@ void FakeVimPluginPrivate::userActionTriggered() if (!key) return; QString cmd = userCommandMap().value(key); - Core::ICore *core = Core::ICore::instance(); - EditorManager *editorManager = core->editorManager(); - IEditor *editor = editorManager->currentEditor(); + IEditor *editor = ICore::editorManager()->currentEditor(); FakeVimHandler *handler = m_editorToHandler[editor]; if (handler) handler->handleInput(cmd); @@ -1040,7 +1037,7 @@ static const char idKey[] = "Command"; void FakeVimPluginPrivate::writeSettings() { - QSettings *settings = ICore::instance()->settings(); + QSettings *settings = ICore::settings(); theFakeVimSettings()->writeSettings(settings); @@ -1088,7 +1085,7 @@ void FakeVimPluginPrivate::writeSettings() void FakeVimPluginPrivate::readSettings() { - QSettings *settings = ICore::instance()->settings(); + QSettings *settings = ICore::settings(); theFakeVimSettings()->readSettings(settings); @@ -1134,14 +1131,14 @@ void FakeVimPluginPrivate::maybeReadVimRc() void FakeVimPluginPrivate::showSettingsDialog() { - ICore::instance()->showOptionsDialog( + ICore::showOptionsDialog( _(Constants::SETTINGS_CATEGORY), _(Constants::SETTINGS_ID)); } void FakeVimPluginPrivate::triggerAction(const Id &id) { - Core::ActionManager *am = ICore::instance()->actionManager(); + Core::ActionManager *am = ICore::actionManager(); QTC_ASSERT(am, return); Core::Command *cmd = am->command(id); QTC_ASSERT(cmd, qDebug() << "UNKNOWN CODE: " << id.name(); return); @@ -1152,7 +1149,7 @@ void FakeVimPluginPrivate::triggerAction(const Id &id) void FakeVimPluginPrivate::setActionChecked(const Id &id, bool check) { - Core::ActionManager *am = ICore::instance()->actionManager(); + Core::ActionManager *am = ICore::actionManager(); QTC_ASSERT(am, return); Core::Command *cmd = am->command(id); QTC_ASSERT(cmd, return); @@ -1260,7 +1257,7 @@ void FakeVimPluginPrivate::windowCommand(int key) void FakeVimPluginPrivate::moveSomewhere(DistFunction f) { - EditorManager *editorManager = ICore::instance()->editorManager(); + EditorManager *editorManager = ICore::editorManager(); IEditor *editor = editorManager->currentEditor(); QWidget *w = editor->widget(); QPlainTextEdit *pe = @@ -1500,7 +1497,7 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd) const QString fileName = handler->currentFileName(); if (editor && editor->file()->fileName() == fileName) { // Handle that as a special case for nicer interaction with core - Core::ICore::instance()->fileManager()->saveFile(editor->file()); + ICore::fileManager()->saveFile(editor->file()); // Check result by reading back. QFile file3(fileName); file3.open(QIODevice::ReadOnly); @@ -1515,7 +1512,7 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd) } } else if (cmd.matches("wa", "wall")) { // :w[all] - FileManager *fm = ICore::instance()->fileManager(); + FileManager *fm = ICore::fileManager(); QList<IFile *> toSave = fm->modifiedFiles(); QList<IFile *> failed = fm->saveModifiedFilesSilently(toSave); if (failed.isEmpty()) @@ -1592,7 +1589,7 @@ void FakeVimPluginPrivate::handleDelayedQuit(bool forced, Core::IEditor *editor) { // This tries to simulate vim behaviour. But the models of vim and // Qt Creator core do not match well... - EditorManager *editorManager = ICore::instance()->editorManager(); + EditorManager *editorManager = ICore::editorManager(); if (editorManager->hasSplitter()) { triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT); } else { @@ -1605,7 +1602,7 @@ void FakeVimPluginPrivate::handleDelayedQuit(bool forced, Core::IEditor *editor) void FakeVimPluginPrivate::handleDelayedQuitAll(bool forced) { triggerAction(Core::Constants::REMOVE_ALL_SPLITS); - ICore::instance()->editorManager()->closeAllEditors(!forced); + ICore::editorManager()->closeAllEditors(!forced); } void FakeVimPluginPrivate::moveToMatchingParenthesis(bool *moved, bool *forward, @@ -1711,7 +1708,7 @@ void FakeVimPluginPrivate::changeSelection int FakeVimPluginPrivate::currentFile() const { - EditorManager *editorManager = ICore::instance()->editorManager(); + EditorManager *editorManager = ICore::editorManager(); OpenEditorsModel *model = editorManager->openedEditorsModel(); IEditor *editor = editorManager->currentEditor(); return model->indexOf(editor).row(); @@ -1719,7 +1716,7 @@ int FakeVimPluginPrivate::currentFile() const void FakeVimPluginPrivate::switchToFile(int n) { - EditorManager *editorManager = ICore::instance()->editorManager(); + EditorManager *editorManager = ICore::editorManager(); Core::OpenEditorsModel *model = editorManager->openedEditorsModel(); int size = model->rowCount(); QTC_ASSERT(size, return); diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index f719f2eaf3..5412062932 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -196,7 +196,7 @@ void FindPlugin::openFindDialog(IFindFilter *filter) void FindPlugin::setupMenu() { - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND); medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); @@ -230,7 +230,7 @@ void FindPlugin::setupMenu() void FindPlugin::setupFilterMenuItems() { - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QList<IFindFilter*> findInterfaces = ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); Core::Command *cmd; @@ -302,7 +302,7 @@ bool FindPlugin::hasFindFlag(Find::FindFlag flag) void FindPlugin::writeSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("Find")); settings->setValue(QLatin1String("Backward"), hasFindFlag(Find::FindBackward)); settings->setValue(QLatin1String("CaseSensitively"), hasFindFlag(Find::FindCaseSensitively)); @@ -317,7 +317,7 @@ void FindPlugin::writeSettings() void FindPlugin::readSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("Find")); bool block = blockSignals(true); setBackward(settings->value(QLatin1String("Backward"), false).toBool()); diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 99032df5bb..9cd39b422a 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -147,7 +147,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen // register actions Core::Context globalcontext(Core::Constants::C_GLOBAL); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND); Core::Command *cmd; @@ -650,7 +650,7 @@ bool FindToolBar::focusNextPrevChild(bool next) void FindToolBar::writeSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("Find")); settings->beginGroup(QLatin1String("FindToolBar")); settings->setValue(QLatin1String("Backward"), QVariant((m_findFlags & Find::FindBackward) != 0)); @@ -663,7 +663,7 @@ void FindToolBar::writeSettings() void FindToolBar::readSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("Find")); settings->beginGroup(QLatin1String("FindToolBar")); Find::FindFlags flags; diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp index e2460130ad..eecc6e80ba 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/find/findtoolwindow.cpp @@ -236,9 +236,9 @@ void FindToolWindow::replace() void FindToolWindow::writeSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("Find")); - settings->setValue(QLatin1String("CurrentFilter"), m_currentFilter ? m_currentFilter->id() : QString()); + settings->setValue(QLatin1String("CurrentFilter"), m_currentFilter ? m_currentFilter->id() : QString()); foreach (IFindFilter *filter, m_filters) filter->writeSettings(settings); settings->endGroup(); @@ -246,7 +246,7 @@ void FindToolWindow::writeSettings() void FindToolWindow::readSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String("Find")); const QString currentFilter = settings->value(QLatin1String("CurrentFilter")).toString(); for (int i = 0; i < m_filters.size(); ++i) { diff --git a/src/plugins/find/searchresultwidget.cpp b/src/plugins/find/searchresultwidget.cpp index 728fc400f8..9acf22ad2d 100644 --- a/src/plugins/find/searchresultwidget.cpp +++ b/src/plugins/find/searchresultwidget.cpp @@ -524,7 +524,7 @@ bool SearchResultWidget::showWarningMessage() const if (m_dontAskAgainGroup.isEmpty()) return false; // read settings - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(m_dontAskAgainGroup); settings->beginGroup(QLatin1String("Rename")); const bool showWarningMessage = settings->value(QLatin1String("ShowWarningMessage"), true).toBool(); @@ -536,7 +536,7 @@ bool SearchResultWidget::showWarningMessage() const void SearchResultWidget::setShowWarningMessage(bool showWarningMessage) { // write to settings - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(m_dontAskAgainGroup); settings->beginGroup(QLatin1String("Rename")); settings->setValue(QLatin1String("ShowWarningMessage"), showWarningMessage); diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 5fe341cfef..742c2331ba 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -243,7 +243,7 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) d->m_expandCollapseAction = new QAction(tr("Expand All"), this); d->m_expandCollapseAction->setCheckable(true); d->m_expandCollapseAction->setIcon(QIcon(QLatin1String(":/find/images/expand.png"))); - Core::Command *cmd = Core::ICore::instance()->actionManager()->registerAction( + Core::Command *cmd = Core::ICore::actionManager()->registerAction( d->m_expandCollapseAction, "Find.ExpandAll", Core::Context(Core::Constants::C_GLOBAL)); cmd->setAttribute(Core::Command::CA_UpdateText); @@ -452,7 +452,7 @@ void SearchResultWindow::handleExpandCollapseToolButton(bool checked) */ void SearchResultWindow::readSettings() { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); if (s) { s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME)); d->m_expandCollapseAction->setChecked(s->value(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_initiallyExpand).toBool()); @@ -466,7 +466,7 @@ void SearchResultWindow::readSettings() */ void SearchResultWindow::writeSettings() { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); if (s) { s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME)); s->setValue(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_expandCollapseAction->isChecked()); diff --git a/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp b/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp index 2185f46083..bcb83edf3b 100644 --- a/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp +++ b/src/plugins/genericprojectmanager/filesselectionwizardpage.cpp @@ -81,7 +81,7 @@ void FilesSelectionWizardPage::initializePage() { m_view->setModel(0); delete m_model; - Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase(); m_model = new SelectableFilesModel(m_genericProjectWizardDialog->path(), this); m_model->setSuffixes(mimeDatabase->suffixes().toSet()); connect(m_model, SIGNAL(parsingProgress(QString)), diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index 10fed2718b..cbe1812742 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -161,7 +161,7 @@ bool GenericProject::saveRawFileList(const QStringList &rawFileList) stream << filePath << QLatin1Char('\n'); saver.setResult(&stream); } - if (!saver.finalize(Core::ICore::instance()->mainWindow())) + if (!saver.finalize(Core::ICore::mainWindow())) return false; refresh(GenericProject::Files); return true; diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp index 2ffbf28d17..1323a89ffd 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp @@ -74,8 +74,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage { using namespace Core; - ICore *core = ICore::instance(); - Core::MimeDatabase *mimeDB = core->mimeDatabase(); + Core::MimeDatabase *mimeDB = ICore::mimeDatabase(); const QLatin1String mimetypesXml(":genericproject/GenericProject.mimetypes.xml"); @@ -96,7 +95,7 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage addAutoReleasedObject(new GenericTargetFactory); const Core::Context projectContext(Constants::PROJECTCONTEXT); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mproject = am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); m_editFilesAction = new QAction(tr("Edit Files..."), this); @@ -124,9 +123,9 @@ void GenericProjectPlugin::editFiles() { GenericProject *genericProject = static_cast<GenericProject *>(m_contextMenuProject); - Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase(); SelectableFilesDialog sfd(QFileInfo(genericProject->file()->fileName()).path(), genericProject->files(), - mimeDatabase->suffixes().toSet(), Core::ICore::instance()->mainWindow()); + mimeDatabase->suffixes().toSet(), Core::ICore::mainWindow()); if (sfd.exec() == QDialog::Accepted) { genericProject->setFiles(sfd.selectedFiles()); } diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index e1afafb78a..17465db817 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -171,8 +171,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w, const QString configFileName = QFileInfo(dir, projectName + QLatin1String(".config")).absoluteFilePath(); const QStringList paths = wizard->selectedPaths(); - Core::ICore *core = Core::ICore::instance(); - Core::MimeDatabase *mimeDatabase = core->mimeDatabase(); + Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase(); Core::MimeType headerTy = mimeDatabase->findByType(QLatin1String("text/x-chdr")); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 3465a4e8e3..1b9ceed5f3 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -295,9 +295,9 @@ private: QStringList m_fileNames; }; -inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property, const QString &entry) +Core::IEditor *locateEditor(const char *property, const QString &entry) { - foreach (Core::IEditor *ed, core->editorManager()->openedEditors()) + foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors()) if (ed->file()->property(property).toString() == entry) return ed; return 0; @@ -350,12 +350,11 @@ const char *GitClient::stashNamePrefix = "stash@{"; GitClient::GitClient(GitSettings *settings) : m_cachedGitVersion(0), m_msgWait(tr("Waiting for data...")), - m_core(Core::ICore::instance()), m_repositoryChangedSignalMapper(0), m_settings(settings) { QTC_CHECK(settings); - connect(m_core, SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); + connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); } GitClient::~GitClient() @@ -398,7 +397,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis const QString &dynamicPropertyValue) const { VcsBase::VcsBaseEditorWidget *rc = 0; - Core::IEditor *outputEditor = locateEditor(m_core, registerDynamicProperty, dynamicPropertyValue); + Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue); if (!outputEditor) return 0; @@ -428,7 +427,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id, QTC_CHECK(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue)); // Create new, set wait message, set up with source and codec - Core::IEditor *outputEditor = m_core->editorManager()->openEditorWithContents(id, &title, m_msgWait); + Core::IEditor *outputEditor = Core::ICore::editorManager()->openEditorWithContents(id, &title, m_msgWait); outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue); rc = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor); connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,int)), @@ -445,7 +444,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id, } rc->setForceReadOnly(true); - m_core->editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + Core::ICore::editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); if (configWidget) rc->setConfigurationWidget(configWidget); @@ -689,7 +688,7 @@ void GitClient::show(const QString &source, const QString &id, const QStringList void GitClient::saveSettings() { - settings()->writeSettings(m_core->settings()); + settings()->writeSettings(Core::ICore::settings()); } void GitClient::slotBlameRevisionRequested(const QString &source, QString change, int lineNumber) @@ -932,8 +931,7 @@ bool GitClient::synchronousInit(const QString &workingDirectory) outputWindow()->appendError(commandOutputFromLocal8Bit(errorText)); else { // TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...) - Core::VcsManager *vcsManager = m_core->vcsManager(); - vcsManager->resetVersionControlForDirectory(workingDirectory); + Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDirectory); } return rc; } @@ -1190,7 +1188,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory, const QStri message = creatorStashMessage(messageKeyword); do { if ((flags & StashPromptDescription)) { - if (!inputText(Core::ICore::instance()->mainWindow(), + if (!inputText(Core::ICore::mainWindow(), tr("Stash Description"), tr("Description:"), &message)) break; } @@ -1481,7 +1479,7 @@ GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory, Q return StashFailed; } - const int answer = askWithDetailedText(m_core->mainWindow(), tr("Changes"), + const int answer = askWithDetailedText(Core::ICore::mainWindow(), tr("Changes"), tr("Would you like to stash your changes?"), statusOutput, QMessageBox::Yes, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); switch (answer) { @@ -1941,7 +1939,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files, // Ask to revert (to do: Handle lists with a selection dialog) const QMessageBox::StandardButton answer - = QMessageBox::question(m_core->mainWindow(), + = QMessageBox::question(Core::ICore::mainWindow(), tr("Revert"), tr("The file has been changed. Do you want to revert it?"), QMessageBox::Yes|QMessageBox::No, @@ -2263,8 +2261,7 @@ bool GitClient::cloneRepository(const QString &directory,const QByteArray &url) const Utils::SynchronousProcessResponse resp = synchronousGit(workingDirectory.path(), arguments, flags); // TODO: Turn this into a VcsBaseClient and use resetCachedVcsInfo(...) - Core::VcsManager *vcsManager = m_core->vcsManager(); - vcsManager->resetVersionControlForDirectory(workingDirectory.absolutePath()); + Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDirectory.absolutePath()); return (resp.result == Utils::SynchronousProcessResponse::Finished); } } diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 0825e4c5eb..d103355220 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -293,7 +293,6 @@ private: mutable unsigned m_cachedGitVersion; const QString m_msgWait; - Core::ICore *m_core; QSignalMapper *m_repositoryChangedSignalMapper; GitSettings *m_settings; }; diff --git a/src/plugins/git/gitorious/gitorioushostwizardpage.cpp b/src/plugins/git/gitorious/gitorioushostwizardpage.cpp index e354bc2e85..0743a29976 100644 --- a/src/plugins/git/gitorious/gitorioushostwizardpage.cpp +++ b/src/plugins/git/gitorious/gitorioushostwizardpage.cpp @@ -52,7 +52,7 @@ static GitoriousHostWidget *createHostWidget() // First time? Populate gitorious from settings. // If there is still no host, add "gitorious.org" Gitorious &gitorious = Gitorious::instance(); - const QSettings *settings = Core::ICore::instance()->settings(); + const QSettings *settings = Core::ICore::settings(); const QString group = QLatin1String(settingsGroupC); if (!gitorious.hostCount()) { gitorious.restoreSettings(group, settings); @@ -83,7 +83,7 @@ GitoriousHostWizardPage::GitoriousHostWizardPage(QWidget *parent) : GitoriousHostWizardPage::~GitoriousHostWizardPage() { // Write out settings + selected row. - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); if (m_widget->isHostListDirty()) Gitorious::instance().saveSettings(QLatin1String(settingsGroupC), settings); if (m_widget->isValid()) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index c9d5f70d8a..f298e905f6 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -127,7 +127,6 @@ GitPlugin *GitPlugin::m_instance = 0; GitPlugin::GitPlugin() : VcsBase::VcsBasePlugin(QLatin1String(Git::Constants::GITSUBMITEDITOR_ID)), - m_core(0), m_commandLocator(0), m_showAction(0), m_submitCurrentAction(0), @@ -281,8 +280,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) Q_UNUSED(arguments) Q_UNUSED(errorMessage) - m_core = Core::ICore::instance(); - m_settings.readSettings(m_core->settings()); + m_settings.readSettings(Core::ICore::settings()); m_gitClient = new GitClient(&m_settings); @@ -312,7 +310,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(m_commandLocator); //register actions - Core::ActionManager *actionManager = m_core->actionManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::ActionContainer *toolsContainer = actionManager->actionContainer(Core::Constants::M_TOOLS); @@ -638,7 +636,7 @@ void GitPlugin::undoRepositoryChanges() QTC_ASSERT(state.hasTopLevel(), return) const QString msg = tr("Undo all pending changes to the repository\n%1?").arg(QDir::toNativeSeparators(state.topLevel())); const QMessageBox::StandardButton answer - = QMessageBox::question(m_core->mainWindow(), + = QMessageBox::question(Core::ICore::mainWindow(), tr("Undo Changes"), msg, QMessageBox::Yes|QMessageBox::No, QMessageBox::No); @@ -710,7 +708,7 @@ void GitPlugin::startCommit(bool amend) Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd, bool amend) { - Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, Constants::GITSUBMITEDITOR_ID, + Core::IEditor *editor = Core::ICore::editorManager()->openEditor(fileName, Constants::GITSUBMITEDITOR_ID, Core::EditorManager::ModeSwitch); GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor); QTC_ASSERT(submitEditor, return 0); @@ -732,8 +730,8 @@ void GitPlugin::submitCurrentLog() // Close the submit editor m_submitActionTriggered = true; QList<Core::IEditor*> editors; - editors.push_back(m_core->editorManager()->currentEditor()); - m_core->editorManager()->closeEditors(editors); + editors.push_back(Core::ICore::editorManager()->currentEditor()); + Core::ICore::editorManager()->closeEditors(editors); } bool GitPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEditor) @@ -776,7 +774,7 @@ bool GitPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *submitEdi bool closeEditor = true; if (model->hasCheckedFiles() || !m_commitAmendSHA1.isEmpty()) { // get message & commit - if (!m_core->fileManager()->saveFile(fileIFace)) + if (!Core::ICore::fileManager()->saveFile(fileIFace)) return false; closeEditor = m_gitClient->addAndCommit(m_submitRepository, editor->panelData(), @@ -860,7 +858,7 @@ void GitPlugin::cleanRepository(const QString &directory) const bool gotFiles = m_gitClient->synchronousCleanList(directory, &files, &errorMessage); QApplication::restoreOverrideCursor(); - QWidget *parent = Core::ICore::instance()->mainWindow(); + QWidget *parent = Core::ICore::mainWindow(); if (!gotFiles) { QMessageBox::warning(parent, tr("Unable to retrieve file list"), errorMessage); @@ -893,7 +891,7 @@ static bool ensureFileSaved(const QString &fileName) Core::IFile *file = editors.front()->file(); if (!file || !file->isModified()) return true; - Core::FileManager *fm = Core::ICore::instance()->fileManager(); + Core::FileManager *fm = Core::ICore::fileManager(); bool canceled; QList<Core::IFile *> files; files << file; @@ -932,7 +930,7 @@ void GitPlugin::applyPatch(const QString &workingDirectory, QString file) // Prompt for file if (file.isEmpty()) { const QString filter = tr("Patches (*.patch *.diff)"); - file = QFileDialog::getOpenFileName(Core::ICore::instance()->mainWindow(), + file = QFileDialog::getOpenFileName(Core::ICore::mainWindow(), tr("Choose Patch"), QString(), filter); if (file.isEmpty()) @@ -981,7 +979,7 @@ template <class NonModalDialog> dialog->show(); dialog->raise(); } else { - dialog = new NonModalDialog(Core::ICore::instance()->mainWindow()); + dialog = new NonModalDialog(Core::ICore::mainWindow()); dialog->refresh(topLevel, true); dialog->show(); } diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 4fe94546b3..72114cdba0 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -55,7 +55,6 @@ QT_END_NAMESPACE namespace Core { class IEditorFactory; -class ICore; class Command; class Context; class ActionManager; @@ -183,7 +182,6 @@ private: void startCommit(bool amend); static GitPlugin *m_instance; - Core::ICore *m_core; Locator::CommandLocator *m_commandLocator; QAction *m_createRepositoryAction; diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp index cae8cc39f8..6334299529 100644 --- a/src/plugins/glsleditor/glsleditor.cpp +++ b/src/plugins/glsleditor/glsleditor.cpp @@ -208,7 +208,7 @@ Core::Id GLSLEditorEditable::id() const bool GLSLEditorEditable::open(QString *errorString, const QString &fileName, const QString &realFileName) { - editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); + editorWidget()->setMimeType(Core::ICore::mimeDatabase()->findByFile(QFileInfo(fileName)).type()); bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName); return b; } diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index 7031e107c3..4b70213b4c 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -107,8 +107,7 @@ Core::Command *createSeparator(Core::ActionManager *am, bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), errorMessage)) return false; parseGlslFile(QLatin1String("glsl_120.frag"), &m_glsl_120_frag); @@ -137,7 +136,7 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er | TextEditor::TextEditorActionHandler::UnCollapseAll); m_actionHandler->initializeActions(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *contextMenu = am->createMenu(GLSLEditor::Constants::M_CONTEXT); Core::ActionContainer *glslToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_GLSL)); glslToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); @@ -163,7 +162,7 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er errorMessage->clear(); Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); - Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase(); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE))); iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), @@ -175,6 +174,7 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")), mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES))); + QObject *core = Core::ICore::instance(); Core::BaseFileWizardParameters fragWizardParameters(Core::IWizard::FileWizard); fragWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL)); fragWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL)); @@ -253,7 +253,7 @@ Core::Command *GLSLEditorPlugin::addToolAction(QAction *a, Core::ActionManager * QByteArray GLSLEditorPlugin::glslFile(const QString &fileName) { - QString path = Core::ICore::instance()->resourcePath(); + QString path = Core::ICore::resourcePath(); path += QLatin1String("/glsl/"); path += fileName; QFile file(path); diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 9136ad04a7..e0f14ce548 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -96,9 +96,6 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe Q_UNUSED(arguments) Q_UNUSED(errorMessage) - // Get the primary access point to the workbench. - Core::ICore *core = Core::ICore::instance(); - // Create a unique context for our own view, that will be used for the // menu entry later. Core::Context context("HelloWorld.MainView"); @@ -108,7 +105,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld())); // Register the action with the action manager - Core::ActionManager *actionManager = core->actionManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Command *command = actionManager->registerAction( helloWorldAction, "HelloWorld.HelloWorldAction", context); diff --git a/src/plugins/help/externalhelpwindow.cpp b/src/plugins/help/externalhelpwindow.cpp index a18d97f36d..4287c3d117 100644 --- a/src/plugins/help/externalhelpwindow.cpp +++ b/src/plugins/help/externalhelpwindow.cpp @@ -50,7 +50,7 @@ using namespace Help::Internal; ExternalHelpWindow::ExternalHelpWindow(QWidget *parent) : QMainWindow(parent) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(Help::Constants::ID_MODE_HELP); const QVariant geometry = settings->value(QLatin1String("geometry")); @@ -180,7 +180,7 @@ ExternalHelpWindow::~ExternalHelpWindow() void ExternalHelpWindow::closeEvent(QCloseEvent *event) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(Help::Constants::ID_MODE_HELP); settings->setValue(QLatin1String("geometry"), saveGeometry()); settings->endGroup(); @@ -195,7 +195,7 @@ bool ExternalHelpWindow::eventFilter(QObject *obj, QEvent *event) QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event); switch (keyEvent->key()) { case Qt::Key_Escape: - Core::ICore::instance()->mainWindow()->activateWindow(); + Core::ICore::mainWindow()->activateWindow(); default: break; } diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp index 40153a5e48..9fea831200 100644 --- a/src/plugins/help/generalsettingspage.cpp +++ b/src/plugins/help/generalsettingspage.cpp @@ -201,7 +201,7 @@ void GeneralSettingsPage::apply() m_contextOption = helpOption; manager->setCustomValue(QLatin1String("ContextHelpOption"), helpOption); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(Help::Constants::ID_MODE_HELP); settings->setValue(QLatin1String("ContextHelpOption"), helpOption); settings->endGroup(); diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index f14a721532..3ae648dae9 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -124,7 +124,6 @@ static QToolButton *toolButton(QAction *action) HelpPlugin::HelpPlugin() : m_mode(0), - m_core(0), m_centralWidget(0), m_rightPaneSideBarWidget(0), m_helpViewerForSideBar(0), @@ -151,15 +150,14 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) { Q_UNUSED(arguments) Q_UNUSED(error) - m_core = Core::ICore::instance(); Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context modecontext(Constants::C_MODE_HELP); - const QString &locale = m_core->userInterfaceLanguage(); + const QString &locale = Core::ICore::userInterfaceLanguage(); if (!locale.isEmpty()) { QTranslator *qtr = new QTranslator(this); QTranslator *qhelptr = new QTranslator(this); - const QString &creatorTrPath = Core::ICore::instance()->resourcePath() + const QString &creatorTrPath = Core::ICore::resourcePath() + QLatin1String("/translations"); const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); const QString &trFile = QLatin1String("assistant_") + locale; @@ -202,7 +200,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) // Add Home, Previous and Next actions (used in the toolbar) QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")), tr("Home"), this); - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->registerAction(action, "Help.Home", globalcontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(home())); @@ -410,7 +408,7 @@ void HelpPlugin::extensionsInitialized() ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown() { if (m_sideBar) - m_sideBar->saveSettings(m_core->settings(), QLatin1String("HelpSideBar")); + m_sideBar->saveSettings(Core::ICore::settings(), QLatin1String("HelpSideBar")); delete m_externalWindow; return SynchronousShutdown; @@ -419,7 +417,7 @@ ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown() void HelpPlugin::setupUi() { // side bar widgets and shortcuts - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Context modecontext(Constants::C_MODE_HELP); IndexWindow *indexWindow = new IndexWindow(); @@ -506,7 +504,7 @@ void HelpPlugin::setupUi() m_splitter->insertWidget(0, m_sideBar); m_splitter->setStretchFactor(0, 0); m_splitter->setStretchFactor(1, 1); - m_sideBar->readSettings(m_core->settings(), QLatin1String("HelpSideBar")); + m_sideBar->readSettings(Core::ICore::settings(), QLatin1String("HelpSideBar")); m_splitter->setSizes(QList<int>() << m_sideBar->size().width() << 300); } @@ -598,10 +596,10 @@ void HelpPlugin::createRightPaneContextViewer() Core::IContext *icontext = new Core::IContext(this); icontext->setContext(context); icontext->setWidget(m_helpViewerForSideBar); - m_core->addContextObject(icontext); + Core::ICore::addContextObject(icontext); QAction *copy = new QAction(this); - Core::Command *cmd = m_core->actionManager()->registerAction(copy, + Core::Command *cmd = Core::ICore::actionManager()->registerAction(copy, Core::Constants::COPY, context); copy->setText(cmd->action()->text()); copy->setIcon(cmd->action()->icon()); @@ -617,7 +615,7 @@ void HelpPlugin::createRightPaneContextViewer() connect(m_helpViewerForSideBar, SIGNAL(backwardAvailable(bool)), back, SLOT(setEnabled(bool))); - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); if (Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED)) { // reuse TextEditor constants to avoid a second pair of menu actions QAction *action = new QAction(tr("Increase Font Size"), this); @@ -700,7 +698,7 @@ void HelpPlugin::showExternalWindow() connectExternalHelpWindow(); m_externalWindow->activateWindow(); if (firstTime) - Core::ICore::instance()->mainWindow()->activateWindow(); + Core::ICore::mainWindow()->activateWindow(); } void HelpPlugin::modeChanged(Core::IMode *mode, Core::IMode *old) @@ -880,7 +878,7 @@ void HelpPlugin::activateContext() // Find out what to show QMap<QString, QUrl> links; - if (IContext *context = m_core->currentContextObject()) { + if (IContext *context = Core::ICore::currentContextObject()) { m_idFromContext = context->contextHelpId(); links = Core::HelpManager::instance()->linksForIdentifier(m_idFromContext); if (links.isEmpty()) { @@ -1044,7 +1042,7 @@ Utils::StyledBar *HelpPlugin::createIconToolBar(bool external) tr("Add Bookmark"), toolBar); connect(bookmark, SIGNAL(triggered()), this, SLOT(addBookmark())); } else { - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); home = am->command(Core::Id("Help.Home"))->action(); back = am->command(Core::Id("Help.Previous"))->action(); next = am->command(Core::Id("Help.Next"))->action(); @@ -1243,7 +1241,7 @@ void HelpPlugin::doSetupIfNeeded() int HelpPlugin::contextHelpOption() const { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); const QString key = Help::Constants::ID_MODE_HELP + QLatin1String("/ContextHelpOption"); if (settings->contains(key)) return settings->value(key, Help::Constants::SideBySideIfPossible).toInt(); diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 2ec27c92d2..04f7d0ccd9 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -44,7 +44,6 @@ QT_FORWARD_DECLARE_CLASS(QToolButton) QT_FORWARD_DECLARE_CLASS(QUrl) namespace Core { -class ICore; class IMode; class MiniSplitter; class SideBar; @@ -140,7 +139,6 @@ private: private: HelpMode *m_mode; - Core::ICore *m_core; CentralWidget *m_centralWidget; QWidget *m_rightPaneSideBarWidget; HelpViewer *m_helpViewerForSideBar; diff --git a/src/plugins/help/helpviewer.cpp b/src/plugins/help/helpviewer.cpp index 2460bc931d..13a946e5f9 100644 --- a/src/plugins/help/helpviewer.cpp +++ b/src/plugins/help/helpviewer.cpp @@ -141,7 +141,7 @@ bool HelpViewer::launchWithExternalApp(const QUrl &url) saver.setAutoRemove(false); if (!saver.hasError()) saver.write(helpEngine.fileData(resolvedUrl)); - if (saver.finalize(Core::ICore::instance()->mainWindow())) + if (saver.finalize(Core::ICore::mainWindow())) return QDesktopServices::openUrl(QUrl(saver.fileName())); } } diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index f672f91fcb..8a8a9b73d6 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -172,7 +172,7 @@ void SearchWidget::indexingStarted() { Q_ASSERT(!m_progress); m_progress = new QFutureInterface<void>(); - Core::ICore::instance()->progressManager() ->addTask(m_progress->future(), + Core::ICore::progressManager() ->addTask(m_progress->future(), tr("Indexing"), QLatin1String("Help.Indexer")); m_progress->setProgressRange(0, 2); m_progress->setProgressValueAndText(1, tr("Indexing Documentation...")); diff --git a/src/plugins/imageviewer/imagevieweractionhandler.cpp b/src/plugins/imageviewer/imagevieweractionhandler.cpp index d31b3fd2a3..8a8483e75b 100644 --- a/src/plugins/imageviewer/imagevieweractionhandler.cpp +++ b/src/plugins/imageviewer/imagevieweractionhandler.cpp @@ -109,7 +109,7 @@ void ImageViewerActionHandler::registerNewAction(int actionId, const Core::Id &i const QString &title, const QKeySequence &key) { Core::Context context(Constants::IMAGEVIEWER_ID); - Core::ActionManager *actionManager = Core::ICore::instance()->actionManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); QAction *action = new QAction(title, this); Core::Command *command = actionManager->registerAction(action, id, context); if (command) diff --git a/src/plugins/imageviewer/imageviewerplugin.cpp b/src/plugins/imageviewer/imageviewerplugin.cpp index 5f1ce4a546..cd1cc8c777 100644 --- a/src/plugins/imageviewer/imageviewerplugin.cpp +++ b/src/plugins/imageviewer/imageviewerplugin.cpp @@ -67,8 +67,7 @@ bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorM { Q_UNUSED(arguments) - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/imageviewer/ImageViewer.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/imageviewer/ImageViewer.mimetypes.xml"), errorMessage)) return false; d->factory = new ImageViewerFactory(this); diff --git a/src/plugins/locator/executefilter.cpp b/src/plugins/locator/executefilter.cpp index 7196fe7e67..f3bc002ff9 100644 --- a/src/plugins/locator/executefilter.cpp +++ b/src/plugins/locator/executefilter.cpp @@ -127,9 +127,9 @@ void ExecuteFilter::finished(int exitCode, QProcess::ExitStatus status) { QString log = QLatin1Char('\'') + headCommand() + QLatin1String("' "); if (status == QProcess::NormalExit && exitCode == 0) - ICore::instance()->messageManager()->printToOutputPane(log + tr("finished"), true); + ICore::messageManager()->printToOutputPane(log + tr("finished"), true); else - ICore::instance()->messageManager()->printToOutputPane(log + tr("failed"), true); + ICore::messageManager()->printToOutputPane(log + tr("failed"), true); m_taskQueue.dequeue(); if (!m_taskQueue.isEmpty()) @@ -138,14 +138,14 @@ void ExecuteFilter::finished(int exitCode, QProcess::ExitStatus status) void ExecuteFilter::readStandardOutput() { - const QByteArray data = m_process->readAllStandardOutput(); - ICore::instance()->messageManager()->printToOutputPane(QString::fromLocal8Bit(data), true); + QByteArray data = m_process->readAllStandardOutput(); + ICore::messageManager()->printToOutputPane(QString::fromLocal8Bit(data), true); } void ExecuteFilter::readStandardError() { - const QByteArray data = m_process->readAllStandardError(); - ICore::instance()->messageManager()->printToOutputPane(QString::fromLocal8Bit(data), true); + QByteArray data = m_process->readAllStandardError(); + ICore::messageManager()->printToOutputPane(QString::fromLocal8Bit(data), true); } void ExecuteFilter::runHeadCommand() @@ -155,13 +155,13 @@ void ExecuteFilter::runHeadCommand() const QString fullPath = Utils::Environment::systemEnvironment().searchInPath(d.executable); if (fullPath.isEmpty()) { const QString log = tr("Could not find executable for '%1'").arg(d.executable); - ICore::instance()->messageManager()->printToOutputPane(log, true); + ICore::messageManager()->printToOutputPane(log, true); m_taskQueue.dequeue(); runHeadCommand(); return; } QString log(tr("Starting command '%1'").arg(headCommand())); - ICore::instance()->messageManager()->printToOutputPane(log, true); + ICore::messageManager()->printToOutputPane(log, true); m_process->setWorkingDirectory(d.workingDirectory); m_process->setCommand(fullPath, d.arguments); m_process->start(); diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index 6891a43731..a97d1298e3 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -104,7 +104,6 @@ LocatorPlugin::~LocatorPlugin() bool LocatorPlugin::initialize(const QStringList &, QString *) { - Core::ICore *core = Core::ICore::instance(); m_settingsPage = new SettingsPage(this); addObject(m_settingsPage); @@ -117,22 +116,22 @@ bool LocatorPlugin::initialize(const QStringList &, QString *) addAutoReleasedObject(view); QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); - Core::Command *cmd = core->actionManager() + Core::Command *cmd = Core::ICore::actionManager() ->registerAction(action, "QtCreator.Locate", Core::Context(Core::Constants::C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); updatePlaceholderText(cmd); - Core::ActionContainer *mtools = core->actionManager()->actionContainer(Core::Constants::M_TOOLS); + Core::ActionContainer *mtools = Core::ICore::actionManager()->actionContainer(Core::Constants::M_TOOLS); mtools->addAction(cmd); addObject(new LocatorManager(m_locatorWidget)); - m_openDocumentsFilter = new OpenDocumentsFilter(core->editorManager()); + m_openDocumentsFilter = new OpenDocumentsFilter(Core::ICore::editorManager()); addObject(m_openDocumentsFilter); - m_fileSystemFilter = new FileSystemFilter(core->editorManager(), m_locatorWidget); + m_fileSystemFilter = new FileSystemFilter(Core::ICore::editorManager(), m_locatorWidget); addObject(m_fileSystemFilter); m_executeFilter = new ExecuteFilter(); @@ -140,7 +139,7 @@ bool LocatorPlugin::initialize(const QStringList &, QString *) addAutoReleasedObject(new LocatorFiltersFilter(this, m_locatorWidget)); - connect(core, SIGNAL(coreOpened()), this, SLOT(startSettingsLoad())); + connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(startSettingsLoad())); return true; } @@ -176,14 +175,13 @@ void LocatorPlugin::startSettingsLoad() void LocatorPlugin::loadSettings() { - Core::ICore *core = Core::ICore::instance(); - QSettings *qs = core->settings(); + QSettings *qs = Core::ICore::settings(); // Backwards compatibility to old settings location if (qs->contains(QLatin1String("QuickOpen/FiltersFilter"))) { loadSettingsHelper(qs); } else { - Core::SettingsDatabase *settings = core->settingsDatabase(); + Core::SettingsDatabase *settings = Core::ICore::settingsDatabase(); loadSettingsHelper(settings); } @@ -200,9 +198,8 @@ void LocatorPlugin::settingsLoaded() void LocatorPlugin::saveSettings() { - Core::ICore *core = Core::ICore::instance(); - if (core && core->settingsDatabase()) { - Core::SettingsDatabase *s = core->settingsDatabase(); + if (Core::ICore::instance() && Core::ICore::settingsDatabase()) { + Core::SettingsDatabase *s = Core::ICore::settingsDatabase(); s->beginGroup(QLatin1String("QuickOpen")); s->remove(QString()); s->setValue(QLatin1String("RefreshInterval"), refreshInterval()); @@ -275,9 +272,8 @@ void LocatorPlugin::refresh(QList<ILocatorFilter*> filters) if (filters.isEmpty()) filters = m_filters; QFuture<void> task = QtConcurrent::run(&ILocatorFilter::refresh, filters); - Core::FutureProgress *progress = Core::ICore::instance() - ->progressManager()->addTask(task, tr("Indexing"), - QLatin1String(Locator::Constants::TASK_INDEX)); + Core::FutureProgress *progress = Core::ICore::progressManager() + ->addTask(task, tr("Indexing"), QLatin1String(Locator::Constants::TASK_INDEX)); connect(progress, SIGNAL(finished()), this, SLOT(saveSettings())); } diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index 7550acbf80..fc2428068d 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -362,7 +362,7 @@ void LocatorWidget::updateFilterList() m_filterMenu->clear(); // update actions and menu - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QMap<QString, QAction *> actionCopy = m_filterActionMap; m_filterActionMap.clear(); // register new actions, update existent @@ -661,6 +661,6 @@ void LocatorWidget::showEvent(QShowEvent *event) void LocatorWidget::showConfigureDialog() { - Core::ICore::instance()->showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE), + Core::ICore::showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE), QLatin1String(Constants::FILTER_OPTIONS_PAGE)); } diff --git a/src/plugins/macros/actionmacrohandler.cpp b/src/plugins/macros/actionmacrohandler.cpp index 8253527b55..3a009adbf1 100644 --- a/src/plugins/macros/actionmacrohandler.cpp +++ b/src/plugins/macros/actionmacrohandler.cpp @@ -64,8 +64,7 @@ ActionMacroHandler::ActionMacroHandler(): connect(m_mapper, SIGNAL(mapped(const QString &)), this, SLOT(addActionEvent(const QString &))); - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); connect(am, SIGNAL(commandAdded(QString)), this, SLOT(addCommand(QString))); @@ -86,8 +85,7 @@ bool ActionMacroHandler::canExecuteEvent(const MacroEvent ¯oEvent) bool ActionMacroHandler::executeEvent(const MacroEvent ¯oEvent) { - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); QAction *action = am->command(Core::Id(macroEvent.value(ACTIONNAME).toString()))->action(); if (!action) @@ -102,8 +100,7 @@ void ActionMacroHandler::addActionEvent(const QString &id) if (!isRecording()) return; - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); const Core::Command *cmd = am->command(Core::Id(id)); if (cmd->isScriptable(cmd->context())) { MacroEvent e; @@ -117,8 +114,7 @@ void ActionMacroHandler::registerCommand(const QString &id) { if (!m_commandIds.contains(id)) { m_commandIds.insert(id); - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); QAction* action = am->command(Core::Id(id))->action(); if (action) { connect(action, SIGNAL(triggered()), m_mapper, SLOT(map())); @@ -135,8 +131,7 @@ void ActionMacroHandler::registerCommand(const QString &id) void ActionMacroHandler::addCommand(const QString &id) { - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); if (am->command(Core::Id(id))->isScriptable()) registerCommand(id); } diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index 2c3ef74860..0951f08599 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -163,9 +163,8 @@ void MacroManager::MacroManagerPrivate::addMacro(Macro *macro) { // Add sortcut Core::Context context(TextEditor::Constants::C_TEXTEDITOR); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); - QShortcut *shortcut = new QShortcut(core->mainWindow()); + Core::ActionManager *am = Core::ICore::actionManager(); + QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow()); shortcut->setWhatsThis(macro->description()); const Core::Id macroId(QLatin1String(Constants::PREFIX_MACRO) + macro->displayName()); am->registerShortcut(shortcut, macroId, context); @@ -181,8 +180,7 @@ void MacroManager::MacroManagerPrivate::removeMacro(const QString &name) if (!macros.contains(name)) return; // Remove shortcut - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->unregisterShortcut(Core::Id(Constants::PREFIX_MACRO+name)); // Remove macro from the map @@ -195,11 +193,10 @@ void MacroManager::MacroManagerPrivate::changeMacroDescription(Macro *macro, con if (!macro->load()) return; macro->setDescription(description); - macro->save(macro->fileName(), Core::ICore::instance()->mainWindow()); + macro->save(macro->fileName(), Core::ICore::mainWindow()); // Change shortcut what's this - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+macro->displayName())); if (command && command->shortcut()) @@ -222,7 +219,7 @@ bool MacroManager::MacroManagerPrivate::executeMacro(Macro *macro) } if (error) { - QMessageBox::warning(Core::ICore::instance()->mainWindow(), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Playing Macro"), tr("An error occurred while replaying the macro, execution stopped.")); } @@ -238,7 +235,7 @@ bool MacroManager::MacroManagerPrivate::executeMacro(Macro *macro) void MacroManager::MacroManagerPrivate::showSaveDialog() { - QMainWindow *mainWindow = Core::ICore::instance()->mainWindow(); + QMainWindow *mainWindow = Core::ICore::mainWindow(); SaveDialog dialog(mainWindow); if (dialog.exec()) { if (dialog.name().isEmpty()) @@ -288,7 +285,7 @@ void MacroManager::startMacro() delete d->currentMacro; d->currentMacro = new Macro; - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(Constants::START_MACRO)->action()->setEnabled(false); am->command(Constants::END_MACRO)->action()->setEnabled(true); am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); @@ -310,7 +307,7 @@ void MacroManager::endMacro() { Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER)); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(Constants::START_MACRO)->action()->setEnabled(true); am->command(Constants::END_MACRO)->action()->setEnabled(false); am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); @@ -327,7 +324,7 @@ void MacroManager::executeLastMacro() return; // make sure the macro doesn't accidentally invoke a macro action - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(Constants::START_MACRO)->action()->setEnabled(false); am->command(Constants::END_MACRO)->action()->setEnabled(false); am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); @@ -356,7 +353,7 @@ bool MacroManager::executeMacro(const QString &name) delete d->currentMacro; d->currentMacro = macro; - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); return true; @@ -407,7 +404,7 @@ void Macros::MacroManager::saveLastMacro() QString Macros::MacroManager::macrosDirectory() const { const QString &path = - Core::ICore::instance()->userResourcePath() + QLatin1String("/macros"); + Core::ICore::userResourcePath() + QLatin1String("/macros"); if (QFile::exists(path) || QDir().mkpath(path)) return path; return QString(); diff --git a/src/plugins/macros/macrooptionswidget.cpp b/src/plugins/macros/macrooptionswidget.cpp index 00e255653e..7154071b90 100644 --- a/src/plugins/macros/macrooptionswidget.cpp +++ b/src/plugins/macros/macrooptionswidget.cpp @@ -102,8 +102,7 @@ void MacroOptionsWidget::initialize() void MacroOptionsWidget::createTable() { QDir dir(MacroManager::instance()->macrosDirectory()); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QMapIterator<QString, Macro *> it(MacroManager::instance()->macros()); while (it.hasNext()) { diff --git a/src/plugins/macros/macrosplugin.cpp b/src/plugins/macros/macrosplugin.cpp index 7d9962342c..d29d02a79e 100644 --- a/src/plugins/macros/macrosplugin.cpp +++ b/src/plugins/macros/macrosplugin.cpp @@ -72,8 +72,7 @@ bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessag addAutoReleasedObject(new MacroOptionsPage); addAutoReleasedObject(new MacroLocatorFilter); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR); diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp index 22073930fa..11d58f3e80 100644 --- a/src/plugins/macros/texteditormacrohandler.cpp +++ b/src/plugins/macros/texteditormacrohandler.cpp @@ -78,7 +78,7 @@ void TextEditorMacroHandler::startRecording(Macros::Macro *macro) m_currentEditor->widget()->installEventFilter(this); // Block completion - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(true); } @@ -89,7 +89,7 @@ void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro) IMacroHandler::endRecordingMacro(macro); // Unblock completion - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(false); } diff --git a/src/plugins/madde/maemoqemumanager.cpp b/src/plugins/madde/maemoqemumanager.cpp index c659b4cefe..47ed28c791 100644 --- a/src/plugins/madde/maemoqemumanager.cpp +++ b/src/plugins/madde/maemoqemumanager.cpp @@ -97,8 +97,7 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent) m_qemuAction->setToolTip(tr("Start MeeGo Emulator")); connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime())); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *actionManager = core->actionManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Command *qemuCommand = actionManager->registerAction(m_qemuAction, "MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL)); qemuCommand->setAttribute(Core::Command::CA_UpdateText); diff --git a/src/plugins/madde/maemoqemusettings.cpp b/src/plugins/madde/maemoqemusettings.cpp index 5ab3841415..b63ebbefa4 100644 --- a/src/plugins/madde/maemoqemusettings.cpp +++ b/src/plugins/madde/maemoqemusettings.cpp @@ -45,7 +45,7 @@ const QString OpenGlModeKey = QLatin1String("OpenGl Mode"); MaemoQemuSettings::OpenGlMode MaemoQemuSettings::openGlMode() { if (!m_initialized) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); m_openGlMode = static_cast<OpenGlMode>(settings->value(OpenGlModeKey, AutoDetect).toInt()); settings->endGroup(); @@ -58,7 +58,7 @@ void MaemoQemuSettings::setOpenGlMode(OpenGlMode openGlMode) { Q_ASSERT(m_initialized); m_openGlMode = openGlMode; - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); settings->setValue(OpenGlModeKey, m_openGlMode); settings->endGroup(); diff --git a/src/plugins/madde/maemosettingspages.cpp b/src/plugins/madde/maemosettingspages.cpp index f57447d67d..e7ef8a401e 100644 --- a/src/plugins/madde/maemosettingspages.cpp +++ b/src/plugins/madde/maemosettingspages.cpp @@ -93,7 +93,7 @@ public: private: Q_SLOT void showSettingsPage() { - Core::ICore::instance()->showOptionsDialog(MaemoQemuSettingsPage::pageCategory(), + Core::ICore::showOptionsDialog(MaemoQemuSettingsPage::pageCategory(), MaemoQemuSettingsPage::pageId()); accept(); } @@ -158,7 +158,7 @@ void MaemoQemuSettingsPage::finish() void MaemoQemuSettingsPage::showQemuCrashDialog() { - MaemoQemuCrashDialog dlg(Core::ICore::instance()->mainWindow()); + MaemoQemuCrashDialog dlg(Core::ICore::mainWindow()); dlg.exec(); } diff --git a/src/plugins/madde/qt4maemotarget.cpp b/src/plugins/madde/qt4maemotarget.cpp index e7072ece73..9d3525ecd5 100644 --- a/src/plugins/madde/qt4maemotarget.cpp +++ b/src/plugins/madde/qt4maemotarget.cpp @@ -284,7 +284,7 @@ void AbstractQt4MaemoTarget::handleTargetAdded(ProjectExplorer::Target *target) if (!files.isEmpty()) { const QString list = QLatin1String("<ul><li>") + files.join(QLatin1String("</li><li>")) + QLatin1String("</li></ul>"); - QMessageBox::StandardButton button = QMessageBox::question(Core::ICore::instance()->mainWindow(), + QMessageBox::StandardButton button = QMessageBox::question(Core::ICore::mainWindow(), tr("Add Packaging Files to Project"), tr("<html>Qt Creator has set up the following files to enable " "packaging:\n %1\nDo you want to add them to the project?</html>") @@ -306,8 +306,7 @@ void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *ta if (!targetCanBeRemoved()) return; - Core::ICore * const core = Core::ICore::instance(); - const int answer = QMessageBox::warning(core->mainWindow(), + const int answer = QMessageBox::warning(Core::ICore::mainWindow(), tr("Qt Creator"), tr("Do you want to remove the packaging file(s) " "associated with the target '%1'?").arg(displayName()), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); @@ -317,7 +316,7 @@ void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *ta if (!pkgFilePaths.isEmpty()) { project()->rootProjectNode()->removeFiles(ProjectExplorer::UnknownFileType, pkgFilePaths); - Core::IVersionControl * const vcs = core->vcsManager() + Core::IVersionControl * const vcs = Core::ICore::vcsManager() ->findVersionControlForDirectory(QFileInfo(pkgFilePaths.first()).dir().path()); if (vcs && vcs->supportsOperation(Core::IVersionControl::DeleteOperation)) { foreach (const QString &filePath, pkgFilePaths) @@ -1187,7 +1186,7 @@ void Qt4HarmattanTarget::handleTargetAddedSpecial() return; Utils::FileReader reader; - if (!reader.fetch(Core::ICore::instance()->resourcePath() + if (!reader.fetch(Core::ICore::resourcePath() + QLatin1String("/templates/shared/") + aegisManifestFileName())) { qDebug("Reading manifest template failed."); return; diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index c9f884fcd8..98eac3ee23 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -153,8 +153,7 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * m_client = new MercurialClient(&mercurialSettings); initializeVcs(new MercurialControl(m_client)); - core = Core::ICore::instance(); - actionManager = core->actionManager(); + actionManager = Core::ICore::actionManager(); optionsPage = new OptionsPage(); addAutoReleasedObject(optionsPage); diff --git a/src/plugins/mercurial/optionspage.cpp b/src/plugins/mercurial/optionspage.cpp index 2e7587a435..e212435d24 100644 --- a/src/plugins/mercurial/optionspage.cpp +++ b/src/plugins/mercurial/optionspage.cpp @@ -125,7 +125,7 @@ void OptionsPage::apply() if (newSettings != plugin->settings()) { //assume success and emit signal that settings are changed; plugin->setSettings(newSettings); - newSettings.writeSettings(Core::ICore::instance()->settings()); + newSettings.writeSettings(Core::ICore::settings()); emit settingsChanged(); } } diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index dd46dcae74..3414d8ef2f 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -237,12 +237,11 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er initializeVcs(new PerforceVersionControl(this)); - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage)) return false; m_perforcePluginInstance = this; - if (QSettings *settings = core->settings()) + if (QSettings *settings = Core::ICore::settings()) m_settings.fromSettings(settings); addAutoReleasedObject(new SettingsPage); @@ -260,7 +259,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er addAutoReleasedObject(m_commandLocator); //register actions - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); @@ -693,7 +692,7 @@ Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, void PerforcePlugin::printPendingChanges() { qApp->setOverrideCursor(Qt::WaitCursor); - PendingChangesDialog dia(pendingChangesData(), Core::ICore::instance()->mainWindow()); + PendingChangesDialog dia(pendingChangesData(), Core::ICore::mainWindow()); qApp->restoreOverrideCursor(); if (dia.exec() == QDialog::Accepted) { const int i = dia.changeNumber(); @@ -1370,9 +1369,9 @@ bool PerforcePlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *subm // Set without triggering the checking mechanism if (wantsPrompt != m_settings.promptToSubmit()) { m_settings.setPromptToSubmit(wantsPrompt); - m_settings.toSettings(Core::ICore::instance()->settings()); + m_settings.toSettings(Core::ICore::settings()); } - if (!Core::ICore::instance()->fileManager()->saveFile(fileIFace)) + if (!Core::ICore::fileManager()->saveFile(fileIFace)) return false; if (answer == VcsBase::VcsBaseSubmitEditor::SubmitDiscarded) { cleanCommitMessageFile(); @@ -1458,7 +1457,7 @@ void PerforcePlugin::setSettings(const Settings &newSettings) if (newSettings != m_settings.settings()) { m_settings.setSettings(newSettings); m_managedDirectoryCache.clear(); - m_settings.toSettings(Core::ICore::instance()->settings()); + m_settings.toSettings(Core::ICore::settings()); getTopLevel(); perforceVersionControl()->emitConfigurationChanged(); } diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index f3e032fb11..ecce22b759 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -111,7 +111,7 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent) this, SLOT(bringToForeground())); #ifdef Q_OS_UNIX - d->m_consoleProcess.setSettings(Core::ICore::instance()->settings()); + d->m_consoleProcess.setSettings(Core::ICore::settings()); #endif connect(&d->m_consoleProcess, SIGNAL(processStarted()), this, SIGNAL(processStarted())); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 7d7fac9371..9de4a9fa94 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -133,7 +133,7 @@ AppOutputPane::AppOutputPane() : this, SLOT(reRunRunControl())); // Stop - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Context globalcontext(Core::Constants::C_GLOBAL); QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); diff --git a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp index 8c615b1a2c..caf3f128e1 100644 --- a/src/plugins/projectexplorer/baseprojectwizarddialog.cpp +++ b/src/plugins/projectexplorer/baseprojectwizarddialog.cpp @@ -129,7 +129,7 @@ void BaseProjectWizardDialog::slotAccepted() { if (d->introPage->useAsDefaultPath()) { // Store the path as default path for new projects if desired. - Core::FileManager *fm = Core::ICore::instance()->fileManager(); + Core::FileManager *fm = Core::ICore::fileManager(); fm->setProjectsDirectory(path()); fm->setUseProjectsDirectory(true); } diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index e03cadfdf4..f9c3ca50b8 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -242,7 +242,7 @@ void BuildManager::cancel() void BuildManager::updateTaskCount() { - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::progressManager(); const int errors = getErrorTaskCount(); if (errors > 0) { progressManager->setApplicationLabel(QString::number(errors)); @@ -254,7 +254,7 @@ void BuildManager::updateTaskCount() void BuildManager::finish() { - QApplication::alert(Core::ICore::instance()->mainWindow(), 3000); + QApplication::alert(Core::ICore::mainWindow(), 3000); } void BuildManager::emitCancelMessage() @@ -318,7 +318,7 @@ void BuildManager::startBuildQueue() } if (!d->m_running) { // Progress Reporting - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::progressManager(); d->m_progressFutureInterface = new QFutureInterface<void>; d->m_progressWatcher.setFuture(d->m_progressFutureInterface->future()); d->m_outputWindow->clearContents(); diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index f2d861830c..c4b52d8b6c 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -297,7 +297,7 @@ void BuildStepListWidget::triggerStepMoveDown(int pos) void BuildStepListWidget::triggerRemoveBuildStep(int pos) { if (!m_buildStepList->removeStep(pos)) { - QMessageBox::warning(Core::ICore::instance()->mainWindow(), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Removing Step failed"), tr("Cannot remove build step while building"), QMessageBox::Ok, QMessageBox::Ok); diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 8dc30c72d8..0ff16117a8 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -131,7 +131,7 @@ QString CustomExecutableRunConfiguration::executable() const CustomExecutableRunConfiguration *that = const_cast<CustomExecutableRunConfiguration *>(this); QWidget *confWidget = that->createConfigurationWidget(); confWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - QDialog dialog(Core::ICore::instance()->mainWindow()); + QDialog dialog(Core::ICore::mainWindow()); dialog.setWindowTitle(displayName()); dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint); dialog.setLayout(new QVBoxLayout()); diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index 5183cc7d33..245f2b8d43 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -420,11 +420,11 @@ QList<CustomWizard*> CustomWizard::createWizards() QList<CustomWizard*> rc; QString errorMessage; QString verboseLog; - const QString templateDirName = Core::ICore::instance()->resourcePath() + + const QString templateDirName = Core::ICore::resourcePath() + QLatin1Char('/') + QLatin1String(templatePathC); - const QString userTemplateDirName = Core::ICore::instance()->userResourcePath() + + const QString userTemplateDirName = Core::ICore::userResourcePath() + QLatin1Char('/') + QLatin1String(templatePathC); @@ -493,7 +493,7 @@ QList<CustomWizard*> CustomWizard::createWizards() if (CustomWizardPrivate::verbose) { // Print to output pane for Windows. verboseLog += listWizards(); qWarning("%s", qPrintable(verboseLog)); - Core::ICore::instance()->messageManager()->printToOutputPanePopup(verboseLog); + Core::ICore::messageManager()->printToOutputPanePopup(verboseLog); } return rc; } diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 265c38c084..d583d0a9c0 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -540,7 +540,7 @@ static inline QString attributeValue(const QXmlStreamReader &r, const char *name // Return locale language attribute "de_UTF8" -> "de", empty string for "C" static inline QString languageSetting() { - QString name = Core::ICore::instance()->userInterfaceLanguage(); + QString name = Core::ICore::userInterfaceLanguage(); const int underScorePos = name.indexOf(QLatin1Char('_')); if (underScorePos != -1) name.truncate(underScorePos); @@ -985,7 +985,7 @@ void CustomWizardContext::reset() { // Basic replacement fields: Suffixes. baseReplacements.clear(); - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); baseReplacements.insert(QLatin1String("CppSourceSuffix"), mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE))); baseReplacements.insert(QLatin1String("CppHeaderSuffix"), diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp index 65d5054258..8a8d2972cb 100644 --- a/src/plugins/projectexplorer/debugginghelper.cpp +++ b/src/plugins/projectexplorer/debugginghelper.cpp @@ -70,7 +70,7 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QStr static QString sourcePath() { - return Core::ICore::instance()->resourcePath() + QLatin1String("/dumper/"); + return Core::ICore::resourcePath() + QLatin1String("/dumper/"); } static QStringList sourceFileNames() diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 4a54fa21c4..0530d23901 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -187,7 +187,7 @@ void FolderNavigationWidget::setAutoSynchronization(bool sync) m_autoSync = sync; - Core::FileManager *fileManager = Core::ICore::instance()->fileManager(); + Core::FileManager *fileManager = Core::ICore::fileManager(); if (m_autoSync) { connect(fileManager, SIGNAL(currentFileChanged(QString)), this, SLOT(setCurrentFile(QString))); diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index f371136345..fef03fb131 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -164,8 +164,8 @@ QSize ListWidget::sizeHint() const // We try to keep the height of the popup equal to the actionbar QSize size(width, height); - static QStatusBar *statusBar = Core::ICore::instance()->statusBar(); - static QWidget *actionBar = Core::ICore::instance()->mainWindow()->findChild<QWidget*>(QLatin1String("actionbar")); + static QStatusBar *statusBar = Core::ICore::statusBar(); + static QWidget *actionBar = Core::ICore::mainWindow()->findChild<QWidget*>(QLatin1String("actionbar")); Q_ASSERT(actionBar); QMargins popupMargins = window()->contentsMargins(); @@ -933,7 +933,7 @@ void MiniProjectTargetSelector::updateSeparatorVisible() void MiniProjectTargetSelector::setVisible(bool visible) { if (visible) { - QStatusBar *statusBar = Core::ICore::instance()->statusBar(); + QStatusBar *statusBar = Core::ICore::statusBar(); QPoint moveTo = statusBar->mapToGlobal(QPoint(0,0)); moveTo -= QPoint(0, sizeHint().height()); move(moveTo); @@ -990,8 +990,8 @@ void MiniProjectTargetSelector::keyReleaseEvent(QKeyEvent *ke) QSize MiniProjectTargetSelector::sizeHint() const { - static QStatusBar *statusBar = Core::ICore::instance()->statusBar(); - static QWidget *actionBar = Core::ICore::instance()->mainWindow()->findChild<QWidget*>(QLatin1String("actionbar")); + static QStatusBar *statusBar = Core::ICore::statusBar(); + static QWidget *actionBar = Core::ICore::mainWindow()->findChild<QWidget*>(QLatin1String("actionbar")); Q_ASSERT(actionBar); int alignedWithActionHeight diff --git a/src/plugins/projectexplorer/pluginfilefactory.cpp b/src/plugins/projectexplorer/pluginfilefactory.cpp index e7f3151bfc..0834dba6b3 100644 --- a/src/plugins/projectexplorer/pluginfilefactory.cpp +++ b/src/plugins/projectexplorer/pluginfilefactory.cpp @@ -98,7 +98,7 @@ QList<ProjectFileFactory *> ProjectFileFactory::createFactories(QString *filterS if (!filterString->isEmpty()) *filterString += filterSeparator; const QString mimeType = manager->mimeType(); - Core::MimeType mime = Core::ICore::instance()->mimeDatabase()->findByType(mimeType); + Core::MimeType mime = Core::ICore::mimeDatabase()->findByType(mimeType); const QString pFilterString = mime.filterString(); allGlobPatterns.append(mime.globPatterns()); *filterString += pFilterString; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 73810342bb..ac1fc6508d 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -328,15 +328,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new TaskHub); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); - connect(core, SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards())); + Core::ActionManager *am = Core::ICore::actionManager(); + connect(Core::ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards())); d->m_welcomePage = new ProjectWelcomePage; connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager())); addObject(d->m_welcomePage); - connect(core->fileManager(), SIGNAL(currentFileChanged(QString)), + connect(Core::ICore::fileManager(), SIGNAL(currentFileChanged(QString)), this, SLOT(setCurrentFile(QString))); d->m_session = new SessionManager(this); @@ -491,7 +490,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er msubProjectContextMenu->appendGroup(Constants::G_PROJECT_LAST); msubProjectContextMenu->appendGroup(Constants::G_PROJECT_TREE); - Core::ActionContainer *runMenu = Core::ICore::instance()->actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU); + Core::ActionContainer *runMenu = Core::ICore::actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU); runMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); QIcon runIcon = QIcon(QLatin1String(Constants::ICON_RUN)); runIcon.addFile(QLatin1String(Constants::ICON_RUN_SMALL)); @@ -884,7 +883,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_projectSelectorAction = new QAction(this); d->m_projectSelectorAction->setCheckable(true); d->m_projectSelectorAction->setEnabled(false); - QWidget *mainWindow = Core::ICore::instance()->mainWindow(); + QWidget *mainWindow = Core::ICore::mainWindow(); d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, d->m_session, mainWindow); connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show())); Core::ModeManager::instance()->addProjectSelector(d->m_projectSelectorAction); @@ -904,14 +903,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er cmd = am->registerAction(d->m_projectSelectorActionQuick, ProjectExplorer::Constants::SELECTTARGETQUICK, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T"))); - connect(core, SIGNAL(saveSettingsRequested()), + connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(savePersistentSettings())); addAutoReleasedObject(new ProjectTreeWidgetFactory); addAutoReleasedObject(new FolderNavigationWidgetFactory); addAutoReleasedObject(new DeployConfigurationFactory); - if (QSettings *s = core->settings()) { + if (QSettings *s = Core::ICore::settings()) { const QStringList fileNames = s->value(QLatin1String("ProjectExplorer/RecentProjects/FileNames")).toStringList(); const QStringList displayNames = @@ -924,7 +923,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er } } - if (QSettings *s = core->settings()) { + if (QSettings *s = Core::ICore::settings()) { d->m_projectExplorerSettings.buildBeforeDeploy = s->value(QLatin1String("ProjectExplorer/Settings/BuildBeforeDeploy"), true).toBool(); d->m_projectExplorerSettings.deployBeforeRun = @@ -1045,7 +1044,7 @@ void ProjectExplorerPlugin::loadAction() openProject(filename, &errorMessage); if (!errorMessage.isEmpty()) - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Failed to open project"), errorMessage); + QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); updateActions(); } @@ -1085,9 +1084,9 @@ void ProjectExplorerPlugin::unloadProject() bool success = false; if (readonlycount > 0) - success = Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave).isEmpty(); + success = Core::ICore::fileManager()->saveModifiedFiles(filesToSave).isEmpty(); else - success = Core::ICore::instance()->fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty(); + success = Core::ICore::fileManager()->saveModifiedFilesSilently(filesToSave).isEmpty(); if (!success) return; @@ -1176,7 +1175,7 @@ void ProjectExplorerPlugin::newProject() if (debug) qDebug() << "ProjectExplorerPlugin::newProject"; - Core::ICore::instance()->showNewItemDialog(tr("New Project", "Title of dialog"), + Core::ICore::showNewItemDialog(tr("New Project", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard)); updateActions(); } @@ -1191,7 +1190,7 @@ void ProjectExplorerPlugin::showSessionManager() } else { d->m_session->save(); } - SessionDialog sessionDialog(d->m_session, Core::ICore::instance()->mainWindow()); + SessionDialog sessionDialog(d->m_session, Core::ICore::mainWindow()); sessionDialog.setAutoLoadSession(d->m_projectExplorerSettings.autorestoreLastSession); sessionDialog.exec(); d->m_projectExplorerSettings.autorestoreLastSession = sessionDialog.autoLoadSession(); @@ -1242,7 +1241,7 @@ void ProjectExplorerPlugin::savePersistentSettings() d->m_session->save(); } - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); if (s) { s->setValue(QLatin1String("ProjectExplorer/StartupSession"), d->m_session->currentSession()); s->remove(QLatin1String("ProjectExplorer/RecentProjects/Files")); @@ -1281,7 +1280,7 @@ void ProjectExplorerPlugin::openProjectWelcomePage(const QString &fileName) QString errorMessage; openProject(fileName, &errorMessage); if (!errorMessage.isEmpty()) - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Failed to open project"), errorMessage); + QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); } bool ProjectExplorerPlugin::openProject(const QString &fileName, QString *errorString) @@ -1313,7 +1312,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName QList<Project*> openedPro; foreach (const QString &fileName, fileNames) { - if (const Core::MimeType mt = Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName))) { + if (const Core::MimeType mt = Core::ICore::mimeDatabase()->findByFile(QFileInfo(fileName))) { foreach (IProjectManager *manager, projectManagers) { if (manager->mimeType() == mt.type()) { QString tmp; @@ -1481,7 +1480,7 @@ void ProjectExplorerPlugin::restoreSession() } } - Core::ICore::instance()->openFiles(combinedList, Core::ICore::OpenFilesFlags(Core::ICore::CanContainLineNumbers | Core::ICore::SwitchMode)); + Core::ICore::openFiles(combinedList, Core::ICore::OpenFilesFlags(Core::ICore::CanContainLineNumbers | Core::ICore::SwitchMode)); updateActions(); } @@ -1592,7 +1591,7 @@ void ProjectExplorerPlugin::buildQueueFinished(bool success) bool ignoreErrors = true; if (d->m_delayedRunConfiguration && success && d->m_buildManager->getErrorTaskCount() > 0) { - ignoreErrors = QMessageBox::question(Core::ICore::instance()->mainWindow(), + ignoreErrors = QMessageBox::question(Core::ICore::mainWindow(), tr("Ignore all errors?"), tr("Found some build errors in current task.\n" "Do you want to ignore them?"), @@ -1621,8 +1620,6 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node else node = d->m_session->nodeForFile(filePath, project); - Core::ICore *core = Core::ICore::instance(); - bool projectChanged = false; if (d->m_currentProject != project) { Core::Context oldContext; @@ -1637,7 +1634,7 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node newContext.add(project->projectLanguage()); } - core->updateAdditionalContexts(oldContext, newContext); + Core::ICore::updateAdditionalContexts(oldContext, newContext); d->m_currentProject = project; @@ -1658,7 +1655,7 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node updateActions(); } - core->fileManager()->setCurrentFile(filePath); + Core::ICore::fileManager()->setCurrentFile(filePath); } void ProjectExplorerPlugin::updateActions() @@ -1756,18 +1753,18 @@ bool ProjectExplorerPlugin::saveModifiedFiles() if (debug) qDebug() << "ProjectExplorerPlugin::saveModifiedFiles"; - QList<Core::IFile *> filesToSave = Core::ICore::instance()->fileManager()->modifiedFiles(); + QList<Core::IFile *> filesToSave = Core::ICore::fileManager()->modifiedFiles(); if (!filesToSave.isEmpty()) { if (d->m_projectExplorerSettings.saveBeforeBuild) { bool cancelled = false; - Core::ICore::instance()->fileManager()->saveModifiedFilesSilently(filesToSave, &cancelled); + Core::ICore::fileManager()->saveModifiedFilesSilently(filesToSave, &cancelled); if (cancelled) return false; } else { bool cancelled = false; bool alwaysSave = false; - Core::FileManager *fm = Core::ICore::instance()->fileManager(); + Core::FileManager *fm = Core::ICore::fileManager(); fm->saveModifiedFiles(filesToSave, &cancelled, QString(), tr("Always save files before build"), &alwaysSave); @@ -2370,7 +2367,7 @@ void ProjectExplorerPlugin::updateRecentProjectMenu() qDebug() << "ProjectExplorerPlugin::updateRecentProjectMenu"; Core::ActionContainer *aci = - Core::ICore::instance()->actionManager()->actionContainer(Constants::M_RECENTPROJECTS); + Core::ICore::actionManager()->actionContainer(Constants::M_RECENTPROJECTS); QMenu *menu = aci->menu(); menu->clear(); @@ -2417,7 +2414,7 @@ void ProjectExplorerPlugin::openRecentProject() QString errorMessage; openProject(fileName, &errorMessage); if (!errorMessage.isEmpty()) - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Failed to open project"), errorMessage); + QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); } } @@ -2452,7 +2449,7 @@ void ProjectExplorerPlugin::updateContextMenuActions() d->m_deleteFileAction->setVisible(true); d->m_runActionContextMenu->setVisible(false); - Core::ActionContainer *runMenu = Core::ICore::instance()->actionManager()->actionContainer(Constants::RUNMENUCONTEXTMENU); + Core::ActionContainer *runMenu = Core::ICore::actionManager()->actionContainer(Constants::RUNMENUCONTEXTMENU); runMenu->menu()->clear(); if (d->m_currentNode && d->m_currentNode->projectNode()) { @@ -2548,7 +2545,7 @@ void ProjectExplorerPlugin::addNewFile() QTC_ASSERT(d->m_currentNode, return) QString location = directoryFor(d->m_currentNode); - Core::ICore::instance()->showNewItemDialog(tr("New File", "Title of dialog"), + Core::ICore::showNewItemDialog(tr("New File", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::FileWizard) + Core::IWizard::wizardsOfKind(Core::IWizard::ClassWizard), location); @@ -2562,7 +2559,7 @@ void ProjectExplorerPlugin::addNewSubproject() if (d->m_currentNode->nodeType() == ProjectNodeType && d->m_currentNode->projectNode()->supportedActions( d->m_currentNode->projectNode()).contains(ProjectNode::AddSubProject)) { - Core::ICore::instance()->showNewItemDialog(tr("New Subproject", "Title of dialog"), + Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard), location); } @@ -2572,7 +2569,7 @@ void ProjectExplorerPlugin::addExistingFiles() { QTC_ASSERT(d->m_currentNode, return) - QStringList fileNames = QFileDialog::getOpenFileNames(Core::ICore::instance()->mainWindow(), + QStringList fileNames = QFileDialog::getOpenFileNames(Core::ICore::mainWindow(), tr("Add Existing Files"), directoryFor(d->m_currentNode)); if (fileNames.isEmpty()) return; @@ -2587,12 +2584,11 @@ void ProjectExplorerPlugin::addExistingFiles(const QStringList &filePaths) void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QStringList &filePaths) { - Core::ICore *core = Core::ICore::instance(); const QString dir = directoryFor(projectNode); QStringList fileNames = filePaths; QHash<FileType, QString> fileTypeToFiles; foreach (const QString &fileName, fileNames) { - FileType fileType = typeForFileName(core->mimeDatabase(), QFileInfo(fileName)); + FileType fileType = typeForFileName(Core::ICore::mimeDatabase(), QFileInfo(fileName)); fileTypeToFiles.insertMulti(fileType, fileName); } @@ -2603,17 +2599,17 @@ void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QSt if (!notAdded.isEmpty()) { QString message = tr("Could not add following files to project %1:\n").arg(projectNode->displayName()); QString files = notAdded.join(QString(QLatin1Char('\n'))); - QMessageBox::warning(core->mainWindow(), tr("Adding Files to Project Failed"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Adding Files to Project Failed"), message + files); foreach (const QString &file, notAdded) fileNames.removeOne(file); } - if (Core::IVersionControl *vcManager = core->vcsManager()->findVersionControlForDirectory(dir)) + if (Core::IVersionControl *vcManager = Core::ICore::vcsManager()->findVersionControlForDirectory(dir)) if (vcManager->supportsOperation(Core::IVersionControl::AddOperation)) { const QString files = fileNames.join(QString(QLatin1Char('\n'))); QMessageBox::StandardButton button = - QMessageBox::question(core->mainWindow(), tr("Add to Version Control"), + QMessageBox::question(Core::ICore::mainWindow(), tr("Add to Version Control"), tr("Add files\n%1\nto version control (%2)?").arg(files, vcManager->displayName()), QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { @@ -2626,7 +2622,7 @@ void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QSt if (!notAddedToVc.isEmpty()) { const QString message = tr("Could not add following files to version control (%1)\n").arg(vcManager->displayName()); const QString filesNotAdded = notAddedToVc.join(QString(QLatin1Char('\n'))); - QMessageBox::warning(core->mainWindow(), tr("Adding to Version Control Failed"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Adding to Version Control Failed"), message + filesNotAdded); } } @@ -2638,8 +2634,7 @@ void ProjectExplorerPlugin::removeProject() ProjectNode *subProjectNode = qobject_cast<ProjectNode*>(d->m_currentNode->projectNode()); ProjectNode *projectNode = qobject_cast<ProjectNode *>(subProjectNode->parentFolderNode()); if (projectNode) { - Core::ICore *core = Core::ICore::instance(); - RemoveFileDialog removeFileDialog(subProjectNode->path(), core->mainWindow()); + RemoveFileDialog removeFileDialog(subProjectNode->path(), Core::ICore::mainWindow()); removeFileDialog.setDeleteFileVisible(false); if (removeFileDialog.exec() == QDialog::Accepted) projectNode->removeSubProjects(QStringList() << subProjectNode->path()); @@ -2662,7 +2657,7 @@ void ProjectExplorerPlugin::searchOnFileSystem() void ProjectExplorerPlugin::showInGraphicalShell() { QTC_ASSERT(d->m_currentNode, return) - Core::FileUtils::showInGraphicalShell(Core::ICore::instance()->mainWindow(), + Core::FileUtils::showInGraphicalShell(Core::ICore::mainWindow(), pathFor(d->m_currentNode)); } @@ -2677,10 +2672,9 @@ void ProjectExplorerPlugin::removeFile() QTC_ASSERT(d->m_currentNode && d->m_currentNode->nodeType() == FileNodeType, return) FileNode *fileNode = qobject_cast<FileNode*>(d->m_currentNode); - Core::ICore *core = Core::ICore::instance(); QString filePath = d->m_currentNode->path(); - RemoveFileDialog removeFileDialog(filePath, core->mainWindow()); + RemoveFileDialog removeFileDialog(filePath, Core::ICore::mainWindow()); if (removeFileDialog.exec() == QDialog::Accepted) { const bool deleteFile = removeFileDialog.isDeleteFileChecked(); @@ -2690,13 +2684,13 @@ void ProjectExplorerPlugin::removeFile() Q_ASSERT(projectNode); if (!projectNode->removeFiles(fileNode->fileType(), QStringList(filePath))) { - QMessageBox::warning(core->mainWindow(), tr("Removing File Failed"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Removing File Failed"), tr("Could not remove file %1 from project %2.").arg(filePath).arg(projectNode->displayName())); return; } // remove from version control - core->vcsManager()->promptToDelete(filePath); + Core::ICore::vcsManager()->promptToDelete(filePath); // remove from file system if (deleteFile) { @@ -2705,7 +2699,7 @@ void ProjectExplorerPlugin::removeFile() if (file.exists()) { // could have been deleted by vc if (!file.remove()) - QMessageBox::warning(core->mainWindow(), tr("Deleting File Failed"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Deleting File Failed"), tr("Could not delete file %1.").arg(filePath)); } } @@ -2717,11 +2711,10 @@ void ProjectExplorerPlugin::deleteFile() QTC_ASSERT(d->m_currentNode && d->m_currentNode->nodeType() == FileNodeType, return) FileNode *fileNode = qobject_cast<FileNode*>(d->m_currentNode); - Core::ICore *core = Core::ICore::instance(); QString filePath = d->m_currentNode->path(); QMessageBox::StandardButton button = - QMessageBox::question(core->mainWindow(), + QMessageBox::question(Core::ICore::mainWindow(), tr("Delete File"), tr("Delete %1 from file system?").arg(filePath), QMessageBox::Yes | QMessageBox::No); @@ -2733,18 +2726,18 @@ void ProjectExplorerPlugin::deleteFile() projectNode->deleteFiles(fileNode->fileType(), QStringList(filePath)); - core->fileManager()->expectFileChange(filePath); + Core::ICore::fileManager()->expectFileChange(filePath); if (Core::IVersionControl *vc = - core->vcsManager()->findVersionControlForDirectory(QFileInfo(filePath).absolutePath())) { + Core::ICore::vcsManager()->findVersionControlForDirectory(QFileInfo(filePath).absolutePath())) { vc->vcsDelete(filePath); } QFile file(filePath); if (file.exists()) { if (!file.remove()) - QMessageBox::warning(core->mainWindow(), tr("Deleting File Failed"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Deleting File Failed"), tr("Could not delete file %1.").arg(filePath)); } - core->fileManager()->unexpectFileChange(filePath); + Core::ICore::fileManager()->unexpectFileChange(filePath); } void ProjectExplorerPlugin::renameFile() @@ -2772,8 +2765,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to) if (orgFilePath == newFilePath) return; - Core::ICore *core = Core::ICore::instance(); - Core::IVersionControl *vc = core->vcsManager()->findVersionControlForDirectory(dir); + Core::IVersionControl *vc = Core::ICore::vcsManager()->findVersionControlForDirectory(dir); bool result = false; if (vc && vc->supportsOperation(Core::IVersionControl::MoveOperation)) @@ -2790,7 +2782,7 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to) } if (result) { // yeah we moved, tell the filemanager about it - Core::ICore::instance()->fileManager()->renamedFile(orgFilePath, newFilePath); + Core::ICore::fileManager()->renamedFile(orgFilePath, newFilePath); // Tell the project plugin about it ProjectNode *projectNode = fileNode->projectNode(); projectNode->renameFile(fileNode->fileType(), orgFilePath, newFilePath); @@ -2847,7 +2839,7 @@ Internal::ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings QStringList ProjectExplorerPlugin::projectFilePatterns() { QStringList patterns; - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); foreach(const IProjectManager *pm, allProjectManagers()) if (const Core::MimeType mt = mdb->findByType(pm->mimeType())) foreach(const Core::MimeGlobPattern &gp, mt.globPatterns()) @@ -2857,11 +2849,11 @@ QStringList ProjectExplorerPlugin::projectFilePatterns() void ProjectExplorerPlugin::openOpenProjectDialog() { - Core::FileManager *fileMananger = Core::ICore::instance()->fileManager(); + Core::FileManager *fileMananger = Core::ICore::fileManager(); const QString path = fileMananger->useProjectsDirectory() ? fileMananger->projectsDirectory() : QString(); const QStringList files = fileMananger->getOpenFileNames(d->m_projectFilterString, path); if (!files.isEmpty()) - Core::ICore::instance()->openFiles(files, Core::ICore::SwitchMode); + Core::ICore::openFiles(files, Core::ICore::SwitchMode); } QList<QPair<QString, QString> > ProjectExplorerPlugin::recentProjects() diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp index 2f9bb9b5ca..e1e55797bf 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp +++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp @@ -185,7 +185,7 @@ QWidget *ProjectExplorerSettingsPage::createPage(QWidget *parent) { m_widget = new ProjectExplorerSettingsWidget(parent); m_widget->setSettings(ProjectExplorerPlugin::instance()->projectExplorerSettings()); - const Core::FileManager *fm = Core::ICore::instance()->fileManager(); + const Core::FileManager *fm = Core::ICore::fileManager(); m_widget->setProjectsDirectory(fm->projectsDirectory()); m_widget->setUseProjectsDirectory(fm->useProjectsDirectory()); if (m_searchKeywords.isEmpty()) @@ -197,7 +197,7 @@ void ProjectExplorerSettingsPage::apply() { if (m_widget) { ProjectExplorerPlugin::instance()->setProjectExplorerSettings(m_widget->settings()); - Core::FileManager *fm = Core::ICore::instance()->fileManager(); + Core::FileManager *fm = Core::ICore::fileManager(); fm->setProjectsDirectory(m_widget->projectsDirectory()); fm->setUseProjectsDirectory(m_widget->useProjectsDirectory()); } diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index e0bff7172d..79e57d0a17 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -339,7 +339,7 @@ void ProjectFileWizardExtension::initializeVersionControlChoices() QStringList versionControlChoices = QStringList(tr("<None>")); if (!m_context->commonDirectory.isEmpty()) { - Core::IVersionControl *managingControl = Core::ICore::instance()->vcsManager()->findVersionControlForDirectory(m_context->commonDirectory); + Core::IVersionControl *managingControl = Core::ICore::vcsManager()->findVersionControlForDirectory(m_context->commonDirectory); if (managingControl) { // Under VCS if (managingControl->supportsOperation(Core::IVersionControl::AddOperation)) { @@ -454,7 +454,7 @@ bool ProjectFileWizardExtension::processProject( } else { // Split into lists by file type and bulk-add them. TypeFileMap typeFileMap; - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); foreach (const Core::GeneratedFile &generatedFile, files) { const QString path = generatedFile.path(); typeFileMap.insert(typeForFileName(mdb, path), path); @@ -515,7 +515,7 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const if (file->isBinary() || file->contents().isEmpty()) return; // nothing to do - const Core::MimeDatabase *mdb = Core::ICore::instance()->mimeDatabase(); + const Core::MimeDatabase *mdb = Core::ICore::mimeDatabase(); Core::MimeType mt = mdb->findByFile(QFileInfo(file->path())); const QString languageId = TextEditor::TextEditorSettings::instance()->languageId(mt.type()); diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 59cbaa63e7..f70507f9ef 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -77,11 +77,11 @@ public: m_context = new Core::IContext(this); m_context->setContext(Core::Context(Constants::C_PROJECT_TREE)); m_context->setWidget(this); - Core::ICore::instance()->addContextObject(m_context); + Core::ICore::addContextObject(m_context); } ~ProjectTreeView() { - Core::ICore::instance()->removeContextObject(m_context); + Core::ICore::removeContextObject(m_context); delete m_context; } @@ -440,7 +440,7 @@ void ProjectTreeWidgetFactory::saveSettings(int position, QWidget *widget) { ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget); Q_ASSERT(ptw); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); const QString baseKey = QLatin1String("ProjectTreeWidget.") + QString::number(position); settings->setValue(baseKey + QLatin1String(".ProjectFilter"), ptw->projectFilter()); settings->setValue(baseKey + QLatin1String(".GeneratedFilter"), ptw->generatedFilesFilter()); @@ -451,7 +451,7 @@ void ProjectTreeWidgetFactory::restoreSettings(int position, QWidget *widget) { ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget); Q_ASSERT(ptw); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); const QString baseKey = QLatin1String("ProjectTreeWidget.") + QString::number(position); ptw->setProjectFilter(settings->value(baseKey + QLatin1String(".ProjectFilter"), false).toBool()); ptw->setGeneratedFilesFilter(settings->value(baseKey + QLatin1String(".GeneratedFilter"), true).toBool()); diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h index e14d0cb980..427ffa59d6 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.h +++ b/src/plugins/projectexplorer/projectwelcomepage.h @@ -94,7 +94,7 @@ public: ProjectWelcomePage(); void facilitateQml(QDeclarativeEngine *engine); - QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/develop.qml")); } + QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/develop.qml")); } QWidget *page() { return 0; } QString title() const { return tr("Develop"); } int priority() const { return 20; } diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index a34bd07ec6..926100f9a9 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -171,7 +171,6 @@ void ProjectWizardPage::slotProjectChanged(int index) void ProjectWizardPage::slotManageVcs() { - Core::ICore *core = Core::ICore::instance(); - core->showOptionsDialog(QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY), + Core::ICore::showOptionsDialog(QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY), QLatin1String(VcsBase::Constants::VCS_COMMON_SETTINGS_ID)); } diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 136caf9f22..bdb3e852cd 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -583,7 +583,7 @@ bool RunControl::showPromptToStopDialog(const QString &title, QTC_ASSERT(isRunning(), return true;) // Show a question message box where user can uncheck this // question for this class. - Utils::CheckableMessageBox messageBox(Core::ICore::instance()->mainWindow()); + Utils::CheckableMessageBox messageBox(Core::ICore::mainWindow()); messageBox.setWindowTitle(title); messageBox.setText(text); messageBox.setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::Cancel); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 513d9d0dce..3f334fd7a8 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -99,8 +99,6 @@ public slots: void sessionLoadingProgress(); private: - Core::ICore *m_core; - QString m_fileName; QList<Project *> m_projects; Project *m_startupProject; @@ -126,8 +124,7 @@ void SessionFile::sessionLoadingProgress() } SessionFile::SessionFile() - : m_core(Core::ICore::instance()), - m_startupProject(0) + : m_startupProject(0) { } @@ -149,7 +146,7 @@ bool SessionFile::load(const QString &fileName) return false; } - m_core->progressManager()->addTask(future.future(), tr("Session"), + ICore::progressManager()->addTask(future.future(), tr("Session"), QLatin1String("ProjectExplorer.SessionFile.Load")); const QStringList &keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList(); @@ -172,7 +169,7 @@ bool SessionFile::load(const QString &fileName) QString errors; QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList, &errors); if (!errors.isEmpty()) - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Failed to open project"), errors); + QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errors); foreach (Project *p, projects) m_failedProjects.removeAll(p->file()->fileName()); } @@ -211,11 +208,11 @@ bool SessionFile::load(const QString &fileName) const QVariant &editorsettings = reader.restoreValue(QLatin1String("EditorSettings")); if (editorsettings.isValid()) { - connect(m_core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), + connect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(sessionLoadingProgress())); - m_core->editorManager()->restoreState( + ICore::editorManager()->restoreState( QByteArray::fromBase64(editorsettings.toByteArray())); - disconnect(m_core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), + disconnect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(sessionLoadingProgress())); } @@ -265,7 +262,7 @@ bool SessionFile::save() int editorCount = 0; - QList<Core::IEditor *> editors = m_core->editorManager()->openedEditors(); + QList<Core::IEditor *> editors = ICore::editorManager()->openedEditors(); foreach (Core::IEditor *editor, editors) { Q_ASSERT(editor); if (!editor->isTemporary()) @@ -273,7 +270,7 @@ bool SessionFile::save() } writer.saveValue(QLatin1String("OpenEditors"), editorCount); writer.saveValue(QLatin1String("EditorSettings"), - m_core->editorManager()->saveState().toBase64()); + ICore::editorManager()->saveState().toBase64()); QMap<QString, QVariant>::const_iterator it, end; end = m_values.constEnd(); @@ -286,7 +283,7 @@ bool SessionFile::save() writer.saveValue(QLatin1String("valueKeys"), keys); - if (writer.save(m_fileName, QLatin1String("QtCreatorSession"), Core::ICore::instance()->mainWindow())) + if (writer.save(m_fileName, QLatin1String("QtCreatorSession"), Core::ICore::mainWindow())) return true; return false; @@ -325,7 +322,6 @@ void SessionFile::clearFailedProjectFileNames() SessionManager::SessionManager(QObject *parent) : QObject(parent), - m_core(Core::ICore::instance()), m_file(new SessionFile), m_sessionNode(new Internal::SessionNodeImpl(this)), m_virginSession(true) @@ -333,7 +329,7 @@ SessionManager::SessionManager(QObject *parent) connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(saveActiveMode(Core::IMode*))); - Core::EditorManager *em = m_core->editorManager(); + EditorManager *em = ICore::editorManager(); connect(em, SIGNAL(editorCreated(Core::IEditor *, QString)), this, SLOT(configureEditor(Core::IEditor *, QString))); @@ -349,7 +345,7 @@ SessionManager::SessionManager(QObject *parent) m_autoSaveSessionTimer->setSingleShot(true); m_autoSaveSessionTimer->setInterval(10000); connect(m_autoSaveSessionTimer, SIGNAL(timeout()), - m_core, SIGNAL(saveSettingsRequested())); + ICore::instance(), SIGNAL(saveSettingsRequested())); } SessionManager::~SessionManager() @@ -683,7 +679,7 @@ bool SessionManager::clear() if (debug) qDebug() << "SessionManager - clearing session ..."; - bool success = m_core->editorManager()->closeAllEditors(); + bool success = ICore::editorManager()->closeAllEditors(); if (success) { if (debug) @@ -861,14 +857,14 @@ void SessionManager::updateWindowTitle() { if (isDefaultSession(m_sessionName)) { if (Project *currentProject = ProjectExplorerPlugin::instance()->currentProject()) - m_core->editorManager()->setWindowTitleAddition(currentProject->displayName()); + ICore::editorManager()->setWindowTitleAddition(currentProject->displayName()); else - m_core->editorManager()->setWindowTitleAddition(QString()); + ICore::editorManager()->setWindowTitleAddition(QString()); } else { QString sessionName = m_sessionName; if (sessionName.isEmpty()) sessionName = tr("Untitled"); - m_core->editorManager()->setWindowTitleAddition(sessionName); + ICore::editorManager()->setWindowTitleAddition(sessionName); } } @@ -969,7 +965,7 @@ QStringList SessionManager::sessions() const { if (m_sessions.isEmpty()) { // We are not initialized yet, so do that now - QDir sessionDir(Core::ICore::instance()->userResourcePath()); + QDir sessionDir(Core::ICore::userResourcePath()); QList<QFileInfo> sessionFiles = sessionDir.entryInfoList(QStringList() << QLatin1String("*.qws"), QDir::NoFilter, QDir::Time); Q_FOREACH(const QFileInfo& fileInfo, sessionFiles) { if (fileInfo.completeBaseName() != QLatin1String("default")) @@ -982,7 +978,7 @@ QStringList SessionManager::sessions() const QString SessionManager::sessionNameToFileName(const QString &session) const { - return m_core->userResourcePath() + QLatin1Char('/') + session + QLatin1String(".qws"); + return ICore::userResourcePath() + QLatin1Char('/') + session + QLatin1String(".qws"); } QString SessionManager::sessionNameFromFileName(const QString &fileName) const @@ -1078,8 +1074,7 @@ bool SessionManager::loadSession(const QString &session) QString SessionManager::lastSession() const { - QSettings *settings = m_core->settings(); - QString fileName = settings->value(QLatin1String("ProjectExplorer/StartupSession")).toString(); + QString fileName = ICore::settings()->value(QLatin1String("ProjectExplorer/StartupSession")).toString(); return QFileInfo(fileName).completeBaseName(); } diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index f00008a4d2..64bbaadb2b 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -46,7 +46,6 @@ class QTimer; QT_END_NAMESPACE namespace Core { -class ICore; class IMode; class IEditor; class IFile; @@ -164,8 +163,6 @@ private: void updateName(const QString &session); - Core::ICore *m_core; - Internal::SessionFile *m_file; Internal::SessionNodeImpl *m_sessionNode; QString m_sessionName; diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index 8034ccbc57..02fc7f4d6d 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -536,7 +536,7 @@ QVariantMap SettingsAccessor::restoreSettings(Project *project) const if (settings.isValid()) { if (settings.m_version > SettingsAccessor::instance()->m_lastVersion + 1) { QMessageBox::information( - Core::ICore::instance()->mainWindow(), + Core::ICore::mainWindow(), QApplication::translate("ProjectExplorer::SettingsAccessor", "Using Old Project Settings File"), QApplication::translate("ProjectExplorer::SettingsAccessor", @@ -567,7 +567,7 @@ QVariantMap SettingsAccessor::restoreSettings(Project *project) const "environment. \n\n" "Do you still want to load the settings file?"), QMessageBox::Yes | QMessageBox::No, - Core::ICore::instance()->mainWindow()); + Core::ICore::mainWindow()); msgBox.setDefaultButton(QMessageBox::No); msgBox.setEscapeButton(QMessageBox::No); if (msgBox.exec() == QMessageBox::No) @@ -613,7 +613,7 @@ QVariantMap SettingsAccessor::restoreSettings(Project *project) const "If you choose not to continue Qt Creator will " "not try to load the .shared file."), QMessageBox::Yes | QMessageBox::No, - Core::ICore::instance()->mainWindow()); + Core::ICore::mainWindow()); msgBox.setDefaultButton(QMessageBox::No); msgBox.setEscapeButton(QMessageBox::No); if (msgBox.exec() == QMessageBox::No) @@ -875,7 +875,7 @@ bool SettingsAccessor::FileAccessor::writeFile(const Project *project, const QString &fileName = project->property(m_id).toString(); return writer.save(fileName.isEmpty() ? assembleFileName(project) : fileName, QLatin1String("QtCreatorProject"), - Core::ICore::instance()->mainWindow()); + Core::ICore::mainWindow()); } // ------------------------------------------------------------------------- diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 625dd46627..56ea8b2993 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -256,7 +256,7 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate) d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview); d->m_taskHub = taskhub; - Core::ICore::instance()->addContextObject(d->m_taskWindowContext); + Core::ICore::addContextObject(d->m_taskWindowContext); connect(d->m_listview->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), tld, SLOT(currentChanged(QModelIndex,QModelIndex))); @@ -305,7 +305,7 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate) TaskWindow::~TaskWindow() { - Core::ICore::instance()->removeContextObject(d->m_taskWindowContext); + Core::ICore::removeContextObject(d->m_taskWindowContext); cleanContextMenu(); delete d->m_filterWarningsButton; delete d->m_listview; diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 544e29d036..271f762293 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -111,7 +111,7 @@ ToolChainManager::ToolChainManager(QObject *parent) : void ToolChainManager::restoreToolChains() { // Restore SDK settings first - QFileInfo systemSettingsFile(Core::ICore::instance()->settings(QSettings::SystemScope)->fileName()); + QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName()); restoreToolChains(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME), true); // Then auto detect @@ -155,7 +155,7 @@ void ToolChainManager::saveToolChains() } } writer.saveValue(QLatin1String(TOOLCHAIN_COUNT_KEY), count); - writer.save(settingsFileName(), QLatin1String("QtCreatorToolChains"), Core::ICore::instance()->mainWindow()); + writer.save(settingsFileName(), QLatin1String("QtCreatorToolChains"), Core::ICore::mainWindow()); // Do not save default debuggers! Those are set by the SDK! } diff --git a/src/plugins/projectexplorer/vcsannotatetaskhandler.cpp b/src/plugins/projectexplorer/vcsannotatetaskhandler.cpp index 7a8c1780b9..0eefb2abb4 100644 --- a/src/plugins/projectexplorer/vcsannotatetaskhandler.cpp +++ b/src/plugins/projectexplorer/vcsannotatetaskhandler.cpp @@ -54,7 +54,7 @@ bool VcsAnnotateTaskHandler::canHandle(const ProjectExplorer::Task &task) QFileInfo fi(task.file); if (!fi.exists() || !fi.isFile() || !fi.isReadable()) return false; - Core::IVersionControl *vc = Core::ICore::instance()->vcsManager()->findVersionControlForDirectory(fi.absolutePath()); + Core::IVersionControl *vc = Core::ICore::vcsManager()->findVersionControlForDirectory(fi.absolutePath()); if (!vc) return false; return vc->supportsOperation(Core::IVersionControl::AnnotateOperation); @@ -63,7 +63,7 @@ bool VcsAnnotateTaskHandler::canHandle(const ProjectExplorer::Task &task) void VcsAnnotateTaskHandler::handle(const ProjectExplorer::Task &task) { QFileInfo fi(task.file); - Core::IVersionControl *vc = Core::ICore::instance()->vcsManager()->findVersionControlForDirectory(fi.absolutePath()); + Core::IVersionControl *vc = Core::ICore::vcsManager()->findVersionControlForDirectory(fi.absolutePath()); Q_ASSERT(vc); Q_ASSERT(vc->supportsOperation(Core::IVersionControl::AnnotateOperation)); vc->vcsAnnotate(fi.absoluteFilePath(), task.line); diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 0af684b1ee..8b386c816e 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -236,7 +236,7 @@ DesignModeWidget::~DesignModeWidget() void DesignModeWidget::restoreDefaultView() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); m_leftSideBar->closeAllWidgets(); m_rightSideBar->closeAllWidgets(); m_leftSideBar->readSettings(settings, "none.LeftSideBar"); @@ -423,7 +423,7 @@ QAction *DesignModeWidget::goIntoComponentAction() const void DesignModeWidget::readSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup("Bauhaus"); m_leftSideBar->readSettings(settings, QLatin1String("LeftSideBar")); @@ -438,7 +438,7 @@ void DesignModeWidget::readSettings() void DesignModeWidget::saveSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup("Bauhaus"); m_leftSideBar->saveSettings(settings, QLatin1String("LeftSideBar")); @@ -767,10 +767,10 @@ void DesignModeWidget::setup() rightLayout->addWidget(m_statesEditorView->widget()); FormEditorContext *formEditorContext = new FormEditorContext(m_formEditorView->widget()); - Core::ICore::instance()->addContextObject(formEditorContext); + Core::ICore::addContextObject(formEditorContext); NavigatorContext *navigatorContext = new NavigatorContext(m_navigatorView->widget()); - Core::ICore::instance()->addContextObject(navigatorContext); + Core::ICore::addContextObject(navigatorContext); // editor and output panes m_outputPlaceholderSplitter->addWidget(m_formEditorView->widget()); diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 81c2ac6f40..0a1aec99a1 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -109,7 +109,7 @@ BauhausPlugin::BauhausPlugin() : BauhausPlugin::~BauhausPlugin() { delete m_designerCore; - Core::ICore::instance()->removeContextObject(m_context); + Core::ICore::removeContextObject(m_context); } //////////////////////////////////////////////////// @@ -119,12 +119,10 @@ BauhausPlugin::~BauhausPlugin() //////////////////////////////////////////////////// bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage/* = 0*/) // =0; { - Core::ICore *core = Core::ICore::instance(); - const Core::Context switchContext(QmlDesigner::Constants::C_QMLDESIGNER, QmlJSEditor::Constants::C_QMLJSEDITOR_ID); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QAction *switchAction = new QAction(tr("Switch Text/Design"), this); Core::Command *command = am->registerAction(switchAction, QmlDesigner::Constants::SWITCH_TEXT_DESIGN, switchContext); @@ -148,7 +146,7 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error addAutoReleasedObject(new SettingsPage); - m_settings.fromSettings(core->settings()); + m_settings.fromSettings(Core::ICore::settings()); errorMessage->clear(); @@ -157,15 +155,14 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error void BauhausPlugin::createDesignModeWidget() { - Core::ICore *creatorCore = Core::ICore::instance(); - Core::ActionManager *actionManager = creatorCore->actionManager(); - m_editorManager = creatorCore->editorManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); + m_editorManager = Core::ICore::editorManager(); Core::ActionContainer *editMenu = actionManager->actionContainer(Core::Constants::M_EDIT); m_mainWidget = new DesignModeWidget; m_context = new DesignModeContext(m_mainWidget); - creatorCore->addContextObject(m_context); + Core::ICore::addContextObject(m_context); Core::Context qmlDesignerMainContext(Constants::C_QMLDESIGNER); Core::Context qmlDesignerFormEditorContext(Constants::C_QMLFORMEDITOR); Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR); @@ -283,7 +280,7 @@ void BauhausPlugin::createDesignModeWidget() connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)), this, SLOT(textEditorsClosed(QList<Core::IEditor*>))); - connect(creatorCore, SIGNAL(contextChanged(Core::IContext*,Core::Context)), + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*,Core::Context)), this, SLOT(contextChanged(Core::IContext*,Core::Context))); } @@ -398,7 +395,7 @@ void BauhausPlugin::setSettings(const DesignerSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = Core::ICore::instance()->settings()) + if (QSettings *settings = Core::ICore::settings()) m_settings.toSettings(settings); } } diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 98d88e02df..4c3db76a4b 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -795,7 +795,7 @@ Core::Id QmlJSEditorEditable::id() const bool QmlJSEditorEditable::open(QString *errorString, const QString &fileName, const QString &realFileName) { bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName); - editorWidget()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type()); + editorWidget()->setMimeType(Core::ICore::mimeDatabase()->findByFile(QFileInfo(fileName)).type()); return b; } @@ -1456,7 +1456,7 @@ void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e) refactoringMenu->setEnabled(!refactoringMenu->isEmpty()); - if (Core::ActionContainer *mcontext = Core::ICore::instance()->actionManager()->actionContainer(QmlJSEditor::Constants::M_CONTEXT)) { + if (Core::ActionContainer *mcontext = Core::ICore::actionManager()->actionContainer(QmlJSEditor::Constants::M_CONTEXT)) { QMenu *contextMenu = mcontext->menu(); foreach (QAction *action, contextMenu->actions()) { menu->addAction(action); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 3c39c2b1f1..90bced560e 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -124,8 +124,7 @@ Core::Command *createSeparator(Core::ActionManager *am, bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qmljseditor/QmlJSEditor.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/qmljseditor/QmlJSEditor.mimetypes.xml"), errorMessage)) return false; m_modelManager = QmlJS::ModelManagerInterface::instance(); @@ -150,6 +149,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e m_editor = new QmlJSEditorFactory(this); addObject(m_editor); + QObject *core = Core::ICore::instance(); Core::BaseFileWizardParameters qmlWizardParameters(Core::IWizard::FileWizard); qmlWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_QML)); qmlWizardParameters.setDisplayCategory(QCoreApplication::translate("QmlJsEditor", Constants::WIZARD_TR_CATEGORY_QML)); @@ -172,7 +172,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e | TextEditor::TextEditorActionHandler::UnCollapseAll); m_actionHandler->initializeActions(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *contextMenu = am->createMenu(QmlJSEditor::Constants::M_CONTEXT); Core::ActionContainer *qmlToolsMenu = am->actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); @@ -255,7 +255,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e addAutoReleasedObject(new QuickToolBar); addAutoReleasedObject(new Internal::QuickToolBarSettingsPage); - connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); + connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(currentEditorChanged(Core::IEditor*))); return true; } diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index ed8b3297da..5b6b5b9bb3 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -932,7 +932,7 @@ void FindReferences::displayResults(int first, int last) connect(m_currentSearch, SIGNAL(cancelled()), this, SLOT(cancel())); Find::SearchResultWindow::instance()->popup(true); - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::progressManager(); Core::FutureProgress *progress = progressManager->addTask( m_watcher.future(), tr("Searching"), QmlJSEditor::Constants::TASK_SEARCH); diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp index 2a6e3be789..ac91d71c49 100644 --- a/src/plugins/qmljseditor/qmljsoutline.cpp +++ b/src/plugins/qmljseditor/qmljsoutline.cpp @@ -159,14 +159,14 @@ void QmlJSOutlineWidget::setCursorSynchronization(bool syncWithCursor) void QmlJSOutlineWidget::restoreSettings(int position) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); bool showBindings = settings->value("QmlJSOutline."+QString::number(position)+".ShowBindings", true).toBool(); m_showBindingsAction->setChecked(showBindings); } void QmlJSOutlineWidget::saveSettings(int position) { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->setValue("QmlJSOutline."+QString::number(position)+".ShowBindings", m_showBindingsAction->isChecked()); } diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index 092dc03693..583c612d15 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -310,7 +310,7 @@ QmlOutlineModel::QmlOutlineModel(QmlJSTextEditorWidget *editor) : m_textEditor(editor) { m_icons = Icons::instance(); - const QString resourcePath = Core::ICore::instance()->resourcePath(); + const QString resourcePath = Core::ICore::resourcePath(); Icons::instance()->setIconFilesPath(resourcePath + "/qmlicons"); // TODO: Maybe add a Copy Action? diff --git a/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp b/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp index c716062d41..a7dcca77f5 100644 --- a/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp +++ b/src/plugins/qmljseditor/quicktoolbarsettingspage.cpp @@ -52,7 +52,7 @@ QuickToolBarSettings::QuickToolBarSettings() void QuickToolBarSettings::set() { if (get() != *this) { - if (QSettings *settings = Core::ICore::instance()->settings()) + if (QSettings *settings = Core::ICore::settings()) toSettings(settings); } } @@ -118,9 +118,8 @@ QString QuickToolBarSettingsPageWidget::searchKeywords() const QuickToolBarSettings QuickToolBarSettings::get() { - Core::ICore *core = Core::ICore::instance(); QuickToolBarSettings settings; - settings.fromSettings(core->settings()); + settings.fromSettings(Core::ICore::settings()); return settings; } diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index 7b7ebc7044..17e2ad2623 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -176,12 +176,12 @@ void InspectorUi::setupUi() void InspectorUi::saveSettings() const { - m_settings->saveSettings(Core::ICore::instance()->settings()); + m_settings->saveSettings(Core::ICore::settings()); } void InspectorUi::restoreSettings() { - m_settings->restoreSettings(Core::ICore::instance()->settings()); + m_settings->restoreSettings(Core::ICore::settings()); } void InspectorUi::setDebuggerEngine(QObject *qmlEngine) diff --git a/src/plugins/qmljsinspector/qmljsinspectortoolbar.cpp b/src/plugins/qmljsinspector/qmljsinspectortoolbar.cpp index cd5c53224d..882f07ab20 100644 --- a/src/plugins/qmljsinspector/qmljsinspectortoolbar.cpp +++ b/src/plugins/qmljsinspector/qmljsinspectortoolbar.cpp @@ -175,8 +175,7 @@ void QmlJsInspectorToolBar::setShowAppOnTop(bool showAppOnTop) void QmlJsInspectorToolBar::createActions() { Core::Context context(Debugger::Constants::C_QMLDEBUGGER); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); m_fromQmlAction = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-small.png")), diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp index 802e9ef5d1..240887bdfd 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp +++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp @@ -219,7 +219,7 @@ QWidget *QmlJSCodeStyleSettingsPage::createPage(QWidget *parent) void QmlJSCodeStyleSettingsPage::apply() { if (m_widget) { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); TextEditor::SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::instance()->qmlJSCodeStyle(); if (originalTabPreferences->tabSettings() != m_pageTabPreferences->tabSettings()) { diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 0ac9f0846f..de1bbb0b21 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -78,7 +78,7 @@ QmlJS::Document::Language QmlJSTools::languageOfFile(const QString &fileName) QStringList jsonSuffixes("json"); if (Core::ICore::instance()) { - Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *db = Core::ICore::mimeDatabase(); Core::MimeType jsSourceTy = db->findByType(Constants::JS_MIMETYPE); jsSuffixes = jsSourceTy.suffixes(); Core::MimeType qmlSourceTy = db->findByType(Constants::QML_MIMETYPE); @@ -102,7 +102,7 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns() { QStringList pattern; if (Core::ICore::instance()) { - Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *db = Core::ICore::mimeDatabase(); Core::MimeType jsSourceTy = db->findByType(Constants::JS_MIMETYPE); Core::MimeType qmlSourceTy = db->findByType(Constants::QML_MIMETYPE); @@ -119,7 +119,6 @@ QStringList QmlJSTools::qmlAndJsGlobPatterns() ModelManager::ModelManager(QObject *parent): ModelManagerInterface(parent), - m_core(Core::ICore::instance()), m_pluginDumper(new PluginDumper(this)) { m_synchronizer.setCancelOnWait(true); @@ -165,8 +164,8 @@ void ModelManager::delayedInitialization() void ModelManager::loadQmlTypeDescriptions() { if (Core::ICore::instance()) { - loadQmlTypeDescriptions(Core::ICore::instance()->resourcePath()); - loadQmlTypeDescriptions(Core::ICore::instance()->userResourcePath()); + loadQmlTypeDescriptions(Core::ICore::resourcePath()); + loadQmlTypeDescriptions(Core::ICore::userResourcePath()); } } @@ -208,12 +207,10 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath) ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const { WorkingCopy workingCopy; - if (!m_core) + if (!Core::ICore::instance()) return workingCopy; - Core::EditorManager *editorManager = m_core->editorManager(); - - foreach (Core::IEditor *editor, editorManager->openedEditors()) { + foreach (Core::IEditor *editor, Core::ICore::editorManager()->openedEditors()) { const QString key = editor->file()->fileName(); if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) { @@ -272,7 +269,7 @@ QFuture<void> ModelManager::refreshSourceFiles(const QStringList &sourceFiles, m_synchronizer.addFuture(result); if (sourceFiles.count() > 1) { - m_core->progressManager()->addTask(result, tr("Indexing"), + Core::ICore::progressManager()->addTask(result, tr("Indexing"), Constants::TASK_INDEX); } @@ -631,7 +628,7 @@ void ModelManager::parse(QFutureInterface<void> &future, // Check whether fileMimeType is the same or extends knownMimeType bool ModelManager::matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType) { - Core::MimeDatabase *db = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *db = Core::ICore::mimeDatabase(); const QStringList knownTypeNames = QStringList(knownMimeType.type()) + knownMimeType.aliases(); diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h index 2e4dfb6279..06bc7f98ba 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.h +++ b/src/plugins/qmljstools/qmljsmodelmanager.h @@ -46,7 +46,6 @@ QT_FORWARD_DECLARE_CLASS(QTimer) namespace Core { -class ICore; class MimeType; } @@ -136,7 +135,6 @@ private: QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents); mutable QMutex m_mutex; - Core::ICore *m_core; QmlJS::Snapshot _validSnapshot; QmlJS::Snapshot _newestSnapshot; QStringList m_allImportPaths; diff --git a/src/plugins/qmljstools/qmljstools_test.cpp b/src/plugins/qmljstools/qmljstools_test.cpp index 7ad6bb1537..75e4f3e7f9 100644 --- a/src/plugins/qmljstools/qmljstools_test.cpp +++ b/src/plugins/qmljstools/qmljstools_test.cpp @@ -58,7 +58,7 @@ void QmlJSTools::Internal::QmlJSToolsPlugin::test_basic() { QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); - const QString welcomescreenRootPath = Core::ICore::instance()->resourcePath() + "/welcomescreen/welcomescreen.qml"; + const QString welcomescreenRootPath = Core::ICore::resourcePath() + "/welcomescreen/welcomescreen.qml"; modelManager->updateSourceFiles(QStringList(welcomescreenRootPath), false); modelManager->joinAllThreads(); diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp index 7dcddd2913..1f7542a23d 100644 --- a/src/plugins/qmljstools/qmljstoolsplugin.cpp +++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp @@ -77,8 +77,7 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings @@ -113,9 +112,9 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) mqmljstools->addAction(cmd); // watch task progress - connect(core->progressManager(), SIGNAL(taskStarted(QString)), + connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)), this, SLOT(onTaskStarted(QString))); - connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), + connect(Core::ICore::progressManager(), SIGNAL(allTasksFinished(QString)), this, SLOT(onAllTasksFinished(QString))); return true; diff --git a/src/plugins/qmljstools/qmljstoolssettings.cpp b/src/plugins/qmljstools/qmljstoolssettings.cpp index a1a469154c..35b658ac9d 100644 --- a/src/plugins/qmljstools/qmljstoolssettings.cpp +++ b/src/plugins/qmljstools/qmljstoolssettings.cpp @@ -109,7 +109,7 @@ QmlJSToolsSettings::QmlJSToolsSettings(QObject *parent) pool->loadCustomCodeStyles(); // load global settings (after built-in settings are added to the pool) - if (QSettings *s = Core::ICore::instance()->settings()) { + if (QSettings *s = Core::ICore::settings()) { d->m_globalCodeStyle->fromSettings(QmlJSTools::Constants::QML_JS_SETTINGS_ID, s); // legacy handling start (Qt Creator Version < 2.4) diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 24d13c1175..50837d527e 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -280,8 +280,7 @@ void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputF void QmlProfilerEngine::wrongSetupMessageBox(const QString &errorMessage) { - Core::ICore * const core = Core::ICore::instance(); - QMessageBox *infoBox = new QMessageBox(core->mainWindow()); + QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow()); infoBox->setIcon(QMessageBox::Critical); infoBox->setWindowTitle(tr("Qt Creator")); //: %1 is detailed error message @@ -313,8 +312,7 @@ void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button) void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg) { - Core::ICore * const core = Core::ICore::instance(); - QMessageBox *noExecWarning = new QMessageBox(core->mainWindow()); + QMessageBox *noExecWarning = new QMessageBox(Core::ICore::mainWindow()); noExecWarning->setIcon(QMessageBox::Warning); noExecWarning->setWindowTitle(tr("QML Profiler")); noExecWarning->setText(warningMsg); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 614d26ced0..3241779070 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -168,7 +168,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) Command *command = 0; const Context globalContext(C_GLOBAL); - ActionManager *am = ICore::instance()->actionManager(); + ActionManager *am = ICore::actionManager(); ActionContainer *menu = am->actionContainer(M_DEBUG_ANALYZER); ActionContainer *options = am->createMenu(M_DEBUG_ANALYZER_QML_OPTIONS); @@ -662,7 +662,7 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode) QString sysroot; { - QSettings *settings = ICore::instance()->settings(); + QSettings *settings = ICore::settings(); host = settings->value(QLatin1String("AnalyzerQmlAttachDialog/host"), QLatin1String("localhost")).toString(); port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toInt(); @@ -710,8 +710,7 @@ void QmlProfilerTool::tryToConnect() d->m_connectionTimer.stop(); d->m_connectionAttempts = 0; - ICore * const core = ICore::instance(); - QMessageBox *infoBox = new QMessageBox(core->mainWindow()); + QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow()); infoBox->setIcon(QMessageBox::Critical); infoBox->setWindowTitle(tr("Qt Creator")); infoBox->setText(tr("Could not connect to the in-process QML profiler.\n" @@ -815,8 +814,7 @@ void QmlProfilerTool::showSaveOption() void QmlProfilerTool::showSaveDialog() { - ICore *core = ICore::instance(); - QString filename = QFileDialog::getSaveFileName(core->mainWindow(), tr("Save QML Trace"), QString(), tr("QML traces (*%1)").arg(TraceFileExtension)); + QString filename = QFileDialog::getSaveFileName(Core::ICore::mainWindow(), tr("Save QML Trace"), QString(), tr("QML traces (*%1)").arg(TraceFileExtension)); if (!filename.isEmpty()) { if (!filename.endsWith(QLatin1String(TraceFileExtension))) filename += QLatin1String(TraceFileExtension); @@ -832,8 +830,7 @@ void QmlProfilerTool::showLoadDialog() if (AnalyzerManager::currentSelectedTool() != this) AnalyzerManager::selectTool(this, StartRemote); - ICore *core = ICore::instance(); - QString filename = QFileDialog::getOpenFileName(core->mainWindow(), tr("Load QML Trace"), QString(), tr("QML traces (*%1)").arg(TraceFileExtension)); + QString filename = QFileDialog::getOpenFileName(Core::ICore::mainWindow(), tr("Load QML Trace"), QString(), tr("QML traces (*%1)").arg(TraceFileExtension)); if (!filename.isEmpty()) { // delayed load (prevent graphical artifacts due to long load time) @@ -844,8 +841,7 @@ void QmlProfilerTool::showLoadDialog() void QmlProfilerTool::showErrorDialog(const QString &error) { - ICore *core = ICore::instance(); - QMessageBox *errorDialog = new QMessageBox(core->mainWindow()); + QMessageBox *errorDialog = new QMessageBox(Core::ICore::mainWindow()); errorDialog->setIcon(QMessageBox::Warning); errorDialog->setWindowTitle(tr("QML Profiler")); errorDialog->setText(error); diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 0e4a8be5d2..c25a0bbeb8 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -97,7 +97,7 @@ QString QmlProject::filesFileName() const void QmlProject::parseProject(RefreshOptions options) { - Core::MessageManager *messageManager = Core::ICore::instance()->messageManager(); + Core::MessageManager *messageManager = Core::ICore::messageManager(); if (options & Files) { if (options & ProjectFile) delete m_projectItem.data(); diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index 3a104edbfd..930d09b4c6 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -72,8 +72,7 @@ bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage) { using namespace Core; - ICore *core = ICore::instance(); - Core::MimeDatabase *mimeDB = core->mimeDatabase(); + Core::MimeDatabase *mimeDB = Core::ICore::mimeDatabase(); const QLatin1String mimetypesXml(":/qmlproject/QmlProject.mimetypes.xml"); @@ -116,7 +115,7 @@ void QmlProjectPlugin::showQmlObserverToolWarning() "and click Rebuild.")); dialog.exec(); if (dialog.clickedButton() == qtPref) { - Core::ICore::instance()->showOptionsDialog( + Core::ICore::showOptionsDialog( ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID); } diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index a0c1912d4f..c73cb8d56f 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -331,7 +331,7 @@ void QmlProjectRunConfiguration::updateEnabled() bool qmlFileFound = false; if (mainScriptSource() == FileInEditor) { Core::IEditor *editor = Core::EditorManager::instance()->currentEditor(); - Core::MimeDatabase *db = ICore::instance()->mimeDatabase(); + Core::MimeDatabase *db = ICore::mimeDatabase(); if (editor) { m_currentFileFilename = editor->file()->fileName(); if (db->findByFile(mainScript()).type() == QLatin1String("application/x-qml")) diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp index a5faef399c..5d14b8be15 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfigurationwidget.cpp @@ -269,8 +269,7 @@ void QmlProjectRunConfigurationWidget::qmlDebugServerPortChanged(uint port) void QmlProjectRunConfigurationWidget::manageQtVersions() { - ICore *core = ICore::instance(); - core->showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, + ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY, QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID); } diff --git a/src/plugins/qt4projectmanager/profileeditor.cpp b/src/plugins/qt4projectmanager/profileeditor.cpp index 405a880fa4..0025855252 100644 --- a/src/plugins/qt4projectmanager/profileeditor.cpp +++ b/src/plugins/qt4projectmanager/profileeditor.cpp @@ -200,7 +200,7 @@ void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = new QMenu(); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mcontext = am->actionContainer(Qt4ProjectManager::Constants::M_CONTEXT); QMenu *contextMenu = mcontext->menu(); diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index bd208cacf8..bc789cf9d0 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -653,9 +653,7 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked) updateEffectiveQMakeCall(); updateQmlDebuggingOption(); - - Core::ICore * const core = Core::ICore::instance(); - QMessageBox *question = new QMessageBox(core->mainWindow()); + QMessageBox *question = new QMessageBox(Core::ICore::mainWindow()); question->setWindowTitle(tr("QML Debugging")); question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?")); question->setStandardButtons(QMessageBox::Yes | QMessageBox::No); @@ -679,7 +677,7 @@ void QMakeStepConfigWidget::buildQmlDebuggingHelper() QFuture<void> task = QtConcurrent::run(&QtSupport::DebuggingHelperBuildTask::run, buildTask); const QString taskName = tr("Building helpers"); - Core::ICore::instance()->progressManager()->addTask(task, taskName, + Core::ICore::progressManager()->addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers")); } diff --git a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp index caaf445eb0..7df7942c77 100644 --- a/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/codaruncontrol.cpp @@ -403,7 +403,7 @@ void CodaRunControl::checkForTimeout() if (m_state != StateConnecting) return; - QMessageBox *mb = createCodaWaitingMessageBox(Core::ICore::instance()->mainWindow()); + QMessageBox *mb = createCodaWaitingMessageBox(Core::ICore::mainWindow()); connect(this, SIGNAL(finished()), mb, SLOT(close())); connect(mb, SIGNAL(finished(int)), this, SLOT(cancelConnection())); mb->open(); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp index 84eed8cc59..690817ad9c 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deploystep.cpp @@ -575,7 +575,7 @@ void S60DeployStep::checkForTimeout() { if (state() != StateConnecting) return; - QMessageBox *mb = CodaRunControl::createCodaWaitingMessageBox(Core::ICore::instance()->mainWindow()); + QMessageBox *mb = CodaRunControl::createCodaWaitingMessageBox(Core::ICore::mainWindow()); connect(this, SIGNAL(codaConnected()), mb, SLOT(close())); connect(this, SIGNAL(finished()), mb, SLOT(close())); connect(this, SIGNAL(finishNow()), mb, SLOT(close())); @@ -588,7 +588,7 @@ void S60DeployStep::showManualInstallationInfo() const QString title = tr("Installation"); const QString text = tr("Continue the installation on your device."); QMessageBox *mb = new QMessageBox(QMessageBox::Information, title, text, - QMessageBox::Ok, Core::ICore::instance()->mainWindow()); + QMessageBox::Ok, Core::ICore::mainWindow()); connect(this, SIGNAL(allFilesInstalled()), mb, SLOT(close())); connect(this, SIGNAL(finished()), mb, SLOT(close())); connect(this, SIGNAL(finishNow()), mb, SLOT(close())); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp index 85aa9005bf..049b10d505 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp @@ -230,7 +230,7 @@ ProjectExplorer::RunControl* S60DeviceDebugRunControlFactory::create(RunConfigur const Debugger::DebuggerStartParameters startParameters = s60DebuggerStartParams(rc); const Debugger::ConfigurationCheck check = Debugger::checkDebugConfiguration(startParameters); if (!check) { - Core::ICore::instance()->showWarningWithOptions(S60DeviceDebugRunControl::tr("Debugger for Symbian Platform"), + Core::ICore::showWarningWithOptions(S60DeviceDebugRunControl::tr("Debugger for Symbian Platform"), check.errorMessage, check.errorDetailsString(), check.settingsCategory, check.settingsPage); return 0; } diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp index 51b30dee32..11fc7202ac 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp @@ -131,7 +131,7 @@ S60Manager::S60Manager(QObject *parent) : QObject(parent) addAutoReleasedObject(new S60PublishingWizardFactoryOvi); addAutoReleasedObject(new SymbianQtVersionFactory); - connect(Core::ICore::instance()->mainWindow(), SIGNAL(deviceChange()), + connect(Core::ICore::mainWindow(), SIGNAL(deviceChange()), SymbianUtils::SymbianDeviceManager::instance(), SLOT(update())); } diff --git a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp index d86ea7d75a..b311d05465 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60runcontrolbase.cpp @@ -114,7 +114,7 @@ void S60RunControlBase::start() QTC_ASSERT(!m_launchProgress, return); m_launchProgress = new QFutureInterface<void>; - Core::ICore::instance()->progressManager()->addTask(m_launchProgress->future(), + Core::ICore::progressManager()->addTask(m_launchProgress->future(), tr("Launching"), QLatin1String("Symbian.Launch")); m_launchProgress->setProgressRange(PROGRESS_MIN, PROGRESS_MAX); diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 32d8b86145..5275551c2c 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -255,7 +255,7 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo { Q_ASSERT(project); m_qt4PriFile = new Qt4PriFile(this); - Core::ICore::instance()->fileManager()->addFile(m_qt4PriFile); + Core::ICore::fileManager()->addFile(m_qt4PriFile); setDisplayName(QFileInfo(filePath).completeBaseName()); @@ -1003,19 +1003,18 @@ bool Qt4PriFileNode::changeIncludes(ProFile *includeFile, const QStringList &pro bool Qt4PriFileNode::priFileWritable(const QString &path) { const QString dir = QFileInfo(path).dir().path(); - Core::ICore *core = Core::ICore::instance(); - Core::IVersionControl *versionControl = core->vcsManager()->findVersionControlForDirectory(dir); - switch (Core::FileManager::promptReadOnlyFile(path, versionControl, core->mainWindow(), false)) { + Core::IVersionControl *versionControl = Core::ICore::vcsManager()->findVersionControlForDirectory(dir); + switch (Core::FileManager::promptReadOnlyFile(path, versionControl, Core::ICore::mainWindow(), false)) { case Core::FileManager::RO_OpenVCS: if (!versionControl->vcsOpen(path)) { - QMessageBox::warning(core->mainWindow(), tr("Cannot Open File"), tr("Cannot open the file for editing with VCS.")); + QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Open File"), tr("Cannot open the file for editing with VCS.")); return false; } break; case Core::FileManager::RO_MakeWriteable: { const bool permsOk = QFile::setPermissions(path, QFile::permissions(path) | QFile::WriteUser); if (!permsOk) { - QMessageBox::warning(core->mainWindow(), tr("Cannot Set Permissions"), tr("Cannot set permissions to writable.")); + QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Set Permissions"), tr("Cannot set permissions to writable.")); return false; } break; @@ -1031,9 +1030,7 @@ bool Qt4PriFileNode::saveModifiedEditors() { QList<Core::IFile*> modifiedFileHandles; - Core::ICore *core = Core::ICore::instance(); - - foreach (Core::IEditor *editor, core->editorManager()->editorsForFileName(m_projectFilePath)) { + foreach (Core::IEditor *editor, Core::ICore::editorManager()->editorsForFileName(m_projectFilePath)) { if (Core::IFile *editorFile = editor->file()) { if (editorFile->isModified()) modifiedFileHandles << editorFile; @@ -1042,7 +1039,7 @@ bool Qt4PriFileNode::saveModifiedEditors() if (!modifiedFileHandles.isEmpty()) { bool cancelled; - core->fileManager()->saveModifiedFiles(modifiedFileHandles, &cancelled, + Core::ICore::fileManager()->saveModifiedFiles(modifiedFileHandles, &cancelled, tr("There are unsaved changes for project file %1.").arg(m_projectFilePath)); if (cancelled) return false; @@ -1104,12 +1101,12 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, QFileInfo fi(m_projectFilePath); if (!fi.isWritable()) { // Try via vcs manager - Core::VcsManager *vcsManager = Core::ICore::instance()->vcsManager(); + Core::VcsManager *vcsManager = Core::ICore::vcsManager(); Core::IVersionControl *versionControl = vcsManager->findVersionControlForDirectory(fi.absolutePath()); if (!versionControl || versionControl->vcsOpen(m_projectFilePath)) { bool makeWritable = QFile::setPermissions(m_projectFilePath, fi.permissions() | QFile::WriteUser); if (!makeWritable) { - QMessageBox::warning(Core::ICore::instance()->mainWindow(), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Failed!"), tr("Could not write project file %1.").arg(m_projectFilePath)); return; @@ -1149,9 +1146,9 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, } // save file - Core::ICore::instance()->fileManager()->expectFileChange(m_projectFilePath); + Core::ICore::fileManager()->expectFileChange(m_projectFilePath); save(lines); - Core::ICore::instance()->fileManager()->unexpectFileChange(m_projectFilePath); + Core::ICore::fileManager()->unexpectFileChange(m_projectFilePath); // This is a hack. // We are saving twice in a very short timeframe, once the editor and once the ProFile. @@ -1159,7 +1156,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, // We manually tell each editor to reload it's file. // (The .pro files are notified by the file system watcher.) QStringList errorStrings; - foreach (Core::IEditor *editor, Core::ICore::instance()->editorManager()->editorsForFileName(m_projectFilePath)) { + foreach (Core::IEditor *editor, Core::ICore::editorManager()->editorsForFileName(m_projectFilePath)) { if (Core::IFile *editorFile = editor->file()) { QString errorString; if (!editorFile->reload(&errorString, Core::IFile::FlagReload, Core::IFile::TypeContents)) @@ -1167,7 +1164,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, } } if (!errorStrings.isEmpty()) - QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("File Error"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("File Error"), errorStrings.join(QLatin1String("\n"))); includeFile->deref(); @@ -1177,7 +1174,7 @@ void Qt4PriFileNode::save(const QStringList &lines) { Utils::FileSaver saver(m_projectFilePath, QIODevice::Text); saver.write(lines.join(QLatin1String("\n")).toLocal8Bit()); - saver.finalize(Core::ICore::instance()->mainWindow()); + saver.finalize(Core::ICore::mainWindow()); m_project->qt4ProjectManager()->notifyChanged(m_projectFilePath); } diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index ba63cbb77e..119c60c186 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -840,7 +840,7 @@ void Qt4Project::asyncUpdate() Q_ASSERT(!m_asyncUpdateFutureInterface); m_asyncUpdateFutureInterface = new QFutureInterface<void>(); - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::progressManager(); m_asyncUpdateFutureInterface->setProgressRange(0, 0); progressManager->addTask(m_asyncUpdateFutureInterface->future(), tr("Evaluating"), @@ -943,7 +943,7 @@ QList<ProjectExplorer::Project*> Qt4Project::dependsOn() void Qt4Project::proFileParseError(const QString &errorMessage) { - Core::ICore::instance()->messageManager()->printToOutputPanePopup(errorMessage); + Core::ICore::messageManager()->printToOutputPanePopup(errorMessage); } QtSupport::ProFileReader *Qt4Project::createProFileReader(Qt4ProFileNode *qt4ProFileNode, Qt4BuildConfiguration *bc) diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index 1bf50de83a..09803f0958 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -179,15 +179,13 @@ void Qt4ProjectConfigWidget::updateShadowBuildUi() void Qt4ProjectConfigWidget::manageQtVersions() { - Core::ICore *core = Core::ICore::instance(); - core->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), + Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID)); } void Qt4ProjectConfigWidget::manageToolChains() { - Core::ICore *core = Core::ICore::instance(); - core->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), + Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY), QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID)); } diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index 2b0eb0a349..7fb3696649 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -107,12 +107,11 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * const Core::Context projectContext(Qt4ProjectManager::Constants::PROJECT_ID); Core::Context projecTreeContext(ProjectExplorer::Constants::C_PROJECT_TREE); - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage)) return false; m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); //create and register objects m_qt4ProjectManager = new Qt4Manager(this); diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index a206254ccc..f448c376d1 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -478,7 +478,7 @@ Qt4DefaultTargetSetupWidget::Qt4DefaultTargetSetupWidget(Qt4BaseTargetFactory *f m_selected(0), m_qtVersionId(-1) { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); QString sourceDir = QFileInfo(m_proFilePath).absolutePath(); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); @@ -726,7 +726,7 @@ void Qt4DefaultTargetSetupWidget::storeSettings() const } } - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); s->setValue(QLatin1String("Qt4ProjectManager.TargetSetupPage.ShadowBuilding"), m_shadowBuildEnabled->isChecked()); int id = -1; int ci = m_versionComboBox->currentIndex(); diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp index 5d58a9c309..babc4e90ea 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileapp.cpp @@ -390,7 +390,7 @@ bool AbstractMobileApp::updateFiles(const QList<AbstractGeneratedFileInfo> &list // CREATORLESSTEST is in tests/manual/appwizards/helpers.cpp QString AbstractMobileApp::templatesRoot() { - return Core::ICore::instance()->resourcePath() + return Core::ICore::resourcePath() + QLatin1String("/templates/"); } diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp index e6c87344fb..fb2ef16d13 100644 --- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp @@ -133,7 +133,7 @@ bool QtWizard::qt4ProjectPostGenerateFiles(const QWizard *w, QString QtWizard::templateDir() { - QString rc = Core::ICore::instance()->resourcePath(); + QString rc = Core::ICore::resourcePath(); rc += QLatin1String("/templates/qt4project"); return rc; } @@ -144,7 +144,7 @@ bool QtWizard::lowerCaseFiles() lowerCaseSettingsKey += QLatin1Char('/'); lowerCaseSettingsKey += QLatin1String(CppTools::Constants::LOWERCASE_CPPFILES_KEY); const bool lowerCaseDefault = CppTools::Constants::lowerCaseFilesDefault; - return Core::ICore::instance()->settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); + return Core::ICore::settings()->value(lowerCaseSettingsKey, QVariant(lowerCaseDefault)).toBool(); } bool QtWizard::showModulesPageForApplications() diff --git a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp index c9da43c717..6ed26c4b65 100644 --- a/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/subdirsprojectwizard.cpp @@ -84,7 +84,7 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener { const SubdirsProjectWizardDialog *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w); if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) { - Core::ICore::instance()->showNewItemDialog(tr("New Subproject", "Title of dialog"), + Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard), wizard->parameters().projectPath()); } else { diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 4b0cafe924..a03821be25 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -237,7 +237,7 @@ void ExamplesListModel::readNewsItems(const QString &examplesPath, const QString QString offsetPath = fi.path(); QDir examplesDir(offsetPath); QDir demosDir(offsetPath); - if (offsetPath.startsWith(Core::ICore::instance()->resourcePath())) { + if (offsetPath.startsWith(Core::ICore::resourcePath())) { // Try to get dir from first Qt Version, based on the Qt source directory // at first, since examplesPath / demosPath points at the build directory examplesDir = sourcePath + QLatin1String("/examples"); @@ -280,7 +280,7 @@ QStringList ExamplesListModel::exampleSources() const const QStringList pattern(QLatin1String("*.xml")); // Read keys from SDK installer - QSettings *settings = Core::ICore::instance()->settings(QSettings::SystemScope); + QSettings *settings = Core::ICore::settings(QSettings::SystemScope); int size = settings->beginReadArray(QLatin1String("ExampleManifests")); for (int i = 0; i < size; ++i) { settings->setArrayIndex(i); @@ -313,7 +313,7 @@ QStringList ExamplesListModel::exampleSources() const } } - QString resourceDir = Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/"); + QString resourceDir = Core::ICore::resourcePath() + QLatin1String("/welcomescreen/"); // Try Creator-provided XML file only if (sources.isEmpty() && anyQtVersionHasExamplesFolder) { diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index d61c67f289..b420d0baa2 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -202,7 +202,7 @@ GettingStartedWelcomePage::GettingStartedWelcomePage() : m_engine(0) QUrl GettingStartedWelcomePage::pageLocation() const { - return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml")); + return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml")); } QString GettingStartedWelcomePage::title() const @@ -257,9 +257,9 @@ QString ExamplesWelcomePage::title() const QUrl ExamplesWelcomePage::pageLocation() const { if (m_showExamples) - return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/examples.qml")); + return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/examples.qml")); else - return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/tutorials.qml")); + return QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/tutorials.qml")); } void ExamplesWelcomePage::facilitateQml(QDeclarativeEngine *engine) @@ -286,12 +286,12 @@ void ExamplesWelcomePage::facilitateQml(QDeclarativeEngine *engine) void ExamplesWelcomePage::openSplitHelp(const QUrl &help) { - Core::ICore::instance()->helpManager()->handleHelpRequest(help.toString()+QLatin1String("?view=split")); + Core::ICore::helpManager()->handleHelpRequest(help.toString()+QLatin1String("?view=split")); } void ExamplesWelcomePage::openHelp(const QUrl &help) { - Core::ICore::instance()->helpManager()->handleHelpRequest(help.toString()); + Core::ICore::helpManager()->handleHelpRequest(help.toString()); } void ExamplesWelcomePage::openUrl(const QUrl &url) @@ -307,7 +307,7 @@ QStringList ExamplesWelcomePage::tagList() const QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileInfo, QStringList &filesToOpen, const QStringList& dependencies) { const QString projectDir = proFileInfo.canonicalPath(); - QDialog d(Core::ICore::instance()->mainWindow()); + QDialog d(Core::ICore::mainWindow()); QGridLayout *lay = new QGridLayout(&d); QLabel *descrLbl = new QLabel; d.setWindowTitle(tr("Copy Project to writable Location?")); @@ -325,7 +325,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI Utils::PathChooser *chooser = new Utils::PathChooser; txt->setBuddy(chooser); chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); chooser->setPath(settings->value( QString::fromLatin1(C_FALLBACK_ROOT), QDir::homePath()).toString()); lay->addWidget(txt, 1, 0); @@ -345,7 +345,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI QDir toDirWithExamplesDir(destBaseDir); if (toDirWithExamplesDir.cd(exampleDirName)) { toDirWithExamplesDir.cdUp(); // step out, just to not be in the way - QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Cannot Use Location"), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Use Location"), tr("The specified location already exists. " "Please specify a valid location."), QMessageBox::Ok, QMessageBox::NoButton); @@ -362,7 +362,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI foreach (const QString &dependency, dependencies) { QString dirName = QDir(dependency).dirName(); if (!Utils::FileUtils::copyRecursively(dependency, targetDir + QDir::separator()+ dirName, &error)) { - QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Cannot Copy Project"), error); + QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Copy Project"), error); // do not fail, just warn; } } @@ -370,7 +370,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI return targetDir + QLatin1Char('/') + proFileInfo.fileName(); } else { - QMessageBox::warning(Core::ICore::instance()->mainWindow(), tr("Cannot Copy Project"), error); + QMessageBox::warning(Core::ICore::mainWindow(), tr("Cannot Copy Project"), error); } } @@ -395,11 +395,11 @@ void ExamplesWelcomePage::openProject(const QString &projectFile, const QStringL // don't try to load help and files if loading the help request is being cancelled QString errorMessage; if (!proFile.isEmpty() && ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFile, &errorMessage)) { - Core::ICore::instance()->openFiles(filesToOpen); - Core::ICore::instance()->helpManager()->handleHelpRequest(help.toString()+QLatin1String("?view=split")); + Core::ICore::openFiles(filesToOpen); + Core::ICore::helpManager()->handleHelpRequest(help.toString()+QLatin1String("?view=split")); } if (!errorMessage.isEmpty()) - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("Failed to open project"), errorMessage); + QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage); } void ExamplesWelcomePage::updateTagsModel() diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp index 3774fd4012..0b45858a8a 100644 --- a/src/plugins/qtsupport/profilereader.cpp +++ b/src/plugins/qtsupport/profilereader.cpp @@ -52,7 +52,7 @@ ProMessageHandler::ProMessageHandler(bool verbose) : m_verbose(verbose) { QObject::connect(this, SIGNAL(errorFound(QString)), - Core::ICore::instance()->messageManager(), SLOT(printToOutputPane(QString)), + Core::ICore::messageManager(), SLOT(printToOutputPane(QString)), Qt::QueuedConnection); } diff --git a/src/plugins/qtsupport/qmldebugginglibrary.cpp b/src/plugins/qtsupport/qmldebugginglibrary.cpp index ed6a45735d..0a3072e1d8 100644 --- a/src/plugins/qtsupport/qmldebugginglibrary.cpp +++ b/src/plugins/qtsupport/qmldebugginglibrary.cpp @@ -154,7 +154,7 @@ QStringList QmlDebuggingLibrary::installDirectories(const QString &qtInstallData QString QmlDebuggingLibrary::sourcePath() { - return Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/"); + return Core::ICore::resourcePath() + QLatin1String("/qml/qmljsdebugger/"); } QStringList QmlDebuggingLibrary::sourceFileNames() diff --git a/src/plugins/qtsupport/qmldumptool.cpp b/src/plugins/qtsupport/qmldumptool.cpp index e27f988274..d37b5164ce 100644 --- a/src/plugins/qtsupport/qmldumptool.cpp +++ b/src/plugins/qtsupport/qmldumptool.cpp @@ -238,7 +238,7 @@ QString QmlDumpTool::toolForVersion(BaseQtVersion *version, bool debugDump) static QString sourcePath() { - return Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmldump/"); + return Core::ICore::resourcePath() + QLatin1String("/qml/qmldump/"); } static QStringList sourceFileNames() @@ -335,7 +335,7 @@ void QmlDumpTool::pathAndEnvironment(ProjectExplorer::Project *project, BaseQtVe buildTask->updateProjectWhenDone(project, preferDebug); QFuture<void> task = QtConcurrent::run(&QmlDumpBuildTask::run, buildTask); const QString taskName = QmlDumpBuildTask::tr("Building helper"); - Core::ICore::instance()->progressManager()->addTask(task, taskName, + Core::ICore::progressManager()->addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers")); } return; diff --git a/src/plugins/qtsupport/qmlobservertool.cpp b/src/plugins/qtsupport/qmlobservertool.cpp index 1584385f43..fde7873e70 100644 --- a/src/plugins/qtsupport/qmlobservertool.cpp +++ b/src/plugins/qtsupport/qmlobservertool.cpp @@ -171,7 +171,7 @@ QStringList QmlObserverTool::installDirectories(const QString &qtInstallData) QString QmlObserverTool::sourcePath() { - return Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmlobserver/"); + return Core::ICore::resourcePath() + QLatin1String("/qml/qmlobserver/"); } QStringList QmlObserverTool::sourceFileNames() diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 03197293b0..7eea018016 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -501,7 +501,7 @@ void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools t QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask); const QString taskName = tr("Building helpers"); - Core::ICore::instance()->progressManager()->addTask(task, taskName, + Core::ICore::progressManager()->addTask(task, taskName, QLatin1String("Qt4ProjectManager::BuildHelpers")); } void QtOptionsPageWidget::buildGdbHelper() diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 8e9e4bface..9f12514d5d 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -359,7 +359,7 @@ void QtVersionManager::saveQtVersions() } writer.saveValue(QLatin1String(QTVERSION_COUNT_KEY), count); - writer.save(settingsFileName(), QLatin1String("QtCreatorQtVersions"), Core::ICore::instance()->mainWindow()); + writer.save(settingsFileName(), QLatin1String("QtCreatorQtVersions"), Core::ICore::mainWindow()); } void QtVersionManager::findSystemQt() @@ -375,7 +375,7 @@ void QtVersionManager::findSystemQt() bool QtVersionManager::legacyRestore() { - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); const QString qtVersionSection = QLatin1String(QtVersionsSectionName); if (!s->contains(qtVersionSection + QLatin1String("/size"))) return false; @@ -526,7 +526,7 @@ void QtVersionManager::updateSettings() } // in SDKs, we want to prefer the Qt version shipping with the SDK - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); Utils::FileName preferred = Utils::FileName::fromUserInput(settings->value(QLatin1String("PreferredQMakePath")).toString()); if (!preferred.isEmpty()) { #ifdef Q_OS_WIN diff --git a/src/plugins/qtsupport/screenshotcropper.cpp b/src/plugins/qtsupport/screenshotcropper.cpp index e678e40cf0..bec9bedf43 100644 --- a/src/plugins/qtsupport/screenshotcropper.cpp +++ b/src/plugins/qtsupport/screenshotcropper.cpp @@ -13,7 +13,7 @@ namespace Internal { #ifdef QT_CREATOR Q_GLOBAL_STATIC_WITH_INITIALIZER(AreasOfInterest, areasOfInterest, { - *x = ScreenshotCropper::loadAreasOfInterest(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/images_areaofinterest.xml")); + *x = ScreenshotCropper::loadAreasOfInterest(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/images_areaofinterest.xml")); }) #else Q_GLOBAL_STATIC(AreasOfInterest, areasOfInterest) diff --git a/src/plugins/remotelinux/deploymentsettingsassistant.cpp b/src/plugins/remotelinux/deploymentsettingsassistant.cpp index 30355e6272..6bf91386ee 100644 --- a/src/plugins/remotelinux/deploymentsettingsassistant.cpp +++ b/src/plugins/remotelinux/deploymentsettingsassistant.cpp @@ -110,7 +110,7 @@ bool DeploymentSettingsAssistant::addLinesToProFile(const DeployableFilesPerProF + separator + lines.join(separator) + QLatin1String("\n}\n"); Utils::FileSaver saver(proFileInfo->proFilePath(), QIODevice::Append); saver.write(proFileString.toLocal8Bit()); - return saver.finalize(Core::ICore::instance()->mainWindow()); + return saver.finalize(Core::ICore::mainWindow()); } void DeploymentSettingsAssistant::handleDeploymentInfoUpdated() diff --git a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp index 0598a93746..d80ba35031 100644 --- a/src/plugins/remotelinux/linuxdeviceconfigurations.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfigurations.cpp @@ -127,7 +127,7 @@ void LinuxDeviceConfigurations::copy(const LinuxDeviceConfigurations *source, void LinuxDeviceConfigurations::save() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); settings->setValue(IdCounterKey, d->nextId); settings->setValue(DefaultKeyFilePathKey, d->defaultSshKeyFilePath); @@ -280,7 +280,7 @@ LinuxDeviceConfigurations::~LinuxDeviceConfigurations() void LinuxDeviceConfigurations::load() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); d->nextId = settings->value(IdCounterKey, 1).toULongLong(); d->defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey, diff --git a/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp b/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp index 8fb6709539..1c73eb1f59 100644 --- a/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp +++ b/src/plugins/remotelinux/linuxdeviceconfigurationssettingswidget.cpp @@ -113,7 +113,7 @@ LinuxDeviceConfigurationsSettingsWidget::LinuxDeviceConfigurationsSettingsWidget LinuxDeviceConfigurationsSettingsWidget::~LinuxDeviceConfigurationsSettingsWidget() { if (m_saveSettingsRequested) { - Core::ICore::instance()->settings()->setValue(LastDeviceConfigIndexKey, + Core::ICore::settings()->setValue(LastDeviceConfigIndexKey, currentIndex()); LinuxDeviceConfigurations::replaceInstance(m_devConfigs.data()); } @@ -161,7 +161,7 @@ void LinuxDeviceConfigurationsSettingsWidget::initGui() m_ui->portsLineEdit->setValidator(portsValidator); connect(m_ui->makeKeyFileDefaultButton, SIGNAL(clicked()), SLOT(setDefaultKeyFilePath())); - int lastIndex = Core::ICore::instance()->settings() + int lastIndex = Core::ICore::settings() ->value(LastDeviceConfigIndexKey, 0).toInt(); if (lastIndex == -1) lastIndex = 0; diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index fef99bf855..b4ae814d47 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -57,7 +57,7 @@ PublicKeyDeploymentDialog *PublicKeyDeploymentDialog::createDialog(const LinuxDe { const QString &dir = QFileInfo(deviceConfig->sshParameters().privateKeyFile).path(); const QString publicKeyFileName = QFileDialog::getOpenFileName(parent - ? parent : Core::ICore::instance()->mainWindow(), + ? parent : Core::ICore::mainWindow(), tr("Choose Public Key File"), dir, tr("Public Key Files (*.pub);;All Files (*)")); if (publicKeyFileName.isEmpty()) diff --git a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp index 82c4da93f9..f58f7066a9 100644 --- a/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxdeployconfigurationwidget.cpp @@ -194,7 +194,7 @@ void RemoteLinuxDeployConfigurationWidget::handleDeviceConfigurationListChanged( void RemoteLinuxDeployConfigurationWidget::showDeviceConfigurations() { - Core::ICore::instance()->showOptionsDialog(LinuxDeviceConfigurationsSettingsPage::pageCategory(), + Core::ICore::showOptionsDialog(LinuxDeviceConfigurationsSettingsPage::pageCategory(), LinuxDeviceConfigurationsSettingsPage::pageId()); } diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp index 8a7ef4c27c..41da017e3c 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationwidget.cpp @@ -312,10 +312,10 @@ void RemoteLinuxRunConfigurationWidget::handleWorkingDirectoryChanged() void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link) { if (link == QLatin1String("deviceconfig")) { - Core::ICore::instance()->showOptionsDialog(LinuxDeviceConfigurationsSettingsPage::pageCategory(), + Core::ICore::showOptionsDialog(LinuxDeviceConfigurationsSettingsPage::pageCategory(), LinuxDeviceConfigurationsSettingsPage::pageId()); } else if (link == QLatin1String("debugger")) { - Core::ICore::instance()->showOptionsDialog(QLatin1String("O.Debugger"), + Core::ICore::showOptionsDialog(QLatin1String("O.Debugger"), QLatin1String("M.Gdb")); } } diff --git a/src/plugins/remotelinux/startgdbserverdialog.cpp b/src/plugins/remotelinux/startgdbserverdialog.cpp index 0d8e941983..f8633d7d78 100644 --- a/src/plugins/remotelinux/startgdbserverdialog.cpp +++ b/src/plugins/remotelinux/startgdbserverdialog.cpp @@ -112,7 +112,7 @@ public: StartGdbServerDialogPrivate::StartGdbServerDialogPrivate(StartGdbServerDialog *q) : q(q), processList(0) { - settings = ICore::instance()->settings(); + settings = ICore::settings(); deviceComboBox = new QComboBox(q); diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp index 173e695843..65c0599942 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.cpp +++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp @@ -70,8 +70,7 @@ ResourceEditorPlugin::~ResourceEditorPlugin() bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments) - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage)) return false; m_editor = new ResourceEditorFactory(this); @@ -93,7 +92,7 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err const Core::Context context(Constants::C_RESOURCEEDITOR); m_undoAction = new QAction(tr("&Undo"), this); m_redoAction = new QAction(tr("&Redo"), this); - Core::ActionManager * const actionManager = core->actionManager(); + Core::ActionManager * const actionManager = Core::ICore::actionManager(); actionManager->registerAction(m_undoAction, Core::Constants::UNDO, context); actionManager->registerAction(m_redoAction, Core::Constants::REDO, context); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo())); diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index a7fa3eadee..429c921b59 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -118,7 +118,7 @@ bool ResourceEditorW::createNew(const QString &contents) { Utils::TempFileSaver saver; saver.write(contents.toUtf8()); - if (!saver.finalize(Core::ICore::instance()->mainWindow())) + if (!saver.finalize(Core::ICore::mainWindow())) return false; const bool rc = m_resourceEditor->load(saver.fileName()); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 1f8be8b7c5..42eb502314 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -270,12 +270,11 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e initializeVcs(new SubversionControl(this)); m_subversionPluginInstance = this; - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) return false; - if (QSettings *settings = core->settings()) + if (QSettings *settings = Core::ICore::settings()) m_settings.fromSettings(settings); addAutoReleasedObject(new SettingsPage); @@ -295,7 +294,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e addAutoReleasedObject(m_commandLocator); //register actions - Core::ActionManager *ami = core->actionManager(); + Core::ActionManager *ami = Core::ICore::actionManager(); Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); Core::ActionContainer *subversionMenu = @@ -513,7 +512,7 @@ bool SubversionPlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *su bool closeEditor = true; if (!fileList.empty()) { // get message & commit - closeEditor = Core::ICore::instance()->fileManager()->saveFile(fileIFace); + closeEditor = Core::ICore::fileManager()->saveFile(fileIFace); if (closeEditor) closeEditor = commit(m_commitMessageFileName, fileList); } @@ -1080,7 +1079,7 @@ void SubversionPlugin::slotDescribe() const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - QInputDialog inputDialog(Core::ICore::instance()->mainWindow()); + QInputDialog inputDialog(Core::ICore::mainWindow()); inputDialog.setWindowFlags(inputDialog.windowFlags() & ~Qt::WindowContextHelpButtonHint); inputDialog.setInputMode(QInputDialog::IntInput); inputDialog.setIntRange(2, INT_MAX); @@ -1200,7 +1199,7 @@ void SubversionPlugin::setSettings(const SubversionSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = Core::ICore::instance()->settings()) + if (QSettings *settings = Core::ICore::settings()) m_settings.toSettings(settings); subVersionControl()->emitConfigurationChanged(); } diff --git a/src/plugins/tasklist/taskfilefactory.cpp b/src/plugins/tasklist/taskfilefactory.cpp index ac9f601265..d63ed182b1 100644 --- a/src/plugins/tasklist/taskfilefactory.cpp +++ b/src/plugins/tasklist/taskfilefactory.cpp @@ -85,7 +85,7 @@ Core::IFile *TaskFileFactory::open(ProjectExplorer::Project *context, const QStr QString errorString; if (!file->open(&errorString, fileName)) { - QMessageBox::critical(Core::ICore::instance()->mainWindow(), tr("File Error"), errorString); + QMessageBox::critical(Core::ICore::mainWindow(), tr("File Error"), errorString); delete file; return 0; } @@ -93,7 +93,7 @@ Core::IFile *TaskFileFactory::open(ProjectExplorer::Project *context, const QStr m_openFiles.append(file); // Register with filemanager: - Core::ICore::instance()->fileManager()->addFile(file); + Core::ICore::fileManager()->addFile(file); return file; } diff --git a/src/plugins/tasklist/tasklistplugin.cpp b/src/plugins/tasklist/tasklistplugin.cpp index 646f29eaee..6e7e6d5a5c 100644 --- a/src/plugins/tasklist/tasklistplugin.cpp +++ b/src/plugins/tasklist/tasklistplugin.cpp @@ -198,8 +198,7 @@ bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMess //: Category under which tasklist tasks are listed in Issues view d->hub->addCategory(QLatin1String(Constants::TASKLISTTASK_ID), tr("My Tasks")); - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"), errorMessage)) return false; d->fileFactory = new Internal::TaskFileFactory(this); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 1d575115ec..c91c5707fc 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -158,7 +158,7 @@ void BaseFileFind::runSearch(Find::SearchResult *search) ITextEditor::openedTextEditorsContents())); } Core::FutureProgress *progress = - Core::ICore::instance()->progressManager()->addTask(watcher->future(), + Core::ICore::progressManager()->addTask(watcher->future(), tr("Search"), QLatin1String(Constants::TASK_SEARCH)); progress->setWidget(label); @@ -179,9 +179,8 @@ void BaseFileFind::doReplace(const QString &text, const QList<Find::SearchResultItem> &items) { QStringList files = replaceAll(text, items); - Core::FileManager *fileManager = Core::ICore::instance()->fileManager(); if (!files.isEmpty()) { - fileManager->notifyFilesChangedInternally(files); + Core::ICore::fileManager()->notifyFilesChangedInternally(files); Find::SearchResultWindow::instance()->hide(); } } diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 923bbbe605..2851005363 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -51,7 +51,7 @@ using namespace Core; BaseHoverHandler::BaseHoverHandler(QObject *parent) : QObject(parent), m_diagnosticTooltip(false) { // Listen for editor opened events in order to connect to tooltip/helpid requests - connect(ICore::instance()->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), + connect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); } diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index e2dd277e41..27dc13b6d3 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -460,7 +460,7 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const } else { QFutureInterface<void> interface; interface.setProgressRange(0, chunks); - Core::ICore::instance()->progressManager()->addTask( + Core::ICore::progressManager()->addTask( interface.future(), tr("Opening file"), QLatin1String(Constants::TASK_OPEN_FILE)); interface.reportStarted(); d->m_document->setUndoRedoEnabled(false); diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 4a48ba13da..f4a2df396b 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -6052,7 +6052,7 @@ QMimeData *BaseTextEditorWidget::duplicateMimeData(const QMimeData *source) cons void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu) { menu->addSeparator(); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QAction *a = am->command(Core::Constants::CUT)->action(); if (a && a->isEnabled()) diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp index f2b511566a..bcb49a6079 100644 --- a/src/plugins/texteditor/behaviorsettingspage.cpp +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -79,7 +79,7 @@ BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate void BehaviorSettingsPage::BehaviorSettingsPagePrivate::init() { - if (const QSettings *s = Core::ICore::instance()->settings()) { + if (const QSettings *s = Core::ICore::settings()) { m_codeStyle->fromSettings(m_parameters.settingsPrefix, s); m_typingSettings.fromSettings(m_parameters.settingsPrefix, s); m_storageSettings.fromSettings(m_parameters.settingsPrefix, s); @@ -151,7 +151,7 @@ void BehaviorSettingsPage::apply() settingsFromUI(&newTypingSettings, &newStorageSettings, &newBehaviorSettings, &newExtraEncodingSettings); - QSettings *s = Core::ICore::instance()->settings(); + QSettings *s = Core::ICore::settings(); if (d->m_codeStyle->tabSettings() != d->m_pageCodeStyle->tabSettings()) { d->m_codeStyle->setTabSettings(d->m_pageCodeStyle->tabSettings()); diff --git a/src/plugins/texteditor/codestylepool.cpp b/src/plugins/texteditor/codestylepool.cpp index 2907951fd1..1ee28c902e 100644 --- a/src/plugins/texteditor/codestylepool.cpp +++ b/src/plugins/texteditor/codestylepool.cpp @@ -93,7 +93,7 @@ QString CodeStylePoolPrivate::generateUniqueId(const QString &id) const static QString customCodeStylesPath() { - QString path = Core::ICore::instance()->userResourcePath(); + QString path = Core::ICore::userResourcePath(); path.append(QLatin1String("/codestyles/")); return path; } diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index f5e201f8be..8e7c4297fb 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -55,7 +55,7 @@ DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate (const DisplaySettingsPageParameters &p) : m_parameters(p), m_page(0) { - if (const QSettings *s = Core::ICore::instance()->settings()) { + if (const QSettings *s = Core::ICore::settings()) { m_displaySettings.fromSettings(m_parameters.settingsPrefix, s); } } @@ -163,8 +163,7 @@ void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySe { if (newDisplaySettings != d->m_displaySettings) { d->m_displaySettings = newDisplaySettings; - Core::ICore *core = Core::ICore::instance(); - if (QSettings *s = core->settings()) + if (QSettings *s = Core::ICore::settings()) d->m_displaySettings.toSettings(d->m_parameters.settingsPrefix, s); emit displaySettingsChanged(newDisplaySettings); diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp index 8e399ab43f..de031d96ca 100644 --- a/src/plugins/texteditor/findincurrentfile.cpp +++ b/src/plugins/texteditor/findincurrentfile.cpp @@ -45,9 +45,9 @@ using namespace TextEditor::Internal; FindInCurrentFile::FindInCurrentFile() : m_currentFile(0) { - connect(Core::ICore::instance()->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), + connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), this, SLOT(handleFileChange(Core::IEditor*))); - handleFileChange(Core::ICore::instance()->editorManager()->currentEditor()); + handleFileChange(Core::ICore::editorManager()->currentEditor()); } QString FindInCurrentFile::id() const diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 1284aa15eb..3738a6d0c9 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -316,7 +316,7 @@ bool FontSettings::loadColorScheme(const QString &fileName, bool FontSettings::saveColorScheme(const QString &fileName) { - const bool saved = m_scheme.save(fileName, Core::ICore::instance()->mainWindow()); + const bool saved = m_scheme.save(fileName, Core::ICore::mainWindow()); if (saved) m_schemeFileName = fileName; return saved; @@ -357,7 +357,7 @@ int FontSettings::defaultFontSize() */ QString FontSettings::defaultSchemeFileName(const QString &fileName) { - QString defaultScheme = Core::ICore::instance()->resourcePath(); + QString defaultScheme = Core::ICore::resourcePath(); defaultScheme += QLatin1String("/styles/"); if (!fileName.isEmpty() && QFile::exists(defaultScheme + fileName)) diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 2d2d0a18e3..3110c45690 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -147,7 +147,7 @@ using namespace TextEditor::Internal; static QString customStylesPath() { - QString path = Core::ICore::instance()->userResourcePath(); + QString path = Core::ICore::userResourcePath(); path.append(QLatin1String("/styles/")); return path; } @@ -189,7 +189,7 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip m_refreshingSchemeList(false) { bool settingsFound = false; - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); if (settings) settingsFound = m_value.fromSettings(m_settingsGroup, m_descriptions, settings); @@ -493,7 +493,7 @@ void FontSettingsPage::copyColorScheme(const QString &name) ColorScheme scheme = d_ptr->m_value.colorScheme(); scheme.setDisplayName(name); - if (scheme.save(fileName, Core::ICore::instance()->mainWindow())) + if (scheme.save(fileName, Core::ICore::mainWindow())) d_ptr->m_value.setColorSchemeFileName(fileName); refreshColorSchemeList(); @@ -560,7 +560,7 @@ void FontSettingsPage::maybeSaveColorScheme() if (messageBox->exec() == QMessageBox::Save) { const ColorScheme &scheme = d_ptr->m_ui->schemeEdit->colorScheme(); - scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::instance()->mainWindow()); + scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::mainWindow()); } } @@ -568,7 +568,7 @@ void FontSettingsPage::refreshColorSchemeList() { QList<ColorSchemeEntry> colorSchemes; - QString resourcePath = Core::ICore::instance()->resourcePath(); + QString resourcePath = Core::ICore::resourcePath(); QDir styleDir(resourcePath + QLatin1String("/styles")); styleDir.setNameFilters(QStringList() << QLatin1String("*.xml")); styleDir.setFilter(QDir::Files); @@ -619,7 +619,7 @@ void FontSettingsPage::apply() // Update the scheme and save it under the name it already has d_ptr->m_value.setColorScheme(d_ptr->m_ui->schemeEdit->colorScheme()); const ColorScheme &scheme = d_ptr->m_value.colorScheme(); - scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::instance()->mainWindow()); + scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::mainWindow()); } int index = d_ptr->m_ui->schemeComboBox->currentIndex(); @@ -636,7 +636,7 @@ void FontSettingsPage::saveSettings() { if (d_ptr->m_value != d_ptr->m_lastValue) { d_ptr->m_lastValue = d_ptr->m_value; - if (QSettings *settings = Core::ICore::instance()->settings()) + if (QSettings *settings = Core::ICore::settings()) d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, settings); QTimer::singleShot(0, this, SLOT(delayedChange())); diff --git a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp index d5d08c742b..6d52d7c2c8 100644 --- a/src/plugins/texteditor/generichighlighter/highlightersettings.cpp +++ b/src/plugins/texteditor/generichighlighter/highlightersettings.cpp @@ -92,7 +92,7 @@ QString findFallbackDefinitionsLocation() } #endif - dir.setPath(Core::ICore::instance()->resourcePath() + QLatin1String("/generic-highlighter")); + dir.setPath(Core::ICore::resourcePath() + QLatin1String("/generic-highlighter")); if (dir.exists() && !dir.entryInfoList().isEmpty()) return dir.path(); @@ -192,7 +192,7 @@ void HighlighterSettings::assignDefaultIgnoredPatterns() void HighlighterSettings::assignDefaultDefinitionsPath() { const QString &path = - Core::ICore::instance()->userResourcePath() + QLatin1String("/generic-highlighter"); + Core::ICore::userResourcePath() + QLatin1String("/generic-highlighter"); if (QFile::exists(path) || QDir().mkpath(path)) m_definitionFilesPath = path; } diff --git a/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp b/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp index fa0bb96aab..b72ba14a4a 100644 --- a/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp +++ b/src/plugins/texteditor/generichighlighter/highlightersettingspage.cpp @@ -72,7 +72,7 @@ HighlighterSettingsPage::HighlighterSettingsPage(const QString &id, QObject *par m_requestMimeTypeRegistration(false), m_d(new HighlighterSettingsPagePrivate(id)) { - if (QSettings *s = Core::ICore::instance()->settings()) + if (QSettings *s = Core::ICore::settings()) m_d->m_settings.fromSettings(m_d->m_settingsPrefix, s); } @@ -168,7 +168,7 @@ void HighlighterSettingsPage::settingsFromUI() m_d->m_settings.setAlertWhenNoDefinition(m_d->m_page->alertWhenNoDefinition->isChecked()); m_d->m_settings.setUseFallbackLocation(m_d->m_page->useFallbackLocation->isChecked()); m_d->m_settings.setIgnoredFilesPatterns(m_d->m_page->ignoreEdit->text()); - if (QSettings *s = Core::ICore::instance()->settings()) + if (QSettings *s = Core::ICore::settings()) m_d->m_settings.toSettings(m_d->m_settingsPrefix, s); } diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index ebb05b16ec..3880353e81 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -186,14 +186,14 @@ public: const int ManagerProcessor::kMaxProgress = 200; ManagerProcessor::ManagerProcessor() - : m_knownSuffixes(QSet<QString>::fromList(Core::ICore::instance()->mimeDatabase()->suffixes())) + : m_knownSuffixes(QSet<QString>::fromList(Core::ICore::mimeDatabase()->suffixes())) { const HighlighterSettings &settings = TextEditorSettings::instance()->highlighterSettings(); m_definitionsPaths.append(settings.definitionFilesPath()); if (settings.useFallbackLocation()) m_definitionsPaths.append(settings.fallbackDefinitionFilesPath()); - Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); + Core::MimeDatabase *mimeDatabase = Core::ICore::mimeDatabase(); foreach (const Core::MimeType &userMimeType, mimeDatabase->readUserModifiedMimeTypes()) m_userModified.insert(userMimeType.type(), userMimeType); foreach (const Core::MimeType &mimeType, mimeDatabase->mimeTypes()) @@ -319,7 +319,7 @@ void Manager::registerMimeTypes() connect(&m_registeringWatcher, SIGNAL(finished()), processor, SLOT(deleteLater())); m_registeringWatcher.setFuture(future); - Core::ICore::instance()->progressManager()->addTask(future, + Core::ICore::progressManager()->addTask(future, tr("Registering definitions"), QLatin1String(Constants::TASK_REGISTER_DEFINITIONS)); } else { @@ -340,7 +340,7 @@ void Manager::registerMimeTypesFinished() PlainTextEditorFactory *factory = TextEditorPlugin::instance()->editorFactory(); const QSet<QString> &inFactory = factory->mimeTypes().toSet(); foreach (const Core::MimeType &mimeType, result.second) { - Core::ICore::instance()->mimeDatabase()->addMimeType(mimeType); + Core::ICore::mimeDatabase()->addMimeType(mimeType); if (!inFactory.contains(mimeType.type())) factory->addMimeType(mimeType.type()); } @@ -455,7 +455,7 @@ void Manager::downloadDefinitions(const QList<QUrl> &urls, const QString &savePa m_isDownloadingDefinitionsSpec = true; QFuture<void> future = QtConcurrent::map(m_downloaders, DownloaderStarter()); m_downloadWatcher.setFuture(future); - Core::ICore::instance()->progressManager()->addTask(future, + Core::ICore::progressManager()->addTask(future, tr("Downloading definitions"), QLatin1String(Constants::TASK_DOWNLOAD_DEFINITIONS)); } diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index 51b945c75c..74188d3b46 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -104,7 +104,7 @@ void OutlineWidgetStack::restoreSettings(int position) { m_position = position; // save it so that we can save/restore in updateCurrentEditor - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); const bool toggleSync = settings->value(outLineKey(position), true).toBool(); toggleSyncButton()->setChecked(toggleSync); @@ -117,7 +117,7 @@ void OutlineWidgetStack::saveSettings(int position) { Q_ASSERT(position == m_position); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->setValue(outLineKey(position), toggleSyncButton()->isEnabled()); if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) { diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index e15377e77f..5737aac631 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -150,13 +150,13 @@ void PlainTextEditorWidget::configure() { Core::MimeType mimeType; if (file()) - mimeType = Core::ICore::instance()->mimeDatabase()->findByFile(file()->fileName()); + mimeType = Core::ICore::mimeDatabase()->findByFile(file()->fileName()); configure(mimeType); } void PlainTextEditorWidget::configure(const QString &mimeType) { - configure(Core::ICore::instance()->mimeDatabase()->findByType(mimeType)); + configure(Core::ICore::mimeDatabase()->findByType(mimeType)); } void PlainTextEditorWidget::configure(const Core::MimeType &mimeType) @@ -221,7 +221,7 @@ QString PlainTextEditorWidget::findDefinitionId(const Core::MimeType &mimeType, if (definitionId.isEmpty()) { foreach (const QString &parent, mimeType.subClassesOf()) { const Core::MimeType &parentMimeType = - Core::ICore::instance()->mimeDatabase()->findByType(parent); + Core::ICore::mimeDatabase()->findByType(parent); definitionId = findDefinitionId(parentMimeType, considerParents); } } @@ -231,7 +231,7 @@ QString PlainTextEditorWidget::findDefinitionId(const Core::MimeType &mimeType, void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo() { - Core::ICore::instance()->showOptionsDialog(QLatin1String(Constants::TEXT_EDITOR_SETTINGS_CATEGORY), + Core::ICore::showOptionsDialog(QLatin1String(Constants::TEXT_EDITOR_SETTINGS_CATEGORY), QLatin1String(Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS)); } diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp index bba0e08788..e39b3dd41b 100644 --- a/src/plugins/texteditor/snippets/snippetscollection.cpp +++ b/src/plugins/texteditor/snippets/snippetscollection.cpp @@ -109,10 +109,10 @@ SnippetsCollection *SnippetsCollection::instance() // SnippetsCollection SnippetsCollection::SnippetsCollection() : - m_userSnippetsPath(Core::ICore::instance()->userResourcePath() + QLatin1String("/snippets/")), + m_userSnippetsPath(Core::ICore::userResourcePath() + QLatin1String("/snippets/")), m_userSnippetsFile(QLatin1String("snippets.xml")) { - QDir dir(Core::ICore::instance()->resourcePath() + QLatin1String("/snippets/")); + QDir dir(Core::ICore::resourcePath() + QLatin1String("/snippets/")); dir.setNameFilters(QStringList(QLatin1String("*.xml"))); foreach (const QFileInfo &fi, dir.entryInfoList()) m_builtInSnippetsFiles.append(fi.absoluteFilePath()); diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp index 2f146481f8..432a0cdb37 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp +++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp @@ -402,7 +402,7 @@ void SnippetsSettingsPagePrivate::apply() if (SnippetsCollection::instance()->synchronize(&errorString)) m_snippetsCollectionChanged = false; else - QMessageBox::critical(Core::ICore::instance()->mainWindow(), + QMessageBox::critical(Core::ICore::mainWindow(), tr("Error While Saving Snippet Collection"), errorString); } } @@ -422,7 +422,7 @@ void SnippetsSettingsPagePrivate::loadSettings() if (m_ui.groupCombo->count() == 0) return; - if (QSettings *s = Core::ICore::instance()->settings()) { + if (QSettings *s = Core::ICore::settings()) { m_settings.fromSettings(m_settingsPrefix, s); const QString &lastGroupName = m_settings.lastUsedSnippetGroup(); const int index = m_ui.groupCombo->findText(lastGroupName); @@ -438,7 +438,7 @@ void SnippetsSettingsPagePrivate::writeSettings() if (m_ui.groupCombo->count() == 0) return; - if (QSettings *s = Core::ICore::instance()->settings()) { + if (QSettings *s = Core::ICore::settings()) { m_settings.setLastUsedSnippetGroup(m_ui.groupCombo->currentText()); m_settings.toSettings(m_settingsPrefix, s); } diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index cc26761162..2a99aec764 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -107,7 +107,7 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context, m_contextId(context), m_initialized(false) { - connect(Core::ICore::instance()->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), + connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), this, SLOT(updateCurrentEditor(Core::IEditor*))); } @@ -147,7 +147,7 @@ void TextEditorActionHandler::createActions() m_gotoAction = registerNewAction(Core::Constants::GOTO, this, SLOT(gotoAction())); m_printAction = registerNewAction(Core::Constants::PRINT, this, SLOT(printAction())); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED); @@ -453,7 +453,7 @@ QAction *TextEditorActionHandler::registerNewAction(const Core::Id &id, bool scr return 0; QAction *result = new QAction(title, this); - Core::ICore::instance()->actionManager()->registerAction(result, id, m_contextId, scriptable); + Core::ICore::actionManager()->registerAction(result, id, m_contextId, scriptable); return result; } @@ -538,7 +538,7 @@ void TextEditorActionHandler::gotoAction() void TextEditorActionHandler::printAction() { if (m_currentEditor) - m_currentEditor->print(Core::ICore::instance()->printer()); + m_currentEditor->print(Core::ICore::printer()); } void TextEditorActionHandler::setVisualizeWhitespace(bool checked) diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 16cf861b82..6f82f108a0 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -103,7 +103,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe { Q_UNUSED(arguments) - if (!Core::ICore::instance()->mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage)) return false; Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); @@ -125,15 +125,14 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe addAutoReleasedObject(m_editorFactory); // Goto line functionality for quick open - Core::ICore *core = Core::ICore::instance(); m_lineNumberFilter = new LineNumberFilter; addAutoReleasedObject(m_lineNumberFilter); Core::Context context(TextEditor::Constants::C_TEXTEDITOR); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); // Add shortcut for invoking automatic completion - QShortcut *completionShortcut = new QShortcut(core->mainWindow()); + QShortcut *completionShortcut = new QShortcut(Core::ICore::mainWindow()); completionShortcut->setWhatsThis(tr("Triggers a completion in this scope")); // Make sure the shortcut still works when the completion widget is active completionShortcut->setContext(Qt::ApplicationShortcut); @@ -146,7 +145,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe connect(completionShortcut, SIGNAL(activated()), this, SLOT(invokeCompletion())); // Add shortcut for invoking quick fix options - QShortcut *quickFixShortcut = new QShortcut(core->mainWindow()); + QShortcut *quickFixShortcut = new QShortcut(Core::ICore::mainWindow()); quickFixShortcut->setWhatsThis(tr("Triggers a quick fix in this scope")); // Make sure the shortcut still works when the quick fix widget is active quickFixShortcut->setContext(Qt::ApplicationShortcut); diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 9c7188d413..40fa0e6482 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -232,7 +232,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent) this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); // TODO: Move these settings to TextEditor category - if (QSettings *s = Core::ICore::instance()->settings()) + if (QSettings *s = Core::ICore::settings()) m_d->m_completionSettings.fromSettings(QLatin1String("CppTools/"), s); } @@ -340,7 +340,7 @@ void TextEditorSettings::setCompletionSettings(const TextEditor::CompletionSetti return; m_d->m_completionSettings = settings; - if (QSettings *s = Core::ICore::instance()->settings()) + if (QSettings *s = Core::ICore::settings()) m_d->m_completionSettings.toSettings(QLatin1String("CppTools/"), s); emit completionSettingsChanged(m_d->m_completionSettings); diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 306dff690d..6a2c336e4e 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -125,7 +125,7 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString * d->checkUpdateInfoWatcher = new QFutureWatcher<QDomDocument>(this); connect(d->checkUpdateInfoWatcher, SIGNAL(finished()), this, SLOT(reactOnUpdaterOutput())); - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); d->updaterProgram = settings->value(QLatin1String("Updater/Application")).toString(); d->updaterCheckOnlyArgument = settings->value(QLatin1String("Updater/CheckOnlyArgument")).toString(); d->updaterRunUiArgument = settings->value(QLatin1String("Updater/RunUiArgument")).toString(); @@ -142,9 +142,7 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString * return false; } - Core::ICore* const core = Core::ICore::instance(); - Core::ActionManager* const actionManager = core->actionManager(); - Core::ActionContainer* const helpActionContainer = actionManager->actionContainer(Core::Constants::M_HELP); + Core::ActionContainer* const helpActionContainer = Core::ICore::actionManager()->actionContainer(Core::Constants::M_HELP); helpActionContainer->menu()->addAction(tr("Start Updater"), this, SLOT(startUpdaterUiApplication())); //wait some time before we want to have the first check @@ -189,7 +187,7 @@ void UpdateInfoPlugin::reactOnUpdaterOutput() startCheckTimer(60 * OneMinute); } else { //added the current almost finished task to the progressmanager - d->updateInfoProgress = Core::ICore::instance()->progressManager()->addTask( + d->updateInfoProgress = Core::ICore::progressManager()->addTask( d->lastCheckUpdateInfoTask, tr("Update"), QLatin1String("Update.GetInfo"), Core::ProgressManager::KeepOnFinish); d->updateInfoProgress->setKeepOnFinish(Core::FutureProgress::KeepOnFinish); diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index e6c9913ca2..f3ecd8a240 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -502,9 +502,7 @@ CallgrindTool::CallgrindTool(QObject *parent) d = new CallgrindToolPrivate(this); setObjectName(QLatin1String("CallgrindTool")); - Core::ICore *core = Core::ICore::instance(); - QObject *editorManager = core->editorManager(); - connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), + connect(Core::ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)), d, SLOT(editorOpened(Core::IEditor*))); } @@ -541,8 +539,7 @@ IAnalyzerTool::ToolMode CallgrindTool::toolMode() const void CallgrindTool::extensionsInitialized() { - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *actionManager = core->actionManager(); + Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Context analyzerContext = Core::Context(Analyzer::Constants::C_ANALYZEMODE); diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index f1a297222e..3365626128 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -83,7 +83,7 @@ bool ValgrindEngine::start() { emit starting(this); - Core::FutureProgress *fp = Core::ICore::instance()->progressManager()->addTask(m_progress->future(), + Core::FutureProgress *fp = Core::ICore::progressManager()->addTask(m_progress->future(), progressTitle(), "valgrind"); fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish); m_progress->setProgressRange(0, progressMaximum); @@ -144,7 +144,7 @@ void ValgrindEngine::handleProgressCanceled() void ValgrindEngine::handleProgressFinished() { - QApplication::alert(Core::ICore::instance()->mainWindow(), 3000); + QApplication::alert(Core::ICore::mainWindow(), 3000); } void ValgrindEngine::runnerFinished() diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp index 1e78fb3e84..d61e58a0a8 100644 --- a/src/plugins/vcsbase/cleandialog.cpp +++ b/src/plugins/vcsbase/cleandialog.cpp @@ -264,7 +264,7 @@ bool CleanDialog::promptToDelete() QFuture<void> task = QtConcurrent::run(cleanTask, &Internal::CleanFilesTask::run); const QString taskName = tr("Cleaning %1"). arg(QDir::toNativeSeparators(d->m_workingDirectory)); - Core::ICore::instance()->progressManager()->addTask(task, taskName, + Core::ICore::progressManager()->addTask(task, taskName, QLatin1String("VcsBase.cleanRepository")); return true; } diff --git a/src/plugins/vcsbase/command.cpp b/src/plugins/vcsbase/command.cpp index 94d3f6b932..0f4f6a89a6 100644 --- a/src/plugins/vcsbase/command.cpp +++ b/src/plugins/vcsbase/command.cpp @@ -197,7 +197,7 @@ void Command::execute() binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter const QString taskName = binary + QLatin1Char(' ') + d->m_jobs.front().arguments.at(0); - Core::ICore::instance()->progressManager()->addTask(task, taskName, binary + QLatin1String(".action")); + Core::ICore::progressManager()->addTask(task, taskName, binary + QLatin1String(".action")); } bool Command::lastExecutionSuccess() const diff --git a/src/plugins/vcsbase/commonsettingspage.cpp b/src/plugins/vcsbase/commonsettingspage.cpp index 91768c7a24..fc0da5ef8c 100644 --- a/src/plugins/vcsbase/commonsettingspage.cpp +++ b/src/plugins/vcsbase/commonsettingspage.cpp @@ -109,7 +109,7 @@ QString CommonSettingsWidget::searchKeyWordMatchString() const CommonOptionsPage::CommonOptionsPage(QObject *parent) : VcsBaseOptionsPage(parent) { - m_settings.fromSettings(Core::ICore::instance()->settings()); + m_settings.fromSettings(Core::ICore::settings()); } void CommonOptionsPage::updateNickNames() @@ -141,7 +141,7 @@ void CommonOptionsPage::apply() const CommonVcsSettings newSettings = m_widget->settings(); if (newSettings != m_settings) { m_settings = newSettings; - m_settings.toSettings(Core::ICore::instance()->settings()); + m_settings.toSettings(Core::ICore::settings()); emit settingsChanged(m_settings); } } diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 3e7c076ad4..dd2c6a16bb 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -69,9 +69,9 @@ Q_DECLARE_METATYPE(QVariant) -inline Core::IEditor *locateEditor(const Core::ICore *core, const char *property, const QString &entry) +inline Core::IEditor *locateEditor(const char *property, const QString &entry) { - foreach (Core::IEditor *ed, core->editorManager()->openedEditors()) + foreach (Core::IEditor *ed, Core::ICore::editorManager()->openedEditors()) if (ed->file()->property(property).toString() == entry) return ed; return 0; @@ -100,7 +100,6 @@ public: void bindCommandToEditor(Command *cmd, VcsBaseEditorWidget *editor); void commandFinishedGotoLine(QObject *editorObject); - Core::ICore *m_core; VcsBaseClientSettings *m_clientSettings; QSignalMapper *m_cmdFinishedMapper; @@ -109,7 +108,6 @@ private: }; VcsBaseClientPrivate::VcsBaseClientPrivate(VcsBaseClient *client, VcsBaseClientSettings *settings) : - m_core(Core::ICore::instance()), m_clientSettings(settings), m_cmdFinishedMapper(new QSignalMapper(client)), m_client(client) @@ -144,7 +142,7 @@ void VcsBaseClientPrivate::annotateRevision(QString source, QString change, int void VcsBaseClientPrivate::saveSettings() { - m_clientSettings->writeSettings(m_core->settings()); + m_clientSettings->writeSettings(Core::ICore::settings()); } void VcsBaseClientPrivate::bindCommandToEditor(Command *cmd, VcsBaseEditorWidget *editor) @@ -176,7 +174,7 @@ VcsBaseClient::VcsBaseClient(VcsBaseClientSettings *settings) : d(new VcsBaseClientPrivate(this, settings)) { qRegisterMetaType<QVariant>(); - connect(d->m_core, SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); + connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings())); connect(d->m_cmdFinishedMapper, SIGNAL(mapped(QObject*)), this, SLOT(commandFinishedGotoLine(QObject*))); } @@ -562,7 +560,7 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(const QString &kind const QString &dynamicPropertyValue) const { VcsBase::VcsBaseEditorWidget *baseEditor = 0; - Core::IEditor *outputEditor = locateEditor(d->m_core, registerDynamicProperty, dynamicPropertyValue); + Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue); const QString progressMsg = tr("Working..."); if (outputEditor) { // Exists already @@ -570,7 +568,7 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(const QString &kind baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor); QTC_ASSERT(baseEditor, return 0); } else { - outputEditor = d->m_core->editorManager()->openEditorWithContents(Core::Id(kind), &title, progressMsg); + outputEditor = Core::ICore::editorManager()->openEditorWithContents(Core::Id(kind), &title, progressMsg); outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue); baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor); connect(baseEditor, SIGNAL(annotateRevisionRequested(QString,QString,int)), @@ -582,7 +580,7 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(const QString &kind } baseEditor->setForceReadOnly(true); - d->m_core->editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + Core::ICore::editorManager()->activateEditor(outputEditor, Core::EditorManager::ModeSwitch); return baseEditor; } @@ -633,8 +631,7 @@ void VcsBaseClient::enqueueJob(Command *cmd, const QStringList &args) void VcsBaseClient::resetCachedVcsInfo(const QString &workingDir) { - Core::VcsManager *vcsManager = d->m_core->vcsManager(); - vcsManager->resetVersionControlForDirectory(workingDir); + Core::ICore::vcsManager()->resetVersionControlForDirectory(workingDir); } } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index f7ed1f6a4e..b4670ffba7 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -209,12 +209,11 @@ public slots: StateListener::StateListener(QObject *parent) : QObject(parent) { - Core::ICore *core = Core::ICore::instance(); - connect(core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), + connect(Core::ICore::editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)), this, SLOT(slotStateChanged())); - connect(core->editorManager(), SIGNAL(currentEditorStateChanged(Core::IEditor*)), + connect(Core::ICore::editorManager(), SIGNAL(currentEditorStateChanged(Core::IEditor*)), this, SLOT(slotStateChanged())); - connect(core->vcsManager(), SIGNAL(repositoryChanged(QString)), + connect(Core::ICore::vcsManager(), SIGNAL(repositoryChanged(QString)), this, SLOT(slotStateChanged())); if (ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance()) @@ -233,14 +232,13 @@ static inline QString displayNameOfEditor(const QString &fileName) void StateListener::slotStateChanged() { const ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); - const Core::ICore *core = Core::ICore::instance(); - Core::VcsManager *vcsManager = core->vcsManager(); + Core::VcsManager *vcsManager = Core::ICore::vcsManager(); // Get the current file. Are we on a temporary submit editor indicated by // temporary path prefix or does the file contains a hash, indicating a project // folder? State state; - Core::EditorManager *em = core->editorManager(); + Core::EditorManager *em = Core::ICore::editorManager(); if (!em || !em->currentEditor() || !em->currentEditor()->file()) state.currentFile.clear(); else @@ -625,7 +623,7 @@ void VcsBasePlugin::promptToDeleteCurrentFile() { const VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasFile(), return) - const bool rc = Core::ICore::instance()->vcsManager()->promptToDelete(versionControl(), state.currentFile()); + const bool rc = Core::ICore::vcsManager()->promptToDelete(versionControl(), state.currentFile()); if (!rc) QMessageBox::warning(0, tr("Version Control"), tr("The file '%1' could not be deleted."). @@ -648,12 +646,12 @@ void VcsBasePlugin::createRepository() if (const ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectExplorerPlugin::instance()->currentProject()) directory = QFileInfo(currentProject->file()->fileName()).absolutePath(); // Prompt for a directory that is not under version control yet - QMainWindow *mw = Core::ICore::instance()->mainWindow(); + QMainWindow *mw = Core::ICore::mainWindow(); do { directory = QFileDialog::getExistingDirectory(mw, tr("Choose Repository Directory"), directory); if (directory.isEmpty()) return; - const Core::IVersionControl *managingControl = Core::ICore::instance()->vcsManager()->findVersionControlForDirectory(directory); + const Core::IVersionControl *managingControl = Core::ICore::vcsManager()->findVersionControlForDirectory(directory); if (managingControl == 0) break; const QString question = tr("The directory '%1' is already managed by a version control system (%2)." diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 6976057ad7..e0362d0035 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -278,7 +278,7 @@ static inline QStringList fieldTexts(const QString &fileContents) void VcsBaseSubmitEditor::createUserFields(const QString &fieldConfigFile) { Utils::FileReader reader; - if (!reader.fetch(fieldConfigFile, QIODevice::Text, Core::ICore::instance()->mainWindow())) + if (!reader.fetch(fieldConfigFile, QIODevice::Text, Core::ICore::mainWindow())) return; // Parse into fields const QStringList fields = fieldTexts(QString::fromUtf8(reader.data())); @@ -590,7 +590,7 @@ VcsBaseSubmitEditor::PromptSubmitResult const bool prompt = forcePrompt || *promptSetting; - QWidget *parent = Core::ICore::instance()->mainWindow(); + QWidget *parent = Core::ICore::mainWindow(); // Pop up a message depending on whether the check succeeded and the // user wants to be prompted bool canCommit = checkSubmitMessage(&errorMessage) && submitWidget->canSubmit(); diff --git a/src/plugins/vcsbase/vcsconfigurationpage.cpp b/src/plugins/vcsbase/vcsconfigurationpage.cpp index 15c08209f4..ec8a394da9 100644 --- a/src/plugins/vcsbase/vcsconfigurationpage.cpp +++ b/src/plugins/vcsbase/vcsconfigurationpage.cpp @@ -94,8 +94,7 @@ bool VcsConfigurationPage::isComplete() const void VcsConfigurationPage::openConfiguration() { - Core::ICore *core = Core::ICore::instance(); - core->showOptionsDialog(VcsBase::Constants::VCS_SETTINGS_CATEGORY, d->m_versionControl->id().toString()); + Core::ICore::showOptionsDialog(VcsBase::Constants::VCS_SETTINGS_CATEGORY, d->m_versionControl->id().toString()); } } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcsplugin.cpp b/src/plugins/vcsbase/vcsplugin.cpp index 29c2cb8693..c828975e02 100644 --- a/src/plugins/vcsbase/vcsplugin.cpp +++ b/src/plugins/vcsbase/vcsplugin.cpp @@ -67,8 +67,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments) - Core::ICore *core = Core::ICore::instance(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/vcsbase/VCSBase.mimetypes.xml"), errorMessage)) + if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/vcsbase/VCSBase.mimetypes.xml"), errorMessage)) return false; m_coreListener = new CoreListener; diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 828cea1280..ec33d49f74 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -177,7 +177,7 @@ bool WelcomeMode::eventFilter(QObject *, QEvent *e) WelcomeMode::~WelcomeMode() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->setValue(QLatin1String(currentPageSettingsKeyC), activePlugin()); delete m_modeWidget; } @@ -193,7 +193,7 @@ void WelcomeMode::facilitateQml(QDeclarativeEngine * /*engine*/) void WelcomeMode::initPlugins() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); setActivePlugin(settings->value(QLatin1String(currentPageSettingsKeyC)).toInt()); // TODO: re-enable reading from Settings when possible. See QTCREATORBUG-6803 @@ -227,7 +227,7 @@ void WelcomeMode::initPlugins() // finally, load the root page m_welcomePage->setSource( - QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/welcomescreen.qml"))); + QUrl::fromLocalFile(Core::ICore::resourcePath() + QLatin1String("/welcomescreen/welcomescreen.qml"))); } QString WelcomeMode::platform() const @@ -270,7 +270,7 @@ void WelcomeMode::sendFeedback() void WelcomeMode::newProject() { - Core::ICore::instance()->showNewItemDialog(tr("New Project"), + Core::ICore::showNewItemDialog(tr("New Project"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard)); } @@ -286,8 +286,8 @@ void WelcomeMode::modeChanged(Core::IMode *mode) // Eike doesn't like this, but I do... // ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); -// Core::ModeManager *modeManager = Core::ICore::instance()->modeManager(); -// Core::EditorManager *editorManager = Core::ICore::instance()->editorManager(); +// Core::ModeManager *modeManager = Core::ICore::modeManager(); +// Core::EditorManager *editorManager = Core::ICore::editorManager(); // if (mode->id() == id() && (!projectExplorer->currentProject() && editorManager->openedEditors().isEmpty())) // modeManager->setModeBarHidden(true); // else |