Get rid of menu_entry_get_rich_label/menu_entry_get_value

This commit is contained in:
twinaphex 2020-09-12 18:48:22 +02:00
parent ef8f51dbbc
commit ba9ad1057f
7 changed files with 61 additions and 40 deletions

View File

@ -3836,8 +3836,15 @@ static void materialui_render_menu_entry_default(
mui->ticker.selected = entry_selected;
/* Read entry parameters */
menu_entry_get_rich_label(entry, &entry_label);
menu_entry_get_value(entry, &entry_value);
if (!string_is_empty(entry->rich_label))
entry_label = entry->rich_label;
else
entry_label = entry->path;
if (entry->enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD)
entry_value = entry->password_value;
else
entry_value = entry->value;
entry_type = entry->type;
entry_file_type = msg_hash_to_file_type(
@ -4159,7 +4166,10 @@ static void materialui_render_menu_entry_playlist_list(
mui->ticker.selected = entry_selected;
/* Read entry parameters */
menu_entry_get_rich_label(entry, &entry_label);
if (!string_is_empty(entry->rich_label))
entry_label = entry->rich_label;
else
entry_label = entry->path;
/* If thumbnails are *not* enabled, increase entry
* margin and decrease usable width by landscape
@ -4388,7 +4398,10 @@ static void materialui_render_menu_entry_playlist_dual_icon(
mui->ticker.selected = entry_selected;
/* Read entry parameters */
menu_entry_get_rich_label(entry, &entry_label);
if (!string_is_empty(entry->rich_label))
entry_label = entry->rich_label;
else
entry_label = entry->path;
/* Draw thumbnails
* > These go at the top of the entry, with a
@ -4528,7 +4541,10 @@ static void materialui_render_menu_entry_playlist_desktop(
(video_height - mui->nav_bar_layout_height - mui->status_bar.height));
/* Read entry parameters */
menu_entry_get_rich_label(entry, &entry_label);
if (!string_is_empty(entry->rich_label))
entry_label = entry->rich_label;
else
entry_label = entry->path;
/* Draw entry label */
if (!string_is_empty(entry_label))
@ -6051,7 +6067,10 @@ static void materialui_show_fullscreen_thumbnails(
menu_entry_get(&selected_entry, 0, selection, NULL, true);
/* > Get entry label */
menu_entry_get_rich_label(&selected_entry, &thumbnail_label);
if (!string_is_empty(selected_entry.rich_label))
thumbnail_label = selected_entry.rich_label;
else
thumbnail_label = selected_entry.path;
/* > Sanity check */
if (!string_is_empty(thumbnail_label))
@ -9176,7 +9195,10 @@ static int materialui_pointer_up_swipe_horz_default(
menu_entry_get(&last_entry, 0, selection, NULL, true);
/* Parse entry */
menu_entry_get_value(&last_entry, &entry_value);
if (last_entry.enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD)
entry_value = last_entry.password_value;
else
entry_value = last_entry.value;
entry_type = last_entry.type;
entry_file_type = msg_hash_to_file_type(
msg_hash_calculate(entry_value));

View File

@ -3875,7 +3875,10 @@ void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
menu_entry_get(&selected_entry, 0, (size_t)ozone->selection, NULL, true);
/* > Get entry label */
menu_entry_get_rich_label(&selected_entry, &thumbnail_label);
if (!string_is_empty(selected_entry.rich_label))
thumbnail_label = selected_entry.rich_label;
else
thumbnail_label = selected_entry.path;
/* > Sanity check */
if (!string_is_empty(thumbnail_label))

View File

@ -686,10 +686,17 @@ border_iterate:
entry.path_enabled = false;
entry.label_enabled = false;
menu_entry_get(&entry, 0, (unsigned)i, selection_buf, true);
menu_entry_get_value(&entry, &entry_value);
if (entry.enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD)
entry_value = entry.password_value;
else
entry_value = entry.value;
/* Prepare text */
menu_entry_get_rich_label(&entry, &entry_rich_label);
if (!string_is_empty(entry.rich_label))
entry_rich_label = entry.rich_label;
else
entry_rich_label = entry.path;
if (use_smooth_ticker)
{

View File

@ -2462,7 +2462,12 @@ static int stripes_draw_item(
}
if (!string_is_empty(entry->path))
menu_entry_get_rich_label(entry, &ticker_str);
{
if (!string_is_empty(entry.rich_label))
ticker_str = entry.rich_label;
else
ticker_str = entry.path;
}
ticker.s = tmp;
ticker.len = ticker_limit;

View File

@ -3194,7 +3194,10 @@ static int xmb_draw_item(
}
}
menu_entry_get_rich_label(&entry, &ticker_str);
if (!string_is_empty(entry.rich_label))
ticker_str = entry.rich_label;
else
ticker_str = entry.path;
if (use_smooth_ticker)
{
@ -4020,7 +4023,10 @@ static void xmb_show_fullscreen_thumbnails(
menu_entry_get(&selected_entry, 0, selection, NULL, true);
/* > Get entry label */
menu_entry_get_rich_label(&selected_entry, &thumbnail_label);
if (!string_is_empty(selected_entry.rich_label))
thumbnail_label = selected_entry.rich_label;
else
thumbnail_label = selected_entry.path;
/* > Sanity check */
if (!string_is_empty(thumbnail_label))

View File

@ -198,10 +198,6 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data);
void menu_entries_set_checked(file_list_t *list, size_t entry_idx,
bool checked);
void menu_entry_get_rich_label(menu_entry_t *entry, const char **rich_label);
void menu_entry_get_value(menu_entry_t *entry, const char **value);
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation);

View File

@ -4381,7 +4381,11 @@ static void get_current_menu_label(struct rarch_state *p_rarch,
menu_entry_init(&entry);
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
menu_entry_get_rich_label(&entry, &entry_label);
if (!string_is_empty(entry.rich_label))
entry_label = entry.rich_label;
else
entry_label = entry.path;
strlcpy(retstr, entry_label, max);
}
@ -5060,28 +5064,6 @@ void menu_entry_init(menu_entry_t *entry)
entry->sublabel_enabled = true;
}
void menu_entry_get_rich_label(menu_entry_t *entry, const char **rich_label)
{
if (!entry || !rich_label)
return;
if (!string_is_empty(entry->rich_label))
*rich_label = entry->rich_label;
else
*rich_label = entry->path;
}
void menu_entry_get_value(menu_entry_t *entry, const char **value)
{
if (!entry || !value)
return;
if (entry->enum_idx == MENU_ENUM_LABEL_CHEEVOS_PASSWORD)
*value = entry->password_value;
else
*value = entry->value;
}
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
size_t i, void *userdata, bool use_representation)
{