Default implementation for the SettingsManagerInterface.
More...
#include <src/windows/include/display_device/windows/settings_manager.h>
|
| bool | prepareDisplayModes (const SingleDisplayConfiguration &config, const std::string &device_to_configure, const StringSet &additional_devices_to_configure, DdGuardFn &guard_fn, SingleDisplayConfigState &new_state, bool &system_settings_touched) |
| | Changes or restores the display modes based on the cached state, new state and configuration.
|
| |
| bool | prepareHdrStates (const SingleDisplayConfiguration &config, const std::string &device_to_configure, const StringSet &additional_devices_to_configure, DdGuardFn &guard_fn, SingleDisplayConfigState &new_state, bool &system_settings_touched) |
| | Changes or restores the HDR states based on the cached state, new state and configuration.
|
| |
| bool | preparePrimaryDevice (const SingleDisplayConfiguration &config, const std::string &device_to_configure, DdGuardFn &guard_fn, SingleDisplayConfigState &new_state, bool &system_settings_touched) |
| | Changes or restores the primary device based on the cached state, new state and configuration.
|
| |
| std::optional< std::tuple< SingleDisplayConfigState, std::string, StringSet > > | prepareTopology (const SingleDisplayConfiguration &config, const ActiveTopology &topology_before_changes, bool &release_context, bool &system_settings_touched) |
| | Preps the topology so that the further settings could be applied.
|
| |
| RevertResult | revertModifiedDisplayModes (const SingleDisplayConfigState::Modified &modified_state, DdGuardFn &guard_fn, bool &system_settings_touched) |
| | Revert display mode changes tracked in the modified settings state.
|
| |
| RevertResult | revertModifiedHdrStates (const SingleDisplayConfigState::Modified &modified_state, DdGuardFn &guard_fn, bool &system_settings_touched) |
| | Revert HDR changes tracked in the modified settings state.
|
| |
| RevertResult | revertModifiedPrimaryDevice (const SingleDisplayConfigState::Modified &modified_state, DdGuardFn &guard_fn, bool &system_settings_touched) |
| | Revert primary device changes tracked in the modified settings state.
|
| |
| RevertResult | revertModifiedSettings (const ActiveTopology ¤t_topology, bool &system_settings_touched, bool *switched_topology=nullptr) |
| | Try to revert the modified settings.
|
| |
|
| enum class | ApplyResult {
Ok
, ApiTemporarilyUnavailable
, DevicePrepFailed
, PrimaryDevicePrepFailed
,
DisplayModePrepFailed
, HdrStatePrepFailed
, PersistenceSaveFailed
} |
| | Outcome values when trying to apply settings. More...
|
| |
| enum class | RevertResult {
Ok
, ApiTemporarilyUnavailable
, TopologyIsInvalid
, SwitchingTopologyFailed
,
RevertingPrimaryDeviceFailed
, RevertingDisplayModesFailed
, RevertingHdrStatesFailed
, PersistenceSaveFailed
} |
| | Outcome values when trying to revert settings. More...
|
| |
Default implementation for the SettingsManagerInterface.
◆ SettingsManager()
Default constructor for the class.
- Parameters
-
| dd_api | A pointer to the Windows Display Device interface. Will throw on nullptr! |
| audio_context_api | [Optional] A pointer to the Audio Context interface. |
| persistent_state | A pointer to a class for managing persistence. |
| workarounds | Workaround settings for the APIs. |
◆ applySettings()
Apply the provided configuration to the system.
- Parameters
-
| config | A desired configuration for the display device. |
- Returns
- The apply result.
*Examples**
A class for applying and reverting display device settings.
Definition settings_manager_interface.h:14
virtual ApplyResult applySettings(const SingleDisplayConfiguration &config)=0
Apply the provided configuration to the system.
Configuration centered around a single display.
Definition types.h:216
Implements display_device::SettingsManagerInterface.
◆ enumAvailableDevices()
Enumerate the available (active and inactive) devices.
- Returns
- A list of available devices. Empty list can also be returned if an error has occurred.
*Examples**
virtual EnumeratedDeviceList enumAvailableDevices() const =0
Enumerate the available (active and inactive) devices.
Implements display_device::SettingsManagerInterface.
◆ getAudioContextApi()
| const std::shared_ptr< AudioContextInterface > & display_device::SettingsManager::getAudioContextApi |
( |
| ) |
const |
|
nodiscard |
Get the audio context API.
- Returns
- Audio context API.
◆ getDisplayName()
| std::string display_device::SettingsManager::getDisplayName |
( |
const std::string & | device_id | ) |
const |
|
nodiscardoverridevirtual |
Get the platform-specific display name associated with the device.
- Parameters
-
| device_id | A device to get display name for. |
- Returns
- A display name or capture selector for the device, or an empty string if the device is inactive or not found. Empty string can also be returned if an error has occurred.
*Examples**
const std::string device_id { "MY_DEVICE_ID" };
virtual std::string getDisplayName(const std::string &device_id) const =0
Get the platform-specific display name associated with the device.
Implements display_device::SettingsManagerInterface.
◆ prepareDisplayModes()
Changes or restores the display modes based on the cached state, new state and configuration.
- Parameters
-
| config | Configuration to be used for preparing display modes. |
| device_to_configure | The main device to be used for preparation. |
| additional_devices_to_configure | Additional devices that should be configured. |
| guard_fn | Reference to the guard function which will be set to restore original state (if needed) in case something else fails down the line. |
| new_state | Reference to the new state which is to be updated accordingly. |
| system_settings_touched | Inticates whether a "write" operation could have been performed on the OS. |
- Returns
- True if no errors have occured, false otherwise.
◆ prepareHdrStates()
Changes or restores the HDR states based on the cached state, new state and configuration.
- Parameters
-
| config | Configuration to be used for preparing HDR states. |
| device_to_configure | The main device to be used for preparation. |
| additional_devices_to_configure | Additional devices that should be configured. |
| guard_fn | Reference to the guard function which will be set to restore original state (if needed) in case something else fails down the line. |
| new_state | Reference to the new state which is to be updated accordingly. |
| system_settings_touched | Inticates whether a "write" operation could have been performed on the OS. |
- Returns
- True if no errors have occured, false otherwise.
◆ preparePrimaryDevice()
Changes or restores the primary device based on the cached state, new state and configuration.
- Parameters
-
| config | Configuration to be used for preparing primary device. |
| device_to_configure | The main device to be used for preparation. |
| guard_fn | Reference to the guard function which will be set to restore original state (if needed) in case something else fails down the line. |
| new_state | Reference to the new state which is to be updated accordingly. |
| system_settings_touched | Inticates whether a "write" operation could have been performed on the OS. |
- Returns
- True if no errors have occured, false otherwise.
◆ prepareTopology()
Preps the topology so that the further settings could be applied.
- Parameters
-
| config | Configuration to be used for preparing topology. |
| topology_before_changes | The current topology before any changes. |
| release_context | Specifies whether the audio context should be released at the very end IF everything else has succeeded. |
| system_settings_touched | Inticates whether a "write" operation could have been performed on the OS. |
- Returns
- A tuple of (new_state that is to be updated/persisted, device_to_configure, additional_devices_to_configure).
◆ resetPersistence()
| bool display_device::SettingsManager::resetPersistence |
( |
| ) |
|
|
nodiscardoverridevirtual |
Reset the persistence in case the settings cannot be reverted.
- Returns
- True if persistence was reset, false otherwise.
In case the settings cannot be reverted, because the display is turned or some other reason, this allows to "accept" the current state and start from scratch, but only if the persistence was cleared successfully.
*Examples**
const bool user_wants_reset { true };
if (user_wants_reset) {
}
}
}
virtual bool resetPersistence()=0
Reset the persistence in case the settings cannot be reverted.
virtual RevertResult revertSettings()=0
Revert the applied configuration and restore the previous settings.
@ Ok
Settings were reverted successfully.
@ Ok
Settings were applied successfully.
Implements display_device::SettingsManagerInterface.
◆ revertModifiedDisplayModes()
Revert display mode changes tracked in the modified settings state.
- Parameters
-
| modified_state | Modified state data to revert. |
| guard_fn | Reference to the guard function which will be set to restore the current state if needed. |
| system_settings_touched | Indicates whether a "write" operation could have been performed on the OS. |
- Returns
- Result enum indicating success or failure.
◆ revertModifiedHdrStates()
Revert HDR changes tracked in the modified settings state.
- Parameters
-
| modified_state | Modified state data to revert. |
| guard_fn | Reference to the guard function which will be set to restore the current state if needed. |
| system_settings_touched | Indicates whether a "write" operation could have been performed on the OS. |
- Returns
- Result enum indicating success or failure.
◆ revertModifiedPrimaryDevice()
Revert primary device changes tracked in the modified settings state.
- Parameters
-
| modified_state | Modified state data to revert. |
| guard_fn | Reference to the guard function which will be set to restore the current state if needed. |
| system_settings_touched | Indicates whether a "write" operation could have been performed on the OS. |
- Returns
- Result enum indicating success or failure.
◆ revertModifiedSettings()
Try to revert the modified settings.
- Parameters
-
| current_topology | Topology before this method is called. |
| system_settings_touched | Indicates whether a "write" operation could have been performed on the OS. |
| switched_topology | [Optional] Indicates whether the current topology was switched to revert settings. |
- Returns
- Result enum indicating success or failure.
- Warning
- The method assumes that the caller will ensure restoring the topology in case of a failure!
◆ revertSettings()
Revert the applied configuration and restore the previous settings.
- Returns
- True if settings were reverted or there was nothing to revert, false otherwise.
*Examples**
Implements display_device::SettingsManagerInterface.
The documentation for this class was generated from the following files: