OSDN Git Service

5b06c7fbf62accd6b28609e7966571ac9ad285df
[qt-creator-jp/qt-creator-jp.git] / src / plugins / coreplugin / icore.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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.
18 **
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.
22 **
23 ** Other Usage
24 **
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.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef ICORE_H
34 #define ICORE_H
35
36 #include "core_global.h"
37
38 #include <QObject>
39 #include <QSettings>
40
41 QT_BEGIN_NAMESPACE
42 class QMainWindow;
43 class QPrinter;
44 class QStatusBar;
45 template <class T> class QList;
46 QT_END_NAMESPACE
47
48
49 namespace Core {
50 class IWizard;
51 class ActionManager;
52 class Context;
53 class EditorManager;
54 class DocumentManager;
55 class HelpManager;
56 class IContext;
57 class MessageManager;
58 class MimeDatabase;
59 class ModeManager;
60 class ProgressManager;
61 class ScriptManager;
62 class SettingsDatabase;
63 class VariableManager;
64 class VcsManager;
65
66 namespace Internal { class MainWindow; }
67
68 class CORE_EXPORT ICore : public QObject
69 {
70     Q_OBJECT
71
72     friend class Internal::MainWindow;
73     explicit ICore(Internal::MainWindow *mw);
74     ~ICore();
75
76 public:
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();
81
82     static void showNewItemDialog(const QString &title,
83                                   const QList<IWizard *> &wizards,
84                                   const QString &defaultLocation = QString());
85
86     static bool showOptionsDialog(const QString &group = QString(),
87                                   const QString &page = QString(),
88                                   QWidget *parent = 0);
89
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(),
94                                        QWidget *parent = 0);
95
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();
107
108     static QSettings *settings(QSettings::Scope scope = QSettings::UserScope);
109     static SettingsDatabase *settingsDatabase();
110     static QPrinter *printer();
111     static QString userInterfaceLanguage();
112
113     static QString resourcePath();
114     static QString userResourcePath();
115
116     static QMainWindow *mainWindow();
117     static QStatusBar *statusBar();
118
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);
126
127     enum OpenFilesFlags {
128         None = 0,
129         SwitchMode = 1,
130         CanContainLineNumbers = 2,
131          /// Stop loading once the first file fails to load
132         StopOnLoadFail = 4
133     };
134     static void openFiles(const QStringList &fileNames, OpenFilesFlags flags = None);
135
136     static void emitNewItemsDialogRequested();
137
138 signals:
139     void coreAboutToOpen();
140     void coreOpened();
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);
147 };
148
149 } // namespace Core
150
151 #endif // ICORE_H