Commit f463c4da authored by hjk's avatar hjk

ProjectExplorer: Make Project::id value based

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