OSDN Git Service

Fix consistency issue with splitter in debug mode.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / projectexplorer.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** Commercial Usage
10 **
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
27 **
28 **************************************************************************/
29
30 #ifndef PROJECTEXPLORER_H
31 #define PROJECTEXPLORER_H
32
33 #include "projectexplorer_export.h"
34
35 #include <extensionsystem/iplugin.h>
36
37 QT_BEGIN_NAMESPACE
38 class QPoint;
39 class QMenu;
40 class QAction;
41 QT_END_NAMESPACE
42
43 namespace Core {
44 class IMode;
45 }
46
47 namespace Utils {
48 class ParameterAction;
49 }
50
51 namespace ProjectExplorer {
52 class BuildManager;
53 class RunControl;
54 class SessionManager;
55 class RunConfiguration;
56 class IRunControlFactory;
57 class Project;
58 class Node;
59 class BuildConfiguration;
60
61 namespace Internal {
62 class ProjectFileFactory;
63 struct ProjectExplorerSettings;
64 }
65
66 struct ProjectExplorerPluginPrivate;
67
68 class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
69     : public ExtensionSystem::IPlugin
70 {
71     Q_OBJECT
72
73 public:
74     ProjectExplorerPlugin();
75     ~ProjectExplorerPlugin();
76
77     static ProjectExplorerPlugin *instance();
78
79     bool openProject(const QString &fileName);
80     QList<Project *> openProjects(const QStringList &fileNames);
81
82     SessionManager *session() const;
83
84     Project *currentProject() const;
85     Node *currentNode() const;
86
87     void setCurrentFile(Project *project, const QString &file);
88     void setCurrentNode(Node *node);
89
90     Project *startupProject() const;
91
92     BuildManager *buildManager() const;
93
94     bool saveModifiedFiles();
95
96     void showContextMenu(const QPoint &globalPos, Node *node);
97     static void populateOpenWithMenu(QMenu *menu, const QString &fileName);
98     static void openEditorFromAction(QAction *action, const QString &fileName);
99
100     //PluginInterface
101     bool initialize(const QStringList &arguments, QString *error_message);
102     void extensionsInitialized();
103     void aboutToShutdown();
104
105     void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
106     Internal::ProjectExplorerSettings projectExplorerSettings() const;
107
108     void startRunControl(RunControl *runControl, const QString &mode);
109
110     // internal public for FlatModel
111     void renameFile(Node *node, const QString &to);
112
113 signals:
114     void aboutToShowContextMenu(ProjectExplorer::Project *project,
115                                 ProjectExplorer::Node *node);
116
117     // Is emitted when a project has been added/removed,
118     // or the file list of a specific project has changed.
119     void fileListChanged();
120
121     void currentProjectChanged(ProjectExplorer::Project *project);
122     void currentNodeChanged(ProjectExplorer::Node *node, ProjectExplorer::Project *project);
123     void aboutToExecuteProject(ProjectExplorer::Project *project, const QString &runMode);
124
125     void settingsChanged();
126
127 public slots:
128     void setStartupProject(ProjectExplorer::Project *project = 0);
129
130 private slots:
131     void buildStateChanged(ProjectExplorer::Project * pro);
132     void buildQueueFinished(bool success);
133     void buildProjectOnly();
134     void buildProject();
135     void buildProjectContextMenu();
136     void buildSession();
137     void rebuildProjectOnly();
138     void rebuildProject();
139     void rebuildProjectContextMenu();
140     void rebuildSession();
141     void cleanProjectOnly();
142     void cleanProject();
143     void cleanProjectContextMenu();
144     void cleanSession();
145     void cancelBuild();
146     void debugProject();
147     void loadAction();
148     void unloadProject();
149     void clearSession();
150     void newProject();
151     void showSessionManager();
152     void populateOpenWithMenu();
153     void openWithMenuTriggered(QAction *action);
154     void updateSessionMenu();
155     void setSession(QAction *action);
156
157     void determineSessionToRestoreAtStartup();
158     void restoreSession();
159     void loadSession(const QString &session);
160     void runProject();
161     void runProjectContextMenu();
162     void savePersistentSettings();
163     void goToTaskWindow();
164
165     void addNewFile();
166     void addExistingFiles();
167     void openFile();
168     void showInGraphicalShell();
169     void removeFile();
170     void renameFile();
171
172     void updateRecentProjectMenu();
173     void openRecentProject();
174     void openTerminalHere();
175
176     void invalidateProject(ProjectExplorer::Project *project);
177
178     void setCurrentFile(const QString &filePath);
179
180     // RunControl
181     void runControlFinished();
182
183     void startupProjectChanged(); // Calls updateRunAction
184     void updateRunActions();
185
186     void loadProject(const QString &project) { openProject(project); }
187     void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
188     void updateActions();
189
190 #ifdef WITH_TESTS
191     void testGccOutputParsers_data();
192     void testGccOutputParsers();
193
194     void testLinuxIccOutputParsers_data();
195     void testLinuxIccOutputParsers();
196
197     void testGnuMakeParserParsing_data();
198     void testGnuMakeParserParsing();
199     void testGnuMakeParserTaskMangling_data();
200     void testGnuMakeParserTaskMangling();
201 #endif
202
203 private:
204     void updateContextMenuActions(Node *node);
205     bool parseArguments(const QStringList &arguments, QString *error);
206     void runProjectImpl(Project *pro, QString mode);
207     void executeRunConfiguration(RunConfiguration *, const QString &mode);
208     bool hasBuildSettings(Project *pro);
209     bool showBuildConfigDialog();
210
211     void setCurrent(Project *project, QString filePath, Node *node);
212
213     QStringList allFilesWithDependencies(Project *pro);
214     IRunControlFactory *findRunControlFactory(RunConfiguration *config, const QString &mode);
215
216     void addToRecentProjects(const QString &fileName, const QString &displayName);
217     void updateWelcomePage();
218     Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const;
219
220     static ProjectExplorerPlugin *m_instance;
221     ProjectExplorerPluginPrivate *d;
222 };
223
224 } // namespace ProjectExplorer
225
226 #endif // PROJECTEXPLORER_H