Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
CDisplaySettings Class Reference

#include <DisplaySettings.h>

Inheritance diagram for CDisplaySettings:
ISettingCallback ISubSettings Observable

Public Member Functions

bool Load (const TiXmlNode *settings) override
 Load settings from the given XML node. More...
 
bool Save (TiXmlNode *settings) const override
 Save settings to the given XML node. More...
 
void Clear () override
 Clear any loaded setting values. More...
 
void OnSettingAction (std::shared_ptr< const CSetting > setting) override
 The given setting has been activated. More...
 
bool OnSettingChanging (std::shared_ptr< const CSetting > setting) override
 The value of the given setting is being changed. More...
 
bool OnSettingUpdate (std::shared_ptr< CSetting > setting, const char *oldSettingId, const TiXmlNode *oldSettingNode) override
 The given setting needs to be updated. More...
 
RESOLUTION GetCurrentResolution () const
 Returns the currently active resolution. More...
 
void SetCurrentResolution (RESOLUTION resolution, bool save=false)
 
RESOLUTION GetDisplayResolution () const
 Returns the best-matching resolution of the videoscreen.screenmode setting value. More...
 
const RESOLUTION_INFOGetResolutionInfo (size_t index) const
 
const RESOLUTION_INFOGetResolutionInfo (RESOLUTION resolution) const
 
RESOLUTION_INFOGetResolutionInfo (size_t index)
 
RESOLUTION_INFOGetResolutionInfo (RESOLUTION resolution)
 
size_t ResolutionInfoSize () const
 
void AddResolutionInfo (const RESOLUTION_INFO &resolution)
 
const RESOLUTION_INFOGetCurrentResolutionInfo () const
 
RESOLUTION_INFOGetCurrentResolutionInfo ()
 
RESOLUTION GetResFromString (const std::string &strResolution)
 
std::string GetStringFromRes (const RESOLUTION resolution, float refreshrate=0.0f)
 
void ApplyCalibrations ()
 
void UpdateCalibrations ()
 
void ClearCalibrations ()
 
void ClearCustomResolutions ()
 
float GetZoomAmount () const
 
void SetZoomAmount (float zoomAmount)
 
float GetPixelRatio () const
 
void SetPixelRatio (float pixelRatio)
 
float GetVerticalShift () const
 
void SetVerticalShift (float verticalShift)
 
bool IsNonLinearStretched () const
 
void SetNonLinearStretched (bool nonLinearStretch)
 
void SetMonitor (std::string monitor)
 
- Public Member Functions inherited from ISettingCallback
virtual ~ISettingCallback ()=default
 
virtual void OnSettingChanged (std::shared_ptr< const CSetting > setting)
 The value of the given setting has changed. More...
 
virtual void OnSettingPropertyChanged (std::shared_ptr< const CSetting > setting, const char *propertyName)
 The given property of the given setting has changed. More...
 
- Public Member Functions inherited from ISubSettings
virtual ~ISubSettings ()=default
 
- Public Member Functions inherited from Observable
 Observable ()=default
 
virtual ~Observable ()=default
 
virtual Observableoperator= (const Observable &observable)
 
virtual void RegisterObserver (Observer *obs)
 Register an observer. More...
 
virtual void UnregisterObserver (Observer *obs)
 Unregister an observer. More...
 
virtual void NotifyObservers (const ObservableMessage message=ObservableMessageNone)
 Send a message to all observers when m_bObservableChanged is true. More...
 
virtual void SetChanged (bool bSetTo=true)
 Mark an observable changed. More...
 
virtual bool IsObserving (const Observer &obs) const
 Check whether this observable is being observed by an observer. More...
 

Static Public Member Functions

static CDisplaySettingsGetInstance ()
 
static void SettingOptionsModesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, std::string > > &list, std::string &current, void *data)
 
static void SettingOptionsRefreshChangeDelaysFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsRefreshRatesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, std::string > > &list, std::string &current, void *data)
 
static void SettingOptionsResolutionsFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsDispModeFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsStereoscopicModesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsPreferredStereoscopicViewModesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsMonitorsFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, std::string > > &list, std::string &current, void *data)
 
static void SettingOptionsCmsModesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsCmsWhitepointsFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsCmsPrimariesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 
static void SettingOptionsCmsGammaModesFiller (std::shared_ptr< const CSetting > setting, std::vector< std::pair< std::string, int > > &list, int &current, void *data)
 

Protected Member Functions

 CDisplaySettings ()
 
 CDisplaySettings (const CDisplaySettings &)=delete
 
