Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
ADDON::CAddonSettings Class Reference

#include <AddonSettings.h>

Inheritance diagram for ADDON::CAddonSettings:
CSettingControlCreator CSettingCreator CSettingsBase ISettingCallback ISettingControlCreator ISettingCreator

Public Member Functions

 CAddonSettings (const std::shared_ptr< IAddon > &addon, AddonInstanceId instanceId)
 
 ~CAddonSettings () override=default
 
bool Initialize () override
 Initializes the setting system with the generic settings definition and platform specific setting definitions.
 
bool Load () override
 Loads the setting values.
 
bool Save () override
 Saves the setting values.
 
std::shared_ptr< CSettingCreateSetting (const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager=nullptr) const override
 Creates a new setting of the given custom setting type.
 
void OnSettingAction (const std::shared_ptr< const CSetting > &setting) override
 The given setting has been activated.
 
const std::string & GetAddonId () const
 
bool Initialize (const CXBMCTinyXML &doc, bool allowEmpty=false)
 
bool Load (const CXBMCTinyXML &doc)
 
bool Save (CXBMCTinyXML &doc) const
 
bool HasSettings () const
 
std::string GetSettingLabel (int label) const
 
std::shared_ptr< CSettingAddSetting (const std::string &settingId, bool value)
 
std::shared_ptr< CSettingAddSetting (const std::string &settingId, int value)
 
std::shared_ptr< CSettingAddSetting (const std::string &settingId, double value)
 
std::shared_ptr< CSettingAddSetting (const std::string &settingId, const std::string &value)
 
- Public Member Functions inherited from CSettingControlCreator
std::shared_ptr< ISettingControlCreateControl (const std::string &controlType) const override
 Creates a new setting control of the given custom setting control type.
 
- Public Member Functions inherited from ISettingControlCreator
virtual ~ISettingControlCreator ()=default
 
- Public Member Functions inherited from CSettingCreator
std::shared_ptr< CSettingCreateSetting (const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager=nullptr) const override
 Creates a new setting of the given custom setting type.
 
- Public Member Functions inherited from ISettingCreator
virtual ~ISettingCreator ()=default
 
- Public Member Functions inherited from CSettingsBase
virtual ~CSettingsBase ()
 
CSettingsManagerGetSettingsManager () const
 
