Merge pull request #12398 from DisasterMo/playlist_entry_enumeration

(ozone) Added simple playlist entry enumeration
This commit is contained in:
Autechre 2021-05-18 13:19:35 +02:00 committed by GitHub
commit 6972cc2bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 101 additions and 1 deletions

View File

@ -1193,6 +1193,10 @@ static const int default_content_favorites_size = 200;
#define DEFAULT_PLAYLIST_SHOW_SUBLABELS true
#endif
/* Show the indices of playlist entries in
* a menu-driver-specific fashion */
#define DEFAULT_PLAYLIST_SHOW_ENTRY_IDX true
#define DEFAULT_PLAYLIST_FUZZY_ARCHIVE_MATCH false
#define DEFAULT_PLAYLIST_PORTABLE_PATHS false

View File

@ -1818,6 +1818,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("content_runtime_log", &settings->bools.content_runtime_log, true, DEFAULT_CONTENT_RUNTIME_LOG, false);
SETTING_BOOL("content_runtime_log_aggregate", &settings->bools.content_runtime_log_aggregate, true, DEFAULT_CONTENT_RUNTIME_LOG_AGGREGATE, false);
SETTING_BOOL("playlist_show_sublabels", &settings->bools.playlist_show_sublabels, true, DEFAULT_PLAYLIST_SHOW_SUBLABELS, false);
SETTING_BOOL("playlist_show_entry_idx", &settings->bools.playlist_show_entry_idx, true, DEFAULT_PLAYLIST_SHOW_ENTRY_IDX, false);
SETTING_BOOL("playlist_sort_alphabetical", &settings->bools.playlist_sort_alphabetical, true, DEFAULT_PLAYLIST_SORT_ALPHABETICAL, false);
SETTING_BOOL("playlist_fuzzy_archive_match", &settings->bools.playlist_fuzzy_archive_match, true, DEFAULT_PLAYLIST_FUZZY_ARCHIVE_MATCH, false);
SETTING_BOOL("playlist_portable_paths", &settings->bools.playlist_portable_paths, true, DEFAULT_PLAYLIST_PORTABLE_PATHS, false);

View File

@ -826,6 +826,7 @@ typedef struct settings
bool playlist_sort_alphabetical;
bool playlist_show_sublabels;
bool playlist_show_entry_idx;
bool playlist_fuzzy_archive_match;
bool playlist_portable_paths;

View File

@ -4594,6 +4594,10 @@ MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS,
"playlist_show_sublabels"
)
MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX,
"playlist_show_entry_idx"
)
MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_FUZZY_ARCHIVE_MATCH,
"playlist_fuzzy_archive_match"

View File

@ -5293,6 +5293,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED,
"Last Played:"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_ENTRY_IDX,
"Show Playlist Entry Index"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_ENTRY_IDX,
"Show entry numbers when viewing playlists. Display format is dependent upon the currently selected menu driver."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME_TYPE,
"Playlist Sub-Label Runtime"
@ -6143,6 +6151,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH,
"File Path"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_INFO_ENTRY_IDX,
"Entry: %lu/%lu"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME,
"Core"

View File

@ -914,6 +914,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_overscan_correction_bottom, ME
#endif
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_sublabels, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_SUBLABELS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_playlist_show_entry_idx, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_ENTRY_IDX)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_border_filler_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BORDER_FILLER_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_border_filler_thickness_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_rgui_background_filler_thickness_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE)
@ -4082,6 +4083,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_PLAYLIST_SHOW_SUBLABELS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_sublabels);
break;
case MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_show_entry_idx);
break;
case MENU_ENUM_LABEL_MENU_RGUI_BORDER_FILLER_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_border_filler_enable);
break;

View File

@ -3963,6 +3963,7 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
playlist_t *playlist = playlist_get_cached();
settings_t *settings = config_get_ptr();
bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata;
bool show_entry_idx = settings->bools.playlist_show_entry_idx;
bool content_runtime_log = settings->bools.content_runtime_log;
bool content_runtime_log_aggr = settings->bools.content_runtime_log_aggregate;
const char *directory_runtime_log = settings->paths.directory_runtime_log;
@ -4006,6 +4007,14 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
playlist_index = list->list[selection].entry_idx;
}
/* Fill entry enumeration */
if (show_entry_idx)
snprintf(ozone->selection_entry_enumeration, sizeof(ozone->selection_entry_enumeration),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_ENTRY_IDX),
(unsigned long)(playlist_index + 1), (unsigned long)list_size);
else
ozone->selection_entry_enumeration[0] = '\0';
/* Fill core name */
if (!core_name || string_is_equal(core_name, "DETECT"))
core_label = msg_hash_to_str(MSG_AUTODETECT);

