frontend: Recognize OBS appearance setting usage in math statements
The check for whether an OBS appearance setting is used in a theme only checks whether there is a direct alias to an injected variable, like `--font_base_value: var(--obsFontScale)`. Math statements like `--font_base_value: calc(1 + var(--obsFontScale))` would not get recognized, so if a theme only uses such statements (no direct aliases), the check would wrongfully conclude that the appearance setting is not used, which would later lead to the setting being disabled in the UI. The value however would be injected correctly. This can be mitigated by checking whether the arguments of the math operations contain the expression.
This commit is contained in:
parent
48feb2c593
commit
3cba029a38
@ -880,16 +880,32 @@ bool OBSApp::SetTheme(const QString &name)
|
||||
/* Check if OBS appearance settings are used in the theme */
|
||||
currentTheme->usesFontScale = false;
|
||||
currentTheme->usesDensity = false;
|
||||
for (const OBSThemeVariable &var_ : vars) {
|
||||
if (var_.type != OBSThemeVariable::Alias)
|
||||
for (const OBSThemeVariable &var : vars) {
|
||||
switch (var.type) {
|
||||
case OBSThemeVariable::Color:
|
||||
case OBSThemeVariable::Size:
|
||||
case OBSThemeVariable::Number:
|
||||
case OBSThemeVariable::String:
|
||||
continue;
|
||||
case OBSThemeVariable::Alias:
|
||||
if (var.value.toString() == "obsFontScale") {
|
||||
currentTheme->usesFontScale = true;
|
||||
}
|
||||
|
||||
if (var_.value.toString() == "obsFontScale") {
|
||||
currentTheme->usesFontScale = true;
|
||||
}
|
||||
|
||||
if (var_.value.toString() == "obsPadding") {
|
||||
currentTheme->usesDensity = true;
|
||||
if (var.value.toString() == "obsPadding") {
|
||||
currentTheme->usesDensity = true;
|
||||
}
|
||||
break;
|
||||
case OBSThemeVariable::Calc:
|
||||
case OBSThemeVariable::Max:
|
||||
case OBSThemeVariable::Min:
|
||||
if (var.value.toStringList().contains("obsFontScale")) {
|
||||
currentTheme->usesFontScale = true;
|
||||
}
|
||||
if (var.value.toStringList().contains("obsPadding")) {
|
||||
currentTheme->usesDensity = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user