OSDN Git Service

85cc013fb85b16795c320d56513a1ddb2da46f23
[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) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
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 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef PROJECTEXPLORER_H
35 #define PROJECTEXPLORER_H
36
37 #include "projectexplorer_export.h"
38
39 #include <extensionsystem/iplugin.h>
40
41 QT_BEGIN_NAMESPACE
42 class QPoint;
43 class QMenu;
44 class QAction;
45 QT_END_NAMESPACE
46
47 namespace Core {
48 class IMode;
49 }
50
51 namespace Utils {
52 class ParameterAction;
53 }
54
55 namespace ProjectExplorer {
56 class BuildManager;
57 class RunControl;
58 class SessionManager;
59 class RunConfiguration;
60 class IRunControlFactory;
61 class Project;
62 class Node;
63 class BuildConfiguration;
64 class ProjectNode;
65
66 namespace Internal {
67 class ProjectFileFactory;
68 struct ProjectExplorerSettings;
69 }
70
71 struct ProjectExplorerPluginPrivate;
72
73 class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
74     : public ExtensionSystem::IPlugin
75 {
76     Q_OBJECT
77
78 public:
79     ProjectExplorerPlugin();
80     ~ProjectExplorerPlugin();
81
82     static ProjectExplorerPlugin *instance();
83
84     Q_SLOT bool openProject(const QString &fileName);
85     QList<Project *> openProjects(const QStringList &fileNames);
86
87     SessionManager *session() const;
88
89     Project *currentProject() const;
90     Node *currentNode() const;
91
92     void setCurrentFile(Project *project, const QString &file);
93     void setCurrentNode(Node *node);
94
95     Project *startupProject() const;
96
97     BuildManager *buildManager() const;
98
99     bool saveModifiedFiles();
100
101     void showContextMenu(const QPoint &globalPos, Node *node);
102     static void populateOpenWithMenu(QMenu *menu, const QString &fileName);
103     static void openEditorFromAction(QAction *action, const QString &fileName);
104
105     //PluginInterface
106     bool initialize(const QStringList &arguments, QString *error_message);
107     void extensionsInitialized();
108     ShutdownFlag aboutToShutdown();
109
110     void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
111     Internal::ProjectExplorerSettings projectExplorerSettings() const;
112
113     void startRunControl(RunControl *runControl, const QString &mode);
114
115     // internal public for FlatModel
116     void renameFile(Node *node, const QString &to);
117     static QStringList projectFilePatterns();
118     bool coreAboutToClose();
119
120     bool canRun(Project *pro, const QString &runMode);
121     void runProject(Project *pro, const QString &mode);
122     void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode);
123
124     void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths);
125     void addExistingFiles(const QStringList &filePaths);
126
127 signals:
128     void aboutToShowContextMenu(ProjectExplorer::Project *project,
129                                 ProjectExplorer::Node *node);
130
131     // Is emitted when a project has been added/removed,
132     // or the file list of a specific project has changed.
133     void fileListChanged();
134
135     void currentProjectChanged(ProjectExplorer::Project *project);
136     void currentNodeChanged(ProjectExplorer::Node *node, ProjectExplorer::Project *project);
137     void aboutToExecuteProject(ProjectExplorer::Project *project, const QString &runMode);
138
139     void settingsChanged();
140
141     void updateRunActions();
142
143 public slots:
144     void openOpenProjectDialog();
145
146 private slots:
147     void buildStateChanged(ProjectExplorer::Project * pro);
148     void buildQueueFinished(bool success);
149     void buildProjectOnly();
150     void buildProject();
151     void buildProjectContextMenu();
152     void buildSession();
153     void rebuildProjectOnly();
154     void rebuildProject();
155     void rebuildProjectContextMenu();
156     void rebuildSession();
157     void deployProjectOnly();
158     void deployProject();
159     void deployProjectContextMenu();
160     void deploySession();
161     void cleanProjectOnly();
162     void cleanProject();
163     void cleanProjectContextMenu();
164     void cleanSession();
165     void cancelBuild();
166     void loadAction();
167     void unloadProject();
168     void clearSession();
169     void newProject();
170     void showSessionManager();
171     void populateOpenWithMenu();
172     void openWithMenuTriggered(QAction *action);
173     void updateSessionMenu();
174     void setSession(QAction *action);
175
176     void determineSessionToRestoreAtStartup();
177     void restoreSession();
178     void loadSession(const QString &session);
179     void runProject();
180     void runProjectContextMenu();
181     void savePersistentSettings();
182
183     void addNewFile();
184     void addExistingFiles();
185     void addNewSubproject();
186     void removeProject();
187     void openFile();
188     void showInGraphicalShell();
189     void removeFile();
190     void deleteFile();
191     void renameFile();
192     void setStartupProject();
193     void setStartupProject(ProjectExplorer::Project *project);
194
195     void updateRecentProjectMenu();
196     void openRecentProject();
197     void openTerminalHere();
198
199     void invalidateProject(ProjectExplorer::Project *project);
200
201     void setCurrentFile(const QString &filePath);
202
203     void runControlFinished();
204
205     void projectAdded(ProjectExplorer::Project *pro);
206     void projectRemoved(ProjectExplorer::Project *pro);
207     void startupProjectChanged(); // Calls updateRunAction
208     void activeTargetChanged();
209     void activeRunConfigurationChanged();
210
211     void updateDeployActions();
212     void slotUpdateRunActions();
213
214     void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
215     void updateActions();
216     void loadCustomWizards();
217     void updateVariable(const QString &variable);
218
219     void publishProject();
220     void updateWelcomePage();
221
222 #ifdef WITH_TESTS
223     void testGccOutputParsers_data();
224     void testGccOutputParsers();
225
226     void testLinuxIccOutputParsers_data();
227     void testLinuxIccOutputParsers();
228
229     void testGnuMakeParserParsing_data();
230     void testGnuMakeParserParsing();
231     void testGnuMakeParserTaskMangling_data();
232     void testGnuMakeParserTaskMangling();
233
234 #ifdef Q_OS_WIN
235     void testMsvcOutputParsers_data();
236     void testMsvcOutputParsers();
237 #endif
238
239     void testGccAbiGuessing_data();
240     void testGccAbiGuessing();
241
242     void testAbiOfBinary_data();
243     void testAbiOfBinary();
244 #endif
245
246 private:
247     QString directoryFor(Node *node);
248     void deploy(QList<Project *>);
249     int queue(QList<Project *>, QStringList stepIds);
250     void updateContextMenuActions();
251     bool parseArguments(const QStringList &arguments, QString *error);
252     void executeRunConfiguration(RunConfiguration *, const QString &mode);
253     bool hasBuildSettings(Project *pro);
254     bool buildSettingsEnabled(Project *pro);
255     bool hasDeploySettings(Project *pro);
256
257     void setCurrent(Project *project, QString filePath, Node *node);
258
259     QStringList allFilesWithDependencies(Project *pro);
260     IRunControlFactory *findRunControlFactory(RunConfiguration *config, const QString &mode);
261
262     void addToRecentProjects(const QString &fileName, const QString &displayName);
263
264     static ProjectExplorerPlugin *m_instance;
265     ProjectExplorerPluginPrivate *d;
266 };
267
268 } // namespace ProjectExplorer
269
270 #endif // PROJECTEXPLORER_H