1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
36 #include "core_global.h"
45 template <class T> class QList;
54 class DocumentManager;
60 class ProgressManager;
62 class SettingsDatabase;
63 class VariableManager;
66 namespace Internal { class MainWindow; }
68 class CORE_EXPORT ICore : public QObject
72 friend class Internal::MainWindow;
73 explicit ICore(Internal::MainWindow *mw);
77 // This should only be used to acccess the signals, so it could
78 // theoretically return an QObject *. For source compatibility
79 // it returns a ICore.
80 static ICore *instance();
82 static void showNewItemDialog(const QString &title,
83 const QList<IWizard *> &wizards,
84 const QString &defaultLocation = QString());
86 static bool showOptionsDialog(const QString &group = QString(),
87 const QString &page = QString(),
90 static bool showWarningWithOptions(const QString &title, const QString &text,
91 const QString &details = QString(),
92 const QString &settingsCategory = QString(),
93 const QString &settingsId = QString(),
96 static ActionManager *actionManager();
97 static QT_DEPRECATED DocumentManager *documentManager(); // Use DocumentManager::... directly.
98 static MessageManager *messageManager();
99 static EditorManager *editorManager();
100 static ProgressManager *progressManager();
101 static ScriptManager *scriptManager();
102 static VariableManager *variableManager();
103 static VcsManager *vcsManager();
104 static QT_DEPRECATED ModeManager *modeManager(); // Use ModeManager::... directly.
105 static MimeDatabase *mimeDatabase();
106 static HelpManager *helpManager();
108 static QSettings *settings(QSettings::Scope scope = QSettings::UserScope);
109 static SettingsDatabase *settingsDatabase();
110 static QPrinter *printer();
111 static QString userInterfaceLanguage();
113 static QString resourcePath();
114 static QString userResourcePath();
116 static QMainWindow *mainWindow();
117 static QStatusBar *statusBar();
119 static IContext *currentContextObject();
120 // Adds and removes additional active contexts, these contexts are appended
121 // to the currently active contexts.
122 static void updateAdditionalContexts(const Context &remove, const Context &add);
123 static bool hasContext(int context);
124 static void addContextObject(IContext *context);
125 static void removeContextObject(IContext *context);
127 enum OpenFilesFlags {
130 CanContainLineNumbers = 2,
131 /// Stop loading once the first file fails to load
134 static void openFiles(const QStringList &fileNames, OpenFilesFlags flags = None);
136 static void emitNewItemsDialogRequested();
139 void coreAboutToOpen();
141 void newItemsDialogRequested();
142 void saveSettingsRequested();
143 void optionsDialogRequested();
144 void coreAboutToClose();
145 void contextAboutToChange(Core::IContext *context);
146 void contextChanged(Core::IContext *context, const Core::Context &additionalContexts);