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 **************************************************************************/
37 #include "projectexplorer_export.h"
39 #include <QtCore/QObject>
40 #include <QtCore/QSet>
41 #include <QtGui/QFileSystemModel>
47 namespace ProjectExplorer {
49 class BuildConfigWidget;
50 class IProjectManager;
51 class EditorConfiguration;
57 class PROJECTEXPLORER_EXPORT Project
63 // Roles to be implemented by all models that are exported via model()
66 FilePathRole = QFileSystemModel::FilePathRole
72 virtual QString displayName() const = 0;
73 virtual QString id() const = 0;
74 virtual Core::IFile *file() const = 0;
75 virtual IProjectManager *projectManager() const = 0;
77 virtual QList<Project *> dependsOn() = 0; //NBS TODO implement dependsOn
79 bool hasActiveBuildSettings() const;
81 // EditorConfiguration:
82 EditorConfiguration *editorConfiguration() const;
85 void addTarget(Target *target);
86 void removeTarget(Target *target);
88 QList<Target *> targets() const;
89 // Note: activeTarget can be 0 (if no targets are defined).
90 Target *activeTarget() const;
91 void setActiveTarget(Target *target);
92 Target *target(const QString &id) const;
95 bool restoreSettings();
97 virtual QList<BuildConfigWidget*> subConfigWidgets();
99 virtual ProjectNode *rootProjectNode() const = 0;
101 enum FilesMode { AllFiles, ExcludeGeneratedFiles };
102 virtual QStringList files(FilesMode fileMode) const = 0;
103 // TODO: generalize to find source(s) of generated files?
104 virtual QString generatedUiHeader(const QString &formFile) const;
106 static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
108 // Serialize all data into a QVariantMap. This map is then saved
109 // in the .user file of the project.
111 // Just put all your data into the map.
113 // Note: Do not forget to call your base class' toMap method.
114 // Note: Do not forget to call setActiveBuildConfiguration when
115 // creating new BuilConfigurations.
116 virtual QVariantMap toMap() const;
118 // The directory that holds the project file. This includes the absolute path.
119 QString projectDirectory() const;
120 static QString projectDirectory(const QString &proFile);
123 void fileListChanged();
125 // Note: activeTarget can be 0 (if no targets are defined).
126 void activeTargetChanged(ProjectExplorer::Target *target);
128 void aboutToRemoveTarget(ProjectExplorer::Target *target);
129 void removedTarget(ProjectExplorer::Target *target);
130 void addedTarget(ProjectExplorer::Target *target);
132 /// convenience signal emitted if the activeBuildConfiguration emits environmentChanged
133 /// or if the activeBuildConfiguration changes
134 /// (including due to the active target changing).
135 void environmentChanged();
137 /// convenience signal emitted if the activeBuildConfiguration emits isEnabledChanged()
138 /// or if the activeBuildConfiguration changes
139 /// (including due to the active target changing).
140 void buildConfigurationEnabledChanged();
143 // restore all data from the map.
145 // Note: Do not forget to call your base class' fromMap method!
146 virtual bool fromMap(const QVariantMap &map);
149 void changeEnvironment();
150 void changeBuildConfigurationEnabled();
153 QScopedPointer<ProjectPrivate> d;
156 } // namespace ProjectExplorer
158 Q_DECLARE_METATYPE(ProjectExplorer::Project *)