diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-03-01 08:03:50 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-03-03 09:00:30 (GMT) |
commit | fde71bd59b1412ae475c06f2d4100ce088e86af6 (patch) | |
tree | 4f3d85c700942d666c5ac5d032c757bc45bb1593 /Swift/QtUI/QtSettingsProvider.cpp | |
parent | 5271144cb6c0ecf3dc237af25197fa72a8737c09 (diff) | |
download | swift-contrib-fde71bd59b1412ae475c06f2d4100ce088e86af6.zip swift-contrib-fde71bd59b1412ae475c06f2d4100ce088e86af6.tar.bz2 |
Unit tests for SettingsProviderHierachy
Also fixing up errors they found and an uninitialised read left-over from the original patch.
Diffstat (limited to 'Swift/QtUI/QtSettingsProvider.cpp')
-rw-r--r-- | Swift/QtUI/QtSettingsProvider.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp index 0c4d49b..64e88d4 100644 --- a/Swift/QtUI/QtSettingsProvider.cpp +++ b/Swift/QtUI/QtSettingsProvider.cpp @@ -18,6 +18,11 @@ QtSettingsProvider::~QtSettingsProvider() { } +bool QtSettingsProvider::hasSetting(const std::string& key) { + return !settings_.value(key.c_str()).isNull(); +} + + std::string QtSettingsProvider::getSetting(const Setting<std::string>& setting) { QVariant variant = settings_.value(setting.getKey().c_str()); return variant.isNull() ? setting.getDefaultValue() : std::string(variant.toString().toUtf8()); |