MacroExpander: Allow registering local expansions

This allows a MacroExpander also to describe an expansion it can
do which was restricted to the global VariableManager only.

The global is now just a thin (unneeded) wrapper about new "standard"
functionality.

Change-Id: Ida7ca70cf3d319eae4220ea8d12f3dd1c0d4042c
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
hjk
2014-10-13 12:49:05 +02:00
parent e43af30faa
commit e279c7e007
35 changed files with 475 additions and 525 deletions

View File

@@ -87,7 +87,8 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
this, SLOT(slotSettingsChanged()));
slotSettingsChanged();
VariableManager::registerVariable(Constants::VAR_VCS_NAME,
Utils::MacroExpander *expander = globalMacroExpander();
expander->registerVariable(Constants::VAR_VCS_NAME,
tr("Name of the version control system in use by the current project."),
[]() -> QString {
IVersionControl *vc = 0;
@@ -96,7 +97,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
return vc ? vc->displayName() : QString();
});
VariableManager::registerVariable(Constants::VAR_VCS_TOPIC,
expander->registerVariable(Constants::VAR_VCS_TOPIC,
tr("The current version control topic (branch or tag) identification of the current project."),
[]() -> QString {
IVersionControl *vc = 0;
@@ -106,7 +107,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
return vc ? vc->vcsTopic(topLevel) : QString();
});
VariableManager::registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
expander->registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
tr("The top level path to the repository the current project is in."),
[]() -> QString {
if (Project *project = ProjectExplorerPlugin::currentProject())