Merge pull request #10706 from jdgleaver/ozone-sort-after-truncate

(Ozone) Add option to sort playlists after name truncation
This commit is contained in:
Autechre 2020-05-25 17:07:36 +02:00 committed by GitHub
commit d3519a2b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 3 deletions

View File

@ -413,6 +413,7 @@
#define DEFAULT_OZONE_COLOR_THEME 1
#define DEFAULT_OZONE_COLLAPSE_SIDEBAR false
#define DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME true
#define DEFAULT_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME true
#define DEFAULT_OZONE_SCROLL_CONTENT_METADATA false
#endif

View File

@ -1667,6 +1667,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#ifdef HAVE_OZONE
SETTING_BOOL("ozone_collapse_sidebar", &settings->bools.ozone_collapse_sidebar, true, DEFAULT_OZONE_COLLAPSE_SIDEBAR, false);
SETTING_BOOL("ozone_truncate_playlist_name", &settings->bools.ozone_truncate_playlist_name, true, DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME, false);
SETTING_BOOL("ozone_sort_after_truncate_playlist_name", &settings->bools.ozone_sort_after_truncate_playlist_name, true, DEFAULT_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME, false);
SETTING_BOOL("ozone_scroll_content_metadata",&settings->bools.ozone_scroll_content_metadata, true, DEFAULT_OZONE_SCROLL_CONTENT_METADATA, false);
#endif
SETTING_BOOL("log_to_file", &settings->bools.log_to_file, true, DEFAULT_LOG_TO_FILE, false);

View File

@ -394,6 +394,7 @@ typedef struct settings
bool enable_device_vibration;
bool ozone_collapse_sidebar;
bool ozone_truncate_playlist_name;
bool ozone_sort_after_truncate_playlist_name;
bool ozone_scroll_content_metadata;
bool log_to_file;

View File

@ -1538,6 +1538,10 @@ MSG_HASH(
MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME,
"ozone_truncate_playlist_name"
)
MSG_HASH(
MENU_ENUM_LABEL_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME,
"ozone_sort_after_truncate_playlist_name"
)
MSG_HASH(
MENU_ENUM_LABEL_OZONE_SCROLL_CONTENT_METADATA,
"ozone_scroll_content_metadata"

View File

@ -7757,6 +7757,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_TRUNCATE_PLAYLIST_NAME,
"When enabled, will remove the system names from the playlists. For example, display 'PlayStation' instead of 'Sony - PlayStation'. Changes require a restart to take effect."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME,
"Sort Playlists After Name Truncation"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME,
"When enabled, playlists will be re-sorted in alphabetical order after removing the 'system' component of their names. Changes require a restart to take effect."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_OZONE_MENU_COLOR_THEME,
"Menu Color Theme"

View File

@ -449,6 +449,7 @@ default_sublabel_macro(action_bind_sublabel_left_thumbnails_ozone, MENU_
default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME)
default_sublabel_macro(action_bind_sublabel_ozone_collapse_sidebar, MENU_ENUM_SUBLABEL_OZONE_COLLAPSE_SIDEBAR)
default_sublabel_macro(action_bind_sublabel_ozone_truncate_playlist_name, MENU_ENUM_SUBLABEL_OZONE_TRUNCATE_PLAYLIST_NAME)
default_sublabel_macro(action_bind_sublabel_ozone_sort_after_truncate_playlist_name, MENU_ENUM_SUBLABEL_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME)
default_sublabel_macro(action_bind_sublabel_ozone_scroll_content_metadata, MENU_ENUM_SUBLABEL_OZONE_SCROLL_CONTENT_METADATA)
#endif
default_sublabel_macro(action_bind_sublabel_menu_thumbnail_upscale_threshold, MENU_ENUM_SUBLABEL_MENU_THUMBNAIL_UPSCALE_THRESHOLD)
@ -1854,6 +1855,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME:
#ifdef HAVE_OZONE
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_truncate_playlist_name);
#endif
break;
case MENU_ENUM_LABEL_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME:
#ifdef HAVE_OZONE
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_sort_after_truncate_playlist_name);
#endif
break;
case MENU_ENUM_LABEL_OZONE_SCROLL_CONTENT_METADATA:

View File

@ -722,6 +722,7 @@ void ozone_init_horizontal_list(ozone_handle_t *ozone)
const char *dir_playlist = settings->paths.directory_playlist;
bool menu_content_show_playlists = settings->bools.menu_content_show_playlists;
bool ozone_truncate_playlist_name = settings->bools.ozone_truncate_playlist_name;
bool ozone_sort_after_truncate = settings->bools.ozone_sort_after_truncate_playlist_name;
menu_displaylist_info_init(&info);
@ -800,9 +801,11 @@ void ozone_init_horizontal_list(ozone_handle_t *ozone)
file_list_set_alt_at_offset(ozone->horizontal_list, i, console_name);
}
/* If playlist names were truncated, re-sort list
* by console name */
if (ozone_truncate_playlist_name && (list_size > 0))
/* If playlist names were truncated and option is
* enabled, re-sort list by console name */
if (ozone_truncate_playlist_name &&
ozone_sort_after_truncate &&
(list_size > 0))
file_list_sort_on_alt(ozone->horizontal_list);
}

View File

@ -4277,6 +4277,7 @@ unsigned menu_displaylist_build_list(
{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_OZONE_SORT_AFTER_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},
};
@ -7464,6 +7465,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_OZONE_COLLAPSE_SIDEBAR, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MATERIALUI_SHOW_NAV_BAR, PARSE_ONLY_BOOL, true},

View File

@ -15806,6 +15806,21 @@ static bool setting_append_list(
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.ozone_sort_after_truncate_playlist_name,
MENU_ENUM_LABEL_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME,
MENU_ENUM_LABEL_VALUE_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME,
DEFAULT_OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
}
#endif

View File

@ -1049,6 +1049,7 @@ enum msg_hash_enums
MENU_LABEL(OZONE_MENU_COLOR_THEME),
MENU_LABEL(OZONE_COLLAPSE_SIDEBAR),
MENU_LABEL(OZONE_TRUNCATE_PLAYLIST_NAME),
MENU_LABEL(OZONE_SORT_AFTER_TRUNCATE_PLAYLIST_NAME),
MENU_LABEL(OZONE_SCROLL_CONTENT_METADATA),
MENU_LABEL(MATERIALUI_MENU_COLOR_THEME),
MENU_LABEL(QUICK_MENU_OVERRIDE_OPTIONS),