From 5b04c060e15aa856adc8c79724a566372cb13150 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Thu, 15 Aug 2024 18:27:17 -0400 Subject: [PATCH] glui: Honor menu_show_sublabels option (#16878) --- menu/drivers/materialui.c | 8 +++++--- menu/menu_setting.c | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 85944e97e5..8fa501f031 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -2754,6 +2754,7 @@ static uint8_t materialui_count_sublabel_lines( menu_entry_t entry; char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH]; int sublabel_width_max = 0; + settings_t *settings = config_get_ptr(); wrapped_sublabel_str[0] = '\0'; @@ -2764,7 +2765,7 @@ static uint8_t materialui_count_sublabel_lines( menu_entry_get(&entry, 0, entry_idx, NULL, true); /* If sublabel is empty, return immediately */ - if (string_is_empty(entry.sublabel)) + if (!settings->bools.menu_show_sublabels || string_is_empty(entry.sublabel)) return 0; /* Wrap sublabel string to fit available width */ @@ -4014,6 +4015,7 @@ static void materialui_render_menu_entry_default( bool draw_text_outside = (x_offset != 0); gfx_display_t *p_disp = disp_get_ptr(); uico_driver_state_t *uico_st = uico_state_get_ptr(); + settings_t *settings = config_get_ptr(); static float color_white[16] = { 1.0f, 1.0f, 1.0f, 1.0f, @@ -4190,7 +4192,7 @@ static void materialui_render_menu_entry_default( /* Draw entry sublabel * > Must be done before label + value, since it * affects y offset positions */ - if (!string_is_empty(entry->sublabel)) + if (settings->bools.menu_show_sublabels && !string_is_empty(entry->sublabel)) { /* Note: Due to the way the selection highlight * marker is drawn (height is effectively 1px larger @@ -4550,7 +4552,7 @@ static void materialui_render_menu_entry_playlist_list( /* Draw entry sublabel * > Must be done before label, since it * affects y offset positions */ - if (!string_is_empty(entry->sublabel)) + if (settings->bools.menu_show_sublabels && !string_is_empty(entry->sublabel)) { /* Note: Due to the way the selection highlight * marker is drawn (height is effectively 1px larger diff --git a/menu/menu_setting.c b/menu/menu_setting.c index b291e1ff62..16adc88999 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -20130,6 +20130,9 @@ static bool setting_append_list( general_write_handler, general_read_handler, SD_FLAG_NONE); + (*list)[list_info->index - 1].action_ok = &setting_bool_action_left_with_refresh; + (*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh; + (*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh; CONFIG_BOOL( list, list_info,