From 52126740933d465ebdef5eb65e523dd224f0aed9 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 29 Jun 2025 12:44:13 +0200 Subject: [PATCH] fix ServiceMenu: amaga TOTES les opcions que s'han d'amagar al inici (not tested pq en macos no va el fullscreen d'inici) --- source/ui/service_menu.cpp | 30 +++++++++++++++++++++--------- source/ui/service_menu.h | 1 + 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/source/ui/service_menu.cpp b/source/ui/service_menu.cpp index 60fe06c..ba0b64a 100644 --- a/source/ui/service_menu.cpp +++ b/source/ui/service_menu.cpp @@ -193,10 +193,7 @@ void ServiceMenu::applySettings() void ServiceMenu::applyVideoSettings() { Screen::get()->applySettings(); - auto option = getOptionByCaption(Lang::getText("[SERVICE_MENU] WINDOW_SIZE")); - if (option) - option->setHidden(Options::video.fullscreen); - updateMenu(); // El menú debe refrescarse si algo se oculta + setHiddenOptions(); } void ServiceMenu::applyAudioSettings() @@ -206,10 +203,7 @@ void ServiceMenu::applyAudioSettings() void ServiceMenu::applySettingsSettings() { - auto option = getOptionByCaption(Lang::getText("[SERVICE_MENU] SHUTDOWN")); - if (option) - option->setHidden(!Options::settings.shutdown_enabled); - updateMenu(); // El menú debe refrescarse si algo se oculta + setHiddenOptions(); } MenuOption *ServiceMenu::getOptionByCaption(const std::string &caption) const @@ -294,7 +288,7 @@ void ServiceMenu::initializeOptions() options_.push_back(std::make_unique(Lang::getText("[SERVICE_MENU] SETTINGS"), SettingsGroup::MAIN, SettingsGroup::SETTINGS)); options_.push_back(std::make_unique(Lang::getText("[SERVICE_MENU] SYSTEM"), SettingsGroup::MAIN, SettingsGroup::SYSTEM)); - // precalculateMenuWidths(); + setHiddenOptions(); } // Sincroniza los valores de las opciones tipo lista @@ -331,3 +325,21 @@ std::string ServiceMenu::settingsGroupToString(SettingsGroup group) const return Lang::getText("[SERVICE_MENU] TITLE"); } } + +// Establece el estado de oculto de ciertas opciones +void ServiceMenu::setHiddenOptions() +{ + { + auto option = getOptionByCaption(Lang::getText("[SERVICE_MENU] WINDOW_SIZE")); + if (option) + option->setHidden(Options::video.fullscreen); + } + + { + auto option = getOptionByCaption(Lang::getText("[SERVICE_MENU] SHUTDOWN")); + if (option) + option->setHidden(!Options::settings.shutdown_enabled); + } + + updateMenu(); // El menú debe refrescarse si algo se oculta +} \ No newline at end of file diff --git a/source/ui/service_menu.h b/source/ui/service_menu.h index ae198ee..d148405 100644 --- a/source/ui/service_menu.h +++ b/source/ui/service_menu.h @@ -95,6 +95,7 @@ private: void AdjustListValues(); void playMenuSound(); std::string settingsGroupToString(SettingsGroup group) const; + void setHiddenOptions(); // --- Singleton --- ServiceMenu();