forked from qt-creator/qt-creator
Fixes: coreplugin: remove more PluginManager parameters
Details: access PluginManager::instance() instead
This commit is contained in:
@@ -93,11 +93,6 @@ MessageManager *CoreImpl::messageManager() const
|
||||
return m_mainwindow->messageManager();
|
||||
}
|
||||
|
||||
ExtensionSystem::PluginManager *CoreImpl::pluginManager() const
|
||||
{
|
||||
return m_mainwindow->pluginManager();
|
||||
}
|
||||
|
||||
EditorManager *CoreImpl::editorManager() const
|
||||
{
|
||||
return m_mainwindow->editorManager();
|
||||
|
@@ -58,7 +58,6 @@ public:
|
||||
FileManager *fileManager() const ;
|
||||
UniqueIDManager *uniqueIDManager() const;
|
||||
MessageManager *messageManager() const;
|
||||
ExtensionSystem::PluginManager *pluginManager() const;
|
||||
EditorManager *editorManager() const;
|
||||
ProgressManager *progressManager() const;
|
||||
ScriptManager *scriptManager() const;
|
||||
|
@@ -50,7 +50,7 @@
|
||||
using namespace Core::Internal;
|
||||
|
||||
CorePlugin::CorePlugin() :
|
||||
m_mainWindow(new MainWindow), m_welcomeMode(0), m_editMode(0), m_pm(0)
|
||||
m_mainWindow(new MainWindow), m_welcomeMode(0), m_editMode(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -71,10 +71,10 @@ CorePlugin::~CorePlugin()
|
||||
delete m_mainWindow;
|
||||
}
|
||||
|
||||
bool CorePlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
|
||||
bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
{
|
||||
m_pm = ExtensionSystem::PluginManager::instance();
|
||||
const bool success = m_mainWindow->init(m_pm, error_message);
|
||||
Q_UNUSED(arguments);
|
||||
const bool success = m_mainWindow->init(errorMessage);
|
||||
if (success) {
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
QWebSettings *webSettings = QWebSettings::globalSettings();
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
CorePlugin();
|
||||
~CorePlugin();
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message = 0);
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage = 0);
|
||||
void extensionsInitialized();
|
||||
|
||||
public slots:
|
||||
@@ -61,8 +61,6 @@ private:
|
||||
MainWindow *m_mainWindow;
|
||||
WelcomeMode *m_welcomeMode;
|
||||
EditMode *m_editMode;
|
||||
|
||||
ExtensionSystem::PluginManager *m_pm;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -130,7 +130,6 @@ MainWindow::MainWindow() :
|
||||
m_rightPaneWidget(0),
|
||||
m_versionDialog(0),
|
||||
m_activeContext(0),
|
||||
m_pluginManager(0),
|
||||
m_outputMode(0),
|
||||
m_generalSettings(new GeneralSettings),
|
||||
m_shortcutSettings(new ShortcutSettings),
|
||||
@@ -225,8 +224,9 @@ void MainWindow::setSuppressNavigationWidget(bool suppress)
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
hide();
|
||||
m_pluginManager->removeObject(m_shortcutSettings);
|
||||
m_pluginManager->removeObject(m_generalSettings);
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
pm->removeObject(m_shortcutSettings);
|
||||
pm->removeObject(m_generalSettings);
|
||||
delete m_messageManager;
|
||||
m_messageManager = 0;
|
||||
delete m_shortcutSettings;
|
||||
@@ -241,7 +241,7 @@ MainWindow::~MainWindow()
|
||||
m_uniqueIDManager = 0;
|
||||
delete m_vcsManager;
|
||||
m_vcsManager = 0;
|
||||
m_pluginManager->removeObject(m_outputMode);
|
||||
pm->removeObject(m_outputMode);
|
||||
delete m_outputMode;
|
||||
m_outputMode = 0;
|
||||
//we need to delete editormanager and viewmanager explicitly before the end of the destructor,
|
||||
@@ -251,7 +251,7 @@ MainWindow::~MainWindow()
|
||||
OutputPaneManager::destroy();
|
||||
|
||||
// Now that the OutputPaneManager is gone, is a good time to delete the view
|
||||
m_pluginManager->removeObject(m_outputView);
|
||||
pm->removeObject(m_outputView);
|
||||
delete m_outputView;
|
||||
|
||||
delete m_editorManager;
|
||||
@@ -260,7 +260,7 @@ MainWindow::~MainWindow()
|
||||
m_viewManager = 0;
|
||||
delete m_progressManager;
|
||||
m_progressManager = 0;
|
||||
m_pluginManager->removeObject(m_coreImpl);
|
||||
pm->removeObject(m_coreImpl);
|
||||
delete m_coreImpl;
|
||||
m_coreImpl = 0;
|
||||
|
||||
@@ -276,10 +276,12 @@ MainWindow::~MainWindow()
|
||||
m_mimeDatabase = 0;
|
||||
}
|
||||
|
||||
bool MainWindow::init(ExtensionSystem::PluginManager *pm, QString *)
|
||||
bool MainWindow::init(QString *errorMessage)
|
||||
{
|
||||
m_pluginManager = pm;
|
||||
m_pluginManager->addObject(m_coreImpl);
|
||||
Q_UNUSED(errorMessage);
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
pm->addObject(m_coreImpl);
|
||||
m_viewManager->init();
|
||||
m_modeManager->init();
|
||||
m_progressManager->init();
|
||||
@@ -301,15 +303,15 @@ bool MainWindow::init(ExtensionSystem::PluginManager *pm, QString *)
|
||||
outputModeWidget->setFocusProxy(oph);
|
||||
|
||||
m_outputMode->setContext(m_globalContext);
|
||||
m_pluginManager->addObject(m_outputMode);
|
||||
m_pluginManager->addObject(m_generalSettings);
|
||||
m_pluginManager->addObject(m_shortcutSettings);
|
||||
pm->addObject(m_outputMode);
|
||||
pm->addObject(m_generalSettings);
|
||||
pm->addObject(m_shortcutSettings);
|
||||
|
||||
// Add widget to the bottom, we create the view here instead of inside the
|
||||
// OutputPaneManager, since the ViewManager needs to be initilized before
|
||||
m_outputView = new Core::BaseView("OutputWindow.Buttons",
|
||||
OutputPaneManager::instance()->buttonsWidget(), QList<int>(), Core::IView::Second);
|
||||
m_pluginManager->addObject(m_outputView);
|
||||
pm->addObject(m_outputView);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -319,7 +321,7 @@ void MainWindow::extensionsInitialized()
|
||||
|
||||
m_viewManager->extensionsInitalized();
|
||||
|
||||
m_messageManager->init(m_pluginManager);
|
||||
m_messageManager->init();
|
||||
OutputPaneManager::instance()->init();
|
||||
|
||||
m_actionManager->initialize();
|
||||
@@ -343,7 +345,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
}
|
||||
|
||||
const QList<ICoreListener *> listeners =
|
||||
pluginManager()->getObjects<ICoreListener>();
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<ICoreListener>();
|
||||
foreach (ICoreListener *listener, listeners) {
|
||||
if (!listener->coreAboutToClose()) {
|
||||
event->ignore();
|
||||
@@ -885,11 +887,6 @@ MimeDatabase *MainWindow::mimeDatabase() const
|
||||
return m_mimeDatabase;
|
||||
}
|
||||
|
||||
ExtensionSystem::PluginManager *MainWindow::pluginManager() const
|
||||
{
|
||||
return m_pluginManager;
|
||||
}
|
||||
|
||||
IContext *MainWindow::contextObject(QWidget *widget)
|
||||
{
|
||||
return m_contextWidgets.value(widget);
|
||||
|
@@ -49,10 +49,6 @@ class QSettings;
|
||||
class QShortcut;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ExtensionSystem {
|
||||
class PluginManager;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
|
||||
class ActionManager;
|
||||
@@ -93,7 +89,7 @@ public:
|
||||
MainWindow();
|
||||
~MainWindow();
|
||||
|
||||
bool init(ExtensionSystem::PluginManager *pm, QString *error_message);
|
||||
bool init(QString *errorMessage);
|
||||
void extensionsInitialized();
|
||||
|
||||
IContext *contextObject(QWidget *widget);
|
||||
@@ -103,12 +99,10 @@ public:
|
||||
|
||||
void openFiles(const QStringList &fileNames);
|
||||
|
||||
inline ExtensionSystem::PluginManager *pluginManager() { return m_pluginManager; }
|
||||
Core::ActionManager *actionManager() const;
|
||||
Core::FileManager *fileManager() const;
|
||||
Core::UniqueIDManager *uniqueIDManager() const;
|
||||
Core::MessageManager *messageManager() const;
|
||||
ExtensionSystem::PluginManager *pluginManager() const;
|
||||
Core::EditorManager *editorManager() const;
|
||||
Core::ProgressManager *progressManager() const;
|
||||
Core::ScriptManager *scriptManager() const;
|
||||
@@ -195,8 +189,6 @@ private:
|
||||
|
||||
QMap<QWidget *, IContext *> m_contextWidgets;
|
||||
|
||||
ExtensionSystem::PluginManager *m_pluginManager;
|
||||
|
||||
BaseMode *m_outputMode;
|
||||
GeneralSettings *m_generalSettings;
|
||||
ShortcutSettings *m_shortcutSettings;
|
||||
|
@@ -44,26 +44,26 @@ using namespace Core;
|
||||
MessageManager *MessageManager::m_instance = 0;
|
||||
|
||||
MessageManager::MessageManager()
|
||||
: m_pm(0), m_messageOutputWindow(0)
|
||||
: m_messageOutputWindow(0)
|
||||
{
|
||||
m_instance = this;
|
||||
}
|
||||
|
||||
MessageManager::~MessageManager()
|
||||
{
|
||||
if (m_pm && m_messageOutputWindow) {
|
||||
m_pm->removeObject(m_messageOutputWindow);
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
if (pm && m_messageOutputWindow) {
|
||||
pm->removeObject(m_messageOutputWindow);
|
||||
delete m_messageOutputWindow;
|
||||
}
|
||||
|
||||
m_instance = 0;
|
||||
}
|
||||
|
||||
void MessageManager::init(ExtensionSystem::PluginManager *pm)
|
||||
void MessageManager::init()
|
||||
{
|
||||
m_pm = pm;
|
||||
m_messageOutputWindow = new Internal::MessageOutputWindow;
|
||||
pm->addObject(m_messageOutputWindow);
|
||||
ExtensionSystem::PluginManager::instance()->addObject(m_messageOutputWindow);
|
||||
}
|
||||
|
||||
void MessageManager::showOutputPane()
|
||||
|
@@ -37,8 +37,6 @@
|
||||
#include "core_global.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace ExtensionSystem { class PluginManager; }
|
||||
|
||||
namespace Core {
|
||||
|
||||
namespace Internal {
|
||||
@@ -53,7 +51,7 @@ public:
|
||||
MessageManager();
|
||||
~MessageManager();
|
||||
|
||||
void init(ExtensionSystem::PluginManager *pm);
|
||||
void init();
|
||||
|
||||
static MessageManager *instance() { return m_instance; }
|
||||
|
||||
@@ -64,7 +62,6 @@ public slots:
|
||||
void printToOutputPane(const QString &text, bool bringToForeground = true);
|
||||
|
||||
private:
|
||||
ExtensionSystem::PluginManager *m_pm;
|
||||
Internal::MessageOutputWindow *m_messageOutputWindow;
|
||||
|
||||
static MessageManager *m_instance;
|
||||
|
@@ -115,7 +115,8 @@ void ViewManager::saveSettings(QSettings *settings)
|
||||
|
||||
IView *ViewManager::view(const QString &id)
|
||||
{
|
||||
QList<IView *> list = m_mainWnd->pluginManager()->getObjects<IView>();
|
||||
QList<IView *> list =
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<IView>();
|
||||
foreach (IView *view, list) {
|
||||
if (view->uniqueViewName() == id)
|
||||
return view;
|
||||
|
Reference in New Issue
Block a user