CDisplaySettingsoperator= (CDisplaySettings const &)=delete
 
 ~CDisplaySettings () override
 
DisplayMode GetCurrentDisplayMode () const
 
- Protected Member Functions inherited from Observable
void SendMessage (const ObservableMessage message)
 Send a message to all observer when m_bObservableChanged is true. More...
 

Static Protected Member Functions

static RESOLUTION GetResolutionFromString (const std::string &strResolution)
 
static std::string GetStringFromResolution (RESOLUTION resolution, float refreshrate=0.0f)
 
static RESOLUTION GetResolutionForScreen ()
 
static RESOLUTION FindBestMatchingResolution (const std::map< RESOLUTION, RESOLUTION_INFO > &resolutionInfos, int width, int height, float refreshrate, unsigned int flags)
 

Additional Inherited Members

- Protected Attributes inherited from Observable
std::atomic< bool > m_bObservableChanged {false}
 
std::vector< Observer * > m_observers
 
CCriticalSection m_obsCritSection
 

Constructor & Destructor Documentation

◆ CDisplaySettings() [1/2]

CDisplaySettings::CDisplaySettings ( )
protected

◆ CDisplaySettings() [2/2]

CDisplaySettings::CDisplaySettings ( const CDisplaySettings )
protecteddelete

◆ ~CDisplaySettings()

CDisplaySettings::~CDisplaySettings ( )
overrideprotecteddefault

Member Function Documentation

◆ AddResolutionInfo()

void CDisplaySettings::AddResolutionInfo ( const RESOLUTION_INFO resolution)

◆ ApplyCalibrations()

void CDisplaySettings::ApplyCalibrations ( )

◆ Clear()

void CDisplaySettings::Clear ( )
overridevirtual

Clear any loaded setting values.

Reimplemented from ISubSettings.

◆ ClearCalibrations()

void CDisplaySettings::ClearCalibrations ( )

◆ ClearCustomResolutions()

void CDisplaySettings::ClearCustomResolutions ( )

◆ FindBestMatchingResolution()

RESOLUTION CDisplaySettings::FindBestMatchingResolution ( const std::map< RESOLUTION, RESOLUTION_INFO > &  resolutionInfos,
int  width,
int  height,
float  refreshrate,
unsigned int  flags 
)
staticprotected

◆ GetCurrentDisplayMode()

DisplayMode CDisplaySettings::GetCurrentDisplayMode ( ) const
protected

◆ GetCurrentResolution()

RESOLUTION CDisplaySettings::GetCurrentResolution ( ) const
inline

Returns the currently active resolution.

This resolution might differ from the display resolution which is based on the user's settings.

See also
SetCurrentResolution
GetResolutionInfo
GetDisplayResolution

◆ GetCurrentResolutionInfo() [1/2]

RESOLUTION_INFO & CDisplaySettings::GetCurrentResolutionInfo ( )
inline

◆ GetCurrentResolutionInfo() [2/2]

const RESOLUTION_INFO & CDisplaySettings::GetCurrentResolutionInfo ( ) const
inline

◆ GetDisplayResolution()

RESOLUTION CDisplaySettings::GetDisplayResolution ( ) const

Returns the best-matching resolution of the videoscreen.screenmode setting value.

This resolution might differ from the current resolution which is based on the properties of the operating system and the attached displays.

See also
GetCurrentResolution

◆ GetInstance()

CDisplaySettings & CDisplaySettings::GetInstance ( )
static

◆ GetPixelRatio()

float CDisplaySettings::GetPixelRatio ( ) const
inline

◆ GetResFromString()

RESOLUTION CDisplaySettings::GetResFromString ( const std::string &  strResolution)
inline

◆ GetResolutionForScreen()

RESOLUTION CDisplaySettings::GetResolutionForScreen ( )
staticprotected

◆ GetResolutionFromString()

RESOLUTION CDisplaySettings::GetResolutionFromString ( const std::string &  strResolution)
staticprotected

◆ GetResolutionInfo() [1/4]

RESOLUTION_INFO & CDisplaySettings::GetResolutionInfo ( RESOLUTION  resolution)

◆ GetResolutionInfo() [2/4]

const RESOLUTION_INFO & CDisplaySettings::GetResolutionInfo ( RESOLUTION  resolution) const

◆ GetResolutionInfo() [3/4]

RESOLUTION_INFO & CDisplaySettings::GetResolutionInfo ( size_t  index)

◆ GetResolutionInfo() [4/4]

