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-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.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 "projectexplorer_export.h"
|
|
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtGui/QFileSystemModel>
|
2009-09-29 11:39:55 +02:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QMenu;
|
|
|
|
|
QT_END_NAMESPACE
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
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;
|
2009-08-06 15:31:32 +02:00
|
|
|
class BuildConfigWidget;
|
2008-12-02 12:01:29 +01:00
|
|
|
class IProjectManager;
|
|
|
|
|
class RunConfiguration;
|
|
|
|
|
class EditorConfiguration;
|
2009-09-29 11:39:55 +02:00
|
|
|
class Environment;
|
|
|
|
|
class ProjectNode;
|
|
|
|
|
class PersistentSettingsWriter;
|
|
|
|
|
class PersistentSettingsReader;
|
|
|
|
|
class BuildConfiguration;
|
2009-09-24 16:02:02 +02:00
|
|
|
class IBuildConfigurationFactory;
|
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();
|
|
|
|
|
|
|
|
|
|
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 configuration
|
2009-09-24 16:02:02 +02:00
|
|
|
void addBuildConfiguration(BuildConfiguration *configuration);
|
|
|
|
|
void removeBuildConfiguration(BuildConfiguration *configuration);
|
2009-11-23 12:11:48 +01:00
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
QList<BuildConfiguration *> buildConfigurations() const;
|
|
|
|
|
BuildConfiguration *activeBuildConfiguration() const;
|
|
|
|
|
void setActiveBuildConfiguration(BuildConfiguration *configuration);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Running
|
2009-10-08 18:37:18 +02:00
|
|
|
QList<RunConfiguration *> runConfigurations() const;
|
|
|
|
|
void addRunConfiguration(RunConfiguration* runConfiguration);
|
|
|
|
|
void removeRunConfiguration(RunConfiguration* runConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-08 18:37:18 +02:00
|
|
|
RunConfiguration* activeRunConfiguration() const;
|
|
|
|
|
void setActiveRunConfiguration(RunConfiguration* runConfiguration);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
EditorConfiguration *editorConfiguration() const;
|
|
|
|
|
|
|
|
|
|
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 BuildConfigWidget *createConfigWidget() = 0;
|
|
|
|
|
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
|
|
|
|
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;
|
|
|
|
|
|
2009-10-08 20:01:07 +02:00
|
|
|
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
|
|
|
|
void fileListChanged();
|
2009-09-17 13:59:10 +02:00
|
|
|
|
|
|
|
|
// TODO clean up signal names
|
|
|
|
|
// might be better to also have
|
|
|
|
|
// a aboutToRemoveRunConfiguration
|
|
|
|
|
// and a removedBuildConfiguration
|
|
|
|
|
// a runconfiguration display name changed is missing
|
2008-12-02 12:01:29 +01:00
|
|
|
void activeBuildConfigurationChanged();
|
|
|
|
|
void activeRunConfigurationChanged();
|
2009-06-23 14:14:29 +02:00
|
|
|
void runConfigurationsEnabledStateChanged();
|
2009-09-17 13:59:10 +02:00
|
|
|
|
|
|
|
|
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
|
|
|
|
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
|
|
|
|
|
2009-11-30 13:57:08 +01:00
|
|
|
void removedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
|
|
|
|
void addedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
2009-09-17 13:59:10 +02:00
|
|
|
|
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.
|
|
|
|
|
*/
|
2009-07-03 16:46:01 +02:00
|
|
|
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2009-09-21 15:50:27 +02:00
|
|
|
QList<BuildConfiguration *> m_buildConfigurationValues;
|
2009-11-24 15:36:31 +01:00
|
|
|
BuildConfiguration *m_activeBuildConfiguration;
|
2009-10-08 18:37:18 +02:00
|
|
|
QList<RunConfiguration *> m_runConfigurations;
|
|
|
|
|
RunConfiguration* m_activeRunConfiguration;
|
2008-12-02 12:01:29 +01:00
|
|
|
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
|