virtual bool IsInitialized () const
 Returns whether the settings system has been initialized or not.
 
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 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< CSettingGetSetting (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< CSettingSectionGetSection (const std::string &section) 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< CVariantGetList (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.
 
- Public Member Functions inherited from ISettingCallback
virtual ~ISettingCallback ()=default
 
virtual bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting is being changed.
 
virtual void OnSettingChanged (const std::shared_ptr< const CSetting > &setting)
 The value of the given setting has changed.
 
virtual bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
 The given setting needs to be updated.
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed.
 

Protected Member Functions

void InitializeSettingTypes () override
 
void InitializeControls () override
 
void InitializeConditions () override
 
bool InitializeDefinitions () override
 
- Protected Member Functions inherited from CSettingControlCreator
 CSettingControlCreator ()=default
 
 ~CSettingControlCreator () override=default
 
- Protected Member Functions inherited from CSettingCreator
 CSettingCreator ()=default
 
 ~CSettingCreator () override=default
 
- Protected Member Functions inherited from CSettingsBase
 CSettingsBase ()
 
virtual void InitializeOptionFillers ()
 
virtual void UninitializeOptionFillers ()
 
virtual void UninitializeConditions ()
 
virtual void InitializeVisibility ()
 
virtual void InitializeDefaults ()
 
virtual void InitializeISettingsHandlers ()
 
virtual void UninitializeISettingsHandlers ()
 
virtual void InitializeISubSettings ()
 
virtual void UninitializeISubSettings ()
 
virtual void InitializeISettingCallbacks ()
 
virtual void UninitializeISettingCallbacks ()
 
bool InitializeDefinitionsFromXml (const CXBMCTinyXML &xml)
 
bool LoadValuesFromXml (const CXBMCTinyXML &xml, bool &updated)
 Loads setting values from the given document in XML format.
 
bool SaveValuesToXml (CXBMCTinyXML &xml) const
 Saves the setting values in XML format to the given document.
 
bool LoadValuesFromXml (const TiXmlElement *root, bool &updated)
 Loads setting values from the given XML element.
 
bool LoadHiddenValuesFromXml (const TiXmlElement *root)
 Loads hidden setting values from the given XML element.
 

Additional Inherited Members

- Protected Attributes inherited from CSettingsBase
bool m_initialized = false
 
CSettingsManagerm_settingsManager
 
CCriticalSection m_critical
 

Constructor & Destructor Documentation

◆ CAddonSettings()

ADDON::CAddonSettings::CAddonSettings ( const std::shared_ptr< IAddon > & addon,
AddonInstanceId instanceId )

◆ ~CAddonSettings()

ADDON::CAddonSettings::~CAddonSettings ( )
overridedefault

Member Function Documentation

◆ AddSetting() [1/4]

std::shared_ptr< CSetting > ADDON::CAddonSettings::AddSetting ( const std::string & settingId,
bool value )

◆ AddSetting() [2/4]

std::shared_ptr< CSetting > ADDON::CAddonSettings::AddSetting ( const std::string & settingId,
const std::string & value )

◆ AddSetting() [3/4]

std::shared_ptr< CSetting > ADDON::CAddonSettings::AddSetting ( const std::string & settingId,
double value )

◆ AddSetting() [4/4]

std::shared_ptr< CSetting > ADDON::CAddonSettings::AddSetting ( const std::string & settingId,
int value )

◆ CreateSetting()

std::shared_ptr< CSetting > ADDON::CAddonSettings::CreateSetting ( const std::string & settingType,
const std::string & settingId,
CSettingsManager * settingsManager = nullptr ) const
overridevirtual

Creates a new setting of the given custom setting type.

Parameters
settingTypestring representation of the setting type
settingIdIdentifier of the setting to be created
settingsManagerReference to the settings manager
Returns
A new setting object of the given (custom) setting type or nullptr if the setting type is unknown

Implements ISettingCreator.

◆ GetAddonId()

const std::string & ADDON::CAddonSettings::GetAddonId ( ) const
inline

◆ GetSettingLabel()

std::string ADDON::CAddonSettings::GetSettingLabel ( int label) const

◆ HasSettings()

bool ADDON::CAddonSettings::HasSettings ( ) const

◆ Initialize() [1/2]

bool ADDON::CAddonSettings::Initialize ( )
inlineoverridevirtual

Initializes the setting system with the generic settings definition and platform specific setting definitions.

Returns
True if the initialization was successful, false otherwise

Reimplemented from CSettingsBase.

◆ Initialize() [2/2]

bool ADDON::CAddonSettings::Initialize ( const CXBMCTinyXML & doc,
bool allowEmpty = false )

◆ InitializeConditions()

void ADDON::CAddonSettings::InitializeConditions ( )
overrideprotectedvirtual

Reimplemented from CSettingsBase.

◆ InitializeControls()

void ADDON::CAddonSettings::InitializeControls ( )
overrideprotectedvirtual

Reimplemented from CSettingsBase.

◆ InitializeDefinitions()

bool ADDON::CAddonSettings::InitializeDefinitions ( )
inlineoverrideprotectedvirtual

Implements CSettingsBase.

◆ InitializeSettingTypes()

void ADDON::CAddonSettings::InitializeSettingTypes ( )
overrideprotectedvirtual

Reimplemented from CSettingsBase.

◆ Load() [1/2]

bool ADDON::CAddonSettings::Load ( )
inlineoverridevirtual

Loads the setting values.

Returns
True if the setting values are successfully loaded, false otherwise

Implements CSettingsBase.

◆ Load() [2/2]

bool ADDON::CAddonSettings::Load ( const CXBMCTinyXML & doc)

◆ OnSettingAction()

void ADDON::CAddonSettings::OnSettingAction ( const std::shared_ptr< const CSetting > & setting)
overridevirtual

The given setting has been activated.

This callback is triggered whenever the given setting has been activated. This callback is only fired for CSettingAction settings.

Parameters
settingThe setting which has been activated.

Reimplemented from ISettingCallback.

◆ Save() [1/2]

bool ADDON::CAddonSettings::Save ( )
overridevirtual

Saves the setting values.

Returns
True if the setting values were successfully saved, false otherwise

Implements CSettingsBase.

◆ Save() [2/2]

bool ADDON::CAddonSettings::Save ( CXBMCTinyXML & doc) const

The documentation for this class was generated from the following files: