UI: Add Accessibility menu to settings

This change introduces an accessibility menu to settings, along with
options for overriding the colors used by OBS in the mixer and in the
preview to be more color blind friendly than the options provided by the
current theme.
This commit is contained in:
VodBox
2021-07-03 17:55:47 +12:00
committed by Ryan Foster
parent 9299a3dbce
commit 77694d76e8
16 changed files with 1816 additions and 21 deletions

View File

@@ -623,6 +623,13 @@ void OBSBasic::ClearVolumeControls()
volumes.clear();
}
void OBSBasic::RefreshVolumeColors()
{
for (VolControl *vol : volumes) {
vol->refreshColors();
}
}
obs_data_array_t *OBSBasic::SaveSceneListOrder()
{
obs_data_array_t *sceneOrder = obs_data_array_create();
@@ -10099,3 +10106,42 @@ void OBSBasic::SetDisplayAffinity(QWindow *window)
UNUSED_PARAMETER(hideFromCapture);
#endif
}
static inline QColor color_from_int(long long val)
{
return QColor(val & 0xff, (val >> 8) & 0xff, (val >> 16) & 0xff,
(val >> 24) & 0xff);
}
QColor OBSBasic::GetSelectionColor() const
{
if (config_get_bool(GetGlobalConfig(), "Accessibility",
"OverrideColors")) {
return color_from_int(config_get_int(
GetGlobalConfig(), "Accessibility", "SelectRed"));
} else {
return QColor::fromRgb(255, 0, 0);
}
}
QColor OBSBasic::GetCropColor() const
{
if (config_get_bool(GetGlobalConfig(), "Accessibility",
"OverrideColors")) {
return color_from_int(config_get_int(
GetGlobalConfig(), "Accessibility", "SelectGreen"));
} else {
return QColor::fromRgb(0, 255, 0);
}
}
QColor OBSBasic::GetHoverColor() const
{
if (config_get_bool(GetGlobalConfig(), "Accessibility",
"OverrideColors")) {
return color_from_int(config_get_int(
GetGlobalConfig(), "Accessibility", "SelectBlue"));
} else {
return QColor::fromRgb(0, 127, 255);
}
}