Kodi Documentation  18.0
Kodi is an open source media player and entertainment hub.
ADDON::CSkinInfo Class Reference

#include <Skin.h>

Inheritance diagram for ADDON::CSkinInfo:
ADDON::CAddon ADDON::IAddon

Classes

class  CStartupWindow
 

Public Member Functions

 CSkinInfo (CAddonInfo addonInfo, const RESOLUTION_INFO &resolution=RESOLUTION_INFO())
 
 CSkinInfo (CAddonInfo addonInfo, const RESOLUTION_INFO &resolution, const std::vector< RESOLUTION_INFO > &resolutions, float effectsSlowDown, bool debugging)
 
 ~CSkinInfo () override
 
void Start ()
 Load resolution information from directories in Path(). More...
 
bool HasSkinFile (const std::string &strFile) const
 
std::string GetSkinPath (const std::string &file, RESOLUTION_INFO *res=NULL, const std::string &baseDir="") const
 Get the full path to the specified file in the skin We search for XML files in the skin folder that best matches the current resolution. More...
 
bool IsDebugging () const
 Return whether skin debugging is enabled. More...
 
int GetFirstWindow () const
 Get the id of the first window to load The first window is generally Startup.xml unless it doesn't exist or if the skinner has specified which start windows they support and the user is going to somewhere other than the home screen. More...
 
int GetStartWindow () const
 Get the id of the window the user wants to start in after any skin animation. More...
 
void ResolveIncludes (TiXmlElement *node, std::map< INFO::InfoPtr, bool > *xmlIncludeConditions=NULL)
 
float GetEffectsSlowdown () const
 
const std::vector< CStartupWindow > & GetStartupWindows () const
 
void GetSkinPaths (std::vector< std::string > &paths) const
 Retrieve the skin paths to search for skin XML files. More...
 
bool IsInUse () const override
 
const std::string & GetCurrentAspect () const
 
void LoadIncludes ()
 
void ToggleDebug ()
 
const INFO::CSkinVariableStringCreateSkinVariable (const std::string &name, int context)
 
bool HasSettings () override
 Don't handle skin settings like normal addon settings. More...
 
bool HasUserSettings () override
 Check whether the user has configured this addon or not. More...
 
int TranslateString (const std::string &setting)
 
const std::string & GetString (int setting) const
 
void SetString (int setting, const std::string &label)
 
int TranslateBool (const std::string &setting)
 
bool GetBool (int setting) const
 
void SetBool (int setting, bool set)
 
void Reset (const std::string &setting)
 
void Reset ()
 
void OnPreInstall () override
 
void OnPostInstall (bool update, bool modal) override
 
- Public Member Functions inherited from ADDON::CAddon
 CAddon (CAddonInfo addonInfo)
 
 ~CAddon () override=default
 
TYPE Type () const override
 
TYPE FullType () const override
 
bool IsType (TYPE type) const override
 
std::string ID () const override
 
std::string Name () const override
 
AddonVersion Version () const override
 
AddonVersion MinVersion () const override
 
std::string Summary () const override
 
std::string Description () const override
 
std::string Path () const override
 
std::string Profile () const override
 
std::string LibPath () const override
 
std::string Author () const override
 
std::string ChangeLog () const override
 
std::string Icon () const override
 
ArtMap Art () const override
 
std::vector< std::string > Screenshots () const override
 
std::string Disclaimer () const override
 
std::string Broken () const override
 
CDateTime InstallDate () const override
 
CDateTime LastUpdated () const override
 
CDateTime LastUsed () const override
 
std::string Origin () const override
 
uint64_t PackageSize () const override
 
const InfoMapExtraInfo () const override
 
const std::vector< DependencyInfo > & GetDependencies () const override
 
std::string FanArt () const override
 
void SaveSettings () override
 Save any user configured settings. More...
 
void UpdateSetting (const std::string &key, const std::string &value) override
 Update a user-configured setting with a new value. More...
 
bool UpdateSettingBool (const std::string &key, bool value) override
 Update a user-configured setting with a new boolean value. More...
 
bool UpdateSettingInt (const std::string &key, int value) override
 Update a user-configured setting with a new integer value. More...
 
bool UpdateSettingNumber (const std::string &key, double value) override
 Update a user-configured setting with a new number value. More...
 
bool UpdateSettingString (const std::string &key, const std::string &value) override
 Update a user-configured setting with a new string value. More...
 
std::string GetSetting (const std::string &key) override
 Retrieve a particular settings value If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingBool (const std::string &key, bool &value) override
 Retrieve a particular settings value as boolean If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingInt (const std::string &key, int &value) override
 Retrieve a particular settings value as integer If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingNumber (const std::string &key, double &value) override
 Retrieve a particular settings value as number If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingString (const std::string &key, std::string &value) override
 Retrieve a particular settings value as string If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
CAddonSettingsGetSettings () const override
 
AddonVersion GetDependencyVersion (const std::string &dependencyID) const override
 get the required version of a dependency. More...
 
bool MeetsVersion (const AddonVersion &version) const override
 return whether or not this addon satisfies the given version requirements More...
 
bool ReloadSettings () override
 
AddonPtr GetRunningInstance () const override
 retrieve the running instance of an add-on if it persists while running. More...
 
void OnPreUnInstall () override
 
void OnPostUnInstall () override
 
- Public Member Functions inherited from ADDON::IAddon
virtual ~IAddon ()=default
 

Static Public Member Functions

static std::unique_ptr< CSkinInfoFromExtension (CAddonInfo addonInfo, const cp_extension_t *ext)
 
static bool TranslateResolution (const std::string &name, RESOLUTION_INFO &res)
 Translate a resolution string. More...
 
static void SettingOptionsSkinColorsFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, std::string > > &list, std::string &current, void *data)
 
static void SettingOptionsSkinFontsFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, std::string > > &list, std::string &current, void *data)
 
static void SettingOptionsSkinThemesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, std::string > > &list, std::string &current, void *data)
 
static void SettingOptionsStartupWindowsFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static std::set< CSkinSettingPtrParseSettings (const TiXmlElement *rootElement)
 

Protected Member Functions

std::string GetDirFromRes (RESOLUTION res) const
 Given a resolution, retrieve the corresponding directory name. More...
 
void GetDefaultResolution (const cp_extension_t *ext, const char *tag, RESOLUTION &res, const RESOLUTION &def) const
 grab a resolution tag from a skin's configuration data More...
 
bool LoadStartupWindows (const cp_extension_t *ext)
 
bool SettingsInitialized () const override
 Whether or not the settings have been initialized. More...
 
bool SettingsLoaded () const override
 Whether or not the settings have been loaded. More...
 
bool SettingsFromXML (const CXBMCTinyXML &doc, bool loadDefaults=false) override
 Parse settings from an XML document. More...
 
bool SettingsToXML (CXBMCTinyXML &doc) const override
 Write settings into an XML document. More...
 
- Protected Member Functions inherited from ADDON::CAddon
bool LoadSettings (bool bForce, bool loadUserSettings=true)
 Load the default settings and override these with any previously configured user settings. More...
 
virtual bool LoadUserSettings ()
 Load the user settings. More...
 
virtual bool HasSettingsToSave () const
 

Static Protected Member Functions

static CSkinSettingPtr ParseSetting (const TiXmlElement *element)
 

Protected Attributes

RESOLUTION_INFO m_defaultRes
 
std::vector< RESOLUTION_INFOm_resolutions
 
float m_effectsSlowDown
 
CGUIIncludes m_includes
 
std::string m_currentAspect
 
std::vector< CStartupWindowm_startupWindows
 
bool m_debugging
 
- Protected Attributes inherited from ADDON::CAddon
const CAddonInfo m_addonInfo
 
std::string m_userSettingsPath
 

Constructor & Destructor Documentation

§ CSkinInfo() [1/2]

ADDON::CSkinInfo::CSkinInfo ( CAddonInfo  addonInfo,
const RESOLUTION_INFO resolution = RESOLUTION_INFO() 
)
explicit

§ CSkinInfo() [2/2]

ADDON::CSkinInfo::CSkinInfo ( CAddonInfo  addonInfo,
const RESOLUTION_INFO resolution,
const std::vector< RESOLUTION_INFO > &  resolutions,
float  effectsSlowDown,
bool  debugging 
)

§ ~CSkinInfo()

ADDON::CSkinInfo::~CSkinInfo ( )
overridedefault

Member Function Documentation

§ CreateSkinVariable()

const INFO::CSkinVariableString * ADDON::CSkinInfo::CreateSkinVariable ( const std::string &  name,
int  context 
)

§ FromExtension()

std::unique_ptr< CSkinInfo > ADDON::CSkinInfo::FromExtension ( CAddonInfo  addonInfo,
const cp_extension_t ext 
)
static

§ GetBool()

bool ADDON::CSkinInfo::GetBool ( int  setting) const

§ GetCurrentAspect()

const std::string& ADDON::CSkinInfo::GetCurrentAspect ( ) const
inline

§ GetDefaultResolution()

void ADDON::CSkinInfo::GetDefaultResolution ( const cp_extension_t ext,
const char *  tag,
RESOLUTION res,
const RESOLUTION def 
) const
protected

grab a resolution tag from a skin's configuration data

Parameters
extpassed addoninfo structure to check for resolution
tagname of the tag to look for
resresolution to return
Returns
true if we find a valid resolution, false otherwise

§ GetDirFromRes()

std::string ADDON::CSkinInfo::GetDirFromRes ( RESOLUTION  res) const
protected

Given a resolution, retrieve the corresponding directory name.

Parameters
resRESOLUTION to translate
Returns
directory name for res

§ GetEffectsSlowdown()

float ADDON::CSkinInfo::GetEffectsSlowdown ( ) const
inline

§ GetFirstWindow()

int ADDON::CSkinInfo::GetFirstWindow ( ) const

Get the id of the first window to load The first window is generally Startup.xml unless it doesn't exist or if the skinner has specified which start windows they support and the user is going to somewhere other than the home screen.

Returns
id of the first window to load

§ GetSkinPath()

std::string ADDON::CSkinInfo::GetSkinPath ( const std::string &  file,
RESOLUTION_INFO res = NULL,
const std::string &  baseDir = "" 
) const

Get the full path to the specified file in the skin We search for XML files in the skin folder that best matches the current resolution.

Parameters
fileXML file to look for
res[out] If non-NULL, the resolution that the returned XML file is in is returned. Defaults to NULL.
baseDir[in] If non-empty, the given directory is searched instead of the skin's directory. Defaults to empty.
Returns
path to the XML file

§ GetSkinPaths()

void ADDON::CSkinInfo::GetSkinPaths ( std::vector< std::string > &  paths) const

Retrieve the skin paths to search for skin XML files.

Parameters
paths[out] vector of paths to search, in order.

§ GetStartupWindows()

const std::vector<CStartupWindow>& ADDON::CSkinInfo::GetStartupWindows ( ) const
inline

§ GetStartWindow()

int ADDON::CSkinInfo::GetStartWindow ( ) const

Get the id of the window the user wants to start in after any skin animation.

Returns
id of the start window

§ GetString()

const std::string & ADDON::CSkinInfo::GetString ( int  setting) const

§ HasSettings()

bool ADDON::CSkinInfo::HasSettings ( )
inlineoverridevirtual

Don't handle skin settings like normal addon settings.

Reimplemented from ADDON::CAddon.

§ HasSkinFile()

bool ADDON::CSkinInfo::HasSkinFile ( const std::string &  strFile) const

§ HasUserSettings()

bool ADDON::CSkinInfo::HasUserSettings ( )
inlineoverridevirtual

Check whether the user has configured this addon or not.

Returns
true if previously saved settings are found, false otherwise
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, GetSetting, UpdateSetting

Reimplemented from ADDON::CAddon.

§ IsDebugging()

bool ADDON::CSkinInfo::IsDebugging ( ) const
inline

Return whether skin debugging is enabled.

Returns
true if skin debugging (set via <debugging>true</debugging> in addon.xml) is enabled.

§ IsInUse()

bool ADDON::CSkinInfo::IsInUse ( ) const
overridevirtual

Reimplemented from ADDON::CAddon.

§ LoadIncludes()

void ADDON::CSkinInfo::LoadIncludes ( )

§ LoadStartupWindows()

bool ADDON::CSkinInfo::LoadStartupWindows ( const cp_extension_t ext)
protected

§ OnPostInstall()

void ADDON::CSkinInfo::OnPostInstall ( bool  update,
bool  modal 
)
overridevirtual

Reimplemented from ADDON::CAddon.

§ OnPreInstall()

void ADDON::CSkinInfo::OnPreInstall ( )
overridevirtual

Reimplemented from ADDON::CAddon.

§ ParseSetting()

CSkinSettingPtr ADDON::CSkinInfo::ParseSetting ( const TiXmlElement *  element)
staticprotected

§ ParseSettings()

std::set< CSkinSettingPtr > ADDON::CSkinInfo::ParseSettings ( const TiXmlElement *  rootElement)
static

§ Reset() [1/2]

void ADDON::CSkinInfo::Reset ( const std::string &  setting)

§ Reset() [2/2]

void ADDON::CSkinInfo::Reset ( )

§ ResolveIncludes()

void ADDON::CSkinInfo::ResolveIncludes ( TiXmlElement *  node,
std::map< INFO::InfoPtr, bool > *  xmlIncludeConditions = NULL 
)

§ SetBool()

void ADDON::CSkinInfo::SetBool ( int  setting,
bool  set 
)

§ SetString()

void ADDON::CSkinInfo::SetString ( int  setting,
const std::string &  label 
)

§ SettingOptionsSkinColorsFiller()

void ADDON::CSkinInfo::SettingOptionsSkinColorsFiller ( std::shared_ptr< const CSetting setting,
std::vector< std::pair< std::string, std::string > > &  list,
std::string &  current,
void data 
)
static

§ SettingOptionsSkinFontsFiller()

void ADDON::CSkinInfo::SettingOptionsSkinFontsFiller ( std::shared_ptr< const CSetting setting,
std::vector< std::pair< std::string, std::string > > &  list,
std::string &  current,
void data 
)
static

§ SettingOptionsSkinThemesFiller()

void ADDON::CSkinInfo::SettingOptionsSkinThemesFiller ( std::shared_ptr< const CSetting setting,
std::vector< std::pair< std::string, std::string > > &  list,
std::string &  current,
void data 
)
static

§ SettingOptionsStartupWindowsFiller()

void ADDON::CSkinInfo::SettingOptionsStartupWindowsFiller ( std::shared_ptr< const CSetting setting,
std::vector< std::pair< std::string, int > > &  list,
int &  current,
void data 
)
static

§ SettingsFromXML()

bool ADDON::CSkinInfo::SettingsFromXML ( const CXBMCTinyXML doc,
bool  loadDefaults = false 
)
overrideprotectedvirtual

Parse settings from an XML document.

Parameters
docXML document to parse for settings
loadDefaultsif true, the default attribute is used and settings are reset prior to parsing, else the value attribute is used.
Returns
true if settings are loaded, false otherwise
See also
SettingsToXML

Reimplemented from ADDON::CAddon.

§ SettingsInitialized()

bool ADDON::CSkinInfo::SettingsInitialized ( ) const
overrideprotectedvirtual

Whether or not the settings have been initialized.

Reimplemented from ADDON::CAddon.

§ SettingsLoaded()

bool ADDON::CSkinInfo::SettingsLoaded ( ) const
overrideprotectedvirtual

Whether or not the settings have been loaded.

Reimplemented from ADDON::CAddon.

§ SettingsToXML()

bool ADDON::CSkinInfo::SettingsToXML ( CXBMCTinyXML doc) const
overrideprotectedvirtual

Write settings into an XML document.

Parameters
docXML document to receive the settings
Returns
true if settings are saved, false otherwise
See also
SettingsFromXML

Reimplemented from ADDON::CAddon.

§ Start()

void ADDON::CSkinInfo::Start ( )

Load resolution information from directories in Path().

§ ToggleDebug()

void ADDON::CSkinInfo::ToggleDebug ( )

§ TranslateBool()

int ADDON::CSkinInfo::TranslateBool ( const std::string &  setting)

§ TranslateResolution()

bool ADDON::CSkinInfo::TranslateResolution ( const std::string &  name,
RESOLUTION_INFO res 
)
static

Translate a resolution string.

Parameters
namethe string to translate
res[out] the resolution structure if name is valid
Returns
true if the resolution is valid, false otherwise

§ TranslateString()

int ADDON::CSkinInfo::TranslateString ( const std::string &  setting)

Member Data Documentation

§ m_currentAspect

std::string ADDON::CSkinInfo::m_currentAspect
protected

§ m_debugging

bool ADDON::CSkinInfo::m_debugging
protected

§ m_defaultRes

RESOLUTION_INFO ADDON::CSkinInfo::m_defaultRes
protected

§ m_effectsSlowDown

float ADDON::CSkinInfo::m_effectsSlowDown
protected

§ m_includes

CGUIIncludes ADDON::CSkinInfo::m_includes
protected

§ m_resolutions

std::vector<RESOLUTION_INFO> ADDON::CSkinInfo::m_resolutions
protected

§ m_startupWindows

std::vector<CStartupWindow> ADDON::CSkinInfo::m_startupWindows
protected

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