diff options
Diffstat (limited to 'Swift/Controllers/ProfileSettingsProvider.h')
-rw-r--r-- | Swift/Controllers/ProfileSettingsProvider.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Swift/Controllers/ProfileSettingsProvider.h b/Swift/Controllers/ProfileSettingsProvider.h new file mode 100644 index 0000000..c485418 --- /dev/null +++ b/Swift/Controllers/ProfileSettingsProvider.h @@ -0,0 +1,33 @@ +#pragma once + +#include "Swiften/Settings/SettingsProvider.h" + +namespace Swift { + +class ProfileSettingsProvider { + public: + ProfileSettingsProvider(const String& profile, SettingsProvider* provider) : profile_(profile) { + provider_ = provider; + bool found = false; + foreach (String existingProfile, provider->getAvailableProfiles()) { + if (existingProfile == profile) { + found = true; + } + } + if (!found) { + provider_->createProfile(profile); + } + }; + virtual ~ProfileSettingsProvider() {}; + virtual String getStringSetting(const String &settingPath) {return provider_->getStringSetting(profileSettingPath(settingPath));}; + virtual void storeString(const String &settingPath, const String &settingValue) {provider_->storeString(profileSettingPath(settingPath), settingValue);}; + + private: + String profileSettingPath(const String &settingPath) {return profile_ + ":" + settingPath;}; + SettingsProvider* provider_; + String profile_; +}; + +} + + |