clang-tidy modernize

This commit is contained in:
2025-07-20 12:51:24 +02:00
parent bfda842d3c
commit 1f0184fde2
74 changed files with 658 additions and 665 deletions

View File

@@ -16,7 +16,7 @@
ServiceMenu *ServiceMenu::instance = nullptr;
void ServiceMenu::init() { ServiceMenu::instance = new ServiceMenu(); }
void ServiceMenu::destroy() { delete ServiceMenu::instance; }
ServiceMenu *ServiceMenu::get() { return ServiceMenu::instance; }
auto ServiceMenu::get() -> ServiceMenu * { return ServiceMenu::instance; }
// Constructor
ServiceMenu::ServiceMenu()
@@ -106,7 +106,13 @@ void ServiceMenu::selectOption() {
return;
if (current_settings_group_ == SettingsGroup::MAIN)
main_menu_selected_ = selected_;
auto &selected_option = display_options_.at(selected_);
auto *selected_option = display_options_.at(selected_);
if (!selected_option) {
// This shouldn't happen in normal operation, but protects against null pointer
return;
}
if (auto folder = dynamic_cast<FolderOption *>(selected_option)) {
previous_settings_group_ = current_settings_group_;
current_settings_group_ = folder->getTargetGroup();
@@ -184,7 +190,7 @@ void ServiceMenu::applySettingsSettings() {
setHiddenOptions();
}
MenuOption *ServiceMenu::getOptionByCaption(const std::string &caption) const {
auto ServiceMenu::getOptionByCaption(const std::string &caption) const -> MenuOption * {
for (const auto &option : options_) {
if (option->getCaption() == caption) {
return option.get();
@@ -195,7 +201,7 @@ MenuOption *ServiceMenu::getOptionByCaption(const std::string &caption) const {
// --- Getters y otros ---
ServiceMenu::GroupAlignment ServiceMenu::getCurrentGroupAlignment() const {
auto ServiceMenu::getCurrentGroupAlignment() const -> ServiceMenu::GroupAlignment {
switch (current_settings_group_) {
case SettingsGroup::VIDEO:
case SettingsGroup::AUDIO:
@@ -206,7 +212,7 @@ ServiceMenu::GroupAlignment ServiceMenu::getCurrentGroupAlignment() const {
}
}
size_t ServiceMenu::countOptionsInGroup(SettingsGroup group) const {
auto ServiceMenu::countOptionsInGroup(SettingsGroup group) const -> size_t {
size_t count = 0;
for (const auto &option : options_) {
if (option->getGroup() == group && !option->isHidden()) {
@@ -269,7 +275,7 @@ void ServiceMenu::playSelectSound() { Audio::get()->playSound("service_menu_sele
void ServiceMenu::playBackSound() { Audio::get()->playSound("service_menu_select.wav", Audio::Group::INTERFACE); }
// Devuelve el nombre del grupo como string para el título
std::string ServiceMenu::settingsGroupToString(SettingsGroup group) const {
auto ServiceMenu::settingsGroupToString(SettingsGroup group) const -> std::string {
switch (group) {
case SettingsGroup::MAIN:
return Lang::getText("[SERVICE_MENU] TITLE");