aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-01-16 16:00:51 +0100
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-01-16 17:50:16 +0100
commit1ed6e1b3e7475d28c95305bd4f53ff4a74655192 (patch)
treec92353717dabcf199d635c228502b5a803092c77
parent4142c7a911f59a135911cce51e0179625e06595f (diff)
Make config commands understand booleans.
The user frontends for our settings assume everything is a string, so do the necessary conversions. Note that this means there is no way to set the string values "true" and "false". For a correct implementation, users would need to supply types when adding new values. Change-Id: If3638525eeebe73857834389bae46484eee92cc3 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/app/shared/qbssettings.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/app/shared/qbssettings.h b/src/app/shared/qbssettings.h
index a32f03e46..356399cde 100644
--- a/src/app/shared/qbssettings.h
+++ b/src/app/shared/qbssettings.h
@@ -44,11 +44,17 @@ inline SettingsPtr qbsSettings()
inline QString settingsValueToRepresentation(const QVariant &value)
{
+ if (value.type() == QVariant::Bool)
+ return QLatin1String(value.toBool() ? "true" : "false");
return value.toStringList().join(QLatin1String(","));
}
inline QVariant representationToSettingsValue(const QString &representation)
{
+ if (representation == QLatin1String("true"))
+ return QVariant(true);
+ if (representation == QLatin1String("false"))
+ return QVariant(false);
const QStringList list = representation.split(QLatin1Char(','), QString::SkipEmptyParts);
if (list.count() > 1)
return list;