ServiceMenu: refactorització d'alguns métodes
ServiceMenu: en Video, amaga tamany de finestra quan está en fullscreen
This commit is contained in:
@@ -142,12 +142,8 @@ void ServiceMenu::moveBack()
|
||||
|
||||
// --- Lógica Interna ---
|
||||
|
||||
void ServiceMenu::updateMenu()
|
||||
void ServiceMenu::updateDisplayOptions()
|
||||
{
|
||||
title_ = settingsGroupToString(current_settings_group_);
|
||||
AdjustListValues();
|
||||
|
||||
// Actualiza las opciones visibles
|
||||
display_options_.clear();
|
||||
for (auto &option : options_)
|
||||
{
|
||||
@@ -156,13 +152,25 @@ void ServiceMenu::updateMenu()
|
||||
display_options_.push_back(option.get());
|
||||
}
|
||||
}
|
||||
updateOptionPairs();
|
||||
}
|
||||
|
||||
// Actualiza los pares de strings para el renderer
|
||||
void ServiceMenu::updateOptionPairs()
|
||||
{
|
||||
option_pairs_.clear();
|
||||
for (const auto &option : display_options_)
|
||||
{
|
||||
option_pairs_.emplace_back(option->getCaption(), option->getValueAsString());
|
||||
}
|
||||
}
|
||||
|
||||
void ServiceMenu::updateMenu()
|
||||
{
|
||||
title_ = settingsGroupToString(current_settings_group_);
|
||||
AdjustListValues();
|
||||
|
||||
// Actualiza las opciones visibles
|
||||
updateDisplayOptions();
|
||||
|
||||
// Notifica al renderer del cambio de layout
|
||||
renderer_->onLayoutChanged(this);
|
||||
@@ -171,27 +179,48 @@ void ServiceMenu::updateMenu()
|
||||
void ServiceMenu::applySettings()
|
||||
{
|
||||
if (current_settings_group_ == SettingsGroup::VIDEO)
|
||||
Screen::get()->applySettings();
|
||||
applyVideoSettings();
|
||||
if (current_settings_group_ == SettingsGroup::AUDIO)
|
||||
Audio::get()->applySettings();
|
||||
applyAudioSettings();
|
||||
if (current_settings_group_ == SettingsGroup::SETTINGS)
|
||||
applySettingsSettings();
|
||||
|
||||
// Actualiza los valores de las opciones
|
||||
updateOptionPairs();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void ServiceMenu::applyAudioSettings()
|
||||
{
|
||||
Audio::get()->applySettings();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
MenuOption *ServiceMenu::getOptionByCaption(const std::string &caption) const
|
||||
{
|
||||
for (const auto &option : options_)
|
||||
{
|
||||
for (auto &option : options_)
|
||||
if (option->getCaption() == caption)
|
||||
{
|
||||
if (option->getCaption() == Lang::getText("[SERVICE_MENU] SHUTDOWN]"))
|
||||
{
|
||||
option->setHidden(!Options::settings.shutdown_enabled);
|
||||
updateMenu(); // El menú debe refrescarse si algo se oculta
|
||||
break;
|
||||
}
|
||||
return option.get();
|
||||
}
|
||||
}
|
||||
// Refresca los pares de strings por si un valor cambió
|
||||
option_pairs_.clear();
|
||||
for (const auto &option : display_options_)
|
||||
{
|
||||
option_pairs_.emplace_back(option->getCaption(), option->getValueAsString());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// --- Getters y otros ---
|
||||
|
||||
Reference in New Issue
Block a user