2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02: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"
|
|
|
|
|
|
2012-03-15 17:17:40 +01:00
|
|
|
#include <coreplugin/id.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QFileSystemModel>
|
2009-09-29 11:39:55 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Core {
|
2012-02-14 16:43:51 +01:00
|
|
|
class IDocument;
|
2011-04-12 12:17:19 +02:00
|
|
|
class Context;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
class BuildInfo;
|
2008-12-02 12:01:29 +01:00
|
|
|
class IProjectManager;
|
|
|
|
|
class EditorConfiguration;
|
2013-08-13 10:52:57 +02:00
|
|
|
class ProjectImporter;
|
2009-09-29 11:39:55 +02:00
|
|
|
class ProjectNode;
|
2012-09-03 18:31:44 +02:00
|
|
|
class Kit;
|
2013-08-13 10:52:57 +02:00
|
|
|
class KitMatcher;
|
2012-11-08 18:02:50 +01:00
|
|
|
class NamedWidget;
|
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
|
2013-01-16 15:27:03 +01:00
|
|
|
FilePathRole = QFileSystemModel::FilePathRole,
|
|
|
|
|
EnabledRole
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Project();
|
|
|
|
|
virtual ~Project();
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
virtual QString displayName() const = 0;
|
2012-03-15 17:17:40 +01:00
|
|
|
virtual Core::Id id() const = 0;
|
2012-02-14 16:43:51 +01:00
|
|
|
virtual Core::IDocument *document() const = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual IProjectManager *projectManager() const = 0;
|
|
|
|
|
|
2013-07-23 12:30:17 +02:00
|
|
|
QString projectFilePath() const;
|
|
|
|
|
|
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);
|
2012-04-24 15:49:09 +02:00
|
|
|
Target *target(const Core::Id id) const;
|
2012-09-03 18:31:44 +02:00
|
|
|
Target *target(Kit *k) const;
|
2012-09-20 11:16:47 +02:00
|
|
|
virtual bool supportsKit(Kit *k, QString *errorMessage = 0) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Target *createTarget(Kit *k);
|
2012-04-24 15:49:09 +02:00
|
|
|
Target *restoreTarget(const QVariantMap &data);
|
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
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
// The directory that holds the project. This includes the absolute path.
|
2010-03-25 13:19:27 +01:00
|
|
|
QString projectDirectory() const;
|
2012-09-03 18:31:44 +02:00
|
|
|
static QString projectDirectory(const QString &top);
|
2010-03-25 13:19:27 +01:00
|
|
|
|
2013-04-10 14:45:47 +02:00
|
|
|
Core::Context projectContext() const;
|
|
|
|
|
Core::Context projectLanguages() const;
|
2011-04-12 12:17:19 +02:00
|
|
|
|
2011-08-01 13:21:01 +00:00
|
|
|
QVariant namedSettings(const QString &name) const;
|
2012-09-24 16:23:13 +02:00
|
|
|
void setNamedSettings(const QString &name, const QVariant &value);
|
2011-08-01 13:21:01 +00:00
|
|
|
|
2011-10-28 10:15:04 +00:00
|
|
|
virtual bool needsConfiguration() const;
|
2012-03-06 13:14:42 +01:00
|
|
|
virtual void configureAsExampleProject(const QStringList &platforms);
|
2011-10-28 10:15:04 +00:00
|
|
|
|
2012-09-06 16:19:14 +02:00
|
|
|
virtual bool supportsNoTargetPanel() const;
|
2013-08-13 10:52:57 +02:00
|
|
|
virtual ProjectImporter *createProjectImporter() const;
|
|
|
|
|
virtual KitMatcher *createRequiredKitMatcher() const { return 0; }
|
|
|
|
|
virtual KitMatcher *createPreferredKitMatcher() const { return 0; }
|
2012-09-06 16:19:14 +02:00
|
|
|
|
2013-05-06 11:14:27 +02:00
|
|
|
virtual bool needsSpecialDeployment() const;
|
|
|
|
|
|
2013-07-22 15:53:57 +02:00
|
|
|
void setup(QList<const BuildInfo *> infoList);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
2012-04-16 19:18:26 +04:00
|
|
|
void displayNameChanged();
|
2008-12-02 12:01:29 +01:00
|
|
|
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();
|
2012-07-17 15:56:43 +02:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
void buildDirectoryChanged();
|
2011-01-19 15:46:01 +01:00
|
|
|
|
2011-08-01 13:21:01 +00:00
|
|
|
void settingsLoaded();
|
|
|
|
|
void aboutToSaveSettings();
|
|
|
|
|
|
2013-04-09 15:30:20 +02:00
|
|
|
void projectContextUpdated();
|
|
|
|
|
void projectLanguagesUpdated();
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
protected:
|
2010-01-19 16:33:44 +01:00
|
|
|
virtual bool fromMap(const QVariantMap &map);
|
2012-10-02 17:46:19 +02:00
|
|
|
virtual bool setupTarget(Target *t);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-04-10 14:45:47 +02:00
|
|
|
void setProjectContext(Core::Context context);
|
|
|
|
|
void setProjectLanguages(Core::Context language);
|
|
|
|
|
void addProjectLanguage(Core::Id id);
|
|
|
|
|
void removeProjectLanguage(Core::Id id);
|
|
|
|
|
void setProjectLanguage(Core::Id id, bool enabled);
|
2011-04-12 12:17:19 +02:00
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
private slots:
|
|
|
|
|
void changeEnvironment();
|
2011-01-19 15:46:01 +01:00
|
|
|
void changeBuildConfigurationEnabled();
|
2012-04-24 15:49:09 +02:00
|
|
|
void onBuildDirectoryChanged();
|
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
|