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