11 #include "settings/lib/ISettingCallback.h" 12 #include "threads/CriticalSection.h" 54 virtual bool Load() = 0;
72 virtual bool Save() = 0;
108 std::shared_ptr<CSetting>
GetSetting(
const std::string&
id)
const;
114 std::vector<std::shared_ptr<CSettingSection>>
GetSections()
const;
121 std::shared_ptr<CSettingSection>
GetSection(
const std::string& section)
const;
129 bool GetBool(
const std::string&
id)
const;
136 int GetInt(
const std::string&
id)
const;
143 double GetNumber(
const std::string&
id)
const;
150 std::string
GetString(
const std::string&
id)
const;
157 std::vector<CVariant>
GetList(
const std::string&
id)
const;
166 bool SetBool(
const std::string&
id,
bool value);
181 bool SetInt(
const std::string&
id,
int value);
189 bool SetNumber(
const std::string&
id,
double value);
197 bool SetString(
const std::string&
id,
const std::string& value);
205 bool SetList(
const std::string&
id,
const std::vector<CVariant>& value);
222 virtual void InitializeSettingTypes() { }
223 virtual void InitializeControls() { }
224 virtual void InitializeOptionFillers() { }
225 virtual void UninitializeOptionFillers() { }
226 virtual void InitializeConditions() { }
227 virtual void UninitializeConditions() { }
228 virtual bool InitializeDefinitions() = 0;
229 virtual void InitializeVisibility() { }
230 virtual void InitializeDefaults() { }
231 virtual void InitializeISettingsHandlers() { }
232 virtual void UninitializeISettingsHandlers() { }
233 virtual void InitializeISubSettings() { }
234 virtual void UninitializeISubSettings() { }
235 virtual void InitializeISettingCallbacks() { }
236 virtual void UninitializeISettingCallbacks() { }
238 bool InitializeDefinitionsFromXml(
const CXBMCTinyXML& xml);
273 bool m_initialized =
false;
275 mutable CCriticalSection m_critical;
virtual bool Load()=0
Loads the setting values.
virtual bool IsLoaded() const
Returns whether the settings system has been loaded or not.
Definition: SettingsBase.cpp:113
bool SetNumber(const std::string &id, double value)
Sets the real number value of the setting with the given identifier.
Definition: SettingsBase.cpp:223
virtual void Unload()
Unloads the previously loaded setting values.
Definition: SettingsBase.cpp:131
int GetInt(const std::string &id) const
Gets the integer value of the setting with the given identifier.
Definition: SettingsBase.cpp:208
std::shared_ptr< CSetting > GetSetting(const std::string &id) const
Gets the setting with the given identifier.
Definition: SettingsBase.cpp:172
Definition: XBMCTinyXML.h:33
virtual bool IsInitialized() const
Returns whether the settings system has been initialized or not.
Definition: SettingsBase.cpp:67
void UnregisterCallback(ISettingCallback *callback)
Unregisters the given ISettingCallback implementation.
Definition: SettingsBase.cpp:167
Definition: ISettingCallback.h:16
std::vector< std::shared_ptr< CSettingSection > > GetSections() const
Gets the full list of setting sections.
Definition: SettingsBase.cpp:180
bool SaveValuesToXml(CXBMCTinyXML &xml) const
Saves the setting values in XML format to the given document.
Definition: SettingsBase.cpp:118
Setting base class containing all the properties which are common to all settings independent of the ...
Definition: Setting.h:46
virtual void SetLoaded()
Tells the settings system that all setting values have been loaded.
Definition: SettingsBase.cpp:108
bool SetDefault(const std::string &id)
Sets the value of the setting with the given identifier to its default.
Definition: SettingsBase.cpp:256
bool SetList(const std::string &id, const std::vector< CVariant > &value)
Sets the values of the list setting with the given identifier.
Definition: SettingsBase.cpp:247
std::vector< CVariant > GetList(const std::string &id) const
Gets the values of the list setting with the given identifier.
Definition: SettingsBase.cpp:238
double GetNumber(const std::string &id) const
Gets the real number value of the setting with the given identifier.
Definition: SettingsBase.cpp:218
std::string GetString(const std::string &id) const
Gets the string value of the setting with the given identifier.
Definition: SettingsBase.cpp:228
bool SetInt(const std::string &id, int value)
Sets the integer value of the setting with the given identifier.
Definition: SettingsBase.cpp:213
Section of setting categories.
Definition: SettingSection.h:152
virtual void Uninitialize()
Uninitializes the settings system.
Definition: SettingsBase.cpp:136
bool LoadHiddenValuesFromXml(const TiXmlElement *root)
Loads hidden setting values from the given XML element.
Definition: SettingsBase.cpp:89
bool GetBool(const std::string &id) const
Gets the boolean value of the setting with the given identifier.
Definition: SettingsBase.cpp:193
void RegisterCallback(ISettingCallback *callback, const std::set< std::string > &settingList)
Registers the given ISettingCallback implementation for the given set of settings.
Definition: SettingsBase.cpp:162
void SetDefaults()
Sets the value of all settings to their default.
Definition: SettingsBase.cpp:261
bool SetBool(const std::string &id, bool value)
Sets the boolean value of the setting with the given identifier.
Definition: SettingsBase.cpp:198
Basic wrapper around CSettingsManager providing the framework for properly setting up the settings ma...
Definition: SettingsBase.h:31
Settings manager responsible for initializing, loading and handling all settings. ...
Definition: SettingsManager.h:41
bool SetString(const std::string &id, const std::string &value)
Sets the string value of the setting with the given identifier.
Definition: SettingsBase.cpp:233
bool ToggleBool(const std::string &id)
Toggles the boolean value of the setting with the given identifier.
Definition: SettingsBase.cpp:203
bool LoadValuesFromXml(const CXBMCTinyXML &xml, bool &updated)
Loads setting values from the given document in XML format.
Definition: SettingsBase.cpp:72
virtual bool Initialize()
Initializes the setting system with the generic settings definition and platform specific setting def...
Definition: SettingsBase.cpp:33
virtual bool Save()=0
Saves the setting values.
std::shared_ptr< CSettingSection > GetSection(const std::string §ion) const
Gets the setting section with the given identifier.
Definition: SettingsBase.cpp:185