aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtsupport/qtkitinformation.cpp
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-10-13 12:49:05 +0200
committerhjk <hjk121@nokiamail.com>2014-10-15 00:49:17 +0200
commite279c7e00787230dcd89301ebb7a182a35c0531b (patch)
tree1f43783b3bae7d3735a36807f040fd3aa1bb5556 /src/plugins/qtsupport/qtkitinformation.cpp
parente43af30faabaf3f38a6a652c519c61512203054f (diff)
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>
Diffstat (limited to 'src/plugins/qtsupport/qtkitinformation.cpp')
-rw-r--r--src/plugins/qtsupport/qtkitinformation.cpp53
1 files changed, 15 insertions, 38 deletions
diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp
index 537f7d2ae7b..4879ff91acf 100644
--- a/src/plugins/qtsupport/qtkitinformation.cpp
+++ b/src/plugins/qtsupport/qtkitinformation.cpp
@@ -38,28 +38,13 @@
#include <projectexplorer/kitinformationmacroexpander.h>
#include <utils/buildablehelperlibrary.h>
+#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace QtSupport {
-namespace Internal {
-
-class QtKitInformationMacroExpander : public ProjectExplorer::KitInformationMacroExpander
-{
-public:
- QtKitInformationMacroExpander(const ProjectExplorer::Kit *k) :
- ProjectExplorer::KitInformationMacroExpander(k)
- { }
-
- bool resolveMacro(const QString &name, QString *ret)
- {
- return QtKitInformation::resolveQtMacro(QtKitInformation::qtVersion(kit()), name, ret);
- }
-};
-
-} // namespace Internal
QtKitInformation::QtKitInformation()
{
@@ -71,26 +56,6 @@ QtKitInformation::QtKitInformation()
this, SLOT(kitsWereLoaded()));
}
-bool QtKitInformation::resolveQtMacro(const BaseQtVersion *version, const QString &name, QString *ret)
-{
- const QString noInfo = QCoreApplication::translate("QtSupport::QtKitInformation", "none");
-
- if (name == QLatin1String("Qt:version")) {
- *ret = version ? version->qtVersionString() : noInfo;
- return true;
- } else if (name == QLatin1String("Qt:name")) {
- *ret = version ? version->displayName() : noInfo;
- return true;
- } else if (name == QLatin1String("Qt:type")) {
- *ret = version ? version->type() : noInfo;
- return true;
- } else if (name == QLatin1String("Qt:mkspec")) {
- *ret = version ? version->mkspec().toUserOutput() : noInfo;
- return true;
- }
- return false;
-}
-
QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
{
Q_UNUSED(k);
@@ -167,9 +132,21 @@ ProjectExplorer::IOutputParser *QtKitInformation::createOutputParser(const Proje
return 0;
}
-Utils::AbstractMacroExpander *QtKitInformation::createMacroExpander(const ProjectExplorer::Kit *k) const
+bool QtKitInformation::resolveMacro(const ProjectExplorer::Kit *kit, const QString &name, QString *ret) const
{
- return new Internal::QtKitInformationMacroExpander(k);
+ if (BaseQtVersion *version = qtVersion(kit)) {
+ MacroExpander *expander = version->macroExpander();
+ if (expander->resolveMacro(name, ret))
+ return true;
+
+ // FIXME: Handle in version expander once we can detect loops.
+ if (name == QLatin1String("Qt:name")) {
+ *ret = version->displayName();
+ return true;
+ }
+ }
+
+ return false;
}
Core::Id QtKitInformation::id()