ProjectExplorer: Add a MacroExpander member in each project

Provide Project:Name there by default, and make it accessible
from the target.

Change-Id: I2faa52dc8c0703f3245cac2ca15b942e3006993a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
hjk
2014-11-15 20:16:53 +01:00
parent 4d3d8bb730
commit 5a351eaa50
2 changed files with 20 additions and 3 deletions

View File

@@ -42,9 +42,12 @@
#include <coreplugin/icore.h>
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/kitmanager.h>
#include <limits>
#include <utils/qtcassert.h>
#include <utils/algorithm.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <limits>
/*!
\class ProjectExplorer::Project
@@ -98,6 +101,8 @@ public:
KitMatcher m_requiredKitMatcher;
KitMatcher m_preferredKitMatcher;
Utils::MacroExpander m_macroExpander;
};
ProjectPrivate::ProjectPrivate() :
@@ -109,7 +114,11 @@ ProjectPrivate::~ProjectPrivate()
{ delete m_accessor; }
Project::Project() : d(new ProjectPrivate)
{ }
{
d->m_macroExpander.setDisplayName(tr("Project"));
d->m_macroExpander.registerVariable("Project:Name", tr("Project Name"),
[this] { return displayName(); });
}
Project::~Project()
{
@@ -516,6 +525,11 @@ void Project::setup(QList<const BuildInfo *> infoList)
}
}
Utils::MacroExpander *Project::macroExpander() const
{
return &d->m_macroExpander;
}
ProjectImporter *Project::createProjectImporter() const
{
return 0;