View File

@ -265,6 +265,7 @@ struct ozone_handle
char selection_core_name[255];
char selection_playtime[255];
char selection_lastplayed[255];
char selection_entry_enumeration[255];
bool cursor_in_sidebar;
bool cursor_in_sidebar_old;

View File

@ -1155,6 +1155,7 @@ void ozone_draw_thumbnail_bar(
enum gfx_animation_ticker_type
menu_ticker_type = (enum gfx_animation_ticker_type)
settings->uints.menu_ticker_type;
bool show_entry_idx = settings->bools.playlist_show_entry_idx;
unsigned y = (unsigned)bottom_row_y_position;
unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2;
unsigned column_x = x_position + separator_padding;
@ -1218,6 +1219,33 @@ void ozone_draw_thumbnail_bar(
if (scroll_content_metadata)
{
/* Entry enumeration */
if (show_entry_idx)
{
ticker_buf[0] = '\0';
if (use_smooth_ticker)
{
ticker_smooth.src_str = ozone->selection_entry_enumeration;
gfx_animation_ticker_smooth(&ticker_smooth);
}
else
{
ticker.str = ozone->selection_entry_enumeration;
gfx_animation_ticker(&ticker);
}
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
ticker_x_offset + column_x,
ticker_buf,
text_color,
1);
}
/* Core association */
ticker_buf[0] = '\0';
@ -1296,6 +1324,18 @@ void ozone_draw_thumbnail_bar(
}
else
{
/* Entry enumeration */
if (show_entry_idx)
ozone_content_metadata_line(
video_width,
video_height,
ozone,
&y,
column_x,
ozone->selection_entry_enumeration,
text_color,
1);
/* Core association */
ozone_content_metadata_line(
video_width,

View File

@ -3981,7 +3981,7 @@ static unsigned menu_displaylist_parse_content_information(
/* If content is currently running, have to make sure
* we have a valid playlist to work with
* (if content is not running, than playlist will always
* (if content is not running, then playlist will always
* be valid provided that playlist_get_cached() does not
* return NULL) */
if (content_loaded)
@ -5392,6 +5392,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_COMPRESSION, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_INLINE_CORE_NAME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX, PARSE_ONLY_BOOL, 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},

View File

@ -17646,6 +17646,27 @@ static bool setting_append_list(
(*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;
/* Playlist entry index display is currently
* supported only by Ozone */
if (string_is_equal(settings->arrays.menu_driver, "ozone"))
{
CONFIG_BOOL(
list, list_info,
&settings->bools.playlist_show_entry_idx,
MENU_ENUM_LABEL_PLAYLIST_SHOW_ENTRY_IDX,
MENU_ENUM_LABEL_VALUE_PLAYLIST_SHOW_ENTRY_IDX,
DEFAULT_PLAYLIST_SHOW_ENTRY_IDX,
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
);
}
CONFIG_UINT(
list, list_info,
&settings->uints.playlist_sublabel_runtime_type,

View File

@ -2022,6 +2022,7 @@ enum msg_hash_enums
/* Content information settings */
MENU_LABEL(CONTENT_INFO_LABEL),
MENU_LABEL(CONTENT_INFO_PATH),
MENU_LABEL(CONTENT_INFO_ENTRY_IDX),
MENU_LABEL(CONTENT_INFO_CORE_NAME),
MENU_LABEL(CONTENT_INFO_DATABASE),
MENU_LABEL(CONTENT_INFO_RUNTIME),
@ -3096,6 +3097,7 @@ enum msg_hash_enums
MENU_LABEL(PLAYLIST_SHOW_INLINE_CORE_NAME),
MENU_LABEL(PLAYLIST_SORT_ALPHABETICAL),
MENU_LABEL(PLAYLIST_SHOW_SUBLABELS),
MENU_LABEL(PLAYLIST_SHOW_ENTRY_IDX),
MENU_LABEL(PLAYLIST_FUZZY_ARCHIVE_MATCH),
MENU_LABEL(PLAYLIST_SUBLABEL_RUNTIME_TYPE),
MENU_LABEL(PLAYLIST_SUBLABEL_LAST_PLAYED_STYLE),