Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Basic wrapper around CSettingsManager providing the framework for properly setting up the settings manager and registering all the callbacks, handlers and custom setting types. More...
#include <SettingsBase.h>
Public Member Functions | |
virtual | ~CSettingsBase () |
CSettingsManager * | GetSettingsManager () const |
virtual bool | Initialize () |
Initializes the setting system with the generic settings definition and platform specific setting definitions. | |
virtual bool | IsInitialized () const |
Returns whether the settings system has been initialized or not. | |
virtual bool | Load ()=0 |
Loads the setting values. | |
virtual void | SetLoaded () |
Tells the settings system that all setting values have been loaded. | |
virtual bool | IsLoaded () const |
Returns whether the settings system has been loaded or not. | |
virtual bool | Save ()=0 |
Saves the setting values. | |
virtual void | Unload () |
Unloads the previously loaded setting values. | |
virtual void | Uninitialize () |
Uninitializes the settings system. | |
void | RegisterCallback (ISettingCallback *callback, const std::set< std::string > &settingList) |
Registers the given ISettingCallback implementation for the given set of settings. | |
void | UnregisterCallback (ISettingCallback *callback) |
Unregisters the given ISettingCallback implementation. | |
std::shared_ptr< CSetting > | GetSetting (const std::string &id) const |
Gets the setting with the given identifier. | |
std::vector< std::shared_ptr< CSettingSection > > | GetSections () const |
Gets the full list of setting sections. | |
std::shared_ptr< CSettingSection > | GetSection (const std::string §ion) const |
Gets the setting section with the given identifier. | |
bool | GetBool (const std::string &id) const |
Gets the boolean value of the setting with the given identifier. | |
int | GetInt (const std::string &id) const |
Gets the integer value of the setting with the given identifier. | |
double | GetNumber (const std::string &id) const |
Gets the real number value of the setting with the given identifier. | |
std::string | GetString (const std::string &id) const |
Gets the string value of the setting with the given identifier. | |
std::vector< CVariant > | GetList (const std::string &id) const |
Gets the values of the list setting with the given identifier. | |
bool | SetBool (const std::string &id, bool value) |
Sets the boolean value of the setting with the given identifier. | |
bool | ToggleBool (const std::string &id) |
Toggles the boolean value of the setting with the given identifier. | |
bool | SetInt (const std::string &id, int value) |
Sets the integer value of the setting with the given identifier. | |
bool | SetNumber (const std::string &id, double value) |
Sets the real number value of the setting with the given identifier. | |
bool | SetString (const std::string &id, const std::string &value) |
Sets the string value of the setting with the given identifier. | |
bool | SetList (const std::string &id, const std::vector< CVariant > &value) |
Sets the values of the list setting with the given identifier. | |
bool | SetDefault (const std::string &id) |
Sets the value of the setting with the given identifier to its default. | |
void | SetDefaults () |
Sets the value of all settings to their default. | |
Protected Attributes | |
bool | m_initialized = false |
CSettingsManager * | m_settingsManager |
CCriticalSection | m_critical |
Basic wrapper around CSettingsManager providing the framework for properly setting up the settings manager and registering all the callbacks, handlers and custom setting types.
|
virtual |
|
protected |
bool CSettingsBase::GetBool | ( | const std::string & | id | ) | const |
Gets the boolean value of the setting with the given identifier.
id | Setting identifier |
int CSettingsBase::GetInt | ( | const std::string & | id | ) | const |
Gets the integer value of the setting with the given identifier.
id | Setting identifier |
std::vector< CVariant > CSettingsBase::GetList | ( | const std::string & | id | ) | const |
Gets the values of the list setting with the given identifier.
id | Setting identifier |
double CSettingsBase::GetNumber | ( | const std::string & | id | ) | const |
Gets the real number value of the setting with the given identifier.
id | Setting identifier |
std::shared_ptr< CSettingSection > CSettingsBase::GetSection | ( | const std::string & | section | ) | const |
Gets the setting section with the given identifier.
section | Setting section identifier |
std::vector< std::shared_ptr< CSettingSection > > CSettingsBase::GetSections | ( | ) | const |
Gets the full list of setting sections.
SettingPtr CSettingsBase::GetSetting | ( | const std::string & | id | ) | const |
Gets the setting with the given identifier.
id | Setting identifier |
|
inline |
std::string CSettingsBase::GetString | ( | const std::string & | id | ) | const |
Gets the string value of the setting with the given identifier.
id | Setting identifier |
|
virtual |
Initializes the setting system with the generic settings definition and platform specific setting definitions.
Reimplemented in ADDON::CAddonSettings, and CSettings.
|
inlineprotectedvirtual |
Reimplemented in ADDON::CAddonSettings, and CSettings.
|
inlineprotectedvirtual |
Reimplemented in ADDON::CAddonSettings, and CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
protectedpure virtual |
Implemented in ADDON::CAddonSettings, and CSettings.
|
protected |
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in ADDON::CAddonSettings, and CSettings.
|
inlineprotectedvirtual |
|
virtual |
Returns whether the settings system has been initialized or not.
|
virtual |
Returns whether the settings system has been loaded or not.
|
pure virtual |
Loads the setting values.
Implemented in ADDON::CAddonSettings, and CSettings.
|
protected |
Loads hidden setting values from the given XML element.
root | XML element containing setting values |
|
protected |
Loads setting values from the given document in XML format.
xml | Document in XML format from which the settings are loaded |
updated | Output parameter indicating whether setting values had to be updated |
Loads setting values from the given XML element.
root | XML element containing setting values |
updated | Output parameter indicating whether setting values had to be updated |
void CSettingsBase::RegisterCallback | ( | ISettingCallback * | callback, |
const std::set< std::string > & | settingList ) |
Registers the given ISettingCallback implementation for the given set of settings.
callback | ISettingCallback implementation |
settingList | List of setting identifiers for which the given callback shall be triggered |
|
pure virtual |
Saves the setting values.
Implemented in ADDON::CAddonSettings, and CSettings.
|
protected |
Saves the setting values in XML format to the given document.
xml | Document to save the setting values in XML format into |
Sets the boolean value of the setting with the given identifier.
id | Setting identifier |
value | Boolean value to set |
bool CSettingsBase::SetDefault | ( | const std::string & | id | ) |
Sets the value of the setting with the given identifier to its default.
id | Setting identifier |
void CSettingsBase::SetDefaults | ( | ) |
Sets the value of all settings to their default.
Sets the integer value of the setting with the given identifier.
id | Setting identifier |
value | Integer value to set |
Sets the values of the list setting with the given identifier.
id | Setting identifier |
value | Values to set |
|
virtual |
Tells the settings system that all setting values have been loaded.
This manual trigger is necessary to enable the ISettingCallback methods being executed.
bool CSettingsBase::SetNumber | ( | const std::string & | id, |
double | value ) |
Sets the real number value of the setting with the given identifier.
id | Setting identifier |
value | Real number value to set |
bool CSettingsBase::SetString | ( | const std::string & | id, |
const std::string & | value ) |
Sets the string value of the setting with the given identifier.
id | Setting identifier |
value | String value to set |
bool CSettingsBase::ToggleBool | ( | const std::string & | id | ) |
Toggles the boolean value of the setting with the given identifier.
id | Setting identifier |
|
virtual |
Uninitializes the settings system.
Unregisters all previously registered callbacks and destroys all setting objects.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
inlineprotectedvirtual |
Reimplemented in CSettings.
|
virtual |
Unloads the previously loaded setting values.
The values of all the settings are reset to their default values.
void CSettingsBase::UnregisterCallback | ( | ISettingCallback * | callback | ) |
Unregisters the given ISettingCallback implementation.
callback | ISettingCallback implementation |
|
mutableprotected |
|
protected |
|
protected |