1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef PROJECTEXPLORER_H
35 #define PROJECTEXPLORER_H
37 #include "projectexplorer_export.h"
39 #include <extensionsystem/iplugin.h>
52 class ParameterAction;
55 namespace ProjectExplorer {
59 class RunConfiguration;
60 class IRunControlFactory;
63 class BuildConfiguration;
67 class ProjectFileFactory;
68 struct ProjectExplorerSettings;
71 struct ProjectExplorerPluginPrivate;
73 class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
74 : public ExtensionSystem::IPlugin
79 ProjectExplorerPlugin();
80 ~ProjectExplorerPlugin();
82 static ProjectExplorerPlugin *instance();
84 Q_SLOT bool openProject(const QString &fileName);
85 QList<Project *> openProjects(const QStringList &fileNames);
87 SessionManager *session() const;
89 Project *currentProject() const;
90 Node *currentNode() const;
92 void setCurrentFile(Project *project, const QString &file);
93 void setCurrentNode(Node *node);
95 Project *startupProject() const;
97 BuildManager *buildManager() const;
99 bool saveModifiedFiles();
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);
106 bool initialize(const QStringList &arguments, QString *error_message);
107 void extensionsInitialized();
108 ShutdownFlag aboutToShutdown();
110 void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
111 Internal::ProjectExplorerSettings projectExplorerSettings() const;
113 void startRunControl(RunControl *runControl, const QString &mode);
115 // internal public for FlatModel
116 void renameFile(Node *node, const QString &to);
117 static QStringList projectFilePatterns();
118 bool coreAboutToClose();
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);
124 void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths);
125 void addExistingFiles(const QStringList &filePaths);
128 void aboutToShowContextMenu(ProjectExplorer::Project *project,
129 ProjectExplorer::Node *node);
131 // Is emitted when a project has been added/removed,
132 // or the file list of a specific project has changed.
133 void fileListChanged();
135 void currentProjectChanged(ProjectExplorer::Project *project);
136 void currentNodeChanged(ProjectExplorer::Node *node, ProjectExplorer::Project *project);
137 void aboutToExecuteProject(ProjectExplorer::Project *project, const QString &runMode);
139 void settingsChanged();
141 void updateRunActions();
144 void openOpenProjectDialog();
147 void buildStateChanged(ProjectExplorer::Project * pro);
148 void buildQueueFinished(bool success);
149 void buildProjectOnly();
151 void buildProjectContextMenu();
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();
163 void cleanProjectContextMenu();
167 void unloadProject();
170 void showSessionManager();
171 void populateOpenWithMenu();
172 void openWithMenuTriggered(QAction *action);
173 void updateSessionMenu();
174 void setSession(QAction *action);
176 void determineSessionToRestoreAtStartup();
177 void restoreSession();
178 void loadSession(const QString &session);
180 void runProjectContextMenu();
181 void savePersistentSettings();
184 void addExistingFiles();
185 void addNewSubproject();
186 void removeProject();
188 void showInGraphicalShell();
192 void setStartupProject();
193 void setStartupProject(ProjectExplorer::Project *project);
195 void updateRecentProjectMenu();
196 void openRecentProject();
197 void openTerminalHere();
199 void invalidateProject(ProjectExplorer::Project *project);
201 void setCurrentFile(const QString &filePath);
203 void runControlFinished();
205 void projectAdded(ProjectExplorer::Project *pro);
206 void projectRemoved(ProjectExplorer::Project *pro);
207 void startupProjectChanged(); // Calls updateRunAction
208 void activeTargetChanged();
209 void activeRunConfigurationChanged();
211 void updateDeployActions();
212 void slotUpdateRunActions();
214 void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
215 void updateActions();
216 void loadCustomWizards();
217 void updateVariable(const QString &variable);
219 void publishProject();
220 void updateWelcomePage();
223 void testGccOutputParsers_data();
224 void testGccOutputParsers();
226 void testLinuxIccOutputParsers_data();
227 void testLinuxIccOutputParsers();
229 void testGnuMakeParserParsing_data();
230 void testGnuMakeParserParsing();
231 void testGnuMakeParserTaskMangling_data();
232 void testGnuMakeParserTaskMangling();
235 void testMsvcOutputParsers_data();
236 void testMsvcOutputParsers();
239 void testGccAbiGuessing_data();
240 void testGccAbiGuessing();
242 void testAbiOfBinary_data();
243 void testAbiOfBinary();
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);
257 void setCurrent(Project *project, QString filePath, Node *node);
259 QStringList allFilesWithDependencies(Project *pro);
260 IRunControlFactory *findRunControlFactory(RunConfiguration *config, const QString &mode);
262 void addToRecentProjects(const QString &fileName, const QString &displayName);
264 static ProjectExplorerPlugin *m_instance;
265 ProjectExplorerPluginPrivate *d;
268 } // namespace ProjectExplorer
270 #endif // PROJECTEXPLORER_H