2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
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
|
|
|
**
|
2009-02-25 09:15:00 +01: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
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-06-17 00:01:27 +10:00
|
|
|
** contact the sales department at http://www.qtsoftware.com/contact.
|
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 "persistentsettings.h"
|
|
|
|
|
#include "projectexplorer_export.h"
|
|
|
|
|
#include "buildconfiguration.h"
|
|
|
|
|
#include "environment.h"
|
|
|
|
|
#include "projectnodes.h"
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QSharedPointer>
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QModelIndex>
|
|
|
|
|
#include <QtCore/QFileInfo>
|
|
|
|
|
#include <QtGui/QFileSystemModel>
|
|
|
|
|
#include <QtGui/QMenu>
|
|
|
|
|
#include <QtGui/QIcon>
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
2009-01-16 16:30:22 +01:00
|
|
|
class IFile;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
|
|
|
|
class BuildManager;
|
|
|
|
|
class BuildStep;
|
|
|
|
|
class BuildStepConfigWidget;
|
|
|
|
|
class IProjectManager;
|
|
|
|
|
class RunConfiguration;
|
|
|
|
|
class EditorConfiguration;
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
virtual QString name() const = 0;
|
|
|
|
|
virtual Core::IFile *file() const = 0;
|
|
|
|
|
virtual IProjectManager *projectManager() const = 0;
|
|
|
|
|
|
|
|
|
|
virtual QList<Project *> dependsOn() = 0; //NBS TODO implement dependsOn
|
|
|
|
|
|
|
|
|
|
virtual bool isApplication() const = 0;
|
|
|
|
|
|
2009-05-06 16:33:43 +02:00
|
|
|
virtual bool hasBuildSettings() const;
|
|
|
|
|
|
2009-01-16 16:30:22 +01:00
|
|
|
// Build/Clean Step functions
|
2008-12-02 12:01:29 +01:00
|
|
|
QList<BuildStep *> buildSteps() const;
|
|
|
|
|
void insertBuildStep(int position, BuildStep *step);
|
|
|
|
|
void removeBuildStep(int position);
|
|
|
|
|
void moveBuildStepUp(int position);
|
|
|
|
|
|
|
|
|
|
QList<BuildStep *> cleanSteps() const;
|
|
|
|
|
void insertCleanStep(int position, BuildStep *step);
|
|
|
|
|
void removeCleanStep(int position);
|
2009-06-22 16:11:45 +02:00
|
|
|
void moveCleanStepUp(int position);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-01-16 16:30:22 +01:00
|
|
|
// Build configuration
|
2008-12-02 12:01:29 +01:00
|
|
|
void addBuildConfiguration(const QString &name);
|
|
|
|
|
void removeBuildConfiguration(const QString &name);
|
|
|
|
|
void copyBuildConfiguration(const QString &source, const QString &dest);
|
|
|
|
|
QStringList buildConfigurations() const;
|
|
|
|
|
QString displayNameFor(const QString &buildConfiguration);
|
|
|
|
|
void setDisplayNameFor(const QString &buildConfiguration, const QString &displayName);
|
|
|
|
|
|
|
|
|
|
QString activeBuildConfiguration() const;
|
|
|
|
|
void setActiveBuildConfiguration(const QString& config);
|
|
|
|
|
|
|
|
|
|
void setValue(const QString &name, const QVariant &value);
|
|
|
|
|
QVariant value(const QString &name) const;
|
|
|
|
|
|
|
|
|
|
void setValue(const QString &buildConfiguration, const QString &name, const QVariant &value);
|
|
|
|
|
QVariant value(const QString &buildConfiguration, const QString &name) const;
|
|
|
|
|
|
|
|
|
|
// Running
|
|
|
|
|
QList<QSharedPointer<RunConfiguration> > runConfigurations() const;
|
|
|
|
|
void addRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration);
|
|
|
|
|
void removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration);
|
|
|
|
|
|
|
|
|
|
QSharedPointer<RunConfiguration> activeRunConfiguration() const;
|
|
|
|
|
void setActiveRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration);
|
|
|
|
|
|
|
|
|
|
EditorConfiguration *editorConfiguration() const;
|
|
|
|
|
|
|
|
|
|
virtual Environment environment(const QString &buildConfiguration) const = 0;
|
|
|
|
|
virtual QString buildDirectory(const QString &buildConfiguration) const = 0;
|
|
|
|
|
|
|
|
|
|
void saveSettings();
|
|
|
|
|
void restoreSettings();
|
|
|
|
|
|
|
|
|
|
virtual BuildStepConfigWidget *createConfigWidget() = 0;
|
|
|
|
|
virtual QList<BuildStepConfigWidget*> subConfigWidgets();
|
|
|
|
|
|
2009-01-16 16:30:22 +01:00
|
|
|
/* This method is called for new build configurations. You should probably
|
|
|
|
|
* set some default values in this method.
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual void newBuildConfiguration(const QString &buildConfiguration) = 0;
|
|
|
|
|
|
|
|
|
|
virtual ProjectNode *rootProjectNode() const = 0;
|
|
|
|
|
|
|
|
|
|
enum FilesMode { AllFiles, ExcludeGeneratedFiles };
|
|
|
|
|
virtual QStringList files(FilesMode fileMode) const = 0;
|
|
|
|
|
|
2009-05-04 18:22:40 +02:00
|
|
|
// C++ specific
|
|
|
|
|
// TODO do a C++ project as a base ?
|
|
|
|
|
virtual QByteArray predefinedMacros(const QString &fileName) const;
|
|
|
|
|
virtual QStringList includePaths(const QString &fileName) const;
|
|
|
|
|
virtual QStringList frameworkPaths(const QString &fileName) const;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
|
|
|
|
void fileListChanged();
|
|
|
|
|
void activeBuildConfigurationChanged();
|
|
|
|
|
void activeRunConfigurationChanged();
|
2009-06-23 14:14:29 +02:00
|
|
|
void runConfigurationsEnabledStateChanged();
|
2009-04-15 14:52:31 +02:00
|
|
|
void removedRunConfiguration(const QString &name);
|
|
|
|
|
void addedRunConfiguration(const QString &name);
|
2008-12-02 12:01:29 +01:00
|
|
|
// This signal is jut there for updating the tree list in the buildsettings wizard
|
2009-05-27 14:41:07 +02:00
|
|
|
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
|
|
|
|
void environmentChanged(const QString &buildConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
protected:
|
2009-01-16 16:30:22 +01:00
|
|
|
/* This method is called when the project .user file is saved. Simply call
|
|
|
|
|
* writer.saveValue() for each value you want to save. Make sure to always
|
|
|
|
|
* call your base class implementation.
|
|
|
|
|
*
|
|
|
|
|
* Note: All the values from the project/buildsteps and buildconfigurations
|
|
|
|
|
* are automatically stored.
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual void saveSettingsImpl(PersistentSettingsWriter &writer);
|
|
|
|
|
|
2009-01-16 16:30:22 +01:00
|
|
|
/* This method is called when the project is opened. You can retrieve all
|
|
|
|
|
* the values you saved in saveSettingsImpl() in this method.
|
|
|
|
|
*
|
|
|
|
|
* Note: This function is also called if there is no .user file. You should
|
|
|
|
|
* probably add some default build and run settings to the project so that
|
|
|
|
|
* it can be build and run.
|
|
|
|
|
*/
|
2008-12-02 12:01:29 +01:00
|
|
|
virtual void restoreSettingsImpl(PersistentSettingsReader &reader);
|
|
|
|
|
|
|
|
|
|
private:
|
2009-04-20 16:29:46 +02:00
|
|
|
Internal::BuildConfiguration *getBuildConfiguration(const QString & name) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QList<BuildStep *> m_buildSteps;
|
|
|
|
|
QList<BuildStep *> m_cleanSteps;
|
|
|
|
|
QStringList m_buildConfigurations;
|
|
|
|
|
QMap<QString, QVariant> m_values;
|
2009-04-20 16:29:46 +02:00
|
|
|
QList<Internal::BuildConfiguration *> m_buildConfigurationValues;
|
2008-12-02 12:01:29 +01:00
|
|
|
QString m_activeBuildConfiguration;
|
|
|
|
|
QList<QSharedPointer<RunConfiguration> > m_runConfigurations;
|
|
|
|
|
QSharedPointer<RunConfiguration> m_activeRunConfiguration;
|
|
|
|
|
EditorConfiguration *m_editorConfiguration;
|
|
|
|
|
};
|
|
|
|
|
|
2008-12-02 16:19:05 +01:00
|
|
|
} // namespace ProjectExplorer
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-01-16 16:30:22 +01:00
|
|
|
#endif // PROJECT_H
|