1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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.
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 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
28 **************************************************************************/
30 #ifndef PROJECTEXPLORER_H
31 #define PROJECTEXPLORER_H
33 #include "projectexplorer_export.h"
35 #include <extensionsystem/iplugin.h>
48 class ParameterAction;
51 namespace ProjectExplorer {
55 class RunConfiguration;
56 class IRunControlFactory;
59 class BuildConfiguration;
62 class ProjectFileFactory;
63 struct ProjectExplorerSettings;
66 struct ProjectExplorerPluginPrivate;
68 class PROJECTEXPLORER_EXPORT ProjectExplorerPlugin
69 : public ExtensionSystem::IPlugin
74 ProjectExplorerPlugin();
75 ~ProjectExplorerPlugin();
77 static ProjectExplorerPlugin *instance();
79 bool openProject(const QString &fileName);
80 QList<Project *> openProjects(const QStringList &fileNames);
82 SessionManager *session() const;
84 Project *currentProject() const;
85 Node *currentNode() const;
87 void setCurrentFile(Project *project, const QString &file);
88 void setCurrentNode(Node *node);
90 Project *startupProject() const;
92 BuildManager *buildManager() const;
94 bool saveModifiedFiles();
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);
101 bool initialize(const QStringList &arguments, QString *error_message);
102 void extensionsInitialized();
103 void aboutToShutdown();
105 void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
106 Internal::ProjectExplorerSettings projectExplorerSettings() const;
108 void startRunControl(RunControl *runControl, const QString &mode);
110 // internal public for FlatModel
111 void renameFile(Node *node, const QString &to);
114 void aboutToShowContextMenu(ProjectExplorer::Project *project,
115 ProjectExplorer::Node *node);
117 // Is emitted when a project has been added/removed,
118 // or the file list of a specific project has changed.
119 void fileListChanged();
121 void currentProjectChanged(ProjectExplorer::Project *project);
122 void currentNodeChanged(ProjectExplorer::Node *node, ProjectExplorer::Project *project);
123 void aboutToExecuteProject(ProjectExplorer::Project *project, const QString &runMode);
125 void settingsChanged();
128 void setStartupProject(ProjectExplorer::Project *project = 0);
131 void buildStateChanged(ProjectExplorer::Project * pro);
132 void buildQueueFinished(bool success);
133 void buildProjectOnly();
135 void buildProjectContextMenu();
137 void rebuildProjectOnly();
138 void rebuildProject();
139 void rebuildProjectContextMenu();
140 void rebuildSession();
141 void cleanProjectOnly();
143 void cleanProjectContextMenu();
148 void unloadProject();
151 void showSessionManager();
152 void populateOpenWithMenu();
153 void openWithMenuTriggered(QAction *action);
154 void updateSessionMenu();
155 void setSession(QAction *action);
157 void determineSessionToRestoreAtStartup();
158 void restoreSession();
159 void loadSession(const QString &session);
161 void runProjectContextMenu();
162 void savePersistentSettings();
163 void goToTaskWindow();
166 void addExistingFiles();
168 void showInGraphicalShell();
172 void updateRecentProjectMenu();
173 void openRecentProject();
174 void openTerminalHere();
176 void invalidateProject(ProjectExplorer::Project *project);
178 void setCurrentFile(const QString &filePath);
181 void runControlFinished();
183 void startupProjectChanged(); // Calls updateRunAction
184 void updateRunActions();
186 void loadProject(const QString &project) { openProject(project); }
187 void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
188 void updateActions();
191 void testGccOutputParsers_data();
192 void testGccOutputParsers();
194 void testLinuxIccOutputParsers_data();
195 void testLinuxIccOutputParsers();
197 void testGnuMakeParserParsing_data();
198 void testGnuMakeParserParsing();
199 void testGnuMakeParserTaskMangling_data();
200 void testGnuMakeParserTaskMangling();
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();
211 void setCurrent(Project *project, QString filePath, Node *node);
213 QStringList allFilesWithDependencies(Project *pro);
214 IRunControlFactory *findRunControlFactory(RunConfiguration *config, const QString &mode);
216 void addToRecentProjects(const QString &fileName, const QString &displayName);
217 void updateWelcomePage();
218 Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const;
220 static ProjectExplorerPlugin *m_instance;
221 ProjectExplorerPluginPrivate *d;
224 } // namespace ProjectExplorer
226 #endif // PROJECTEXPLORER_H