const RESOLUTION_INFO & CDisplaySettings::GetResolutionInfo ( size_t  index) const

◆ GetStringFromRes()

std::string CDisplaySettings::GetStringFromRes ( const RESOLUTION  resolution,
float  refreshrate = 0.0f 
)
inline

◆ GetStringFromResolution()

std::string CDisplaySettings::GetStringFromResolution ( RESOLUTION  resolution,
float  refreshrate = 0.0f 
)
staticprotected

◆ GetVerticalShift()

float CDisplaySettings::GetVerticalShift ( ) const
inline

◆ GetZoomAmount()

float CDisplaySettings::GetZoomAmount ( ) const
inline

◆ IsNonLinearStretched()

bool CDisplaySettings::IsNonLinearStretched ( ) const
inline

◆ Load()

bool CDisplaySettings::Load ( const TiXmlNode *  settings)
overridevirtual

Load settings from the given XML node.

Parameters
settingsXML node containing setting values
Returns
True if loading the settings was successful, false otherwise.

Reimplemented from ISubSettings.

◆ OnSettingAction()

void CDisplaySettings::OnSettingAction ( 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.

◆ OnSettingChanging()

bool CDisplaySettings::OnSettingChanging ( std::shared_ptr< const CSetting setting)
overridevirtual

The value of the given setting is being changed.

This callback is triggered whenever the value of a setting is being changed. The given CSetting already contains the new value and the handler of the callback has the possibility to allow or revert changing the value of the setting. In case of a revert OnSettingChanging() is called again to inform all listeners that the value change has been reverted.

Parameters
settingThe setting whose value is being changed (already containing the changed value)
Returns
True if the new value is acceptable otherwise false

Reimplemented from ISettingCallback.

◆ OnSettingUpdate()

bool CDisplaySettings::OnSettingUpdate ( std::shared_ptr< CSetting setting,
const char *  oldSettingId,
const TiXmlNode *  oldSettingNode 
)
overridevirtual

The given setting needs to be updated.

This callback is triggered when a setting needs to be updated because its value is outdated. This only happens when initially loading the value of a setting and will not be triggered afterwards.

Parameters
settingThe setting which needs to be updated.
oldSettingIdThe id of the previous setting.
oldSettingNodeThe old setting node
Returns
True if the setting has been successfully updated otherwise false

Reimplemented from ISettingCallback.

◆ operator=()

CDisplaySettings & CDisplaySettings::operator= ( CDisplaySettings const &  )
protecteddelete

◆ ResolutionInfoSize()

size_t CDisplaySettings::ResolutionInfoSize ( ) const
inline

◆ Save()

bool CDisplaySettings::Save ( TiXmlNode *  settings) const
overridevirtual

Save settings to the given XML node.

Parameters
settingsXML node in which the settings will be saved
Returns
True if saving the settings was successful, false otherwise.

Reimplemented from ISubSettings.

◆ SetCurrentResolution()

void CDisplaySettings::SetCurrentResolution ( RESOLUTION  resolution,
bool  save = false 
)

◆ SetMonitor()

void CDisplaySettings::SetMonitor ( std::string  monitor)

◆ SetNonLinearStretched()

void CDisplaySettings::SetNonLinearStretched ( bool  nonLinearStretch)
inline

◆ SetPixelRatio()

void CDisplaySettings::SetPixelRatio ( float  pixelRatio)
inline

◆ SettingOptionsCmsGammaModesFiller()

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

◆ SettingOptionsCmsModesFiller()

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

◆ SettingOptionsCmsPrimariesFiller()

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

◆ SettingOptionsCmsWhitepointsFiller()

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

◆ SettingOptionsDispModeFiller()

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

◆ SettingOptionsModesFiller()

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

◆ SettingOptionsMonitorsFiller()

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

◆ SettingOptionsPreferredStereoscopicViewModesFiller()

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

◆ SettingOptionsRefreshChangeDelaysFiller()

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

◆ SettingOptionsRefreshRatesFiller()

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

◆ SettingOptionsResolutionsFiller()

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

◆ SettingOptionsStereoscopicModesFiller()

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

◆ SetVerticalShift()

void CDisplaySettings::SetVerticalShift ( float  verticalShift)
inline

◆ SetZoomAmount()

void CDisplaySettings::SetZoomAmount ( float  zoomAmount)
inline

◆ UpdateCalibrations()

void CDisplaySettings::UpdateCalibrations ( )
Todo:
erase calibrations with default values

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