diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 97b9d70376499404b9a2ae227b24cf0be139f3af..7e3d15dc4c18a2330aa5707da716e9a28311c54d 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -42,16 +42,16 @@ #include <QtGui/QMainWindow> #include <QtGui/QHBoxLayout> -#include <coreplugin/icore.h> +#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/coreconstants.h> +#include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/icore.h> #include <coreplugin/mimedatabase.h> #include <coreplugin/uniqueidmanager.h> -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/editormanager/editormanager.h> #include <extensionsystem/pluginmanager.h> -#include <texteditor/texteditorsettings.h> -#include <texteditor/fontsettings.h> #include <find/ifindsupport.h> +#include <texteditor/fontsettings.h> +#include <texteditor/texteditorsettings.h> #include <utils/linecolumnlabel.h> #include <utils/reloadpromptutils.h> @@ -205,7 +205,7 @@ public: break; } - switch (Core::Utils::reloadPrompt(fileName, BinEditorPlugin::core()->mainWindow())) { + switch (Core::Utils::reloadPrompt(fileName, Core::ICore::instance()->mainWindow())) { case Core::Utils::ReloadCurrent: open(fileName); break; @@ -231,12 +231,15 @@ class BinEditorInterface : public Core::IEditor { Q_OBJECT public: - BinEditorInterface(BinEditor *parent ) : Core::IEditor(parent) { + BinEditorInterface(BinEditor *parent) + : Core::IEditor(parent) + { + Core::ICore *core = Core::ICore::instance(); m_editor = parent; m_file = new BinEditorFile(parent); - m_context << BinEditorPlugin::core()->uniqueIDManager()-> + m_context << core->uniqueIDManager()-> uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR); - m_context << BinEditorPlugin::core()->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); + m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); m_cursorPositionLabel = new Core::Utils::LineColumnLabel; QHBoxLayout *l = new QHBoxLayout; @@ -317,7 +320,8 @@ QString BinEditorFactory::kind() const Core::IFile *BinEditorFactory::open(const QString &fileName) { - Core::IEditor *iface = m_owner->m_core->editorManager()->openEditor(fileName, kind()); + Core::ICore *core = Core::ICore::instance(); + Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind()); return iface ? iface->file() : 0; } @@ -337,8 +341,7 @@ QStringList BinEditorFactory::mimeTypes() const BinEditorPlugin *BinEditorPlugin::m_instance = 0; -BinEditorPlugin::BinEditorPlugin() : - m_core(0) +BinEditorPlugin::BinEditorPlugin() { m_undoAction = m_redoAction = m_copyAction = m_selectAllAction = 0; m_instance = this; @@ -354,16 +357,11 @@ BinEditorPlugin *BinEditorPlugin::instance() return m_instance; } -Core::ICore *BinEditorPlugin::core() -{ - return m_instance->m_core; -} - QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title) { QAction *result = new QAction(title, this); - m_core->actionManager()->registerAction(result, id, m_context); + Core::ICore::instance()->actionManager()->registerAction(result, id, m_context); return result; } @@ -386,7 +384,8 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor) QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed())); editor->setEditorInterface(editorInterface); - m_context << BinEditorPlugin::core()->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); + Core::ICore *core = Core::ICore::instance(); + m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::C_BINEDITOR); if (!m_undoAction) { m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO), this, SLOT(undoAction()), @@ -416,13 +415,16 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor) aggregate->add(editor); } -bool BinEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) +bool BinEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/bineditor/BinEditor.mimetypes.xml"), errorMessage)) + Q_UNUSED(arguments); + Q_UNUSED(errorMessage); + + Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/bineditor/BinEditor.mimetypes.xml"), errorMessage)) return false; - connect(m_core, SIGNAL(contextAboutToChange(Core::IContext *)), + connect(core, SIGNAL(contextAboutToChange(Core::IContext *)), this, SLOT(updateCurrentEditor(Core::IContext *))); addAutoReleasedObject(new BinEditorFactory(this)); diff --git a/src/plugins/bineditor/bineditorplugin.h b/src/plugins/bineditor/bineditorplugin.h index 51ff129dd6259de65c085116b4116302e647433b..ddc4333acdb5c36514060642c9ee98228f052a1a 100644 --- a/src/plugins/bineditor/bineditorplugin.h +++ b/src/plugins/bineditor/bineditorplugin.h @@ -62,7 +62,6 @@ public: ~BinEditorPlugin(); static BinEditorPlugin *instance(); - static Core::ICore *core(); bool initialize(const QStringList &arguments, QString *error_message = 0); void extensionsInitialized(); diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index dbe9246d977a2ec51dbc99949ce23793b1b5635d..3d9ea294d927d0eef495f8da7b2a4d9280e33009 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -58,6 +58,7 @@ Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*) using namespace Bookmarks; using namespace Bookmarks::Internal; using namespace ProjectExplorer; +using namespace Core; BookmarkDelegate::BookmarkDelegate(QObject *parent) : QStyledItemDelegate(parent), m_normalPixmap(0), m_selectedPixmap(0) @@ -214,8 +215,7 @@ BookmarkView::BookmarkView(QWidget *parent) this, SLOT(gotoBookmark(const QModelIndex &))); m_bookmarkContext = new BookmarkContext(this); - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - core->addContextObject(m_bookmarkContext); + ICore::instance()->addContextObject(m_bookmarkContext); setItemDelegate(new BookmarkDelegate(this)); setFrameStyle(QFrame::NoFrame); @@ -225,8 +225,7 @@ BookmarkView::BookmarkView(QWidget *parent) BookmarkView::~BookmarkView() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - core->removeContextObject(m_bookmarkContext); + ICore::instance()->removeContextObject(m_bookmarkContext); } void BookmarkView::contextMenuEvent(QContextMenuEvent *event) @@ -246,13 +245,11 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event) connect(removeAll, SIGNAL(triggered()), this, SLOT(removeAll())); - menu.exec(mapToGlobal(event->pos())); } void BookmarkView::removeFromContextMenu() { - removeBookmark(m_contextMenuIndex); } @@ -296,7 +293,7 @@ void BookmarkView::gotoBookmark(const QModelIndex &index) BookmarkContext::BookmarkContext(BookmarkView *widget) : m_bookmarkView(widget) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = ICore::instance(); m_context << core->uniqueIDManager()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); } @@ -315,15 +312,14 @@ QWidget *BookmarkContext::widget() //// BookmarkManager::BookmarkManager() : - m_core(BookmarksPlugin::core()), m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png"))) { m_selectionModel = new QItemSelectionModel(this, this); - connect(m_core, SIGNAL(contextChanged(Core::IContext*)), + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)), this, SLOT(updateActionStatus())); - ExtensionSystem::PluginManager *pm = m_core->pluginManager(); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ProjectExplorerPlugin *projectExplorer = pm->getObject<ProjectExplorerPlugin>(); connect(projectExplorer->session(), SIGNAL(sessionLoaded()), @@ -513,7 +509,8 @@ void BookmarkManager::documentPrevNext(bool next) nextLine = markLine; } - m_core->editorManager()->addCurrentPositionToNavigationHistory(true); + Core::EditorManager *em = Core::ICore::instance()->editorManager(); + em->addCurrentPositionToNavigationHistory(true); if (next) { if (nextLine == -1) editor->gotoLine(firstLine); @@ -525,7 +522,7 @@ void BookmarkManager::documentPrevNext(bool next) else editor->gotoLine(prevLine); } - m_core->editorManager()->addCurrentPositionToNavigationHistory(); + em->addCurrentPositionToNavigationHistory(); } void BookmarkManager::next() @@ -557,7 +554,8 @@ void BookmarkManager::prev() TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const { - Core::IEditor *currEditor = m_core->editorManager()->currentEditor(); + Core::EditorManager *em = Core::ICore::instance()->editorManager(); + Core::IEditor *currEditor = em->currentEditor(); if (!currEditor) return 0; return qobject_cast<TextEditor::ITextEditor *>(currEditor); @@ -566,7 +564,7 @@ TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const /* Returns the current session. */ SessionManager *BookmarkManager::sessionManager() const { - ExtensionSystem::PluginManager *pm = m_core->pluginManager(); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>(); return pe->session(); } diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 1763b4e52605dde5c5dd3a2b43ac92dc0817d4d9..0a422e5b2393871d6c3f1082655109b4a1915c25 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -48,7 +48,6 @@ class SessionManager; } namespace Core { -class ICore; class IEditor; } @@ -131,7 +130,6 @@ private: typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap; DirectoryFileBookmarksMap m_bookmarksMap; - Core::ICore *m_core; QIcon m_bookmarkIcon; diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index 961b11bd71437ee64125d6f1054ff3ef162575ae..d7051fab068429fd18bffe645be56afa5d9ccb2e 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -57,7 +57,7 @@ using namespace TextEditor; BookmarksPlugin *BookmarksPlugin::m_instance = 0; BookmarksPlugin::BookmarksPlugin() - : m_bookmarkManager(0), m_core(0) + : m_bookmarkManager(0) { m_instance = this; } @@ -68,13 +68,13 @@ void BookmarksPlugin::extensionsInitialized() bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - Core::ActionManager *am = m_core->actionManager(); + Core::ICore *core = Core::ICore::instance(); + Core::ActionManager *am = core->actionManager(); - QList<int> context = QList<int>() << m_core->uniqueIDManager()-> + QList<int> context = QList<int>() << core->uniqueIDManager()-> uniqueIdentifier(Constants::BOOKMARKS_CONTEXT); QList<int> textcontext, globalcontext; - textcontext << m_core->uniqueIDManager()-> + textcontext << core->uniqueIDManager()-> uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); globalcontext << Core::Constants::C_GLOBAL_ID; @@ -172,7 +172,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) this, SLOT(bookmarkMarginActionTriggered())); // EditorManager - QObject *editorManager = m_core->editorManager(); + QObject *editorManager = core->editorManager(); connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), this, SLOT(editorAboutToClose(Core::IEditor*))); connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), diff --git a/src/plugins/bookmarks/bookmarksplugin.h b/src/plugins/bookmarks/bookmarksplugin.h index f4853c48cb89f1b9d1d88ad9bde02dcded293471..ef3cfbe0236b25f8b98750df672d4f6917e59e24 100644 --- a/src/plugins/bookmarks/bookmarksplugin.h +++ b/src/plugins/bookmarks/bookmarksplugin.h @@ -45,7 +45,6 @@ class QMenu; QT_END_NAMESPACE namespace Core { -class ICore; class IEditor; } @@ -67,7 +66,6 @@ public: ~BookmarksPlugin(); static BookmarksPlugin *instance() { return m_instance; } - static Core::ICore *core() { return m_instance->m_core; } bool initialize(const QStringList &arguments, QString *error_message); void extensionsInitialized(); @@ -85,7 +83,6 @@ private slots: private: static BookmarksPlugin *m_instance; BookmarkManager *m_bookmarkManager; - Core::ICore *m_core; QAction *m_toggleAction; QAction *m_prevAction; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 1f4bc59e9efb04170f759024f6dd5a1244de86bd..966c0144355d73273e7d03b0db7d9ce527e3f7dc 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -37,7 +37,6 @@ #include "cmakeprojectconstants.h" #include <coreplugin/icore.h> -#include <extensionsystem/pluginmanager.h> #include <coreplugin/uniqueidmanager.h> #include <projectexplorer/projectexplorerconstants.h> @@ -45,7 +44,7 @@ using namespace CMakeProjectManager::Internal; CMakeManager::CMakeManager() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); m_projectContext = core->uniqueIDManager()->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT); m_projectLanguage = core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index b83c4c2e30f7153e7a053b720ca822eb23afbdba..29ad08ec5f1501ee5ec58c5a62f1fb72673a4f68 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -39,7 +39,6 @@ #include <coreplugin/icore.h> #include <coreplugin/mimedatabase.h> -#include <extensionsystem/pluginmanager.h> #include <QtCore/QtPlugin> #include <QtCore/QDebug> @@ -57,7 +56,7 @@ CMakeProjectPlugin::~CMakeProjectPlugin() bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage)) return false; addAutoReleasedObject(new CMakeManager()); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index 3932d42598b6cd2b466a993a9b131863d9173297..9101801ac735804376aa8b81c536ce0e03e52d6d 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -61,7 +61,7 @@ namespace { You get the only implementation of this class from the core interface ICore::actionManager() method, e.g. \code - ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager() + Core::ICore::instance()->actionManager() \endcode The main reasons for the need of this class is to provide a central place where the user @@ -80,8 +80,7 @@ namespace { So to register a globally active action "My Action" put the following in your plugin's IPlugin::initialize method: \code - Core::ActionManager *am = ExtensionSystem::PluginManager::instance() - ->getObject<Core::ICore>()->actionManager(); + Core::ActionManager *am = Core::ICore::instance()->actionManager(); QAction *myAction = new QAction(tr("My Action"), this); Core::Command *cmd = am->registerAction(myAction, "myplugin.myaction", diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp index 63521ce6f0ac4a90b1a65abbeb0dcf2414fdb363..9f8ec24b576b20712c6447f3d5c04317c26f3d92 100644 --- a/src/plugins/coreplugin/coreimpl.cpp +++ b/src/plugins/coreplugin/coreimpl.cpp @@ -36,12 +36,21 @@ #include <QtCore/QDir> #include <QtCore/QCoreApplication> +namespace Core { +namespace Internal { + +// The Core Singleton +static CoreImpl *m_instance = 0; + +} // namespace Internal +} // namespace Core + + using namespace Core; using namespace Core::Internal; -CoreImpl *CoreImpl::m_instance = 0; -CoreImpl *CoreImpl::instance() +ICore* ICore::instance() { return m_instance; } diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h index b09de4101f6a13262d7e0e0cc66e4ac08aee8889..a845a4b99056c679dd89e3e1faef964256acf55f 100644 --- a/src/plugins/coreplugin/coreimpl.h +++ b/src/plugins/coreplugin/coreimpl.h @@ -45,8 +45,6 @@ class CoreImpl : public ICore Q_OBJECT public: - static CoreImpl *instance(); - CoreImpl(MainWindow *mainwindow); ~CoreImpl() {} @@ -93,8 +91,6 @@ public: private: MainWindow *m_mainwindow; friend class MainWindow; - - static CoreImpl *m_instance; }; } // namespace Internal diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index 5d6d32741778dee6d1a526db4e83f4bb75be5552..5654c885758b8430dc34e4ccecc44428f1708cd0 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -51,10 +51,7 @@ You should never create a subclass of this interface. The one and only instance is created by the Core plugin. You can access this instance - from your plugin via the plugin manager, e.g. - \code - ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - \endcode + from your plugin through \c{Core::instance()}. \mainclass */ diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 22df3bd9ee335bdc7cf83a39f4313fb6873f6265..4f369e23c41059684df29f1b461fe74f539d7628 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -74,6 +74,8 @@ public: ICore() {} virtual ~ICore() {} + static ICore *instance(); + virtual QStringList showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, const QString &defaultLocation = QString()) = 0; diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 46262e4ee554704bedec114a419246a71f52b5da..24a0b6eac3783d2935639cf77b6e326cdcecc2a4 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -217,7 +217,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. - CoreImpl *core = CoreImpl::instance(); + ICore *core = ICore::instance(); foreach (const int context, m_addedContexts) core->removeAdditionalContext(context); diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 5c7e03e8930a78a21345e6ba073fb87ca51b2d75..1141909aa0cf611cd26a3c32fb16f3874955d7e0 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -316,8 +316,8 @@ void NavigationWidget::objectAdded(QObject * obj) if (!factory) return; - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - Core::ActionManager *am = core->actionManager(); + ICore *core = ICore::instance(); + ActionManager *am = core->actionManager(); QList<int> navicontext = QList<int>() << core->uniqueIDManager()-> uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE); @@ -399,9 +399,8 @@ NavigationSubWidget::~NavigationSubWidget() void NavigationSubWidget::setCurrentIndex(int index) { // Remove toolbutton - foreach (QWidget *w, m_additionalToolBarWidgets) { + foreach (QWidget *w, m_additionalToolBarWidgets) delete w; - } // Remove old Widget delete m_navigationWidget; @@ -466,8 +465,7 @@ void NavigationSubWidget::setFactory(INavigationWidgetFactory *factory) void NavigationSubWidget::setFactory(const QString &name) { - for (int i = 0; i < m_navigationComboBox->count(); ++i) - { + for (int i = 0; i < m_navigationComboBox->count(); ++i) { INavigationWidgetFactory *factory = m_navigationComboBox->itemData(i).value<INavigationWidgetFactory *>(); if (factory->displayName() == name) diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index dc27d837d287ba0a04e83760d4db683c513f1efa..372c76d446468be567a257bf428e7ee45c788d6c 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -395,8 +395,7 @@ void OutputPane::showPage(int idx, bool focus) if (!OutputPanePlaceHolder::m_current) { // In this mode we don't have a placeholder // switch to the output mode and switch the page - ICore *core = m_pluginManager->getObject<ICore>(); - core->modeManager()->activateMode(Constants::MODE_OUTPUT); + ICore::instance()->modeManager()->activateMode(Constants::MODE_OUTPUT); ensurePageVisible(idx); } else { // else we make that page visible @@ -411,14 +410,13 @@ void OutputPane::showPage(int idx, bool focus) void OutputPane::togglePage(bool focus) { int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender())); - if(OutputPanePlaceHolder::m_current + if (OutputPanePlaceHolder::m_current && OutputPanePlaceHolder::m_current->isVisible() && m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) { slotHide(); } else { showPage(idx, focus); } - } void OutputPane::setCloseable(bool b) diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index e4682ee61b1f9021d5a4b3521faf1307eaf330bd..af4cbabbbe808ebafe7d8e0d6574212bd9286eb0 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -38,16 +38,16 @@ #include "splitter.h" #include "view.h" -#include <coreplugin/icore.h> +#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/coreconstants.h> +#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/filemanager.h> +#include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> +#include <coreplugin/messageoutputwindow.h> #include <coreplugin/uniqueidmanager.h> -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/editormanager/editormanager.h> #include <extensionsystem/pluginmanager.h> #include <texteditor/itexteditor.h> -#include <coreplugin/messageoutputwindow.h> #include <QtCore/QtPlugin> #include <QtCore/QDebug> @@ -63,8 +63,6 @@ using namespace CodePaster; using namespace Core; using namespace TextEditor; -Core::ICore *gCoreInstance = NULL; - CodepasterPlugin::CodepasterPlugin() : m_settingsPage(0), m_fetcher(0), m_poster(0) { @@ -84,11 +82,9 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m Q_UNUSED(arguments); Q_UNUSED(error_message); - gCoreInstance = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - // Create the globalcontext list to register actions accordingly QList<int> globalcontext; - globalcontext << gCoreInstance->uniqueIDManager()-> + globalcontext << ICore::instance()->uniqueIDManager()-> uniqueIdentifier(Core::Constants::C_GLOBAL); // Create the settings Page @@ -96,7 +92,7 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m addObject(m_settingsPage); //register actions - Core::ActionManager *actionManager = gCoreInstance->actionManager(); + Core::ActionManager *actionManager = ICore::instance()->actionManager(); Core::ActionContainer *toolsContainer = actionManager->actionContainer(Core::Constants::M_TOOLS); @@ -133,7 +129,7 @@ void CodepasterPlugin::post() { if (m_poster) delete m_poster; - IEditor* editor = gCoreInstance->editorManager()->currentEditor(); + IEditor* editor = ICore::instance()->editorManager()->currentEditor(); ITextEditor* textEditor = qobject_cast<ITextEditor*>(editor); if (!textEditor) return; @@ -244,7 +240,7 @@ void CustomFetcher::customRequestFinished(int, bool error) QByteArray data = body(); if (!m_listWidget) { QString title = QString::fromLatin1("Code Paster: %1").arg(m_id); - gCoreInstance->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR + ICore::instance()->editorManager()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR , &title, data); } else { m_listWidget->clear(); @@ -284,7 +280,7 @@ void CustomPoster::customRequestFinished(int, bool error) if (!error) { if (m_copy) QApplication::clipboard()->setText(pastedUrl()); - gCoreInstance->messageManager()->printToOutputPane(pastedUrl(), m_output); + ICore::instance()->messageManager()->printToOutputPane(pastedUrl(), m_output); } else QMessageBox::warning(0, "Code Paster Error", "Some error occured while posting", QMessageBox::Ok); #if 0 // Figure out how to access diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp index 333630636178df33155ff3acdab70eb3b7cb0fb7..1907d6eebea6ea9d7cde7b11e708ef8e3d2e0d4f 100644 --- a/src/plugins/cpaster/settingspage.cpp +++ b/src/plugins/cpaster/settingspage.cpp @@ -34,7 +34,6 @@ #include "settingspage.h" #include <coreplugin/icore.h> -#include <extensionsystem/pluginmanager.h> #include <QtCore/QSettings> #include <QtGui/QLineEdit> @@ -46,10 +45,7 @@ using namespace CodePaster; SettingsPage::SettingsPage() { - Core::ICore *coreIFace = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (coreIFace) - m_settings = coreIFace->settings(); - + m_settings = Core::ICore::instance()->settings(); if (m_settings) { m_settings->beginGroup("CodePaster"); m_username = m_settings->value("UserName", qgetenv("USER")).toString(); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index b41a70c218d7472a991ed015b156b274cf30122e..093c39611bbcb89c02e97d86564c2cfa6846696e 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -139,15 +139,14 @@ QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &contex CPPEditorEditable::CPPEditorEditable(CPPEditor *editor) : BaseTextEditorEditable(editor) { - Core::ICore *core = CppPlugin::core(); + Core::ICore *core = Core::ICore::instance(); m_context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); m_context << core->uniqueIDManager()->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); } -CPPEditor::CPPEditor(QWidget *parent) : - TextEditor::BaseTextEditor(parent), - m_core(CppPlugin::core()) +CPPEditor::CPPEditor(QWidget *parent) + : TextEditor::BaseTextEditor(parent) { setParenthesesMatchingEnabled(true); setMarksVisible(true); @@ -169,7 +168,8 @@ CPPEditor::CPPEditor(QWidget *parent) : /*ambiguousMember=*/ 0, Qt::WidgetShortcut); #endif - m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); + m_modelManager = ExtensionSystem::PluginManager::instance() + ->getObject<CppTools::CppModelManagerInterface>(); if (m_modelManager) { connect(m_modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index cf1337c0cbda4a48f9c720ece2e7d04adc207c76..5059a92d8b1d290aacc69d462dff93b3d0ef9216 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -67,15 +67,16 @@ using namespace CppEditor::Internal; using namespace CPlusPlus; +using namespace Core; CppHoverHandler::CppHoverHandler(QObject *parent) : QObject(parent) - , m_core(CppPlugin::core()) , m_helpEngineNeedsSetup(false) { - m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); + m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>(); - QFileInfo fi(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings()->fileName()); + ICore *core = ICore::instance(); + QFileInfo fi(core->settings()->fileName()); // FIXME shouldn't the help engine create the directory if it doesn't exist? QDir directory(fi.absolutePath()+"/qtcreator"); if (!directory.exists()) @@ -90,7 +91,7 @@ CppHoverHandler::CppHoverHandler(QObject *parent) m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0; // Listen for editor opened events in order to connect to tooltip/helpid requests - connect(m_core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), + connect(core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); } @@ -99,7 +100,7 @@ void CppHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int p updateHelpIdAndTooltip(editor, pos); } -void CppHoverHandler::editorOpened(Core::IEditor *editor) +void CppHoverHandler::editorOpened(IEditor *editor) { CPPEditorEditable *cppEditor = qobject_cast<CPPEditorEditable *>(editor); if (!cppEditor) @@ -117,9 +118,10 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint if (!editor) return; - const int dbgcontext = m_core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER); + ICore *core = ICore::instance(); + const int dbgcontext = core->uniqueIDManager()->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER); - if (m_core->hasContext(dbgcontext)) + if (core->hasContext(dbgcontext)) return; updateHelpIdAndTooltip(editor, pos); diff --git a/src/plugins/cppeditor/cpphoverhandler.h b/src/plugins/cppeditor/cpphoverhandler.h index 27daccc35d7e40c490842047408ac75e387a443f..6833c9f57430deab1fa243efed71e5f6ac151788 100644 --- a/src/plugins/cppeditor/cpphoverhandler.h +++ b/src/plugins/cppeditor/cpphoverhandler.h @@ -42,7 +42,6 @@ class QPoint; QT_END_NAMESPACE namespace Core { -class ICore; class IEditor; } @@ -74,7 +73,6 @@ private slots: private: void updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos); - Core::ICore *m_core; CppTools::CppModelManagerInterface *m_modelManager; QHelpEngineCore *m_helpEngine; QString m_helpId; diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 105ca5adbcd8d5dcfe61081beef65c71386f6925..f2309edb9acf1e0934be7ab59c0b3ad3ceaceb88 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -88,7 +88,7 @@ QString CppPluginEditorFactory::kind() const Core::IFile *CppPluginEditorFactory::open(const QString &fileName) { - Core::IEditor *iface = m_owner->m_core->editorManager()->openEditor(fileName, kind()); + Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind()); return iface ? iface->file() : 0; } @@ -111,7 +111,6 @@ QStringList CppPluginEditorFactory::mimeTypes() const CppPlugin *CppPlugin::m_instance = 0; CppPlugin::CppPlugin() : - m_core(0), m_actionHandler(0), m_factory(0) { @@ -131,11 +130,6 @@ CppPlugin *CppPlugin::instance() return m_instance; } -Core::ICore *CppPlugin::core() -{ - return m_instance->m_core; -} - void CppPlugin::initializeEditor(CPPEditor *editor) { // common actions @@ -160,14 +154,13 @@ void CppPlugin::initializeEditor(CPPEditor *editor) // auto completion connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)), - TextEditor::Internal::CompletionSupport::instance(core()), SLOT(autoComplete(ITextEditable*, bool))); + TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(ITextEditable*, bool))); } bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - typedef TextEditor::TextEditorActionHandler TextEditorActionHandler; - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) + Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) return false; m_factory = new CppPluginEditorFactory(this); @@ -181,21 +174,21 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess wizardParameters.setTrCategory(tr("C++")); wizardParameters.setDescription(tr("Creates a new C++ header file.")); wizardParameters.setName(tr("C++ Header File")); - addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, m_core)); + addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core)); wizardParameters.setDescription(tr("Creates a new C++ source file.")); wizardParameters.setName(tr("C++ Source File")); - addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, m_core)); + addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core)); wizardParameters.setKind(Core::IWizard::ClassWizard); wizardParameters.setName(tr("C++ Class")); wizardParameters.setDescription(tr("Creates a header and a source file for a new class.")); - addAutoReleasedObject(new CppClassWizard(wizardParameters, m_core)); + addAutoReleasedObject(new CppClassWizard(wizardParameters, core)); QList<int> context; - context << m_core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); + context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = core->actionManager(); am->createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; @@ -218,22 +211,22 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd); am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); - m_actionHandler = new CPPEditorActionHandler(m_core, + m_actionHandler = new CPPEditorActionHandler(core, CppEditor::Constants::C_CPPEDITOR, TextEditor::TextEditorActionHandler::Format | TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCollapseAll); // Check Suffixes - if (const QSettings *settings = m_core->settings()) { + if (const QSettings *settings = core->settings()) { const QString headerSuffixKey = QLatin1String(headerSuffixKeyC); if (settings->contains(headerSuffixKey)) { const QString headerSuffix = settings->value(headerSuffixKey, QString()).toString(); if (!headerSuffix.isEmpty()) - m_core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix); + core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE), headerSuffix); const QString sourceSuffix = settings->value(QLatin1String(sourceSuffixKeyC), QString()).toString(); if (!sourceSuffix.isEmpty()) - m_core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix); + core->mimeDatabase()->setPreferredSuffix(QLatin1String(Constants::CPP_SOURCE_MIMETYPE), sourceSuffix); } } return true; @@ -246,7 +239,8 @@ void CppPlugin::extensionsInitialized() void CppPlugin::switchDeclarationDefinition() { - CPPEditor *editor = qobject_cast<CPPEditor*>(m_core->editorManager()->currentEditor()->widget()); + Core::ICore *core = Core::ICore::instance(); + CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget()); if (editor) { editor->switchDeclarationDefinition(); } @@ -254,7 +248,8 @@ void CppPlugin::switchDeclarationDefinition() void CppPlugin::jumpToDefinition() { - CPPEditor *editor = qobject_cast<CPPEditor*>(m_core->editorManager()->currentEditor()->widget()); + Core::ICore *core = Core::ICore::instance(); + CPPEditor *editor = qobject_cast<CPPEditor*>(core->editorManager()->currentEditor()->widget()); if (editor) { editor->jumpToDefinition(); } diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index 52655e6ae7060c40a46972c61e5afd5828949310..c653866e27128217d8c1c8ac5ab2bbf9dec0dec5 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -65,7 +65,6 @@ public: ~CppPlugin(); static CppPlugin *instance(); - static Core::ICore *core(); bool initialize(const QStringList &arguments, QString *error_message = 0); void extensionsInitialized(); diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 177b40f03e44714a1cd731ac2ee71744dc404b0d..75f64fea5da9db750abf37ff1de1652a31e7c13e 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -433,10 +433,10 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) modified within Workbench. */ -CppModelManager::CppModelManager(QObject *parent) : - CppModelManagerInterface(parent), - m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()) +CppModelManager::CppModelManager(QObject *parent) + : CppModelManagerInterface(parent) { + m_core = Core::ICore::instance(); // FIXME m_dirty = true; m_projectExplorer = ExtensionSystem::PluginManager::instance() diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index ca1c57f86355a185a042a7bd4b4ef1828c79a7e5..849c3c691fd5c99da94186f497089b4939e7629c 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -46,7 +46,7 @@ namespace ProjectExplorer { namespace CppTools { -class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject +class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject { Q_OBJECT diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index cd45cb356c435adccce96704b637c7156e78f0ce..c28c4a8127d499a39005520b4c7e31cb5d520993 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -65,10 +65,8 @@ enum { debug = 0 }; CppToolsPlugin *CppToolsPlugin::m_instance = 0; -CppToolsPlugin::CppToolsPlugin() : - m_core(0), - m_context(-1), - m_modelManager(0) +CppToolsPlugin::CppToolsPlugin() + : m_context(-1), m_modelManager(0) { m_instance = this; } @@ -79,21 +77,23 @@ CppToolsPlugin::~CppToolsPlugin() m_modelManager = 0; // deleted automatically } -bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *) +bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - Core::ActionManager *am = m_core->actionManager(); + Q_UNUSED(arguments); + Q_UNUSED(error); + Core::ICore *core = Core::ICore::instance(); + Core::ActionManager *am = core->actionManager(); // Objects m_modelManager = new CppModelManager(this); addAutoReleasedObject(m_modelManager); - m_completion = new CppCodeCompletion(m_modelManager, m_core); + m_completion = new CppCodeCompletion(m_modelManager, core); addAutoReleasedObject(m_completion); CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager, - m_core->editorManager()); + core->editorManager()); addAutoReleasedObject(quickOpenFilter); - addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager())); - addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager())); + addAutoReleasedObject(new CppClassesFilter(m_modelManager, core->editorManager())); + addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, core->editorManager())); addAutoReleasedObject(new CompletionSettingsPage(m_completion)); // Menus @@ -105,7 +105,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *) mtools->addMenu(mcpptools); // Actions - m_context = m_core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); + m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR); QList<int> context = QList<int>() << m_context; QAction *switchAction = new QAction(tr("Switch Header/Source"), this); @@ -115,7 +115,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *) connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource())); // Restore settings - QSettings *settings = m_core->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(QLatin1String("CppTools")); settings->beginGroup(QLatin1String("Completion")); const bool caseSensitive = settings->value(QLatin1String("CaseSensitive"), true).toBool(); @@ -135,7 +135,7 @@ void CppToolsPlugin::extensionsInitialized() void CppToolsPlugin::shutdown() { // Save settings - QSettings *settings = m_core->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(QLatin1String("CppTools")); settings->beginGroup(QLatin1String("Completion")); settings->setValue(QLatin1String("CaseSensitive"), m_completion->caseSensitivity() == Qt::CaseSensitive); @@ -147,14 +147,12 @@ void CppToolsPlugin::shutdown() void CppToolsPlugin::switchHeaderSource() { - if (!m_core) - return; - - Core::IEditor *editor = m_core->editorManager()->currentEditor(); + Core::EditorManager *editorManager = Core::ICore::instance()->editorManager(); + Core::IEditor *editor = editorManager->currentEditor(); QString otherFile = correspondingHeaderOrSource(editor->file()->fileName()); if (!otherFile.isEmpty()) { - m_core->editorManager()->openEditor(otherFile); - m_core->editorManager()->ensureEditorManagerVisible(); + editorManager->openEditor(otherFile); + editorManager->ensureEditorManagerVisible(); } } @@ -222,7 +220,7 @@ static QStringList matchingCandidateSuffixes(const Core::MimeDatabase *mimeDatas QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) const { - const Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + const Core::ICore *core = Core::ICore::instance(); const Core::MimeDatabase *mimeDatase = core->mimeDatabase(); ProjectExplorer::ProjectExplorerPlugin *explorer = ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>(); diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index 092de535b3ed2e318453f6405861055b479d6007..281fe1f708d2829656eb10ae7ba18f1381910e9e 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -42,10 +42,6 @@ class QFileInfo; class QDir; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace CppTools { namespace Internal { @@ -75,7 +71,6 @@ private: QString correspondingHeaderOrSourceI(const QString &fileName) const; QFileInfo findFile(const QDir &dir, const QString &name, const ProjectExplorer::Project *project) const; - Core::ICore *m_core; int m_context; CppModelManager *m_modelManager; CppCodeCompletion *m_completion; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 8fa465d543f67564f606a8aaf5a5f9a43fb31b61..7fd564a3a0546f22019ad110bcd7e539132c24d3 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -55,12 +55,12 @@ #include <coreplugin/rightpane.h> #include <coreplugin/uniqueidmanager.h> -#include <extensionsystem/pluginmanager.h> - #include <cplusplus/ExpressionUnderCursor.h> #include <cppeditor/cppeditorconstants.h> +#include <extensionsystem/pluginmanager.h> + #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/session.h> @@ -346,7 +346,7 @@ DebuggerPlugin::~DebuggerPlugin() static QSettings *settings() { - return ExtensionSystem::PluginManager::instance()->getObject<ICore>()->settings(); + return ICore::instance()->settings(); } void DebuggerPlugin::shutdown() @@ -387,7 +387,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes m_pm = ExtensionSystem::PluginManager::instance(); - ICore *core = m_pm->getObject<Core::ICore>(); + ICore *core = ICore::instance(); QTC_ASSERT(core, return false); Core::ActionManager *am = core->actionManager(); @@ -713,8 +713,7 @@ ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const /*! Activates the previous mode when the current mode is the debug mode. */ void DebuggerPlugin::activatePreviousMode() { - ICore *core = m_pm->getObject<Core::ICore>(); - Core::ModeManager *const modeManager = core->modeManager(); + Core::ModeManager *const modeManager = ICore::instance()->modeManager(); if (modeManager->currentMode() == modeManager->mode(Constants::MODE_DEBUG) && !m_previousMode.isEmpty()) { @@ -725,7 +724,7 @@ void DebuggerPlugin::activatePreviousMode() void DebuggerPlugin::activateDebugMode() { - ICore *core = m_pm->getObject<Core::ICore>(); + ICore *core = ICore::instance(); Core::ModeManager *modeManager = core->modeManager(); m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName()); modeManager->activateMode(QLatin1String(MODE_DEBUG)); @@ -733,7 +732,7 @@ void DebuggerPlugin::activateDebugMode() void DebuggerPlugin::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object) { - ICore *core = m_pm->getObject<Core::ICore>(); + ICore *core = ICore::instance(); if (!core || !core->editorManager()) return; Core::IEditor *editor = core->editorManager()->currentEditor(); @@ -872,7 +871,7 @@ void DebuggerPlugin::gotoLocation(const QString &fileName, int lineNumber, void DebuggerPlugin::changeStatus(int status) { bool startIsContinue = (status == DebuggerInferiorStopped); - ICore *core = m_pm->getObject<Core::ICore>(); + ICore *core = ICore::instance(); if (startIsContinue) { core->addAdditionalContext(m_gdbRunningContext); core->updateContext(); @@ -916,8 +915,7 @@ void DebuggerPlugin::readSettings() #if defined(Q_OS_WIN32) defaultCommand.append(".exe"); #endif - Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); - QString defaultScript = coreIFace->resourcePath() + + QString defaultScript = ICore::instance()->resourcePath() + QLatin1String("/gdb/qt4macros"); s->beginGroup(QLatin1String("DebugMode")); diff --git a/src/plugins/debugger/gdbtypemacros.cpp b/src/plugins/debugger/gdbtypemacros.cpp index d392a836f0e82961c0f32bfcd997c1c7e159a607..c586e6c3027e5d284169385f372f023374df98b1 100644 --- a/src/plugins/debugger/gdbtypemacros.cpp +++ b/src/plugins/debugger/gdbtypemacros.cpp @@ -35,7 +35,6 @@ #include "gdbengine.h" #include "imports.h" -#include <extensionsystem/pluginmanager.h> #include <coreplugin/icore.h> #include <QtCore/QSettings> @@ -49,9 +48,7 @@ TypeMacroPage::TypeMacroPage(GdbSettings *settings) m_pm = ExtensionSystem::PluginManager::instance(); m_settings = settings; - Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); - if (!coreIFace || !coreIFace->settings()) - return; + Core::ICore *coreIFace = ICore::instance(); QSettings *s = coreIFace->settings(); s->beginGroup("GdbOptions"); @@ -164,14 +161,11 @@ void TypeMacroPage::finished(bool accepted) m_settings->m_typeMacros.insert(item->text(0), data); } - Core::ICore *coreIFace = m_pm->getObject<Core::ICore>(); - if (coreIFace && coreIFace->settings()) { - QSettings *s = coreIFace->settings(); - s->beginGroup("GdbOptions"); - s->setValue("ScriptFile", m_settings->m_scriptFile); - s->setValue("TypeMacros", m_settings->m_typeMacros); - s->endGroup(); - } + QSettings *s = ICore::instance()->settings(); + s->beginGroup("GdbOptions"); + s->setValue("ScriptFile", m_settings->m_scriptFile); + s->setValue("TypeMacros", m_settings->m_typeMacros); + s->endGroup(); } void TypeMacroPage::onAddButton() diff --git a/src/plugins/designer/cpp/formclasswizardpage.cpp b/src/plugins/designer/cpp/formclasswizardpage.cpp index 6c7c72c05cf93d56aa4a22cf9a4c2b8afd686ad7..389820750274ecb72d3e9c97e18911aeea441b50 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.cpp +++ b/src/plugins/designer/cpp/formclasswizardpage.cpp @@ -37,7 +37,6 @@ #include <coreplugin/icore.h> #include <cppeditor/cppeditorconstants.h> -#include <extensionsystem/pluginmanager.h> #include <QtCore/QDebug> #include <QtCore/QDir> @@ -176,7 +175,7 @@ bool FormClassWizardPage::validatePage() void FormClassWizardPage::saveSettings() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); if (QSettings *settings = core->settings()) { settings->beginGroup(QLatin1String(formClassWizardPageGroupC)); settings->setValue(QLatin1String(translationKeyC), hasRetranslationSupport()); @@ -190,7 +189,7 @@ void FormClassWizardPage::restoreSettings() bool retranslationSupport = true; int embedding = PointerAggregatedUiClass; - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); if (QSettings *settings = core->settings()) { QString key = QLatin1String(formClassWizardPageGroupC); diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index 051f3e567d6d54410ee404652cedb7881802152b..6215fedff04a16b95a2ac7533bb0c0c1cc49d910 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -50,7 +50,6 @@ #include <coreplugin/mimedatabase.h> #include <coreplugin/coreconstants.h> #include <coreplugin/uniqueidmanager.h> -#include <extensionsystem/pluginmanager.h> #include <QtCore/QtPlugin> #include <QtCore/QDebug> @@ -90,13 +89,16 @@ FormEditorPlugin::~FormEditorPlugin() // INHERITED FROM ExtensionSystem::Plugin // //////////////////////////////////////////////////// -bool FormEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message/* = 0*/) // =0; +bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error_message)) + Q_UNUSED(arguments); + Q_UNUSED(error); + + Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error)) return false; - if (!initializeTemplates(error_message)) + if (!initializeTemplates(error)) return false; const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR)); @@ -108,7 +110,7 @@ bool FormEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er // Make sure settings pages and action shortcuts are registered FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins); - error_message->clear(); + error->clear(); return true; } @@ -122,10 +124,10 @@ void FormEditorPlugin::extensionsInitialized() // //////////////////////////////////////////////////// -bool FormEditorPlugin::initializeTemplates(QString * /* error_message */) +bool FormEditorPlugin::initializeTemplates(QString *error) { - - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Q_UNUSED(error); + Core::ICore *core = Core::ICore::instance(); FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); wizardParameters.setCategory(QLatin1String("Qt")); wizardParameters.setTrCategory(tr("Qt")); diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index dc5cddb5e60a2846583df6dcab2a3e550fe65f50..05a4001effb71fb436d067c218c08c8ce4038301 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -163,7 +163,7 @@ FormEditorW::FormEditorW() : m_formeditor(QDesignerComponents::createFormEditor(0)), m_integration(0), m_fwm(0), - m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()), + m_core(Core::ICore::instance()), m_initStage(RegisterPlugins), m_actionGroupEditMode(0), m_actionPrint(0), diff --git a/src/plugins/designer/workbenchintegration.cpp b/src/plugins/designer/workbenchintegration.cpp index 3db3512a716461c6ff46b0825ad1148fef8f42f5..9e25f80432a782eda98d7f8825f4be0262337cb6 100644 --- a/src/plugins/designer/workbenchintegration.cpp +++ b/src/plugins/designer/workbenchintegration.cpp @@ -79,8 +79,8 @@ static QString msgClassNotFound(const QString &uiClassName, const QList<Document static inline CppTools::CppModelManagerInterface *cppModelManagerInstance() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - return core->pluginManager()->getObject<CppTools::CppModelManagerInterface>(); + return ExtensionSystem::PluginManager::instance() + ->getObject<CppTools::CppModelManagerInterface>(); } WorkbenchIntegration::WorkbenchIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) : diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 4083af7d50bf920daacb057ded3d0ed62305de0f..6d2431de188fb7023a695244def174ff1c2e739f 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -45,7 +45,6 @@ #include <coreplugin/messagemanager.h> #include <coreplugin/modemanager.h> #include <coreplugin/uniqueidmanager.h> -#include <extensionsystem/pluginmanager.h> #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/session.h> @@ -159,7 +158,7 @@ bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *err m_handler = new FakeVimHandler; - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + m_core = Core::ICore::instance(); QTC_ASSERT(m_core, return false); Core::ActionManager *actionManager = m_core->actionManager(); diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index 1494d89a4b34759dd2c2dd5e34aae6c581fba512..fb6c9c53b71477ff47b1420520f19f8c4063aa01 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -60,8 +60,7 @@ using namespace Find; using namespace Find::Internal; FindPlugin::FindPlugin() - : m_core(0), - m_currentDocumentFind(0), + : m_currentDocumentFind(0), m_findToolBar(0), m_findDialog(0), m_findCompletionModel(new QStringListModel(this)), @@ -78,14 +77,14 @@ FindPlugin::~FindPlugin() bool FindPlugin::initialize(const QStringList &, QString *) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); setupMenu(); - m_currentDocumentFind = new CurrentDocumentFind(m_core); + m_currentDocumentFind = new CurrentDocumentFind(core); m_findToolBar = new FindToolBar(this, m_currentDocumentFind); m_findDialog = new FindToolWindow(this); - SearchResultWindow *searchResultWindow = new SearchResultWindow(m_core); + SearchResultWindow *searchResultWindow = new SearchResultWindow(core); addAutoReleasedObject(searchResultWindow); return true; } @@ -125,10 +124,10 @@ void FindPlugin::openFindFilter() m_findDialog->open(filter); } - void FindPlugin::setupMenu() { - Core::ActionManager *am = m_core->actionManager(); + Core::ICore *core = Core::ICore::instance(); + Core::ActionManager *am = core->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); @@ -151,7 +150,8 @@ void FindPlugin::setupMenu() void FindPlugin::setupFilterMenuItems() { - Core::ActionManager *am = m_core->actionManager(); + Core::ICore *core = Core::ICore::instance(); + Core::ActionManager *am = core->actionManager(); QList<IFindFilter*> findInterfaces = ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); Core::Command *cmd; @@ -173,11 +173,6 @@ void FindPlugin::setupFilterMenuItems() m_findDialog->setFindFilters(findInterfaces); } -Core::ICore *FindPlugin::core() -{ - return m_core; -} - QTextDocument::FindFlags FindPlugin::findFlags() const { return m_findFlags; @@ -218,7 +213,7 @@ bool FindPlugin::hasFindFlag(QTextDocument::FindFlag flag) void FindPlugin::writeSettings() { - QSettings *settings = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("Find"); settings->setValue("Backward", QVariant((m_findFlags & QTextDocument::FindBackward) != 0)); settings->setValue("CaseSensitively", QVariant((m_findFlags & QTextDocument::FindCaseSensitively) != 0)); @@ -231,7 +226,7 @@ void FindPlugin::writeSettings() void FindPlugin::readSettings() { - QSettings *settings = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("Find"); bool block = blockSignals(true); setBackward(settings->value("Backward", false).toBool()); diff --git a/src/plugins/find/findplugin.h b/src/plugins/find/findplugin.h index caad6daa0cc3be4d52181a4a9f630a9a43c48208..9b2ac1f4aa637e40a4afa9163195ee076a40a4a6 100644 --- a/src/plugins/find/findplugin.h +++ b/src/plugins/find/findplugin.h @@ -64,7 +64,6 @@ public: void extensionsInitialized(); void shutdown(); - Core::ICore *core(); QTextDocument::FindFlags findFlags() const; void updateFindCompletion(const QString &text); void updateReplaceCompletion(const QString &text); @@ -93,7 +92,6 @@ private: void readSettings(); //variables - Core::ICore *m_core; QHash<IFindFilter *, QAction *> m_filterActions; CurrentDocumentFind *m_currentDocumentFind; diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 88d5fed220de26b337d9e446263e4955e7f143a5..5af25e496d4509fd09f968c93401d103ee885173 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -141,7 +141,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen QList<int> globalcontext; globalcontext << Core::Constants::C_GLOBAL_ID; - Core::ActionManager *am = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->actionManager(); + Core::ActionManager *am = Core::ICore::instance()->actionManager(); Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND); Core::Command *cmd; diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp index f45c99b2aa313e963ff0d11d4b98d4a18bb0d42c..f9f23d0668f3094d6e8c893ac821542f120f1011 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/find/findtoolwindow.cpp @@ -42,7 +42,7 @@ using namespace Find; using namespace Find::Internal; FindToolWindow::FindToolWindow(FindPlugin *plugin) - : QDialog(plugin->core()->mainWindow()), + : QDialog(Core::ICore::instance()->mainWindow()), m_plugin(plugin), m_findCompleter(new QCompleter(this)) { @@ -124,7 +124,7 @@ void FindToolWindow::search() void FindToolWindow::writeSettings() { - QSettings *settings = m_plugin->core()->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("Find"); foreach (IFindFilter *filter, m_filters) filter->writeSettings(settings); @@ -133,7 +133,7 @@ void FindToolWindow::writeSettings() void FindToolWindow::readSettings() { - QSettings *settings = m_plugin->core()->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("Find"); foreach (IFindFilter *filter, m_filters) filter->readSettings(settings); diff --git a/src/plugins/git/gitcommand.cpp b/src/plugins/git/gitcommand.cpp index ce81be961d6c8d5e06a594532547dd62be00f91b..fa62401b0119c1d22f789935af2b9a7ab2d3ec74 100644 --- a/src/plugins/git/gitcommand.cpp +++ b/src/plugins/git/gitcommand.cpp @@ -84,8 +84,7 @@ void GitCommand::execute() QFuture<void> task = QtConcurrent::run(this, &GitCommand::run); const QString taskName = QLatin1String("Git ") + m_jobs.front().arguments.at(0); - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - core->progressManager()->addTask(task, taskName, + Core::ICore::instance()->progressManager()->addTask(task, taskName, QLatin1String("Git.action"), Core::ProgressManager::CloseOnSuccess); } diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 263474312e00166a0f47ff9177094a1e98adb17c..a49ba12b42e1645353db78dbb6f1ff1ed236646d 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -232,7 +232,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message) Q_UNUSED(arguments); Q_UNUSED(error_message); - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + m_core = Core::ICore::instance(); m_gitClient = new GitClient(this, m_core); // Create the globalcontext list to register actions accordingly QList<int> globalcontext; diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 6dd0bc9c63f9feb9d65e007fa9789008f8dd0197..522984a9814c7de6b7379a22d17200eb2c9510dd 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -39,7 +39,6 @@ #include <coreplugin/icore.h> #include <coreplugin/modemanager.h> #include <coreplugin/uniqueidmanager.h> -#include <extensionsystem/pluginmanager.h> #include <QtCore/QDebug> #include <QtCore/QtPlugin> @@ -78,7 +77,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_m Q_UNUSED(error_message) // Get the primary access point to the workbench. - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); // Create a unique context id for our own view, that will be used for the // menu entry later. diff --git a/src/plugins/helloworld/helloworldplugin.h b/src/plugins/helloworld/helloworldplugin.h index 8aa2a9aa127cef0aa00a6d571be54bba05da1fec..36c60165a326dd54993d7b624d08dca2384f2dcd 100644 --- a/src/plugins/helloworld/helloworldplugin.h +++ b/src/plugins/helloworld/helloworldplugin.h @@ -36,8 +36,6 @@ #include <extensionsystem/iplugin.h> -#include <QtCore/QObject> - namespace HelloWorld { namespace Internal { diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 74900b6acee27f50eef532f6f56d10060f3d183c..a22cc1f5105850a96bbde8088458938e069e67ee 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -123,9 +123,11 @@ HelpPlugin::~HelpPlugin() { } -bool HelpPlugin::initialize(const QStringList & /*arguments*/, QString *) +bool HelpPlugin::initialize(const QStringList &arguments, QString *error) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Q_UNUSED(arguments); + Q_UNUSED(error); + m_core = Core::ICore::instance(); QList<int> globalcontext; globalcontext << Core::Constants::C_GLOBAL_ID; QList<int> modecontext; diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 73008ca8225a2d500cbb97839472416a081aaaa8..75a868232e2e1ac928ea1d02742c4ef34587a869 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -145,7 +145,6 @@ bool CoreListener::editorAboutToClose(Core::IEditor *editor) // PerforcePlugin //// -Core::ICore *PerforcePlugin::m_coreInstance = NULL; PerforcePlugin *PerforcePlugin::m_perforcePluginInstance = NULL; PerforcePlugin::PerforcePlugin() : @@ -183,17 +182,20 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { Perforce::Constants::C_PERFORCESUBMITEDITOR }; -bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) +bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMessage) { + Q_UNUSED(arguments); + Q_UNUSED(errorMessage); + typedef VCSBase::VCSEditorFactory<PerforceEditor> PerforceEditorFactory; typedef VCSBase::VCSSubmitEditorFactory<PerforceSubmitEditor> PerforceSubmitEditorFactory; - m_coreInstance = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage)) + Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.perforce/Perforce.mimetypes.xml"), errorMessage)) return false; m_perforcePluginInstance = this; - if (QSettings *settings = m_coreInstance->settings()) + if (QSettings *settings = core->settings()) m_settings.fromSettings(settings); m_perforceOutputWindow = new PerforceOutputWindow(this); @@ -209,24 +211,19 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro static const char *describeSlot = SLOT(describe(QString,QString)); const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters); for (int i = 0; i < editorCount; i++) { - m_editorFactories.push_back(new PerforceEditorFactory(editorParameters + i, m_coreInstance, this, describeSlot)); + m_editorFactories.push_back(new PerforceEditorFactory(editorParameters + i, core, this, describeSlot)); addObject(m_editorFactories.back()); } m_versionControl = new PerforceVersionControl(this); addObject(m_versionControl); -#ifdef USE_P4_API - m_workbenchClientUser = new WorkbenchClientUser(m_perforceOutputWindow, this); - m_enableP4APIActions = true; -#endif - m_coreListener = new CoreListener(this); addObject(m_coreListener); //register actions - Core::ActionManager *am = m_coreInstance->actionManager(); + Core::ActionManager *am = Core::ICore::instance()->actionManager(); Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); @@ -245,7 +242,7 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro QList<int> perforcesubmitcontext; perforcesubmitcontext << - m_coreInstance->uniqueIDManager()->uniqueIdentifier(Constants::C_PERFORCESUBMITEDITOR); + Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_PERFORCESUBMITEDITOR); Core::Command *command; QAction *tmpaction; @@ -383,10 +380,10 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro m_redoAction = new QAction(tr("&Redo"), this); command = am->registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext); - connect(m_coreInstance, SIGNAL(contextChanged(Core::IContext *)), + connect(core, SIGNAL(contextChanged(Core::IContext *)), this, SLOT(updateActions())); - connect(m_coreInstance->fileManager(), SIGNAL(currentFileChanged(const QString &)), + connect(core->fileManager(), SIGNAL(currentFileChanged(const QString &)), this, SLOT(updateActions())); return true; @@ -420,10 +417,8 @@ void PerforcePlugin::deleteCurrentFile() void PerforcePlugin::revertCurrentFile() { - QTC_ASSERT(m_coreInstance, return); - const QString fileName = currentFileName(); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName); + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(fileName); QStringList args; args << QLatin1String("diff") << QLatin1String("-sa"); PerforceResponse result = runP4Cmd(args, QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow, codec); @@ -439,7 +434,7 @@ void PerforcePlugin::revertCurrentFile() return; } - Core::FileManager *fm = m_coreInstance->fileManager(); + Core::FileManager *fm = Core::ICore::instance()->fileManager(); QList<Core::IFile *> files = fm->managedFiles(fileName); foreach (Core::IFile *file, files) { fm->blockFileChange(file); @@ -472,7 +467,7 @@ void PerforcePlugin::diffAllOpened() void PerforcePlugin::printOpenedFileList() { - Core::IEditor *e = m_coreInstance->editorManager()->currentEditor(); + Core::IEditor *e = Core::ICore::instance()->editorManager()->currentEditor(); if (e) e->widget()->setFocus(); PerforceResponse result = runP4Cmd(QStringList() << QLatin1String("opened"), QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow); @@ -488,8 +483,6 @@ void PerforcePlugin::resolve() void PerforcePlugin::submit() { - QTC_ASSERT(m_coreInstance, return); - if (!checkP4Command()) { showOutput(tr("No p4 executable specified!"), true); return; @@ -550,8 +543,8 @@ void PerforcePlugin::submit() Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames) { Core::IEditor *editor = - m_coreInstance->editorManager()->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND); - m_coreInstance->editorManager()->ensureEditorManagerVisible(); + Core::ICore::instance()->editorManager()->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND); + Core::ICore::instance()->editorManager()->ensureEditorManagerVisible(); PerforceSubmitEditor *submitEditor = dynamic_cast<PerforceSubmitEditor*>(editor); QTC_ASSERT(submitEditor, return 0); submitEditor->restrictToProjectFiles(depotFileNames); @@ -563,7 +556,7 @@ Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, void PerforcePlugin::printPendingChanges() { qApp->setOverrideCursor(Qt::WaitCursor); - PendingChangesDialog dia(pendingChangesData(), m_coreInstance->mainWindow()); + PendingChangesDialog dia(pendingChangesData(), Core::ICore::instance()->mainWindow()); qApp->restoreOverrideCursor(); if (dia.exec() == QDialog::Accepted) { const int i = dia.changeNumber(); @@ -596,7 +589,7 @@ void PerforcePlugin::annotate() void PerforcePlugin::annotate(const QString &fileName) { - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName); + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(fileName); QStringList args; args << QLatin1String("annotate") << QLatin1String("-cqi") << fileName; const PerforceResponse result = runP4Cmd(args, QStringList(), @@ -623,7 +616,7 @@ void PerforcePlugin::filelog() void PerforcePlugin::filelog(const QString &fileName) { - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName); + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(fileName); QStringList args; args << QLatin1String("filelog") << QLatin1String("-li") << fileName; const PerforceResponse result = runP4Cmd(args, QStringList(), @@ -752,7 +745,6 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args, qDebug() << "PerforcePlugin::runP4Cmd" << args << extraArgs << debugCodec(outputCodec); PerforceResponse response; response.error = true; - QTC_ASSERT(m_coreInstance, return response); if (!checkP4Command()) { response.message = tr("No p4 executable specified!"); m_perforceOutputWindow->append(response.message, true); @@ -847,7 +839,7 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q if (Perforce::Constants::debug) qDebug() << "PerforcePlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec); QString s = title; - Core::IEditor *ediface = m_coreInstance->editorManager()-> + Core::IEditor *ediface = Core::ICore::instance()->editorManager()-> newFile(kind, &s, output.toLocal8Bit()); PerforceEditor *e = qobject_cast<PerforceEditor*>(ediface->widget()); if (!e) @@ -882,7 +874,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname) Core::IEditor *editor = 0; bool displayInEditor = true; Core::IEditor *existingEditor = 0; - QTextCodec *codec = files.empty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(m_coreInstance, files.front()); + QTextCodec *codec = files.empty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(files.front()); if (Perforce::Constants::debug) qDebug() << Q_FUNC_INFO << files << debugCodec(codec); @@ -895,7 +887,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname) diffname = fi.fileName(); } - foreach (Core::IEditor *ed, m_coreInstance->editorManager()->openedEditors()) { + foreach (Core::IEditor *ed, Core::ICore::instance()->editorManager()->openedEditors()) { if (ed->property("originalFileName").toString() == fileName) { existingEditor = ed; displayInEditor = false; @@ -918,7 +910,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname) } else if (!displayInEditor && existingEditor) { if (existingEditor) { existingEditor->createNew(result.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(existingEditor); + Core::ICore::instance()->editorManager()->setCurrentEditor(existingEditor); } } } @@ -926,7 +918,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname) void PerforcePlugin::describe(const QString & source, const QString &n) { - QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(m_coreInstance, source); + QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(source); QStringList args; args << QLatin1String("describe") << QLatin1String("-du") << n; const PerforceResponse result = runP4Cmd(args, QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow, codec); @@ -936,29 +928,32 @@ void PerforcePlugin::describe(const QString & source, const QString &n) void PerforcePlugin::submitCurrentLog() { - m_coreInstance->editorManager()->closeEditors(QList<Core::IEditor*>() - << m_coreInstance->editorManager()->currentEditor()); + Core::EditorManager *em = Core::ICore::instance()->editorManager(); + em->closeEditors(QList<Core::IEditor*>() << em->currentEditor()); } bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) { if (!m_changeTmpFile || !editor) return true; + Core::ICore *core = Core::ICore::instance(); Core::IFile *fileIFace = editor->file(); if (!fileIFace) return true; QFileInfo editorFile(fileIFace->fileName()); QFileInfo changeFile(m_changeTmpFile->fileName()); if (editorFile.absoluteFilePath() == changeFile.absoluteFilePath()) { - const QMessageBox::StandardButton answer = QMessageBox::question(m_coreInstance->mainWindow(), tr("Closing p4 Editor"), tr("Do you want to submit this change list?"), - QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes); - if (answer == QMessageBox::Cancel) { + const QMessageBox::StandardButton answer = + QMessageBox::question(core->mainWindow(), + tr("Closing p4 Editor"), + tr("Do you want to submit this change list?"), + QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes); + if (answer == QMessageBox::Cancel) return false; - } - m_coreInstance->fileManager()->blockFileChange(fileIFace); + core->fileManager()->blockFileChange(fileIFace); fileIFace->save(); - m_coreInstance->fileManager()->unblockFileChange(fileIFace); + core->fileManager()->unblockFileChange(fileIFace); if (answer == QMessageBox::Yes) { QByteArray change = m_changeTmpFile->readAll(); m_changeTmpFile->close(); @@ -1007,15 +1002,14 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) void PerforcePlugin::openFiles(const QStringList &files) { - foreach (QString s, files) { - m_coreInstance->editorManager()->openEditor(clientFilePath(s)); - } - m_coreInstance->editorManager()->ensureEditorManagerVisible(); + Core::EditorManager *em = Core::ICore::instance()->editorManager(); + foreach (QString s, files) + em->openEditor(clientFilePath(s)); + em->ensureEditorManagerVisible(); } QString PerforcePlugin::clientFilePath(const QString &serverFilePath) { - QTC_ASSERT(m_coreInstance, return QString()); if (!checkP4Command()) return QString(); @@ -1041,7 +1035,7 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath) QString PerforcePlugin::currentFileName() { - QString fileName = m_coreInstance->fileManager()->currentFile(); + QString fileName = Core::ICore::instance()->fileManager()->currentFile(); // TODO: Use FileManager::fixPath const QFileInfo fileInfo(fileName); @@ -1069,67 +1063,9 @@ bool PerforcePlugin::checkP4Command() const return true; } -#ifdef USE_P4_API -void PerforcePlugin::runP4APICmd(const QString &cmd, const QStringList &args) -{ - m_enableP4APIActions = false; - updateActions(); - - ClientApi client; - if (!m_settings.defaultEnv) { - client.SetClient(m_settings.p4Client.toLatin1().constData()); - client.SetPort(m_settings.p4Port.toLatin1().constData()); - client.SetUser(m_settings.p4User.toLatin1().constData()); - } - - Error err; - m_coreInstance->messageManager()->displayStatusBarMessage(tr("Connecting to p4 server...")); - client.SetProtocol("api", "56"); - client.Init(&err); - if (err.Test()) { - StrBuf msg; - err.Fmt(&msg); - QMessageBox::critical(m_coreInstance->mainWindow(), tr("Perforce Plugin"), tr("Failed to connect to p4 server <b>%1</b>!").arg(msg.Text())); - client.Final(&err); - m_coreInstance->messageManager()->displayStatusBarMessage(tr("Connection to p4 server failed!"), 3000); - return; - } - m_coreInstance->messageManager()->displayStatusBarMessage(tr("Connection to p4 server established."), 3000); - - // ???? - //client.SetCwd("c:\\depot\\research\\qworkbench\\src"); - - int argc = args.count(); - char **argv = (char**)malloc(argc*sizeof(char*)); - int i = 0; - foreach (QString s, args) - argv[i++] = qstrdup(s.toLatin1().constData()); - - client.SetArgv( argc, argv ); - try { - client.Run(cmd.toLatin1().constData(), m_workbenchClientUser); - } catch (...) { - QMessageBox::critical(m_coreInstance->mainWindow(), tr("Perforce Plugin"), tr("Failed to run command <b>%1</b>!").arg(cmd)); - } - client.Final(&err); - i = 0; - while (i<argc) - free(argv[i++]); - free(argv); - - m_enableP4APIActions = true; - updateActions(); - - Core::IEditor *edt = m_coreInstance->editorManager()->currentEditor(); - if (edt && edt->widget()) - edt->widget()->setFocus(); -} -#endif - QString PerforcePlugin::pendingChangesData() { QString data; - Q_ASSERT(m_coreInstance); if (!checkP4Command()) return data; @@ -1169,22 +1105,18 @@ PerforcePlugin::~PerforcePlugin() m_settingsPage = 0; } -#ifdef USE_P4_API - if (m_workbenchClientUser) { - delete m_workbenchClientUser; - m_workbenchClientUser = 0; - } -#endif if (m_perforceOutputWindow) { removeObject(m_perforceOutputWindow); delete m_perforceOutputWindow; m_perforceOutputWindow = 0; } + if (m_submitEditorFactory) { removeObject(m_submitEditorFactory); delete m_submitEditorFactory; m_submitEditorFactory = 0; } + if (m_versionControl) { removeObject(m_versionControl); delete m_versionControl; @@ -1214,7 +1146,7 @@ void PerforcePlugin::setSettings(const PerforceSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = m_coreInstance->settings()) + if (QSettings *settings = Core::ICore::instance()->settings()) m_settings.toSettings(settings); } } @@ -1252,12 +1184,6 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName, return rc; } -Core::ICore *PerforcePlugin::coreInstance() -{ - QTC_ASSERT(m_coreInstance, return 0); - return m_coreInstance; -} - PerforcePlugin *PerforcePlugin::perforcePluginInstance() { QTC_ASSERT(m_perforcePluginInstance, return 0); diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h index 8069154a25c3464b1d9f2e8c55fdc32148e74958..e5985a28ab5bcce0067f57652d42a05babba3545 100644 --- a/src/plugins/perforce/perforceplugin.h +++ b/src/plugins/perforce/perforceplugin.h @@ -42,12 +42,6 @@ #include <extensionsystem/iplugin.h> #include <projectexplorer/projectexplorer.h> -#ifdef USE_P4_API -#include "workbenchclientuser.h" -#else - -#endif - #include <QtCore/QObject> #include <QtCore/QProcess> #include <QtCore/QStringList> @@ -117,7 +111,6 @@ public: Core::IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames); - static Core::ICore *coreInstance(); static PerforcePlugin *perforcePluginInstance(); PerforceSettings settings() const; @@ -230,7 +223,6 @@ private: static const char * const SEPARATOR2; static const char * const SEPARATOR3; - static Core::ICore *m_coreInstance; static PerforcePlugin *m_perforcePluginInstance; QString pendingChangesData(); diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index ff426805c2eedb072a40820fbb12e947f3aa6db3..a7e7286a30f6b18acfa823a3a9d98be333737107 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -178,8 +178,7 @@ void BuildManager::startBuildQueue() { if (!m_running) { // Progress Reporting - Core::ProgressManager *progressManager = - ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->progressManager(); + Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); m_progressFutureInterface = new QFutureInterface<void>; m_progressWatcher.setFuture(m_progressFutureInterface->future()); Core::FutureProgress *progress = progressManager->addTask(m_progressFutureInterface->future(), diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index c11d2c958ee4fefbf725abb939596aa4ec355311..f4f5efc52be9c4c3e912a474d5dbf183412b843e 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -147,10 +147,12 @@ ProjectExplorerPlugin *ProjectExplorerPlugin::instance() return m_instance; } -bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QString *) +bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - m_core = pm->getObject<Core::ICore>(); + Q_UNUSED(arguments); + Q_UNUSED(error); + + m_core = Core::ICore::instance(); Core::ActionManager *am = m_core->actionManager(); addObject(this); diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 50f946966a1491f9d9db276f44ce3129ac947590..03243abb5ca1a9f74aff29e1ca388e59133a3539 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -251,7 +251,7 @@ void TaskModel::setFileNotFound(const QModelIndex &idx, bool b) TaskWindow::TaskWindow() { - m_coreIFace = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); m_model = new TaskModel; m_listview = new TaskView; @@ -266,10 +266,10 @@ TaskWindow::TaskWindow() m_listview->setContextMenuPolicy(Qt::ActionsContextMenu); m_taskWindowContext = new TaskWindowContext(m_listview); - m_coreIFace->addContextObject(m_taskWindowContext); + core->addContextObject(m_taskWindowContext); m_copyAction = new QAction(QIcon(Core::Constants::ICON_COPY), tr("&Copy"), this); - m_coreIFace->actionManager()-> + core->actionManager()-> registerAction(m_copyAction, Core::Constants::COPY, m_taskWindowContext->context()); m_listview->addAction(m_copyAction); @@ -289,7 +289,7 @@ TaskWindow::TaskWindow() TaskWindow::~TaskWindow() { - m_coreIFace->removeContextObject(m_taskWindowContext); + Core::ICore::instance()->removeContextObject(m_taskWindowContext); delete m_listview; delete m_model; } @@ -315,7 +315,6 @@ void TaskWindow::clearContents() void TaskWindow::visibilityChanged(bool /* b */) { - } void TaskWindow::addItem(ProjectExplorer::BuildParserInterface::PatternType type, @@ -579,7 +578,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, TaskWindowContext::TaskWindowContext(QWidget *widget) : m_taskList(widget) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); m_context << core->uniqueIDManager()->uniqueIdentifier(Core::Constants::C_PROBLEM_PANE); } diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h index 71875f9e84fb7ace6514fb2a50bde22462d7bc6b..269f6e3ce6201c8bed8c565631b957bde756a7d9 100644 --- a/src/plugins/projectexplorer/taskwindow.h +++ b/src/plugins/projectexplorer/taskwindow.h @@ -89,7 +89,6 @@ private slots: private: int sizeHintForColumn(int column) const; - Core::ICore *m_coreIFace; int m_errorCount; int m_currentTask; diff --git a/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp b/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp index b299e70d3f1fd33b221aeea3cf368b3d04c9c519..ea622415a2012fad7634659ca0a6cd24e7d70d61 100644 --- a/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp +++ b/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp @@ -38,7 +38,7 @@ #include "qt4project.h" #include "qt4projectmanagerconstants.h" -#include <extensionsystem/pluginmanager.h> +#include <coreplugin/icore.h> #include <utils/qtcassert.h> using namespace Qt4ProjectManager; @@ -66,8 +66,7 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi) QVariant v = value("clean"); if (v.isNull() || v.toBool() == false) { // Normal run - QString dumperPath = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() - ->resourcePath() + "/gdbmacros/"; + QString dumperPath = Core::ICore::instance()->resourcePath() + "/gdbmacros/"; QStringList files; files << "gdbmacros.cpp" << "gdbmacros.pro"; diff --git a/src/plugins/qt4projectmanager/profileeditor.cpp b/src/plugins/qt4projectmanager/profileeditor.cpp index da1dc0ac2ed07df75419e0ed4999800f7f6cd532..12750868c4b4a48c176def4bbb3de83b664e219e 100644 --- a/src/plugins/qt4projectmanager/profileeditor.cpp +++ b/src/plugins/qt4projectmanager/profileeditor.cpp @@ -42,7 +42,6 @@ #include <coreplugin/icore.h> #include <coreplugin/uniqueidmanager.h> -#include <extensionsystem/pluginmanager.h> #include <texteditor/fontsettings.h> #include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditorconstants.h> @@ -60,9 +59,10 @@ using namespace Qt4ProjectManager::Internal; using namespace ProjectExplorer; -ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor, Core::ICore *core) - :BaseTextEditorEditable(editor) +ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor) + : BaseTextEditorEditable(editor) { + Core::ICore *core = Core::ICore::instance(); m_context << core->uniqueIDManager()-> uniqueIdentifier(Qt4ProjectManager::Constants::C_PROFILEEDITOR); m_context << core->uniqueIDManager()-> @@ -73,15 +73,13 @@ ProFileEditorEditable::ProFileEditorEditable(ProFileEditor *editor, Core::ICore TextEditor::BaseTextEditorEditable *ProFileEditor::createEditableInterface() { - return new ProFileEditorEditable(this, m_core); + return new ProFileEditorEditable(this); } ProFileEditor::ProFileEditor(QWidget *parent, ProFileEditorFactory *factory, TextEditor::TextEditorActionHandler *ah) : BaseTextEditor(parent), m_factory(factory), m_ah(ah) { Qt4Manager *manager = factory->qt4ProjectManager(); - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - ProFileDocument *doc = new ProFileDocument(manager); doc->setMimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)); setBaseTextDocument(doc); diff --git a/src/plugins/qt4projectmanager/profileeditor.h b/src/plugins/qt4projectmanager/profileeditor.h index e2c6c3be5c872ca5fe4b8f6a658462edb63010e4..256e9a9500801b5646724b1e01a09ff095214318 100644 --- a/src/plugins/qt4projectmanager/profileeditor.h +++ b/src/plugins/qt4projectmanager/profileeditor.h @@ -41,12 +41,6 @@ namespace TextEditor { class FontSettings; -class BaseEditorActionHandler; -} - -namespace Core { -class ICore; -class IFile; } namespace Qt4ProjectManager { @@ -66,7 +60,7 @@ class ProFileEditor; class ProFileEditorEditable : public TextEditor::BaseTextEditorEditable { public: - ProFileEditorEditable(ProFileEditor *, Core::ICore *core); + ProFileEditorEditable(ProFileEditor *); QList<int> context() const; bool duplicateSupported() const { return true; } @@ -98,7 +92,6 @@ public slots: virtual void setFontSettings(const TextEditor::FontSettings &); private: - Core::ICore *m_core; ProFileEditorFactory *m_factory; TextEditor::TextEditorActionHandler *m_ah; }; diff --git a/src/plugins/qt4projectmanager/profileeditorfactory.cpp b/src/plugins/qt4projectmanager/profileeditorfactory.cpp index 11704c2fb1b81bba71e73fc0a441829ad6b6774e..b3d32a025e4862275f5eda96b52e349aaafa8eb5 100644 --- a/src/plugins/qt4projectmanager/profileeditorfactory.cpp +++ b/src/plugins/qt4projectmanager/profileeditorfactory.cpp @@ -40,7 +40,6 @@ #include <coreplugin/icore.h> #include <coreplugin/fileiconprovider.h> #include <coreplugin/editormanager/editormanager.h> -#include <extensionsystem/pluginmanager.h> #include <texteditor/texteditoractionhandler.h> #include <QtCore/QFileInfo> @@ -75,7 +74,7 @@ QString ProFileEditorFactory::kind() const Core::IFile *ProFileEditorFactory::open(const QString &fileName) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind()); return iface ? iface->file() : 0; } diff --git a/src/plugins/qt4projectmanager/qt4buildconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4buildconfigwidget.cpp index 0a53b99b62d37dc632f86546650619c2c84fbd26..46d5b106f5cf41bfad75b01cd39b06dc8b39e218 100644 --- a/src/plugins/qt4projectmanager/qt4buildconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4buildconfigwidget.cpp @@ -36,11 +36,11 @@ #include "makestep.h" #include "qmakestep.h" #include "qt4project.h" +#include "qt4projectmanagerconstants.h" #include "qt4projectmanager.h" #include "ui_qt4buildconfigwidget.h" -#include <extensionsystem/pluginmanager.h> + #include <coreplugin/mainwindow.h> -#include "qt4projectmanagerconstants.h" #include <QtGui/QFileDialog> @@ -93,7 +93,7 @@ Qt4BuildConfigWidget::~Qt4BuildConfigWidget() void Qt4BuildConfigWidget::manageQtVersions() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); core->showOptionsDialog(Constants::QT_CATEGORY, Constants::QTVERSION_PAGE); } diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 2cc23b9ea8a5423a3d433770bf19652f7a41e07b..d7a1783feb52b39c810aa8f10d2f5195210a72ec 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -262,7 +262,7 @@ bool Qt4PriFileNode::changeIncludes(ProFile *includeFile, const QStringList &pro bool Qt4PriFileNode::priFileWritable(const QString &path) { const QString dir = QFileInfo(path).dir().path(); - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); Core::IVersionControl *versionControl = core->vcsManager()->findVersionControlForDirectory(dir); switch (Core::EditorManager::promptReadOnlyFile(path, versionControl, core->mainWindow(), false)) { case Core::EditorManager::RO_OpenVCS: @@ -291,7 +291,7 @@ bool Qt4PriFileNode::saveModifiedEditors(const QString &path) QList<Core::IFile*> allFileHandles; QList<Core::IFile*> modifiedFileHandles; - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); foreach (Core::IFile *file, core->fileManager()->managedFiles(path)) { allFileHandles << file; @@ -428,7 +428,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, void Qt4PriFileNode::save(ProFile *includeFile) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); Core::FileManager *fileManager = core->fileManager(); QList<Core::IFile *> allFileHandles = fileManager->managedFiles(includeFile->fileName()); Core::IFile *modifiedFileHandle = 0; @@ -839,13 +839,12 @@ void Qt4ProFileNode::updateUiFiles() ProFileReader *Qt4PriFileNode::createProFileReader() const { ProFileReader *reader = new ProFileReader(); - connect(reader, SIGNAL(errorFound(const QString &)), - m_project, SLOT(proFileParseError(const QString &))); + connect(reader, SIGNAL(errorFound(QString)), + m_project, SLOT(proFileParseError(QString))); QtVersion *version = m_project->qtVersion(m_project->activeBuildConfiguration()); - if (version->isValid()) { + if (version->isValid()) reader->setQtVersion(version); - } reader->setOutputDir(m_qt4ProFileNode->buildDir()); diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 0e64fc2be1eb2e22a78a69724004369c6ab1704d..e771109d066a56056223c6f69f13359a2ef1c70f 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -48,6 +48,7 @@ #include "projectloadwizard.h" #include "gdbmacrosbuildstep.h" +#include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> #include <coreplugin/coreconstants.h> #include <cpptools/cppmodelmanagerinterface.h> diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index c589d2eb8651f66b975a44f0e8a5bc2c462d979a..35fd609b1179c36b26e480d5a386b5f650211f35 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -42,6 +42,7 @@ #include "qmakestep.h" #include <extensionsystem/pluginmanager.h> +#include <coreplugin/icore.h> #include <coreplugin/basefilewizard.h> #include <coreplugin/messagemanager.h> #include <coreplugin/uniqueidmanager.h> diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index a8dfb4cb89dd72581845689d114e8d78381f1179..763d7fb65d963638afc3ffc6aad29f2f861ed3d5 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -97,31 +97,31 @@ static Core::Command *createSeparator(Core::ActionManager *am, */ bool Qt4ProjectManagerPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage)) + Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage)) return false; - m_projectExplorer = m_core->pluginManager()->getObject<ProjectExplorer::ProjectExplorerPlugin>(); + m_projectExplorer = core->pluginManager()->getObject<ProjectExplorer::ProjectExplorerPlugin>(); - Core::ActionManager *am = m_core->actionManager(); + Core::ActionManager *am = core->actionManager(); //create and register objects - m_qt4ProjectManager = new Qt4Manager(this, m_core); + m_qt4ProjectManager = new Qt4Manager(this, core); addObject(m_qt4ProjectManager); TextEditor::TextEditorActionHandler *editorHandler - = new TextEditor::TextEditorActionHandler(m_core, Constants::C_PROFILEEDITOR); + = new TextEditor::TextEditorActionHandler(core, Constants::C_PROFILEEDITOR); m_proFileEditorFactory = new ProFileEditorFactory(m_qt4ProjectManager, editorHandler); addObject(m_proFileEditorFactory); - GuiAppWizard *guiWizard = new GuiAppWizard(m_core); + GuiAppWizard *guiWizard = new GuiAppWizard(core); addAutoReleasedObject(guiWizard); - ConsoleAppWizard *consoleWizard = new ConsoleAppWizard(m_core); + ConsoleAppWizard *consoleWizard = new ConsoleAppWizard(core); addAutoReleasedObject(consoleWizard); - LibraryWizard *libWizard = new LibraryWizard(m_core); + LibraryWizard *libWizard = new LibraryWizard(core); addAutoReleasedObject(libWizard); addAutoReleasedObject(new QMakeBuildStepFactory); @@ -148,7 +148,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList & /*arguments*/, QStr am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); //register actions - m_projectContext = m_core->uniqueIDManager()-> + m_projectContext = core->uniqueIDManager()-> uniqueIdentifier(Qt4ProjectManager::Constants::PROJECT_KIND); QList<int> context = QList<int>() << m_projectContext; Core::Command *command; diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h index 584a9bfca47472b6e44dcfca319eabe7fc64380d..374e8918345e49a1049e0c8418817e8ef0f156e8 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h @@ -36,7 +36,6 @@ #include <projectexplorer/project.h> #include <projectexplorer/projectexplorer.h> -#include <coreplugin/icore.h> namespace Qt4ProjectManager { @@ -79,7 +78,6 @@ private slots: #endif private: - Core::ICore *m_core; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; ProFileEditorFactory *m_proFileEditorFactory; Qt4Manager *m_qt4ProjectManager; diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index 3953e6d9ba4a0baabb7cc0a3a6acdeb249e30a69..3ff03bcc28a305115a3828fed94b71f780f7b475 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -41,7 +41,6 @@ #include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> #include <coreplugin/variablemanager.h> -#include <extensionsystem/pluginmanager.h> #include <projectexplorer/buildstep.h> #include <utils/qtcassert.h> @@ -182,8 +181,7 @@ void Qt4RunConfiguration::updateCachedValues() ProFileReader *reader = static_cast<Qt4Project *>(project())->createProFileReader(); if (!reader->readProFile(m_proFilePath)) { delete reader; - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - core->messageManager()->printToOutputPane(QString("Could not parse %1. The Qt4 run configuration %2 can not be started.").arg(m_proFilePath).arg(name())); + Core::ICore::instance()->messageManager()->printToOutputPane(QString("Could not parse %1. The Qt4 run configuration %2 can not be started.").arg(m_proFilePath).arg(name())); return; } @@ -233,7 +231,7 @@ QString Qt4RunConfiguration::resolveVariables(const QString &buildConfiguration, QString relSubDir = QFileInfo(project()->file()->fileName()).absoluteDir().relativeFilePath(m_srcDir); QString baseDir = QDir(project()->buildDirectory(buildConfiguration)).absoluteFilePath(relSubDir); - Core::VariableManager *vm = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->variableManager(); + Core::VariableManager *vm = Core::ICore::instance()->variableManager(); if (!vm) return QString(); QString dest; diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 41b2366581dc09d5585d634d246f5f3b197a5ac6..6e67989158b6424f4da2f06c0bc1591016eb471e 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -37,6 +37,7 @@ #include "msvcenvironment.h" #include "cesdkhandler.h" +#include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> #include <extensionsystem/pluginmanager.h> #include <help/helpplugin.h> @@ -63,8 +64,7 @@ static const char *newQtVersionsKey = "NewQtVersions"; QtVersionManager::QtVersionManager() : m_emptyVersion(new QtVersion) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - QSettings *s = m_core->settings(); + QSettings *s = Core::ICore::instance()->settings(); m_defaultVersion = s->value(defaultQtVersionKey, 0).toInt(); m_idcount = 1; @@ -116,7 +116,8 @@ void QtVersionManager::addVersion(QtVersion *version) void QtVersionManager::updateDocumentation() { - Help::HelpManager *helpManager = m_core->pluginManager()->getObject<Help::HelpManager>(); + Help::HelpManager *helpManager + = ExtensionSystem::PluginManager::instance()->getObject<Help::HelpManager>(); Q_ASSERT(helpManager); QStringList fileEndings = QStringList() << "/qch/qt.qch" << "/qch/qmake.qch" << "/qch/designer.qch"; QStringList files; @@ -196,7 +197,7 @@ void QtVersionManager::apply() void QtVersionManager::writeVersionsIntoSettings() { - QSettings *s = m_core->settings(); + QSettings *s = Core::ICore::instance()->settings(); s->setValue(defaultQtVersionKey, m_defaultVersion); s->beginWriteArray("QtVersions"); for (int i = 0; i < m_versions.size(); ++i) { @@ -235,7 +236,7 @@ void QtVersionManager::addNewVersionsFromInstaller() // NewQtVersions="qt 4.3.2=c:\\qt\\qt432;qt embedded=c:\\qtembedded;" // or NewQtVersions="qt 4.3.2=c:\\qt\\qt432=c:\\qtcreator\\mingw\\=prependToPath; // Duplicate entries are not added, the first new version is set as default. - QSettings *settings = m_core->settings(); + QSettings *settings = Core::ICore::instance()->settings(); if (!settings->contains(newQtVersionsKey)) return; diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index 872b44b2178ff8f3c6926fb3340592a5a819202b..f6ccd017b67e7edd9cd16548e06cfd967d3604d1 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -37,7 +37,6 @@ #include "ui_qtversionmanager.h" #include <coreplugin/dialogs/ioptionspage.h> -#include <coreplugin/icore.h> #include <projectexplorer/projectexplorer.h> #include <QtCore/QDebug> @@ -208,7 +207,6 @@ private: static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list); void updateUniqueIdToIndexMap(); - Core::ICore *m_core; QPointer<QtDirWidget> m_widget; QtVersion *m_emptyVersion; diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp index d67cd1ab46ec1e1f278878a4358842ce755e4450..b61861a8e6795af2dfbb18d29f6777a266b48654 100644 --- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp @@ -35,6 +35,7 @@ #include "qt4project.h" #include "qt4projectmanagerconstants.h" +#include <coreplugin/icore.h> #include <extensionsystem/pluginmanager.h> #include <projectexplorer/projectexplorer.h> diff --git a/src/plugins/qtestlib/qtestlibplugin.cpp b/src/plugins/qtestlib/qtestlibplugin.cpp index 5b38e05b33afee294bbfe334759bcf521f07050f..7d0cada5323c365aec704c9097973d40889dce7f 100644 --- a/src/plugins/qtestlib/qtestlibplugin.cpp +++ b/src/plugins/qtestlib/qtestlibplugin.cpp @@ -33,25 +33,26 @@ #include "qtestlibplugin.h" -#include <QtCore/qplugin.h> -#include <QIcon> -#include <QDebug> -#include <QKeySequence> -#include <QAction> -#include <QHeaderView> -#include <QDomDocument> -#include <QTemporaryFile> -#include <texteditor/TextEditorInterfaces> #include <Qt4IProjectManagers> -#include <QFileInfo> -#include <QDir> -#include <QStandardItemModel> -#include <QTreeView> -#include <QTextEdit> -#include <QSplitter> -#include <QVBoxLayout> -#include <QComboBox> -#include <QLabel> +#include <texteditor/TextEditorInterfaces> + +#include <QtCore/QAction> +#include <QtCore/QDebug> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtCore/QIcon> +#include <QtCore/QKeySequence> +#include <QtCore/QTemporaryFile> +#include <QtCore/QtPlugin> +#include <QtGui/QComboBox> +#include <QtGui/QHeaderView> +#include <QtGui/QLabel> +#include <QtGui/QSplitter> +#include <QtGui/QStandardItemModel> +#include <QtGui/QTextEdit> +#include <QtGui/QTreeView> +#include <QtGui/QVBoxLayout> +#include <QtXml/QDomDocument> using namespace QTestLib::Internal; diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp index fec9d760b0db914d9dd44aa0755cb3ad559f264f..dcf69b04b06c66f93265b419ad72edea0a01c7c2 100644 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp +++ b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp @@ -78,7 +78,7 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString { typedef SharedTools::QScriptHighlighter QScriptHighlighter; - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qtscripteditor/QtScriptEditor.mimetypes.xml"), error_message)) return false; m_scriptcontext << core->uniqueIDManager()->uniqueIdentifier(QtScriptEditor::Constants::C_QTSCRIPTEDITOR); diff --git a/src/plugins/quickopen/quickopenplugin.cpp b/src/plugins/quickopen/quickopenplugin.cpp index 80b1ca131c08133d38829df34a1c4df568db3267..f0354c0ba6c756cda3031b3af45f29242195575d 100644 --- a/src/plugins/quickopen/quickopenplugin.cpp +++ b/src/plugins/quickopen/quickopenplugin.cpp @@ -82,8 +82,7 @@ QuickOpenPlugin::~QuickOpenPlugin() bool QuickOpenPlugin::initialize(const QStringList &, QString *) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - + Core::ICore *core = Core::ICore::instance(); m_settingsPage = new SettingsPage(core, this); addObject(m_settingsPage); @@ -137,7 +136,7 @@ void QuickOpenPlugin::startSettingsLoad() void QuickOpenPlugin::loadSettings() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); QSettings settings; settings.beginGroup("QuickOpen"); m_refreshTimer.setInterval(settings.value("RefreshInterval", 60).toInt()*60000); @@ -170,16 +169,15 @@ void QuickOpenPlugin::settingsLoaded() void QuickOpenPlugin::saveSettings() { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); if (core && core->settings()) { QSettings *s = core->settings(); s->beginGroup("QuickOpen"); - s->setValue("Interval", m_refreshTimer.interval()/60000); + s->setValue("Interval", m_refreshTimer.interval() / 60000); s->remove(""); foreach (IQuickOpenFilter *filter, m_filters) { - if (!m_customFilters.contains(filter)) { + if (!m_customFilters.contains(filter)) s->setValue(filter->name(), filter->saveState()); - } } s->beginGroup("CustomFilters"); int i = 0; @@ -245,7 +243,7 @@ void QuickOpenPlugin::refresh(QList<IQuickOpenFilter*> filters) if (filters.isEmpty()) filters = m_filters; QFuture<void> task = QtConcurrent::run(&IQuickOpenFilter::refresh, filters); - Core::FutureProgress *progress = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>() + Core::FutureProgress *progress = Core::ICore::instance() ->progressManager()->addTask(task, tr("Indexing"), Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess); connect(progress, SIGNAL(finished()), this, SLOT(saveSettings())); } diff --git a/src/plugins/quickopen/quickopentoolwindow.cpp b/src/plugins/quickopen/quickopentoolwindow.cpp index 40cbeb7edcfde9f7958005af686a982f934a182b..d769313b58a1bbef5ce334571301c0129a4d925b 100644 --- a/src/plugins/quickopen/quickopentoolwindow.cpp +++ b/src/plugins/quickopen/quickopentoolwindow.cpp @@ -490,7 +490,6 @@ void QuickOpenToolWindow::showEvent(QShowEvent *event) void QuickOpenToolWindow::showConfigureDialog() { - ExtensionSystem::PluginManager::instance() - ->getObject<Core::ICore>()->showOptionsDialog(Constants::QUICKOPEN_CATEGORY, + Core::ICore::instance()->showOptionsDialog(Constants::QUICKOPEN_CATEGORY, Constants::FILTER_OPTIONS_PAGE); } diff --git a/src/plugins/regexp/regexpplugin.cpp b/src/plugins/regexp/regexpplugin.cpp index 86a4ca0a7ca4b41a322fbf244cd859c9463a249e..af1bc8f242f91198e6bcdb264ccc63ecc6e3d024 100644 --- a/src/plugins/regexp/regexpplugin.cpp +++ b/src/plugins/regexp/regexpplugin.cpp @@ -32,14 +32,15 @@ ***************************************************************************/ #include "regexpplugin.h" -#include "settings.h" + #include "regexpwindow.h" +#include "settings.h" #include <coreplugin/baseview.h> #include <coreplugin/icore.h> #include <coreplugin/uniqueidmanager.h> -#include <QtCore/qplugin.h> +#include <QtCore/QtPlugin> using namespace RegExp::Internal; @@ -49,25 +50,24 @@ RegExpPlugin::RegExpPlugin() RegExpPlugin::~RegExpPlugin() { - if (m_regexpWindow) { - m_regexpWindow->settings().toQSettings(m_core->settings()); - } + if (m_regexpWindow) + m_regexpWindow->settings().toQSettings(Core::ICore::instance()->settings()); } void RegExpPlugin::extensionsInitialized() { } - -bool RegExpPlugin::initialize(const QStringList & /*arguments*/, QString *error_message) +bool RegExpPlugin::initialize(const QStringList &arguments, QString *errorMessage) { - Q_UNUSED(error_message) - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Q_UNUSED(arguments); + Q_UNUSED(errorMessage) + Core::ICore *core = Core::ICore::instance(); m_regexpWindow = new RegExpWindow; Settings settings; - settings.fromQSettings(m_core->settings()); + settings.fromQSettings(core->settings()); m_regexpWindow->setSettings(settings); - const int plugId = m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String("RegExpPlugin")); + const int plugId = core->uniqueIDManager()->uniqueIdentifier(QLatin1String("RegExpPlugin")); addAutoReleasedObject(new Core::BaseView("TextEditor.RegExpWindow", m_regexpWindow, QList<int>() << plugId, diff --git a/src/plugins/regexp/regexpplugin.h b/src/plugins/regexp/regexpplugin.h index c944d37bc17fd739bd5fe53b253d386b37d22003..aa102953704082e350bf60d38b475bb72d8e7698 100644 --- a/src/plugins/regexp/regexpplugin.h +++ b/src/plugins/regexp/regexpplugin.h @@ -39,10 +39,6 @@ #include <QtCore/QObject> #include <QtCore/QPointer> -namespace Core { -class ICore; -} - namespace RegExp { namespace Internal { @@ -56,11 +52,10 @@ public: RegExpPlugin(); virtual ~RegExpPlugin(); - bool initialize(const QStringList &arguments, QString *error_message); + bool initialize(const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); private: - Core::ICore *m_core; QPointer<RegExpWindow> m_regexpWindow; }; diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp index 3775564cc80654028a7e18b8513d4067da9d41ca..a1d612efc2e31da586ead7d8cb1fa5cc90803148 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.cpp +++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp @@ -56,9 +56,8 @@ using namespace ResourceEditor::Internal; ResourceEditorPlugin::ResourceEditorPlugin() : m_wizard(0), m_editor(0), - m_core(NULL), - m_redoAction(NULL), - m_undoAction(NULL) + m_redoAction(0), + m_undoAction(0) { } @@ -68,13 +67,14 @@ ResourceEditorPlugin::~ResourceEditorPlugin() removeObject(m_wizard); } -bool ResourceEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message) +bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), error_message)) + Q_UNUSED(arguments); + Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage)) return false; - m_editor = new ResourceEditorFactory(m_core, this); + m_editor = new ResourceEditorFactory(core, this); addObject(m_editor); Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); @@ -83,16 +83,16 @@ bool ResourceEditorPlugin::initialize(const QStringList & /*arguments*/, QString wizardParameters.setCategory(QLatin1String("Qt")); wizardParameters.setTrCategory(tr("Qt")); - m_wizard = new ResourceWizard(wizardParameters, m_core, this); + m_wizard = new ResourceWizard(wizardParameters, core, this); addObject(m_wizard); - error_message->clear(); + errorMessage->clear(); // Register undo and redo - Core::ActionManager * const actionManager = m_core->actionManager(); - int const pluginId = m_core->uniqueIDManager()->uniqueIdentifier( + Core::ActionManager * const actionManager = core->actionManager(); + int const pluginId = core->uniqueIDManager()->uniqueIdentifier( Constants::C_RESOURCEEDITOR); - QList<int> const idList = QList<int>() << pluginId; + const QList<int> idList = QList<int>() << pluginId; m_undoAction = new QAction(tr("&Undo"), this); m_redoAction = new QAction(tr("&Redo"), this); actionManager->registerAction(m_undoAction, Core::Constants::UNDO, idList); @@ -129,7 +129,7 @@ void ResourceEditorPlugin::onUndoStackChanged(ResourceEditorW const *editor, ResourceEditorW * ResourceEditorPlugin::currentEditor() const { ResourceEditorW * const focusEditor = qobject_cast<ResourceEditorW *>( - m_core->editorManager()->currentEditor()); + Core::ICore::instance()->editorManager()->currentEditor()); QTC_ASSERT(focusEditor, return 0); return focusEditor; } diff --git a/src/plugins/resourceeditor/resourceeditorplugin.h b/src/plugins/resourceeditor/resourceeditorplugin.h index fd9576ea00de1db41e644d64f240b6ce5bfdfb6d..d8c4c3daf1a68570fe3f4df476a9d7ce4bf858c0 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.h +++ b/src/plugins/resourceeditor/resourceeditorplugin.h @@ -36,11 +36,9 @@ #include <extensionsystem/iplugin.h> -QT_FORWARD_DECLARE_CLASS(QAction); - -namespace Core { - class ICore; -} +QT_BEGIN_NAMESPACE +class QAction; +QT_END_NAMESPACE namespace ResourceEditor { namespace Internal { @@ -57,8 +55,8 @@ public: ResourceEditorPlugin(); virtual ~ResourceEditorPlugin(); - //Plugin - bool initialize(const QStringList &arguments, QString *error_message = 0); + // IPlugin + bool initialize(const QStringList &arguments, QString *errorMessage = 0); void extensionsInitialized(); private slots: @@ -74,7 +72,6 @@ private: private: ResourceWizard *m_wizard; ResourceEditorFactory *m_editor; - Core::ICore *m_core; QAction *m_redoAction; QAction *m_undoAction; }; diff --git a/src/plugins/snippets/snippetsplugin.cpp b/src/plugins/snippets/snippetsplugin.cpp index c014a6432a1a5e4f27f467ddac2ad953fcf4eb30..32dd4bc04e2655b54b3dfef63769ae7e03aa60c8 100644 --- a/src/plugins/snippets/snippetsplugin.cpp +++ b/src/plugins/snippets/snippetsplugin.cpp @@ -36,13 +36,12 @@ #include "snippetsplugin.h" #include "snippetspec.h" -#include <QtCore/qplugin.h> +#include <QtCore/QtPlugin> #include <QtCore/QDebug> #include <QtGui/QShortcut> #include <QtGui/QApplication> #include <extensionsystem/pluginmanager.h> -#include <coreplugin/icore.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/actionmanager/actionmanagerinterface.h> #include <coreplugin/editormanager/editormanager.h> @@ -69,19 +68,20 @@ void SnippetsPlugin::extensionsInitialized() { } -bool SnippetsPlugin::initialize(const QStringList & /*arguments*/, QString *) +bool SnippetsPlugin::initialize(const QStringList &arguments, QString *) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); - Core::ActionManager *am = m_core->actionManager(); + Q_UNUSED(arguments); + Core::ICore *core = Core::ICore::instance(); + Core::ActionManager *am = core->actionManager(); QList<int> context; - context << m_core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); + context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); m_snippetWnd = new SnippetsWindow(); addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree", m_snippetWnd, - QList<int>() << m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window")) - << m_core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR), + QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window")) + << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR), Qt::RightDockWidgetArea)); m_snippetsCompletion = new SnippetsCompletion(this); addObject(m_snippetsCompletion); @@ -107,11 +107,12 @@ QString SnippetsPlugin::simplifySnippetName(SnippetSpec *snippet) const void SnippetsPlugin::snippetActivated() { + Core::ICore *core = Core::ICore::instance(); SnippetSpec *snippet = m_shortcuts.value(sender()); - if (snippet && m_core->editorManager()->currentEditor()) { + if (snippet && core->editorManager()->currentEditor()) { TextEditor::ITextEditable *te = qobject_cast<TextEditor::ITextEditable *>( - m_core->editorManager()->currentEditor()); + core->editorManager()->currentEditor()); m_snippetWnd->insertSnippet(te, snippet); } } diff --git a/src/plugins/snippets/snippetsplugin.h b/src/plugins/snippets/snippetsplugin.h index 3647244d659ea820c80e395390a6be55bf4b8d85..dba0804a63282c96e530a14a89d8dc8b890d57e0 100644 --- a/src/plugins/snippets/snippetsplugin.h +++ b/src/plugins/snippets/snippetsplugin.h @@ -40,11 +40,6 @@ #include <extensionsystem/iplugin.h> -namespace Core { -class ICore; -struct Application; -} - namespace Snippets { namespace Internal { @@ -62,9 +57,8 @@ public: static SnippetsPlugin *instance() { return m_instance; } static SnippetsWindow *snippetsWindow() { return m_instance->m_snippetWnd; } - static Core::ICore *core() { return m_instance->m_core; } - bool initialize(const QStringList &arguments, QString *error_message); + bool initialize(const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); private slots: @@ -74,7 +68,6 @@ private: static SnippetsPlugin *m_instance; QString simplifySnippetName(SnippetSpec *snippet) const; - Core::ICore *m_core; SnippetsCompletion *m_snippetsCompletion; SnippetsWindow *m_snippetWnd; diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 0e3ad1c32a759b24585d47fd0b08edff782a4597..23f4986bc31032870f8befcf079574e174b4572a 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -249,8 +249,10 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { Subversion::Constants::SUBVERSIONCOMMITEDITOR }; -bool SubversionPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) +bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMessage) { + Q_UNUSED(arguments); + typedef VCSBase::VCSSubmitEditorFactory<SubversionSubmitEditor> SubversionSubmitEditorFactory; typedef VCSBase::VCSEditorFactory<SubversionEditor> SubversionEditorFactory; using namespace Constants; @@ -259,7 +261,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments*/, QString *er using namespace ExtensionSystem; m_subversionPluginInstance = this; - m_coreInstance = PluginManager::instance()->getObject<Core::ICore>(); + m_coreInstance = Core::ICore::instance(); if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) return false; @@ -493,7 +495,7 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname) if (Subversion::Constants::debug) qDebug() << Q_FUNC_INFO << files << diffname; const QString source = files.empty() ? QString() : files.front(); - QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(m_coreInstance, source); + QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(source); if (files.count() == 1 && diffname.isEmpty()) diffname = QFileInfo(files.front()).fileName(); @@ -760,7 +762,7 @@ void SubversionPlugin::filelogCurrentFile() void SubversionPlugin::filelog(const QString &file) { - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, file); + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file); // no need for temp file QStringList args(QLatin1String("log")); args.append(QDir::toNativeSeparators(file)); @@ -802,7 +804,7 @@ void SubversionPlugin::annotateCurrentFile() void SubversionPlugin::annotate(const QString &file) { - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, file); + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file); QStringList args(QLatin1String("annotate")); args.push_back(QLatin1String("-v")); @@ -861,7 +863,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) args.push_back(diffArg); args.push_back(topLevel); - QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, source); + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(source); const SubversionResponse response = runSvn(args, subversionShortTimeOut, false, codec); if (response.error) return; @@ -1015,12 +1017,6 @@ void SubversionPlugin::setSettings(const SubversionSettings &s) } } -Core::ICore *SubversionPlugin::coreInstance() -{ - QTC_ASSERT(m_coreInstance, return 0); - return m_coreInstance; -} - SubversionPlugin *SubversionPlugin::subversionPluginInstance() { QTC_ASSERT(m_subversionPluginInstance, return m_subversionPluginInstance); diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 729bbc909fde61010f7ff7b137c927fddbcaa565..17285e73351a31aee5922ea7f1b0a7bb96cc6c47 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -105,7 +105,6 @@ public: bool managesDirectory(const QString &directory) const; QString findTopLevelForDirectory(const QString &directory) const; - static Core::ICore *coreInstance(); static SubversionPlugin *subversionPluginInstance(); private slots: diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 11c129fb10aed1319ba00ae5e9d67070b24a2b08..cae7df6bd7d58d0f0dda146f2436bd621e830824 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -88,7 +88,7 @@ using namespace TextEditor::Internal; namespace TextEditor { - namespace Internal { +namespace Internal { class TextEditExtraArea : public QWidget { BaseTextEditor *textEdit; @@ -124,16 +124,15 @@ protected: } }; - } -} +} // namespace Internal +} // namespace TextEditor ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName, int line, int column, const QString &editorKind) { - Core::EditorManager *editorManager = - ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager(); + Core::EditorManager *editorManager = Core::ICore::instance()->editorManager(); editorManager->addCurrentPositionToNavigationHistory(true); Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true); TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor); @@ -563,7 +562,7 @@ bool BaseTextEditor::open(const QString &fileName) return false; } -Core::IFile * BaseTextEditor::file() +Core::IFile *BaseTextEditor::file() { return d->m_document; } diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp index 4e4adf28bdcfc091ed9d9e2c8e131782451ef300..c5db69325657e50643a59d1408cd0e9a6ae97458 100644 --- a/src/plugins/texteditor/basetextmark.cpp +++ b/src/plugins/texteditor/basetextmark.cpp @@ -57,7 +57,7 @@ BaseTextMark::BaseTextMark(const QString &filename, int line) void BaseTextMark::init() { m_init = true; - Core::EditorManager *em = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager(); + Core::EditorManager *em = Core::ICore::instance()->editorManager(); connect(em, SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); foreach (Core::IEditor *editor, em->openedEditors()) @@ -117,7 +117,7 @@ void BaseTextMark::updateMarker() void BaseTextMark::moveMark(const QString & /* filename */, int /* line */) { - Core::EditorManager *em = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager(); + Core::EditorManager *em = Core::ICore::instance()->editorManager(); if (!m_init) { connect(em, SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); m_init = true; diff --git a/src/plugins/texteditor/completionsupport.cpp b/src/plugins/texteditor/completionsupport.cpp index 43665b064e9813c837e534c5189056dec55acb8a..ddac8de09d179f99f2ab2c25df364786765568a2 100644 --- a/src/plugins/texteditor/completionsupport.cpp +++ b/src/plugins/texteditor/completionsupport.cpp @@ -49,23 +49,23 @@ using namespace TextEditor; using namespace TextEditor::Internal; -CompletionSupport *CompletionSupport::instance(Core::ICore *core) +CompletionSupport *CompletionSupport::instance() { static CompletionSupport *m_instance = 0; - if (!m_instance) { - m_instance = new CompletionSupport(core); - } + if (!m_instance) + m_instance = new CompletionSupport; return m_instance; } -CompletionSupport::CompletionSupport(Core::ICore *core) - : QObject(core), +CompletionSupport::CompletionSupport() + : QObject(Core::ICore::instance()), m_completionList(0), m_startPosition(0), m_checkCompletionTrigger(false), m_editor(0) { - m_completionCollector = core->pluginManager()->getObject<ICompletionCollector>(); + m_completionCollector = ExtensionSystem::PluginManager::instance() + ->getObject<ICompletionCollector>(); } void CompletionSupport::performCompletion(const CompletionItem &item) diff --git a/src/plugins/texteditor/completionsupport.h b/src/plugins/texteditor/completionsupport.h index 9704f80f2a229c9ce9a9fb07f4b44e56ce1ba4cd..a2300010200929b3efad6db0b7d0ee3883ab3bf8 100644 --- a/src/plugins/texteditor/completionsupport.h +++ b/src/plugins/texteditor/completionsupport.h @@ -38,8 +38,6 @@ #include <QtCore/QObject> -namespace Core { class ICore; } - namespace TextEditor { struct CompletionItem; @@ -58,9 +56,9 @@ class TEXTEDITOR_EXPORT CompletionSupport : public QObject Q_OBJECT public: - CompletionSupport(Core::ICore *core); + CompletionSupport(); - static CompletionSupport *instance(Core::ICore *core); + static CompletionSupport *instance(); public slots: void autoComplete(ITextEditable *editor, bool forced); diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 9122d791a75aa61c3b76cc703410f3b4e71d2406..c36d985a18ba2209accc2466cc5654723986e5e4 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -88,10 +88,12 @@ Core::ICore *TextEditorPlugin::core() return m_instance->m_core; } -//ExtensionSystem::PluginInterface -bool TextEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) +// ExtensionSystem::PluginInterface +bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) { - m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Q_UNUSED(arguments); + + m_core = Core::ICore::instance(); if (!m_core->mimeDatabase()->addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage)) return false; @@ -170,9 +172,6 @@ void TextEditorPlugin::initializeEditor(TextEditor::PlainTextEditor *editor) void TextEditorPlugin::invokeCompletion() { - if (!m_core) - return; - Core::IEditor *iface = m_core->editorManager()->currentEditor(); ITextEditor *editor = qobject_cast<ITextEditor *>(iface); if (editor) diff --git a/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp b/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp index 6427a1e9fab68b5d9a447388bc202ea61692b577..f4610ed668563ae756724c84b5c2cc53a854645d 100644 --- a/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp +++ b/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp @@ -36,7 +36,6 @@ #include <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> -#include <extensionsystem/pluginmanager.h> namespace VCSBase { @@ -83,7 +82,7 @@ QStringList BaseVCSSubmitEditorFactory::mimeTypes() const Core::IFile *BaseVCSSubmitEditorFactory::open(const QString &fileName) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Core::ICore *core = Core::ICore::instance(); if (Core::IEditor *iface = core->editorManager()->openEditor(fileName, kind())) return iface->file(); return 0; diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 4458765b36e4ac14eeca6d90a5196bef68284cda..7cf2f2a9a4ee1564b8f9186918ac3a9a6f822ce0 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -68,8 +68,7 @@ class VCSBaseEditorEditable : public TextEditor::BaseTextEditorEditable { public: VCSBaseEditorEditable(VCSBaseEditor *, - const VCSBaseEditorParameters *type, - Core::ICore *); + const VCSBaseEditorParameters *type); QList<int> context() const; bool duplicateSupported() const { return false; } @@ -83,11 +82,10 @@ private: }; VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor, - const VCSBaseEditorParameters *type, - Core::ICore *core) : - BaseTextEditorEditable(editor), - m_kind(type->kind) + const VCSBaseEditorParameters *type) + : BaseTextEditorEditable(editor), m_kind(type->kind) { + Core::ICore *core = Core::ICore::instance(); m_context << core->uniqueIDManager()->uniqueIdentifier(QLatin1String(type->context)) << core->uniqueIDManager()->uniqueIdentifier(QLatin1String(TextEditor::Constants::C_TEXTEDITOR)); @@ -100,46 +98,39 @@ QList<int> VCSBaseEditorEditable::context() const // ----------- VCSBaseEditorPrivate -struct VCSBaseEditorPrivate { +struct VCSBaseEditorPrivate +{ VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent); const VCSBaseEditorParameters *m_parameters; QAction *m_describeAction; QString m_currentChange; - Core::ICore *m_core; QString m_source; }; -VCSBaseEditorPrivate::VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent) : - m_parameters(type), - m_describeAction(new QAction(parent)), - m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()) +VCSBaseEditorPrivate::VCSBaseEditorPrivate(const VCSBaseEditorParameters *type, QObject *parent) + : m_parameters(type), m_describeAction(new QAction(parent)) { } // ------------ VCSBaseEditor -VCSBaseEditor::VCSBaseEditor(const VCSBaseEditorParameters *type, - QWidget *parent) : - BaseTextEditor(parent), - m_d(new VCSBaseEditorPrivate(type, this)) +VCSBaseEditor::VCSBaseEditor(const VCSBaseEditorParameters *type, QWidget *parent) + : BaseTextEditor(parent), + d(new VCSBaseEditorPrivate(type, this)) { if (VCSBase::Constants::Internal::debug) qDebug() << "VCSBaseEditor::VCSBaseEditor" << type->type << type->kind; setReadOnly(true); - - connect(m_d->m_describeAction, SIGNAL(triggered()), this, SLOT(describe())); - + connect(d->m_describeAction, SIGNAL(triggered()), this, SLOT(describe())); viewport()->setMouseTracking(true); - setBaseTextDocument(new Internal::VCSBaseTextDocument); - - setMimeType(QLatin1String(m_d->m_parameters->mimeType)); + setMimeType(QLatin1String(d->m_parameters->mimeType)); } void VCSBaseEditor::init() { - switch (m_d->m_parameters->type) { + switch (d->m_parameters->type) { case RegularCommandOutput: case LogOutput: case AnnotateOutput: @@ -154,17 +145,17 @@ void VCSBaseEditor::init() VCSBaseEditor::~VCSBaseEditor() { - delete m_d; + delete d; } QString VCSBaseEditor::source() const { - return m_d->m_source; + return d->m_source; } void VCSBaseEditor::setSource(const QString &source) { - m_d->m_source = source; + d->m_source = source; } QTextCodec *VCSBaseEditor::codec() const @@ -183,7 +174,7 @@ void VCSBaseEditor::setCodec(QTextCodec *c) EditorContentType VCSBaseEditor::contentType() const { - return m_d->m_parameters->type; + return d->m_parameters->type; } bool VCSBaseEditor::isModified() const @@ -193,19 +184,19 @@ bool VCSBaseEditor::isModified() const TextEditor::BaseTextEditorEditable *VCSBaseEditor::createEditableInterface() { - return new VCSBaseEditorEditable(this, m_d->m_parameters, m_d->m_core); + return new VCSBaseEditorEditable(this, d->m_parameters); } void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = createStandardContextMenu(); // 'click on change-interaction' - if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) { - m_d->m_currentChange = changeUnderCursor(cursorForPosition(e->pos())); - if (!m_d->m_currentChange.isEmpty()) { - m_d->m_describeAction->setText(tr("Describe change %1").arg(m_d->m_currentChange)); + if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) { + d->m_currentChange = changeUnderCursor(cursorForPosition(e->pos())); + if (!d->m_currentChange.isEmpty()) { + d->m_describeAction->setText(tr("Describe change %1").arg(d->m_currentChange)); menu->addSeparator(); - menu->addAction(m_d->m_describeAction); + menu->addAction(d->m_describeAction); } } menu->exec(e->globalPos()); @@ -217,7 +208,7 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e) bool overrideCursor = false; Qt::CursorShape cursorShape; - if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) { + if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) { // Link emulation behaviour for 'click on change-interaction' QTextCursor cursor = cursorForPosition(e->pos()); QString change = changeUnderCursor(cursor); @@ -245,11 +236,11 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e) void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e) { - if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) { + if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { QTextCursor cursor = cursorForPosition(e->pos()); - m_d->m_currentChange = changeUnderCursor(cursor); - if (!m_d->m_currentChange.isEmpty()) { + d->m_currentChange = changeUnderCursor(cursor); + if (!d->m_currentChange.isEmpty()) { describe(); e->accept(); return; @@ -261,7 +252,7 @@ void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e) void VCSBaseEditor::mouseDoubleClickEvent(QMouseEvent *e) { - if (m_d->m_parameters->type == DiffOutput) { + if (d->m_parameters->type == DiffOutput) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { QTextCursor cursor = cursorForPosition(e->pos()); jumpToChangeFromDiff(cursor); @@ -282,16 +273,16 @@ void VCSBaseEditor::keyPressEvent(QKeyEvent *e) void VCSBaseEditor::describe() { if (VCSBase::Constants::Internal::debug) - qDebug() << "VCSBaseEditor::describe" << m_d->m_currentChange; - if (!m_d->m_currentChange.isEmpty()) - emit describeRequested(m_d->m_source, m_d->m_currentChange); + qDebug() << "VCSBaseEditor::describe" << d->m_currentChange; + if (!d->m_currentChange.isEmpty()) + emit describeRequested(d->m_source, d->m_currentChange); } void VCSBaseEditor::slotActivateAnnotation() { // The annotation highlighting depends on contents (change number // set with assigned colors) - if (m_d->m_parameters->type != AnnotateOutput) + if (d->m_parameters->type != AnnotateOutput) return; const QSet<QString> changes = annotationChanges(); @@ -372,9 +363,10 @@ void VCSBaseEditor::jumpToChangeFromDiff(QTextCursor cursor) if (!exists) return; - Core::IEditor *ediface = m_d->m_core->editorManager()->openEditor(fileName); - m_d->m_core->editorManager()->ensureEditorManagerVisible(); - if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ediface)) + Core::EditorManager *em = Core::ICore::instance()->editorManager(); + Core::IEditor *ed = em->openEditor(fileName); + em->ensureEditorManagerVisible(); + if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ed)) editor->gotoLine(chunkStart + lineCount); } @@ -386,7 +378,7 @@ void VCSBaseEditor::setPlainTextData(const QByteArray &data) void VCSBaseEditor::setFontSettings(const TextEditor::FontSettings &fs) { TextEditor::BaseTextEditor::setFontSettings(fs); - if (m_d->m_parameters->type == DiffOutput) { + if (d->m_parameters->type == DiffOutput) { if (DiffHighlighter *highlighter = qobject_cast<DiffHighlighter*>(baseTextDocument()->syntaxHighlighter())) { static QVector<QString> categories; if (categories.isEmpty()) { @@ -413,11 +405,12 @@ const VCSBaseEditorParameters *VCSBaseEditor::findType(const VCSBaseEditorParame } // Find the codec used for a file querying the editor. -static QTextCodec *findFileCodec(const Core::ICore *core, const QString &source) +static QTextCodec *findFileCodec(const QString &source) { typedef QList<Core::IEditor *> EditorList; - const EditorList editors = core->editorManager()->editorsForFileName(source); + const EditorList editors = + Core::ICore::instance()->editorManager()->editorsForFileName(source); if (!editors.empty()) { const EditorList::const_iterator ecend = editors.constEnd(); for (EditorList::const_iterator it = editors.constBegin(); it != ecend; ++it) @@ -456,13 +449,13 @@ static QTextCodec *findProjectCodec(const QString &dir) return 0; } -QTextCodec *VCSBaseEditor::getCodec(const Core::ICore *core, const QString &source) +QTextCodec *VCSBaseEditor::getCodec(const QString &source) { if (!source.isEmpty()) { // Check file const QFileInfo sourceFi(source); if (sourceFi.isFile()) - if (QTextCodec *fc = findFileCodec(core, source)) + if (QTextCodec *fc = findFileCodec(source)) return fc; // Find by project via directory if (QTextCodec *pc = findProjectCodec(sourceFi.isFile() ? sourceFi.absolutePath() : source)) diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h index 42c31c6c37dfb18b6fd0c6fb9789fb0bec2d3e09..5c516f00ffb56bd696298a4056227341d384f85d 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.h +++ b/src/plugins/vcsbase/vcsbaseeditor.h @@ -46,10 +46,6 @@ class QTextCodec; class QTextCursor; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace VCSBase { struct VCSBaseEditorPrivate; @@ -121,7 +117,7 @@ public: // the editor manager and the project managers (defaults to system codec). // The codec should be set on editors displaying diff or annotation // output. - static QTextCodec *getCodec(const Core::ICore *core, const QString &source); + static QTextCodec *getCodec(const QString &source); // Utility to return the editor from the IEditor returned by the editor // manager which is a BaseTextEditable. @@ -166,7 +162,7 @@ private: void jumpToChangeFromDiff(QTextCursor cursor); - VCSBaseEditorPrivate *m_d; + VCSBaseEditorPrivate *d; }; } // namespace VCSBase diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 7cbd8a9233ed6f2ad6a929d6065f63b18e41b242..06cefbb71dde5cf31700d377600fe311d2d579b5 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -34,13 +34,12 @@ #include "vcsbaseplugin.h" #include "diffhighlighter.h" -#include <extensionsystem/pluginmanager.h> #include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/mimedatabase.h> -#include <QtCore/qplugin.h> +#include <QtCore/QtPlugin> namespace VCSBase { namespace Internal { @@ -57,10 +56,12 @@ VCSBasePlugin::~VCSBasePlugin() m_instance = 0; } -bool VCSBasePlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) +bool VCSBasePlugin::initialize(const QStringList &arguments, QString *errorMessage) { - Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>(); + Q_UNUSED(arguments); + Q_UNUSED(errorMessage); + Core::ICore *core = Core::ICore::instance(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/vcsbase/VCSBase.mimetypes.xml"), errorMessage)) return false; diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 9bec38c5753b9e0084909e89537a185054caf0e9..64192d1b6b4382017856090d3a6c935baf948b60 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -59,12 +59,12 @@ enum { wantToolBar = 0 }; namespace VCSBase { -struct VCSBaseSubmitEditorPrivate { +struct VCSBaseSubmitEditorPrivate +{ VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters, Core::Utils::SubmitEditorWidget *editorWidget, QObject *q); - Core::ICore *m_core; Core::Utils::SubmitEditorWidget *m_widget; QToolBar *m_toolWidget; const VCSBaseSubmitEditorParameters *m_parameters; @@ -79,13 +79,12 @@ struct VCSBaseSubmitEditorPrivate { VCSBaseSubmitEditorPrivate::VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters, Core::Utils::SubmitEditorWidget *editorWidget, QObject *q) : - m_core(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()), m_widget(editorWidget), m_toolWidget(0), m_parameters(parameters), m_file(new VCSBase::Internal::SubmitEditorFile(QLatin1String(m_parameters->mimeType), q)) { - m_contexts << m_core->uniqueIDManager()->uniqueIdentifier(m_parameters->context); + m_contexts << Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(m_parameters->context); } VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters,