vdr 2.8.1
cTheme Class Reference

#include <themes.h>

Public Member Functions

 cTheme (void)
const char * Name (void)
const char * Description (void)
bool Load (const char *FileName, bool OnlyDescriptions=false)
bool Save (const char *FileName)
int AddColor (const char *Name, tColor Color)
tColor Color (int Subject)

Static Public Attributes

static constexpr int MaxThemeColors = 128

Private Member Functions

bool FileNameOk (const char *FileName, bool SetName=false)

Private Attributes

cString name
cStringList descriptions
cStringList colorNames
cVector< tColorcolorValues

Detailed Description

Definition at line 17 of file themes.h.

Constructor & Destructor Documentation

◆ cTheme()

cTheme::cTheme ( void )

Creates a new theme class.

Definition at line 17 of file themes.c.

References name.

Member Function Documentation

◆ AddColor()

int cTheme::AddColor ( const char * Name,
tColor Color )

Adds a color with the given Name to this theme, initializes it with Color and returns an index into the color array that can be used in a call to Color() later.

The index returned from the first call to AddColor() is 0, and subsequent calls will return values that are incremented by 1 with every call. If a color entry with the given Name already exists, its value will be overwritten with Color and the returned index will be that of the existing entry.

Definition at line 169 of file themes.c.

References Color(), colorNames, colorValues, and Name().

◆ Color()

tColor cTheme::Color ( int Subject)

Returns the color for the given Subject.

Subject must be one of the values returned by a previous call to AddColor().

Definition at line 182 of file themes.c.

References colorValues.

Referenced by AddColor().

◆ Description()

const char * cTheme::Description ( void )

Returns a user visible, single line description of this theme.

The actual text shouldn't be too long, so that it can be fully displayed in the Setup/OSD menu.

Definition at line 62 of file themes.c.

References descriptions, I18nCurrentLanguage(), and name.

◆ FileNameOk()

bool cTheme::FileNameOk ( const char * FileName,
bool SetName = false )
private

Definition at line 22 of file themes.c.

References esyslog, isempty(), and name.

Referenced by Load(), and Save().

◆ Load()

bool cTheme::Load ( const char * FileName,
bool OnlyDescriptions = false )

Loads the theme data from the given file.

Definition at line 70 of file themes.c.

References colorNames, colorValues, descriptions, esyslog, FileNameOk(), I18nLanguageIndex(), isempty(), isyslog, LOG_ERROR_STR, cReadLine::Read(), skipspace(), and stripspace().

◆ Name()

const char * cTheme::Name ( void )
inline

Definition at line 30 of file themes.h.

References name.

Referenced by AddColor().

◆ Save()

bool cTheme::Save ( const char * FileName)

Saves the theme data to the given file.

FileName must be in the form "<skin>-<theme>.theme", where <skin> is the name of the skin this theme applies to, and <theme> is the actual theme name, which will be used to identify this theme in the 'setup.conf', and is normally not seen by the user. It should consist of only lowercase letters and digits.

Definition at line 148 of file themes.c.

References cSafeFile::Close(), colorNames, colorValues, descriptions, FileNameOk(), I18nLanguageCode(), I18nLanguages(), cSafeFile::Open(), and cVector< T >::Size().

Member Data Documentation

◆ colorNames

cStringList cTheme::colorNames
private

Definition at line 24 of file themes.h.

Referenced by AddColor(), Load(), and Save().

◆ colorValues

cVector<tColor> cTheme::colorValues
private

Definition at line 25 of file themes.h.

Referenced by AddColor(), Color(), Load(), and Save().

◆ descriptions

cStringList cTheme::descriptions
private

Definition at line 23 of file themes.h.

Referenced by Description(), Load(), and Save().

◆ MaxThemeColors

int cTheme::MaxThemeColors = 128
staticconstexpr

Definition at line 20 of file themes.h.

◆ name

cString cTheme::name
private

Definition at line 22 of file themes.h.

Referenced by cTheme(), Description(), FileNameOk(), and Name().


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