forked from qt-creator/qt-creator
ProjectExplorer: Make Project::id value based
Change-Id: Ie210d2a068158c6caaac66aae58cbd886f61c18d Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -78,6 +78,7 @@ AutotoolsProject::AutotoolsProject(AutotoolsManager *manager, const QString &fil
|
|||||||
m_watchedFiles(),
|
m_watchedFiles(),
|
||||||
m_makefileParserThread(0)
|
m_makefileParserThread(0)
|
||||||
{
|
{
|
||||||
|
setId(Constants::AUTOTOOLS_PROJECT_ID);
|
||||||
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
|
setProjectContext(Core::Context(Constants::PROJECT_CONTEXT));
|
||||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
||||||
|
|
||||||
@@ -108,11 +109,6 @@ QString AutotoolsProject::displayName() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id AutotoolsProject::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Constants::AUTOTOOLS_PROJECT_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IDocument *AutotoolsProject::document() const
|
Core::IDocument *AutotoolsProject::document() const
|
||||||
{
|
{
|
||||||
return m_file;
|
return m_file;
|
||||||
|
@@ -73,7 +73,6 @@ public:
|
|||||||
~AutotoolsProject();
|
~AutotoolsProject();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
Core::Id id() const;
|
|
||||||
Core::IDocument *document() const;
|
Core::IDocument *document() const;
|
||||||
ProjectExplorer::IProjectManager *projectManager() const;
|
ProjectExplorer::IProjectManager *projectManager() const;
|
||||||
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
||||||
|
@@ -92,6 +92,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
m_rootNode(new CMakeProjectNode(fileName)),
|
m_rootNode(new CMakeProjectNode(fileName)),
|
||||||
m_watcher(new QFileSystemWatcher(this))
|
m_watcher(new QFileSystemWatcher(this))
|
||||||
{
|
{
|
||||||
|
setId(Constants::CMAKEPROJECT_ID);
|
||||||
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
|
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
|
||||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
||||||
|
|
||||||
@@ -512,11 +513,6 @@ QString CMakeProject::displayName() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id CMakeProject::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Constants::CMAKEPROJECT_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IDocument *CMakeProject::document() const
|
Core::IDocument *CMakeProject::document() const
|
||||||
{
|
{
|
||||||
return m_file;
|
return m_file;
|
||||||
|
@@ -80,7 +80,6 @@ public:
|
|||||||
~CMakeProject();
|
~CMakeProject();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
Core::Id id() const;
|
|
||||||
Core::IDocument *document() const;
|
Core::IDocument *document() const;
|
||||||
CMakeManager *projectManager() const;
|
CMakeManager *projectManager() const;
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ TestProject::TestProject(const QString &name, QObject *parent)
|
|||||||
: m_name (name)
|
: m_name (name)
|
||||||
{
|
{
|
||||||
setParent(parent);
|
setParent(parent);
|
||||||
|
setId(Core::Id::fromString(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
TestProject::~TestProject()
|
TestProject::~TestProject()
|
||||||
|
@@ -48,9 +48,6 @@ public:
|
|||||||
virtual QString displayName() const
|
virtual QString displayName() const
|
||||||
{ return m_name; }
|
{ return m_name; }
|
||||||
|
|
||||||
virtual Core::Id id() const
|
|
||||||
{ return Core::Id::fromString(m_name); }
|
|
||||||
|
|
||||||
virtual Core::IDocument *document() const
|
virtual Core::IDocument *document() const
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
|
|
||||||
|
@@ -69,6 +69,7 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName)
|
|||||||
: m_manager(manager),
|
: m_manager(manager),
|
||||||
m_fileName(fileName)
|
m_fileName(fileName)
|
||||||
{
|
{
|
||||||
|
setId(Constants::GENERICPROJECT_ID);
|
||||||
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
|
setProjectContext(Context(GenericProjectManager::Constants::PROJECTCONTEXT));
|
||||||
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
|
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
|
||||||
|
|
||||||
@@ -375,11 +376,6 @@ QString GenericProject::displayName() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Id GenericProject::id() const
|
|
||||||
{
|
|
||||||
return Id(Constants::GENERICPROJECT_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDocument *GenericProject::document() const
|
IDocument *GenericProject::document() const
|
||||||
{
|
{
|
||||||
return m_creatorIDocument;
|
return m_creatorIDocument;
|
||||||
|
@@ -60,7 +60,6 @@ public:
|
|||||||
QString configFileName() const;
|
QString configFileName() const;
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
Core::Id id() const;
|
|
||||||
Core::IDocument *document() const;
|
Core::IDocument *document() const;
|
||||||
ProjectExplorer::IProjectManager *projectManager() const;
|
ProjectExplorer::IProjectManager *projectManager() const;
|
||||||
|
|
||||||
|
@@ -85,6 +85,7 @@ public:
|
|||||||
ProjectPrivate();
|
ProjectPrivate();
|
||||||
~ProjectPrivate();
|
~ProjectPrivate();
|
||||||
|
|
||||||
|
Core::Id m_id;
|
||||||
QList<Target *> m_targets;
|
QList<Target *> m_targets;
|
||||||
Target *m_activeTarget;
|
Target *m_activeTarget;
|
||||||
EditorConfiguration *m_editorConfiguration;
|
EditorConfiguration *m_editorConfiguration;
|
||||||
@@ -114,6 +115,12 @@ Project::~Project()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core::Id Project::id() const
|
||||||
|
{
|
||||||
|
QTC_CHECK(d->m_id.isValid());
|
||||||
|
return d->m_id;
|
||||||
|
}
|
||||||
|
|
||||||
QString Project::projectFilePath() const
|
QString Project::projectFilePath() const
|
||||||
{
|
{
|
||||||
return document()->filePath();
|
return document()->filePath();
|
||||||
@@ -264,6 +271,11 @@ bool Project::setupTarget(Target *t)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Project::setId(Core::Id id)
|
||||||
|
{
|
||||||
|
d->m_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
Target *Project::restoreTarget(const QVariantMap &data)
|
Target *Project::restoreTarget(const QVariantMap &data)
|
||||||
{
|
{
|
||||||
Core::Id id = idFromMap(data);
|
Core::Id id = idFromMap(data);
|
||||||
|
@@ -73,7 +73,7 @@ public:
|
|||||||
virtual ~Project();
|
virtual ~Project();
|
||||||
|
|
||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual Core::Id id() const = 0;
|
Core::Id id() const;
|
||||||
virtual Core::IDocument *document() const = 0;
|
virtual Core::IDocument *document() const = 0;
|
||||||
virtual IProjectManager *projectManager() const = 0;
|
virtual IProjectManager *projectManager() const = 0;
|
||||||
|
|
||||||
@@ -164,6 +164,7 @@ protected:
|
|||||||
virtual bool fromMap(const QVariantMap &map);
|
virtual bool fromMap(const QVariantMap &map);
|
||||||
virtual bool setupTarget(Target *t);
|
virtual bool setupTarget(Target *t);
|
||||||
|
|
||||||
|
void setId(Core::Id id);
|
||||||
void setProjectContext(Core::Context context);
|
void setProjectContext(Core::Context context);
|
||||||
void setProjectLanguages(Core::Context language);
|
void setProjectLanguages(Core::Context language);
|
||||||
void addProjectLanguage(Core::Id id);
|
void addProjectLanguage(Core::Id id);
|
||||||
|
@@ -102,6 +102,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
|
|||||||
{
|
{
|
||||||
m_parsingDelay.setInterval(1000); // delay parsing by 1s.
|
m_parsingDelay.setInterval(1000); // delay parsing by 1s.
|
||||||
|
|
||||||
|
setId(Constants::PROJECT_ID);
|
||||||
setProjectContext(Context(Constants::PROJECT_ID));
|
setProjectContext(Context(Constants::PROJECT_ID));
|
||||||
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
|
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX));
|
||||||
|
|
||||||
@@ -132,11 +133,6 @@ QString QbsProject::displayName() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Id QbsProject::id() const
|
|
||||||
{
|
|
||||||
return Constants::PROJECT_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
IDocument *QbsProject::document() const
|
IDocument *QbsProject::document() const
|
||||||
{
|
{
|
||||||
foreach (IDocument *doc, m_qbsDocuments) {
|
foreach (IDocument *doc, m_qbsDocuments) {
|
||||||
|
@@ -74,7 +74,6 @@ public:
|
|||||||
~QbsProject();
|
~QbsProject();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
Core::Id id() const;
|
|
||||||
Core::IDocument *document() const;
|
Core::IDocument *document() const;
|
||||||
QbsManager *projectManager() const;
|
QbsManager *projectManager() const;
|
||||||
|
|
||||||
|
@@ -110,6 +110,7 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
|
|||||||
m_defaultImport(UnknownImport),
|
m_defaultImport(UnknownImport),
|
||||||
m_modelManager(QmlJS::ModelManagerInterface::instance())
|
m_modelManager(QmlJS::ModelManagerInterface::instance())
|
||||||
{
|
{
|
||||||
|
setId("QmlProjectManager.QmlProject");
|
||||||
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
setProjectContext(Context(QmlProjectManager::Constants::PROJECTCONTEXT));
|
||||||
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
|
setProjectLanguages(Context(ProjectExplorer::Constants::LANG_QMLJS));
|
||||||
|
|
||||||
@@ -311,11 +312,6 @@ QString QmlProject::displayName() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Id QmlProject::id() const
|
|
||||||
{
|
|
||||||
return "QmlProjectManager.QmlProject";
|
|
||||||
}
|
|
||||||
|
|
||||||
IDocument *QmlProject::document() const
|
IDocument *QmlProject::document() const
|
||||||
{
|
{
|
||||||
return m_file;
|
return m_file;
|
||||||
|
@@ -61,7 +61,6 @@ public:
|
|||||||
QString filesFileName() const;
|
QString filesFileName() const;
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
Core::Id id() const;
|
|
||||||
Core::IDocument *document() const;
|
Core::IDocument *document() const;
|
||||||
ProjectExplorer::IProjectManager *projectManager() const;
|
ProjectExplorer::IProjectManager *projectManager() const;
|
||||||
|
|
||||||
|
@@ -343,6 +343,7 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
|
|||||||
m_centralizedFolderWatcher(0),
|
m_centralizedFolderWatcher(0),
|
||||||
m_activeTarget(0)
|
m_activeTarget(0)
|
||||||
{
|
{
|
||||||
|
setId(Constants::QT4PROJECT_ID);
|
||||||
setProjectContext(Core::Context(Qt4ProjectManager::Constants::PROJECT_ID));
|
setProjectContext(Core::Context(Qt4ProjectManager::Constants::PROJECT_ID));
|
||||||
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
|
||||||
|
|
||||||
@@ -888,11 +889,6 @@ QString Qt4Project::displayName() const
|
|||||||
return QFileInfo(projectFilePath()).completeBaseName();
|
return QFileInfo(projectFilePath()).completeBaseName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id Qt4Project::id() const
|
|
||||||
{
|
|
||||||
return Core::Id(Constants::QT4PROJECT_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IDocument *Qt4Project::document() const
|
Core::IDocument *Qt4Project::document() const
|
||||||
{
|
{
|
||||||
return m_fileInfo;
|
return m_fileInfo;
|
||||||
|
@@ -77,7 +77,6 @@ public:
|
|||||||
virtual ~Qt4Project();
|
virtual ~Qt4Project();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
Core::Id id() const;
|
|
||||||
Core::IDocument *document() const;
|
Core::IDocument *document() const;
|
||||||
ProjectExplorer::IProjectManager *projectManager() const;
|
ProjectExplorer::IProjectManager *projectManager() const;
|
||||||
Qt4Manager *qt4ProjectManager() const;
|
Qt4Manager *qt4ProjectManager() const;
|
||||||
|
Reference in New Issue
Block a user