diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtSettingsProvider.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp index 4a8a868..e8479a4 100644 --- a/Swift/QtUI/QtSettingsProvider.cpp +++ b/Swift/QtUI/QtSettingsProvider.cpp @@ -5,7 +5,6 @@ */ #include "QtSettingsProvider.h" -#include "QtSwiftUtil.h" #include <QStringList> @@ -19,30 +18,30 @@ QtSettingsProvider::~QtSettingsProvider() { } std::string QtSettingsProvider::getStringSetting(const std::string &settingPath) { - QVariant setting = settings_.value(P2QSTRING(settingPath)); - return setting.isNull() ? "" : Q2PSTRING(setting.toString()); + QVariant setting = settings_.value(settingPath.c_str()); + return setting.isNull() ? "" : std::string(setting.toString().toUtf8()); } void QtSettingsProvider::storeString(const std::string &settingPath, const std::string &settingValue) { - settings_.setValue(P2QSTRING(settingPath), P2QSTRING(settingValue)); + settings_.setValue(settingPath.c_str(), settingValue.c_str()); } bool QtSettingsProvider::getBoolSetting(const std::string &settingPath, bool defaultValue) { - QVariant setting = settings_.value(P2QSTRING(settingPath)); + QVariant setting = settings_.value(settingPath.c_str()); return setting.isNull() ? defaultValue : setting.toBool(); } void QtSettingsProvider::storeBool(const std::string &settingPath, bool settingValue) { - settings_.setValue(P2QSTRING(settingPath), settingValue); + settings_.setValue(settingPath.c_str(), settingValue); } int QtSettingsProvider::getIntSetting(const std::string &settingPath, int defaultValue) { - QVariant setting = settings_.value(P2QSTRING(settingPath)); + QVariant setting = settings_.value(settingPath.c_str()); return setting.isNull() ? defaultValue : setting.toInt(); } void QtSettingsProvider::storeInt(const std::string &settingPath, int settingValue) { - settings_.setValue(P2QSTRING(settingPath), settingValue); + settings_.setValue(settingPath.c_str(), settingValue); } std::vector<std::string> QtSettingsProvider::getAvailableProfiles() { @@ -56,19 +55,19 @@ std::vector<std::string> QtSettingsProvider::getAvailableProfiles() { void QtSettingsProvider::createProfile(const std::string& profile) { QStringList stringList = settings_.value("profileList").toStringList(); - stringList.append(P2QSTRING(profile)); + stringList.append(profile.c_str()); settings_.setValue("profileList", stringList); } void QtSettingsProvider::removeProfile(const std::string& profile) { - QString profileStart(P2QSTRING(profile) + ":"); + QString profileStart(QString(profile.c_str()) + ":"); foreach (QString key, settings_.allKeys()) { if (key.startsWith(profileStart)) { settings_.remove(key); } } QStringList stringList = settings_.value("profileList").toStringList(); - stringList.removeAll(P2QSTRING(profile)); + stringList.removeAll(profile.c_str()); settings_.setValue("profileList", stringList); } |