Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
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.
 
bool Save (TiXmlNode *settings) const override
 Save settings to the given XML node.
 
void Clear () override
 Clear any loaded setting values.
 
void OnSettingAction (const std::shared_ptr< const CSetting > &setting) override
 The given setting has been activated.
 
bool OnSettingChanging (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting is being changed.
 
bool OnSettingUpdate (const std::shared_ptr< CSetting > &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode) override
 The given setting needs to be updated.
 
void OnSettingChanged (const std::shared_ptr< const CSetting > &setting) override
 The value of the given setting has changed.
 
RESOLUTION GetCurrentResolution () const
 Returns the currently active resolution.
 
void SetCurrentResolution (RESOLUTION resolution, bool save=false)
 
RESOLUTION GetDisplayResolution () const
 Returns the best-matching resolution of the videoscreen.screenmode setting value.
 
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 (const std::string &monitor)
 
- Public Member Functions inherited from ISettingCallback
virtual ~ISettingCallback ()=default
 
virtual void OnSettingPropertyChanged (const std::shared_ptr< const CSetting > &setting, const char *propertyName)
 The given property of the given setting has changed.
 
- Public Member Functions inherited from ISubSettings
virtual ~ISubSettings ()=default
 
- Public Member Functions inherited from Observable
 Observable ()=default
 
virtual ~Observable ()=default
 
Observableoperator= (const Observable &observable)
 
virtual void RegisterObserver (Observer *obs)
 Register an observer.
 
virtual void UnregisterObserver (Observer *obs)
 Unregister an observer.
 
virtual void NotifyObservers (const ObservableMessage message=ObservableMessageNone)
 Send a message to all observers when m_bObservableChanged is true.
 
virtual void SetChanged (bool bSetTo=true)
 Mark an observable changed.
 
virtual bool IsObserving (const Observer &obs) const
 Check whether this observable is being observed by an observer.
 

Static Public Member Functions

static CDisplaySettingsGetInstance ()
 
static void SettingOptionsModesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsRefreshChangeDelaysFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsRefreshRatesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsResolutionsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsDispModeFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsStereoscopicModesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsPreferredStereoscopicViewModesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsMonitorsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< StringSettingOption > &list, std::string &current, void *data)
 
static void SettingOptionsCmsModesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsCmsWhitepointsFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsCmsPrimariesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &list, int &current, void *data)
 
static void SettingOptionsCmsGammaModesFiller (const std::shared_ptr< const CSetting > &setting, std::vector< IntegerSettingOption > &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.
 

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< boolm_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 ( 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.

◆ OnSettingChanged()

void CDisplaySettings::OnSettingChanged ( const std::shared_ptr< const CSetting > & setting)
overridevirtual

The value of the given setting has changed.

This callback is triggered whenever the value of a setting has been successfully changed (i.e. none of the OnSettingChanging() handlers) has reverted the change.

Parameters
settingThe setting whose value has been changed

Reimplemented from ISettingCallback.

◆ OnSettingChanging()

bool CDisplaySettings::OnSettingChanging ( const 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 ( const 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 ( const std::string & monitor)

◆ SetNonLinearStretched()

void CDisplaySettings::SetNonLinearStretched ( bool nonLinearStretch)
inline

◆ SetPixelRatio()

void CDisplaySettings::SetPixelRatio ( float pixelRatio)
inline

◆ SettingOptionsCmsGammaModesFiller()

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

◆ SettingOptionsCmsModesFiller()

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

◆ SettingOptionsCmsPrimariesFiller()

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

◆ SettingOptionsCmsWhitepointsFiller()

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

◆ SettingOptionsDispModeFiller()

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

◆ SettingOptionsModesFiller()

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

◆ SettingOptionsMonitorsFiller()

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

◆ SettingOptionsPreferredStereoscopicViewModesFiller()

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

◆ SettingOptionsRefreshChangeDelaysFiller()

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

◆ SettingOptionsRefreshRatesFiller()

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

◆ SettingOptionsResolutionsFiller()

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

◆ SettingOptionsStereoscopicModesFiller()

void CDisplaySettings::SettingOptionsStereoscopicModesFiller ( const std::shared_ptr< const CSetting > & setting,
std::vector< IntegerSettingOption > & 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: