2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef PROJECT_H
|
|
|
|
|
#define PROJECT_H
|
|
|
|
|
|
|
|
|
|
#include "projectexplorer_export.h"
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
2010-02-08 15:50:06 +01:00
|
|
|
#include <QtCore/QSet>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtGui/QFileSystemModel>
|
2009-09-29 11:39:55 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Core {
|
2009-01-16 16:30:22 +01:00
|
|
|
class IFile;
|
2011-04-12 12:17:19 +02:00
|
|
|
class Context;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
class BuildConfigWidget;
|
2008-12-02 12:01:29 +01:00
|
|
|
class IProjectManager;
|
|
|
|
|
class EditorConfiguration;
|
2009-09-29 11:39:55 +02:00
|
|
|
class ProjectNode;
|
2010-02-08 15:50:06 +01:00
|
|
|
class Target;
|
2010-09-21 09:17:37 +02:00
|
|
|
class ProjectPrivate;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
// Documentation inside.
|
2008-12-02 12:01:29 +01:00
|
|
|
class PROJECTEXPLORER_EXPORT Project
|
|
|
|
|
: public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2009-01-16 16:30:22 +01:00
|
|
|
// Roles to be implemented by all models that are exported via model()
|
2008-12-02 12:01:29 +01:00
|
|
|
enum ModelRoles {
|
|
|
|
|
// Absolute file path
|
|
|
|
|
FilePathRole = QFileSystemModel::FilePathRole
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Project();
|
|
|
|
|
virtual ~Project();
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
virtual QString displayName() const = 0;
|
2010-01-22 15:59:44 +01:00
|
|
|
virtual QString id() const = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual Core::IFile *file() const = 0;
|
|
|
|
|
virtual IProjectManager *projectManager() const = 0;
|
|
|
|
|
|
|
|
|
|
virtual QList<Project *> dependsOn() = 0; //NBS TODO implement dependsOn
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
bool hasActiveBuildSettings() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// EditorConfiguration:
|
|
|
|
|
EditorConfiguration *editorConfiguration() const;
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// Target:
|
|
|
|
|
void addTarget(Target *target);
|
2011-10-24 13:10:38 +00:00
|
|
|
bool removeTarget(Target *target);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QList<Target *> targets() const;
|
|
|
|
|
// Note: activeTarget can be 0 (if no targets are defined).
|
|
|
|
|
Target *activeTarget() const;
|
|
|
|
|
void setActiveTarget(Target *target);
|
|
|
|
|
Target *target(const QString &id) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
void saveSettings();
|
2009-07-03 16:46:01 +02:00
|
|
|
bool restoreSettings();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
virtual QList<BuildConfigWidget*> subConfigWidgets();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
virtual ProjectNode *rootProjectNode() const = 0;
|
|
|
|
|
|
|
|
|
|
enum FilesMode { AllFiles, ExcludeGeneratedFiles };
|
|
|
|
|
virtual QStringList files(FilesMode fileMode) const = 0;
|
2009-12-03 16:23:15 +01:00
|
|
|
// TODO: generalize to find source(s) of generated files?
|
|
|
|
|
virtual QString generatedUiHeader(const QString &formFile) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
|
|
|
|
|
|
2010-01-19 16:33:44 +01:00
|
|
|
virtual QVariantMap toMap() const;
|
|
|
|
|
|
2010-03-25 13:19:27 +01:00
|
|
|
// The directory that holds the project file. This includes the absolute path.
|
|
|
|
|
QString projectDirectory() const;
|
2010-06-08 14:19:05 +02:00
|
|
|
static QString projectDirectory(const QString &proFile);
|
2010-03-25 13:19:27 +01:00
|
|
|
|
2011-04-12 12:17:19 +02:00
|
|
|
virtual Core::Context projectContext() const;
|
|
|
|
|
virtual Core::Context projectLanguage() const;
|
|
|
|
|
|
2011-08-01 13:21:01 +00:00
|
|
|
QVariant namedSettings(const QString &name) const;
|
|
|
|
|
void setNamedSettings(const QString &name, QVariant &value);
|
|
|
|
|
|
2011-10-28 10:15:04 +00:00
|
|
|
virtual bool needsConfiguration() const;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
|
|
|
|
void fileListChanged();
|
2009-09-17 13:59:10 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
// Note: activeTarget can be 0 (if no targets are defined).
|
|
|
|
|
void activeTargetChanged(ProjectExplorer::Target *target);
|
|
|
|
|
|
|
|
|
|
void aboutToRemoveTarget(ProjectExplorer::Target *target);
|
|
|
|
|
void removedTarget(ProjectExplorer::Target *target);
|
|
|
|
|
void addedTarget(ProjectExplorer::Target *target);
|
2009-09-17 13:59:10 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
void environmentChanged();
|
2011-01-19 15:46:01 +01:00
|
|
|
void buildConfigurationEnabledChanged();
|
|
|
|
|
|
2011-08-01 13:21:01 +00:00
|
|
|
void settingsLoaded();
|
|
|
|
|
void aboutToSaveSettings();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2010-01-19 16:33:44 +01:00
|
|
|
virtual bool fromMap(const QVariantMap &map);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-04-12 12:17:19 +02:00
|
|
|
virtual void setProjectContext(Core::Context context);
|
|
|
|
|
virtual void setProjectLanguage(Core::Context language);
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
private slots:
|
|
|
|
|
void changeEnvironment();
|
2011-01-19 15:46:01 +01:00
|
|
|
void changeBuildConfigurationEnabled();
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
2011-09-16 15:00:41 +02:00
|
|
|
ProjectPrivate *d;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2008-12-02 16:19:05 +01:00
|
|
|
} // namespace ProjectExplorer
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-01-21 21:12:40 +01:00
|
|
|
Q_DECLARE_METATYPE(ProjectExplorer::Project *)
|
|
|
|
|
|
2009-01-16 16:30:22 +01:00
|
|
|
#endif // PROJECT_H
|