Variables: Use lambdas as callbacks to resolve variables

Instead of broadcasting for each resolution we ask the code
that knows about a specific variable directly.

Change-Id: I2f0f4f2acceba85a236995d236980594a3166bd8
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
hjk
2014-06-23 16:57:56 +02:00
parent 000fbe63bc
commit 2982a763ac
15 changed files with 292 additions and 414 deletions

View File

@@ -51,14 +51,6 @@ bool ProjectMacroExpander::resolveProjectMacro(const QString &name, QString *ret
result = m_projectName;
found = true;
}
} else if (Core::VariableManager::isFileVariable(
name.toUtf8(), ProjectExplorer::Constants::VAR_CURRENTPROJECT_PREFIX)) {
if (!m_projectFile.filePath().isEmpty()) {
result = Core::VariableManager::fileVariableValue(name.toUtf8(),
ProjectExplorer::Constants::VAR_CURRENTPROJECT_PREFIX,
m_projectFile);
found = true;
}
} else if (m_kit && name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTKIT_NAME)) {
result = m_kit->displayName();
found = true;
@@ -101,6 +93,7 @@ bool ProjectMacroExpander::resolveProjectMacro(const QString &name, QString *ret
return found;
}
// Try to resolve using local information, otherwise fall back to global variables.
bool ProjectMacroExpander::resolveMacro(const QString &name, QString *ret)
{
bool found = resolveProjectMacro(name, ret);