diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-07-08 12:28:16 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-09 16:59:35 +0200 |
commit | 89513bce4f2996be93bdb30b32a1ef844d9cec36 (patch) | |
tree | f8cdddd64c77710c6b41716aef2621c0d3f0c931 /src/app/shared | |
parent | 9b925ffec2ca3e87893e5699cc8d48132c5af517 (diff) |
factor out settings-related functions to own file
This allows us to add more complex functionality to the
Settings/String conversion functions.
Change-Id: Ic4896868914d7f6e5a0bbd64beb0d64d3fd82ce7
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/app/shared')
-rw-r--r-- | src/app/shared/qbssettings.cpp | 49 | ||||
-rw-r--r-- | src/app/shared/qbssettings.h | 20 |
2 files changed, 51 insertions, 18 deletions
diff --git a/src/app/shared/qbssettings.cpp b/src/app/shared/qbssettings.cpp new file mode 100644 index 000000000..5f6131214 --- /dev/null +++ b/src/app/shared/qbssettings.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Build Suite. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qbssettings.h" + +QString settingsValueToRepresentation(const QVariant &value) +{ + if (value.type() == QVariant::Bool) + return QLatin1String(value.toBool() ? "true" : "false"); + return value.toStringList().join(QLatin1String(",")); +} + +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; + return representation; +} diff --git a/src/app/shared/qbssettings.h b/src/app/shared/qbssettings.h index d5b8e4be1..36a192622 100644 --- a/src/app/shared/qbssettings.h +++ b/src/app/shared/qbssettings.h @@ -34,23 +34,7 @@ #include <QStringList> #include <QVariant> -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; - return representation; -} +QString settingsValueToRepresentation(const QVariant &value); +QVariant representationToSettingsValue(const QString &representation); #endif // Include guard |