Commit 040a0f2d authored by Tobias Hunger's avatar Tobias Hunger

JsonWizard: Allow for variables in features passed to KitsPage

Change-Id: I8c0d6b8b6e46d2de7cd4b088c7c98c2efe57427f
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 57d65274
...@@ -145,7 +145,7 @@ FeatureSet JsonKitsPage::evaluate(const QVector<JsonKitsPage::ConditionalFeature ...@@ -145,7 +145,7 @@ FeatureSet JsonKitsPage::evaluate(const QVector<JsonKitsPage::ConditionalFeature
FeatureSet features; FeatureSet features;
foreach (const ConditionalFeature &f, list) { foreach (const ConditionalFeature &f, list) {
if (JsonWizard::boolFromVariant(f.condition, wiz->expander())) if (JsonWizard::boolFromVariant(f.condition, wiz->expander()))
features |= f.feature; features |= Feature::fromString(wiz->expander()->expand(f.feature));
} }
return features; return features;
} }
...@@ -167,7 +167,7 @@ QVector<JsonKitsPage::ConditionalFeature> JsonKitsPage::parseFeatures(const QVar ...@@ -167,7 +167,7 @@ QVector<JsonKitsPage::ConditionalFeature> JsonKitsPage::parseFeatures(const QVar
foreach (const QVariant &element, data.toList()) { foreach (const QVariant &element, data.toList()) {
if (element.type() == QVariant::String) { if (element.type() == QVariant::String) {
result.append({ Feature::fromString(element.toString()), QVariant(true) }); result.append({ element.toString(), QVariant(true) });
} else if (element.type() == QVariant::Map) { } else if (element.type() == QVariant::Map) {
const QVariantMap obj = element.toMap(); const QVariantMap obj = element.toMap();
const QString feature = obj.value(QLatin1String(KEY_FEATURE)).toString(); const QString feature = obj.value(QLatin1String(KEY_FEATURE)).toString();
...@@ -177,7 +177,7 @@ QVector<JsonKitsPage::ConditionalFeature> JsonKitsPage::parseFeatures(const QVar ...@@ -177,7 +177,7 @@ QVector<JsonKitsPage::ConditionalFeature> JsonKitsPage::parseFeatures(const QVar
return QVector<ConditionalFeature>(); return QVector<ConditionalFeature>();
} }
result.append({ Feature::fromString(feature), obj.value(QLatin1String(KEY_CONDITION), true) }); result.append({ feature, obj.value(QLatin1String(KEY_CONDITION), true) });
} else { } else {
if (errorMessage) if (errorMessage)
*errorMessage = tr("Feature list element is not a string or object."); *errorMessage = tr("Feature list element is not a string or object.");
......
...@@ -58,10 +58,10 @@ public: ...@@ -58,10 +58,10 @@ public:
class ConditionalFeature { class ConditionalFeature {
public: public:
ConditionalFeature() = default; ConditionalFeature() = default;
ConditionalFeature(const Core::Feature &f, const QVariant &c) : feature(f), condition(c) ConditionalFeature(const QString &f, const QVariant &c) : feature(f), condition(c)
{ } { }
Core::Feature feature; QString feature;
QVariant condition; QVariant condition;
}; };
static QVector<ConditionalFeature> parseFeatures(const QVariant &data, static QVector<ConditionalFeature> parseFeatures(const QVariant &data,
......
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