GUI: Allow manual setting of custom GUI scale values

We keep this value and do not override it
This commit is contained in:
Eugene Sandulenko 2024-01-20 20:52:29 +01:00
parent c1aca01197
commit 6db11ef605
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -2386,13 +2386,22 @@ void GlobalOptionsDialog::build() {
#endif
// Misc Tab
_guiBasePopUp->setSelected(2);
bool seenValue = false;
int value = ConfMan.getInt("gui_scale");
if (!value)
value = 100; // Setting default sane value
for (int i = 0; guiBaseLabels[i]; i++) {
if (value == guiBaseValues[i])
if (value == guiBaseValues[i]) {
seenValue = true;
_guiBasePopUp->setSelected(i);
}
}
if (!seenValue)
_guiBasePopUp->setSelected(ARRAYSIZE(guiBaseLabels) - 1);
_autosavePeriodPopUp->setSelected(1);
value = ConfMan.getInt("autosave_period");
for (int i = 0; savePeriodLabels[i]; i++) {
@ -2538,10 +2547,24 @@ void GlobalOptionsDialog::addGUIControls(GuiObject *boss, const Common::String &
_guiBasePopUpDesc = new StaticTextWidget(boss, prefix + "GUIBasePopupDesc", _("GUI scale:"));
_guiBasePopUp = new PopUpWidget(boss, prefix + "GUIBasePopup");
bool seenValue = false;
int oldGuiScale = ConfMan.getInt("gui_scale");
if (!oldGuiScale)
oldGuiScale = 100; // Setting default sane value
for (int i = 0; guiBaseLabels[i]; i++) {
if (guiBaseValues[i] == oldGuiScale)
seenValue = true;
_guiBasePopUp->appendEntry(_(guiBaseLabels[i]), guiBaseValues[i]);
}
if (!seenValue) {
Common::U32String customText = Common::U32String::format(_("%d%% - Custom"), oldGuiScale);
_guiBasePopUp->appendEntry(customText, oldGuiScale);
}
_rendererPopUpDesc = new StaticTextWidget(boss, prefix + "RendererPopupDesc", _("GUI renderer:"));
_rendererPopUp = new PopUpWidget(boss, prefix + "RendererPopup");