summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2012-01-18 23:25:34 +0100
committerhjk <qthjk@ovi.com>2012-01-24 15:20:11 +0100
commit0fbd7f320f5dc466913781e04867ce36f31c5d7a (patch)
tree0f229c3fd055dd5ebf202efe1f784302f019a56e
parent951b1120d603892b910b90b4d375d58b39354703 (diff)
downloadqt-creator-0fbd7f320f5dc466913781e04867ce36f31c5d7a.tar.gz
Core: make ICore interface static
This mainly serves two purposes: (a) it saves a function call in ICore::instance()->foo() vs ICore::foo() at runtime (b) it saves typing and reduces line noise when reading It's also (mostly) source compatible, as ICore::instance()->foo() remains compilable. Change-Id: Icf7be0bce17fefe3560473534a8991ff79cbecc3 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
-rw-r--r--src/plugins/coreplugin/coreimpl.cpp241
-rw-r--r--src/plugins/coreplugin/coreimpl.h106
-rw-r--r--src/plugins/coreplugin/coreplugin.pro2
-rw-r--r--src/plugins/coreplugin/dialogs/iwizard.cpp8
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp22
-rw-r--r--src/plugins/coreplugin/icore.cpp210
-rw-r--r--src/plugins/coreplugin/icore.h87
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp4
-rw-r--r--src/plugins/coreplugin/mainwindow.h3
-rw-r--r--src/plugins/projectexplorer/projectwizardpage.cpp2
10 files changed, 274 insertions, 411 deletions
diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp
deleted file mode 100644
index 6118050d02..0000000000
--- a/src/plugins/coreplugin/coreimpl.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#include "coreimpl.h"
-#include "mainwindow.h"
-
-#include <QtCore/QDir>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDebug>
-
-#include <QtGui/QStatusBar>
-
-namespace Core {
-namespace Internal {
-
-// The Core Singleton
-static CoreImpl *m_instance = 0;
-
-} // namespace Internal
-} // namespace Core
-
-
-using namespace Core;
-using namespace Core::Internal;
-
-
-ICore* ICore::instance()
-{
- return m_instance;
-}
-
-CoreImpl::CoreImpl(MainWindow *mainwindow)
-{
- m_instance = this;
- m_mainwindow = mainwindow;
-}
-
-CoreImpl::~CoreImpl()
-{
- m_instance = 0;
-}
-
-void CoreImpl::showNewItemDialog(const QString &title,
- const QList<IWizard *> &wizards,
- const QString &defaultLocation)
-{
- m_mainwindow->showNewItemDialog(title, wizards, defaultLocation);
-}
-
-bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
-{
- return m_mainwindow->showOptionsDialog(group, page, parent);
-}
-
-bool CoreImpl::showWarningWithOptions(const QString &title, const QString &text,
- const QString &details,
- const QString &settingsCategory,
- const QString &settingsId,
- QWidget *parent)
-{
- return m_mainwindow->showWarningWithOptions(title, text,
- details, settingsCategory,
- settingsId, parent);
-}
-
-ActionManager *CoreImpl::actionManager() const
-{
- return m_mainwindow->actionManager();
-}
-
-FileManager *CoreImpl::fileManager() const
-{
- return m_mainwindow->fileManager();
-}
-
-MessageManager *CoreImpl::messageManager() const
-{
- return m_mainwindow->messageManager();
-}
-
-EditorManager *CoreImpl::editorManager() const
-{
- return m_mainwindow->editorManager();
-}
-
-ProgressManager *CoreImpl::progressManager() const
-{
- return m_mainwindow->progressManager();
-}
-
-ScriptManager *CoreImpl::scriptManager() const
-{
- return m_mainwindow->scriptManager();
-}
-
-VariableManager *CoreImpl::variableManager() const
-{
- return m_mainwindow->variableManager();
-}
-
-VcsManager *CoreImpl::vcsManager() const
-{
- return m_mainwindow->vcsManager();
-}
-
-ModeManager *CoreImpl::modeManager() const
-{
- return m_mainwindow->modeManager();
-}
-
-MimeDatabase *CoreImpl::mimeDatabase() const
-{
- return m_mainwindow->mimeDatabase();
-}
-
-HelpManager *CoreImpl::helpManager() const
-{
- return m_mainwindow->helpManager();
-}
-
-QSettings *CoreImpl::settings(QSettings::Scope scope) const
-{
- return m_mainwindow->settings(scope);
-}
-
-SettingsDatabase *CoreImpl::settingsDatabase() const
-{
- return m_mainwindow->settingsDatabase();
-}
-
-QPrinter *CoreImpl::printer() const
-{
- return m_mainwindow->printer();
-}
-
-QString CoreImpl::userInterfaceLanguage() const
-{
- return qApp->property("qtc_locale").toString();
-}
-
-#ifdef Q_OS_MAC
-# define SHARE_PATH "/../Resources"
-#else
-# define SHARE_PATH "/../share/qtcreator"
-#endif
-
-QString CoreImpl::resourcePath() const
-{
- return QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String(SHARE_PATH));
-}
-
-QString CoreImpl::userResourcePath() const
-{
- // Create qtcreator dir if it doesn't yet exist
- const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
- const QString urp = configDir + QLatin1String("/qtcreator");
-
- QFileInfo fi(urp + QLatin1Char('/'));
- if (!fi.exists()) {
- QDir dir;
- if (!dir.mkpath(urp))
- qWarning() << "could not create" << urp;
- }
-
- return urp;
-}
-
-IContext *CoreImpl::currentContextObject() const
-{
- return m_mainwindow->currentContextObject();
-}
-
-
-QMainWindow *CoreImpl::mainWindow() const
-{
- return m_mainwindow;
-}
-
-QStatusBar *CoreImpl::statusBar() const
-{
- return m_mainwindow->statusBar();
-}
-
-void CoreImpl::updateAdditionalContexts(const Context &remove, const Context &add)
-{
- m_mainwindow->updateAdditionalContexts(remove, add);
-}
-
-bool CoreImpl::hasContext(int context) const
-{
- return m_mainwindow->hasContext(context);
-}
-
-void CoreImpl::addContextObject(IContext *context)
-{
- m_mainwindow->addContextObject(context);
-}
-
-void CoreImpl::removeContextObject(IContext *context)
-{
- m_mainwindow->removeContextObject(context);
-}
-
-void CoreImpl::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags)
-{
- m_mainwindow->openFiles(arguments, flags);
-}
-
-void CoreImpl::emitNewItemsDialogRequested()
-{
- emit newItemsDialogRequested();
-}
diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h
deleted file mode 100644
index 6c995a2a8e..0000000000
--- a/src/plugins/coreplugin/coreimpl.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-**
-** GNU Lesser General Public License Usage
-**
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this file.
-** Please review the following information to ensure the GNU Lesser General
-** Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** Other Usage
-**
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**************************************************************************/
-
-#ifndef COREIMPL_H
-#define COREIMPL_H
-
-#include "icore.h"
-
-namespace Core {
-namespace Internal {
-class MainWindow;
-
-class CoreImpl : public ICore
-{
- Q_OBJECT
-
-public:
- CoreImpl(MainWindow *mainwindow);
- ~CoreImpl();
-
- void showNewItemDialog(const QString &title,
- const QList<IWizard *> &wizards,
- const QString &defaultLocation = QString());
- bool showOptionsDialog(const QString &group = QString(),
- const QString &page = QString(),
- QWidget *parent = 0);
- bool showWarningWithOptions(const QString &title, const QString &text,
- const QString &details = QString(),
- const QString &settingsCategory = QString(),
- const QString &settingsId = QString(),
- QWidget *parent = 0);
-
- ActionManager *actionManager() const;
- FileManager *fileManager() const ;
- MessageManager *messageManager() const;
- EditorManager *editorManager() const;
- ProgressManager *progressManager() const;
- ScriptManager *scriptManager() const;
- VariableManager *variableManager() const;
- VcsManager *vcsManager() const;
- ModeManager *modeManager() const;
- MimeDatabase *mimeDatabase() const;
- HelpManager *helpManager() const;
-
- QSettings *settings(QSettings::Scope scope = QSettings::UserScope) const;
- SettingsDatabase *settingsDatabase() const;
- QPrinter *printer() const;
- QString userInterfaceLanguage() const;
-
- QString resourcePath() const;
- QString userResourcePath() const;
-
- IContext *currentContextObject() const;
-
- QMainWindow *mainWindow() const;
- QStatusBar *statusBar() const;
-
- // Adds and removes additional active contexts, these contexts are appended
- // to the currently active contexts.
- void updateAdditionalContexts(const Context &remove, const Context &add);
- bool hasContext(int context) const;
- void addContextObject(IContext *context);
- void removeContextObject(IContext *context);
-
- void openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags);
-
- void emitNewItemsDialogRequested();
-
-private:
- MainWindow *m_mainwindow;
- friend class MainWindow;
-};
-
-} // namespace Internal
-} // namespace Core
-
-#endif // COREIMPL_H
diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro
index d2cc2b02b3..fe78c4b558 100644
--- a/src/plugins/coreplugin/coreplugin.pro
+++ b/src/plugins/coreplugin/coreplugin.pro
@@ -57,7 +57,6 @@ SOURCES += mainwindow.cpp \
coreplugin.cpp \
variablemanager.cpp \
modemanager.cpp \
- coreimpl.cpp \
basefilewizard.cpp \
generatedfile.cpp \
plugindialog.cpp \
@@ -160,7 +159,6 @@ HEADERS += mainwindow.h \
coreplugin.h \
variablemanager.h \
modemanager.h \
- coreimpl.h \
basefilewizard.h \
generatedfile.h \
plugindialog.h \
diff --git a/src/plugins/coreplugin/dialogs/iwizard.cpp b/src/plugins/coreplugin/dialogs/iwizard.cpp
index 3dec333a5b..3a766def1f 100644
--- a/src/plugins/coreplugin/dialogs/iwizard.cpp
+++ b/src/plugins/coreplugin/dialogs/iwizard.cpp
@@ -31,7 +31,7 @@
**************************************************************************/
#include "iwizard.h"
-#include "coreimpl.h"
+#include "icore.h"
#include <extensionsystem/pluginmanager.h>
@@ -145,8 +145,7 @@ template <class Predicate>
QList<IWizard*> findWizards(Predicate predicate)
{
// Hack: Trigger delayed creation of wizards
- if (Core::Internal::CoreImpl *ci = qobject_cast<Core::Internal::CoreImpl*>(ICore::instance()))
- ci->emitNewItemsDialogRequested();
+ ICore::emitNewItemsDialogRequested();
// Filter all wizards
const QList<IWizard*> allWizards = IWizard::allWizards();
QList<IWizard*> rc;
@@ -160,8 +159,7 @@ template <class Predicate>
QList<IWizard*> IWizard::allWizards()
{
// Hack: Trigger delayed creation of wizards
- if (Core::Internal::CoreImpl *ci = qobject_cast<Core::Internal::CoreImpl*>(ICore::instance()))
- ci->emitNewItemsDialogRequested();
+ ICore::emitNewItemsDialogRequested();
return ExtensionSystem::PluginManager::instance()->getObjects<IWizard>();
}
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index 9c1c9c8bde..2abcae13da 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -32,7 +32,7 @@
#include "editorview.h"
#include "editormanager.h"
-#include "coreimpl.h"
+#include "icore.h"
#include "minisplitter.h"
#include "openeditorsmodel.h"
@@ -139,7 +139,7 @@ EditorView::~EditorView()
void EditorView::closeView()
{
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
IEditor *editor = currentEditor();
if (editor)
em->closeEditor(editor);
@@ -406,7 +406,7 @@ void EditorView::updateCurrentPositionInNavigationHistory()
void EditorView::goBackInNavigationHistory()
{
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
updateCurrentPositionInNavigationHistory();
while (m_currentNavigationHistoryPosition > 0) {
--m_currentNavigationHistoryPosition;
@@ -431,7 +431,7 @@ void EditorView::goBackInNavigationHistory()
void EditorView::goForwardInNavigationHistory()
{
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
updateCurrentPositionInNavigationHistory();
if (m_currentNavigationHistoryPosition >= m_navigationHistory.size()-1)
return;
@@ -490,12 +490,12 @@ void SplitterOrView::mousePressEvent(QMouseEvent *e)
if (e->button() != Qt::LeftButton)
return;
setFocus(Qt::MouseFocusReason);
- CoreImpl::instance()->editorManager()->setCurrentView(this);
+ ICore::instance()->editorManager()->setCurrentView(this);
}
void SplitterOrView::paintEvent(QPaintEvent *)
{
- if (CoreImpl::instance()->editorManager()->currentSplitterOrView() != this)
+ if (ICore::instance()->editorManager()->currentSplitterOrView() != this)
return;
if (!m_view || hasEditors())
@@ -657,7 +657,7 @@ void SplitterOrView::split(Qt::Orientation orientation)
m_splitter = new MiniSplitter(this);
m_splitter->setOrientation(orientation);
m_layout->addWidget(m_splitter);
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
Core::IEditor *e = m_view->currentEditor();
SplitterOrView *view = 0;
@@ -710,7 +710,7 @@ void SplitterOrView::unsplitAll()
void SplitterOrView::unsplitAll_helper()
{
if (!m_isRoot && m_view)
- CoreImpl::instance()->editorManager()->emptyView(m_view);
+ ICore::instance()->editorManager()->emptyView(m_view);
if (m_splitter) {
for (int i = 0; i < m_splitter->count(); ++i) {
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i))) {
@@ -726,7 +726,7 @@ void SplitterOrView::unsplit()
return;
Q_ASSERT(m_splitter->count() == 1);
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
SplitterOrView *childSplitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
QSplitter *oldSplitter = m_splitter;
m_splitter = 0;
@@ -771,7 +771,7 @@ QByteArray SplitterOrView::saveState() const
<< static_cast<SplitterOrView*>(m_splitter->widget(1))->saveState();
} else {
IEditor* e = editor();
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
// don't save state of temporary or ad-hoc editors
if (e && (e->isTemporary() || e->file()->fileName().isEmpty())) {
@@ -812,7 +812,7 @@ void SplitterOrView::restoreState(const QByteArray &state)
static_cast<SplitterOrView*>(m_splitter->widget(0))->restoreState(first);
static_cast<SplitterOrView*>(m_splitter->widget(1))->restoreState(second);
} else if (mode == "editor" || mode == "currenteditor") {
- EditorManager *em = CoreImpl::instance()->editorManager();
+ EditorManager *em = ICore::instance()->editorManager();
QString fileName;
QString id;
QByteArray editorState;
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index aaed807d58..59dde6cf54 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -343,3 +343,213 @@
\brief Sent just after a new \a context became the current context
(meaning that its widget got focus), or if the additional context ids changed.
*/
+
+#include "icore.h"
+#include "mainwindow.h"
+
+#include <QtCore/QDir>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+#include <QtGui/QStatusBar>
+
+namespace Core {
+
+// The Core Singleton
+static ICore *m_instance = 0;
+
+namespace Internal {
+static MainWindow *m_mainwindow;
+} // namespace Internal
+
+using namespace Core::Internal;
+
+
+ICore *ICore::instance()
+{
+ return m_instance;
+}
+
+ICore::ICore(MainWindow *mainwindow)
+{
+ m_instance = this;
+ m_mainwindow = mainwindow;
+}
+
+ICore::~ICore()
+{
+ m_instance = 0;
+}
+
+void ICore::showNewItemDialog(const QString &title,
+ const QList<IWizard *> &wizards,
+ const QString &defaultLocation)
+{
+ m_mainwindow->showNewItemDialog(title, wizards, defaultLocation);
+}
+
+bool ICore::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
+{
+ return m_mainwindow->showOptionsDialog(group, page, parent);
+}
+
+bool ICore::showWarningWithOptions(const QString &title, const QString &text,
+ const QString &details,
+ const QString &settingsCategory,
+ const QString &settingsId,
+ QWidget *parent)
+{
+ return m_mainwindow->showWarningWithOptions(title, text,
+ details, settingsCategory,
+ settingsId, parent);
+}
+
+ActionManager *ICore::actionManager()
+{
+ return m_mainwindow->actionManager();
+}
+
+FileManager *ICore::fileManager()
+{
+ return m_mainwindow->fileManager();
+}
+
+MessageManager *ICore::messageManager()
+{
+ return m_mainwindow->messageManager();
+}
+
+EditorManager *ICore::editorManager()
+{
+ return m_mainwindow->editorManager();
+}
+
+ProgressManager *ICore::progressManager()
+{
+ return m_mainwindow->progressManager();
+}
+
+ScriptManager *ICore::scriptManager()
+{
+ return m_mainwindow->scriptManager();
+}
+
+VariableManager *ICore::variableManager()
+{
+ return m_mainwindow->variableManager();
+}
+
+VcsManager *ICore::vcsManager()
+{
+ return m_mainwindow->vcsManager();
+}
+
+ModeManager *ICore::modeManager()
+{
+ return m_mainwindow->modeManager();
+}
+
+MimeDatabase *ICore::mimeDatabase()
+{
+ return m_mainwindow->mimeDatabase();
+}
+
+HelpManager *ICore::helpManager()
+{
+ return m_mainwindow->helpManager();
+}
+
+QSettings *ICore::settings(QSettings::Scope scope)
+{
+ return m_mainwindow->settings(scope);
+}
+
+SettingsDatabase *ICore::settingsDatabase()
+{
+ return m_mainwindow->settingsDatabase();
+}
+
+QPrinter *ICore::printer()
+{
+ return m_mainwindow->printer();
+}
+
+QString ICore::userInterfaceLanguage()
+{
+ return qApp->property("qtc_locale").toString();
+}
+
+#ifdef Q_OS_MAC
+# define SHARE_PATH "/../Resources"
+#else
+# define SHARE_PATH "/../share/qtcreator"
+#endif
+
+QString ICore::resourcePath()
+{
+ return QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String(SHARE_PATH));
+}
+
+QString ICore::userResourcePath()
+{
+ // Create qtcreator dir if it doesn't yet exist
+ const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
+ const QString urp = configDir + QLatin1String("/qtcreator");
+
+ QFileInfo fi(urp + QLatin1Char('/'));
+ if (!fi.exists()) {
+ QDir dir;
+ if (!dir.mkpath(urp))
+ qWarning() << "could not create" << urp;
+ }
+
+ return urp;
+}
+
+IContext *ICore::currentContextObject()
+{
+ return m_mainwindow->currentContextObject();
+}
+
+
+QMainWindow *ICore::mainWindow()
+{
+ return m_mainwindow;
+}
+
+QStatusBar *ICore::statusBar()
+{
+ return m_mainwindow->statusBar();
+}
+
+void ICore::updateAdditionalContexts(const Context &remove, const Context &add)
+{
+ m_mainwindow->updateAdditionalContexts(remove, add);
+}
+
+bool ICore::hasContext(int context)
+{
+ return m_mainwindow->hasContext(context);
+}
+
+void ICore::addContextObject(IContext *context)
+{
+ m_mainwindow->addContextObject(context);
+}
+
+void ICore::removeContextObject(IContext *context)
+{
+ m_mainwindow->removeContextObject(context);
+}
+
+void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags)
+{
+ m_mainwindow->openFiles(arguments, flags);
+}
+
+void ICore::emitNewItemsDialogRequested()
+{
+ emit m_instance->newItemsDialogRequested();
+}
+
+} // namespace Core
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index f9e4bb3d20..dadcc0df91 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -63,60 +63,63 @@ class SettingsDatabase;
class VariableManager;
class VcsManager;
+namespace Internal { class MainWindow; }
+
class CORE_EXPORT ICore : public QObject
{
Q_OBJECT
-public:
- ICore() {}
- virtual ~ICore() {}
+ friend class Internal::MainWindow;
+ explicit ICore(Internal::MainWindow *mw);
+ ~ICore();
+public:
static ICore *instance();
- virtual void showNewItemDialog(const QString &title,
- const QList<IWizard *> &wizards,
- const QString &defaultLocation = QString()) = 0;
+ static void showNewItemDialog(const QString &title,
+ const QList<IWizard *> &wizards,
+ const QString &defaultLocation = QString());
- virtual bool showOptionsDialog(const QString &group = QString(),
- const QString &page = QString(),
- QWidget *parent = 0) = 0;
+ static bool showOptionsDialog(const QString &group = QString(),
+ const QString &page = QString(),
+ QWidget *parent = 0);
- virtual bool showWarningWithOptions(const QString &title, const QString &text,
+ static bool showWarningWithOptions(const QString &title, const QString &text,
const QString &details = QString(),
const QString &settingsCategory = QString(),
const QString &settingsId = QString(),
- QWidget *parent = 0) = 0;
-
- virtual ActionManager *actionManager() const = 0;
- virtual FileManager *fileManager() const = 0;
- virtual MessageManager *messageManager() const = 0;
- virtual EditorManager *editorManager() const = 0;
- virtual ProgressManager *progressManager() const = 0;
- virtual ScriptManager *scriptManager() const = 0;
- virtual VariableManager *variableManager() const = 0;
- virtual VcsManager *vcsManager() const = 0;
- virtual ModeManager *modeManager() const = 0;
- virtual MimeDatabase *mimeDatabase() const = 0;
- virtual HelpManager *helpManager() const = 0;
-
- virtual QSettings *settings(QSettings::Scope scope = QSettings::UserScope) const = 0;
- virtual SettingsDatabase *settingsDatabase() const = 0;
- virtual QPrinter *printer() const = 0;
- virtual QString userInterfaceLanguage() const = 0;
-
- virtual QString resourcePath() const = 0;
- virtual QString userResourcePath() const = 0;
-
- virtual QMainWindow *mainWindow() const = 0;
- virtual QStatusBar *statusBar() const = 0;
-
- virtual IContext *currentContextObject() const = 0;
+ QWidget *parent = 0);
+
+ static ActionManager *actionManager();
+ static FileManager *fileManager();
+ static MessageManager *messageManager();
+ static EditorManager *editorManager();
+ static ProgressManager *progressManager();
+ static ScriptManager *scriptManager();
+ static VariableManager *variableManager();
+ static VcsManager *vcsManager();
+ static ModeManager *modeManager();
+ static MimeDatabase *mimeDatabase();
+ static HelpManager *helpManager();
+
+ static QSettings *settings(QSettings::Scope scope = QSettings::UserScope);
+ static SettingsDatabase *settingsDatabase();
+ static QPrinter *printer();
+ static QString userInterfaceLanguage();
+
+ static QString resourcePath();
+ static QString userResourcePath();
+
+ static QMainWindow *mainWindow();
+ static QStatusBar *statusBar();
+
+ static IContext *currentContextObject();
// Adds and removes additional active contexts, these contexts are appended
// to the currently active contexts.
- virtual void updateAdditionalContexts(const Context &remove, const Context &add) = 0;
- virtual bool hasContext(int context) const = 0;
- virtual void addContextObject(IContext *context) = 0;
- virtual void removeContextObject(IContext *context) = 0;
+ static void updateAdditionalContexts(const Context &remove, const Context &add);
+ static bool hasContext(int context);
+ static void addContextObject(IContext *context);
+ static void removeContextObject(IContext *context);
enum OpenFilesFlags {
None = 0,
@@ -125,7 +128,9 @@ public:
/// Stop loading once the first file fails to load
StopOnLoadFail = 4
};
- virtual void openFiles(const QStringList &fileNames, OpenFilesFlags flags = None) = 0;
+ static void openFiles(const QStringList &fileNames, OpenFilesFlags flags = None);
+
+ static void emitNewItemsDialogRequested();
signals:
void coreAboutToOpen();
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index f1bd87f144..c6271f6a18 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -34,7 +34,7 @@
#include "actioncontainer.h"
#include "command.h"
#include "actionmanager_p.h"
-#include "coreimpl.h"
+#include "icore.h"
#include "coreconstants.h"
#include "editormanager.h"
#include "externaltool.h"
@@ -127,7 +127,7 @@ enum { debugMainWindow = 0 };
MainWindow::MainWindow() :
EventFilteringMainWindow(),
- m_coreImpl(new CoreImpl(this)),
+ m_coreImpl(new ICore(this)),
m_additionalContexts(Constants::C_GLOBAL),
m_settings(ExtensionSystem::PluginManager::instance()->settings()),
m_globalSettings(ExtensionSystem::PluginManager::instance()->globalSettings()),
diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h
index a5be298ebe..f2a35f5e5f 100644
--- a/src/plugins/coreplugin/mainwindow.h
+++ b/src/plugins/coreplugin/mainwindow.h
@@ -70,7 +70,6 @@ class VcsManager;
namespace Internal {
class ActionManagerPrivate;
-class CoreImpl;
class FancyTabWidget;
class GeneralSettings;
class ProgressManagerPrivate;
@@ -180,7 +179,7 @@ private:
void readSettings();
void writeSettings();
- CoreImpl *m_coreImpl;
+ ICore *m_coreImpl;
Context m_additionalContexts;
QSettings *m_settings;
QSettings *m_globalSettings;
diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp
index bac7381fb8..a34bd07ec6 100644
--- a/src/plugins/projectexplorer/projectwizardpage.cpp
+++ b/src/plugins/projectexplorer/projectwizardpage.cpp
@@ -33,7 +33,7 @@
#include "projectwizardpage.h"
#include "ui_projectwizardpage.h"
-#include <coreplugin/coreimpl.h>
+#include <coreplugin/icore.h>
#include <vcsbase/vcsbaseconstants.h>
#include <QtCore/QDir>