From 6164e33b07aa83042bd846dd76e0e6e8c5b9cad9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 21 Dec 2019 17:22:43 +0100 Subject: [PATCH] (Menu) Settings -> Playlists - more selective hiding --- menu/menu_displaylist.c | 56 ++++++++++++++++++++++++++++------------- menu/menu_setting.c | 6 +++++ 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 32bd664e37..846f26675b 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -8322,28 +8322,48 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); { - menu_displaylist_build_info_t build_list[] = { - {MENU_ENUM_LABEL_HISTORY_LIST_ENABLE, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE, PARSE_ONLY_UINT}, - {MENU_ENUM_LABEL_CONTENT_FAVORITES_SIZE, PARSE_ONLY_INT }, - {MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_PLAYLIST_ENTRY_REMOVE, PARSE_ONLY_UINT}, - {MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, PARSE_ONLY_UINT}, - {MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE, PARSE_ONLY_UINT}, - {MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE, PARSE_ONLY_UINT}, - {MENU_ENUM_LABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_SCAN_WITHOUT_CORE_MATCH, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG, PARSE_ONLY_BOOL}, - {MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG_AGGREGATE, PARSE_ONLY_BOOL}, + settings_t *settings = config_get_ptr(); + menu_displaylist_build_info_selective_t build_list[] = { + {MENU_ENUM_LABEL_HISTORY_LIST_ENABLE, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE, PARSE_ONLY_UINT, false}, + {MENU_ENUM_LABEL_CONTENT_FAVORITES_SIZE, PARSE_ONLY_INT, true}, + {MENU_ENUM_LABEL_PLAYLIST_ENTRY_RENAME, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_PLAYLIST_ENTRY_REMOVE, PARSE_ONLY_UINT, true}, + {MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, PARSE_ONLY_UINT, true}, + {MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE, PARSE_ONLY_UINT, false}, + {MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE, PARSE_ONLY_UINT, false}, + {MENU_ENUM_LABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_SCAN_WITHOUT_CORE_MATCH, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_CONTENT_RUNTIME_LOG_AGGREGATE, PARSE_ONLY_BOOL, true}, }; for (i = 0; i < ARRAY_SIZE(build_list); i++) { - if (menu_displaylist_parse_settings_enum(info->list, + switch (build_list[i].enum_idx) + { + case MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_RUNTIME_TYPE: + case MENU_ENUM_LABEL_PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE: + if (settings->bools.playlist_show_sublabels) + build_list[i].checked = true; + break; + case MENU_ENUM_LABEL_CONTENT_HISTORY_SIZE: + if (settings->bools.history_list_enable) + build_list[i].checked = true; + break; + default: + break; + } + } + + for (i = 0; i < ARRAY_SIZE(build_list); i++) + { + if (build_list[i].checked && + menu_displaylist_parse_settings_enum(info->list, build_list[i].enum_idx, build_list[i].parse_type, false) == 0) count++; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1cd43f9d65..94984097bc 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -14972,6 +14972,9 @@ static bool setting_append_list( general_read_handler, SD_FLAG_ADVANCED ); + (*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_UINT( list, list_info, @@ -15088,6 +15091,9 @@ static bool setting_append_list( 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_UINT( list, list_info,