mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 22:20:59 +00:00
ozone: complete content metadata section
This commit is contained in:
parent
adb8714105
commit
222b7e7be0
@ -837,7 +837,7 @@ static int action_bind_sublabel_playlist_entry(
|
|||||||
unsigned last_played_minute = 0;
|
unsigned last_played_minute = 0;
|
||||||
unsigned last_played_second = 0;
|
unsigned last_played_second = 0;
|
||||||
|
|
||||||
if (!settings->bools.playlist_show_sublabels)
|
if (!settings->bools.playlist_show_sublabels || string_is_equal(settings->arrays.menu_driver, "ozone"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Get current playlist */
|
/* Get current playlist */
|
||||||
|
@ -439,9 +439,63 @@ static void ozone_update_thumbnail_path(void *data, unsigned i, char pos)
|
|||||||
if (playlist)
|
if (playlist)
|
||||||
{
|
{
|
||||||
const char *core_name = NULL;
|
const char *core_name = NULL;
|
||||||
|
const char *core_label = NULL;
|
||||||
playlist_get_index(playlist, i,
|
playlist_get_index(playlist, i,
|
||||||
NULL, NULL, NULL, &core_name, NULL, NULL);
|
NULL, NULL, NULL, &core_name, NULL, NULL);
|
||||||
|
|
||||||
|
/* Fill core name */
|
||||||
|
if (!core_name || string_is_equal(core_name, "DETECT"))
|
||||||
|
core_label = msg_hash_to_str(MSG_AUTODETECT);
|
||||||
|
else
|
||||||
|
core_label = core_name;
|
||||||
|
|
||||||
|
snprintf(ozone->selection_core_name, sizeof(ozone->selection_core_name),
|
||||||
|
"%s", core_label);
|
||||||
|
|
||||||
|
/* Fill play time if applicable */
|
||||||
|
if (settings->bools.content_runtime_log)
|
||||||
|
{
|
||||||
|
unsigned runtime_hours = 0;
|
||||||
|
unsigned runtime_minutes = 0;
|
||||||
|
unsigned runtime_seconds = 0;
|
||||||
|
|
||||||
|
unsigned last_played_year = 0;
|
||||||
|
unsigned last_played_month = 0;
|
||||||
|
unsigned last_played_day = 0;
|
||||||
|
unsigned last_played_hour = 0;
|
||||||
|
unsigned last_played_minute = 0;
|
||||||
|
unsigned last_played_second = 0;
|
||||||
|
|
||||||
|
playlist_get_runtime_index(playlist, i, NULL, NULL,
|
||||||
|
&runtime_hours, &runtime_minutes, &runtime_seconds,
|
||||||
|
&last_played_year, &last_played_month, &last_played_day,
|
||||||
|
&last_played_hour, &last_played_minute, &last_played_second);
|
||||||
|
|
||||||
|
snprintf(ozone->selection_playtime, sizeof(ozone->selection_playtime), "%02u:%02u:%02u",
|
||||||
|
runtime_hours, runtime_minutes, runtime_seconds);
|
||||||
|
|
||||||
|
if (last_played_year == 0 && last_played_month == 0 && last_played_day == 0
|
||||||
|
&& last_played_hour == 0 && last_played_minute == 0 && last_played_second == 0)
|
||||||
|
{
|
||||||
|
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s",
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%04u/%02u/%02u - %02u:%02u:%02u",
|
||||||
|
last_played_year, last_played_month, last_played_day,
|
||||||
|
last_played_hour, last_played_minute, last_played_second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(ozone->selection_playtime, sizeof(ozone->selection_playtime), "%s",
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
|
||||||
|
|
||||||
|
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s",
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
|
||||||
|
}
|
||||||
|
|
||||||
if (string_is_equal(core_name, "imageviewer"))
|
if (string_is_equal(core_name, "imageviewer"))
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
@ -1940,9 +1994,9 @@ static void ozone_toggle(void *userdata, bool menu_on)
|
|||||||
{
|
{
|
||||||
ozone->draw_sidebar = true;
|
ozone->draw_sidebar = true;
|
||||||
ozone->sidebar_offset = 0.0f;
|
ozone->sidebar_offset = 0.0f;
|
||||||
|
|
||||||
ozone_sidebar_update_collapse(ozone, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ozone_sidebar_update_collapse(ozone, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ozone_menu_init_list(void *data)
|
static bool ozone_menu_init_list(void *data)
|
||||||
|
@ -235,6 +235,10 @@ struct ozone_handle
|
|||||||
|
|
||||||
uintptr_t thumbnail;
|
uintptr_t thumbnail;
|
||||||
uintptr_t left_thumbnail;
|
uintptr_t left_thumbnail;
|
||||||
|
|
||||||
|
char selection_core_name[255];
|
||||||
|
char selection_playtime[64];
|
||||||
|
char selection_lastplayed[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* If you change this struct, also
|
/* If you change this struct, also
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
static int ozone_get_entries_padding(ozone_handle_t* ozone, bool old_list)
|
static int ozone_get_entries_padding(ozone_handle_t* ozone, bool old_list)
|
||||||
{
|
{
|
||||||
/* TODO: Once we have thumbnails this condition will no longer work
|
|
||||||
* on playlists (where the sidebar is partially collapsed with depth == 1) */
|
|
||||||
if (ozone->depth == 1)
|
if (ozone->depth == 1)
|
||||||
if (old_list)
|
if (old_list)
|
||||||
return ozone->dimensions.entry_padding_horizontal_full;
|
return ozone->dimensions.entry_padding_horizontal_full;
|
||||||
@ -640,6 +638,38 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ozone_content_metadata_line(video_frame_info_t *video_info, ozone_handle_t *ozone,
|
||||||
|
unsigned *y, unsigned title_column_x, unsigned data_column_x,
|
||||||
|
const char *title, const char *data)
|
||||||
|
{
|
||||||
|
ozone_draw_text(video_info, ozone,
|
||||||
|
title,
|
||||||
|
title_column_x,
|
||||||
|
*y + FONT_SIZE_FOOTER,
|
||||||
|
TEXT_ALIGN_LEFT,
|
||||||
|
video_info->width, video_info->height,
|
||||||
|
ozone->fonts.footer,
|
||||||
|
ozone->theme->text_rgba,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
if (font_driver_get_message_width(ozone->fonts.footer, data, strlen(data), 1) > ozone->dimensions.thumbnail_bar_width / 2)
|
||||||
|
*y += font_driver_get_line_height(ozone->fonts.footer, 1);
|
||||||
|
|
||||||
|
ozone_draw_text(video_info, ozone,
|
||||||
|
data,
|
||||||
|
data_column_x,
|
||||||
|
*y + FONT_SIZE_FOOTER,
|
||||||
|
TEXT_ALIGN_RIGHT,
|
||||||
|
video_info->width, video_info->height,
|
||||||
|
ozone->fonts.footer,
|
||||||
|
ozone->theme->text_rgba,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
*y += font_driver_get_line_height(ozone->fonts.footer, 1) * 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_info)
|
void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_info)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -681,7 +711,8 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
|||||||
unsigned thumb_x_position = x_position + sidebar_width/2 - (ozone->dimensions.thumbnail_width + ozone->dimensions.sidebar_entry_icon_padding) / 2;
|
unsigned thumb_x_position = x_position + sidebar_width/2 - (ozone->dimensions.thumbnail_width + ozone->dimensions.sidebar_entry_icon_padding) / 2;
|
||||||
unsigned thumb_y_position = video_info->height / 2 - ozone->dimensions.thumbnail_height / 2;
|
unsigned thumb_y_position = video_info->height / 2 - ozone->dimensions.thumbnail_height / 2;
|
||||||
|
|
||||||
thumb_y_position -= ozone->dimensions.thumbnail_height / 2 + ozone->dimensions.sidebar_entry_icon_padding/2;
|
if (!string_is_equal(ozone->selection_core_name, "imageviewer"))
|
||||||
|
thumb_y_position -= ozone->dimensions.thumbnail_height / 2 + ozone->dimensions.sidebar_entry_icon_padding/2;
|
||||||
|
|
||||||
ozone_draw_icon(video_info,
|
ozone_draw_icon(video_info,
|
||||||
ozone->dimensions.thumbnail_width,
|
ozone->dimensions.thumbnail_width,
|
||||||
@ -717,9 +748,46 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
|||||||
ozone_pure_white
|
ozone_pure_white
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else if (!string_is_equal(ozone->selection_core_name, "imageviewer"))
|
||||||
{
|
{
|
||||||
/* TODO: Content metadata */
|
unsigned y = video_info->height / 2 + ozone->dimensions.sidebar_entry_icon_padding / 2;
|
||||||
|
unsigned content_metadata_padding = ozone->dimensions.sidebar_entry_icon_padding*3;
|
||||||
|
unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2;
|
||||||
|
unsigned title_column_x = x_position + content_metadata_padding;
|
||||||
|
unsigned data_column_x = x_position + sidebar_width - content_metadata_padding;
|
||||||
|
|
||||||
|
/* Content metadata */
|
||||||
|
y += 10;
|
||||||
|
|
||||||
|
/* Separator */
|
||||||
|
menu_display_draw_quad(video_info,
|
||||||
|
x_position + separator_padding, y,
|
||||||
|
sidebar_width - separator_padding*2, 1,
|
||||||
|
video_info->width, video_info->height,
|
||||||
|
ozone->theme_dynamic.entries_border);
|
||||||
|
|
||||||
|
y += 18;
|
||||||
|
|
||||||
|
/* Core association */
|
||||||
|
ozone_content_metadata_line(video_info, ozone,
|
||||||
|
&y, title_column_x, data_column_x,
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE),
|
||||||
|
ozone->selection_core_name
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Playtime */
|
||||||
|
ozone_content_metadata_line(video_info, ozone,
|
||||||
|
&y, title_column_x, data_column_x,
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME),
|
||||||
|
ozone->selection_playtime
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Last played */
|
||||||
|
ozone_content_metadata_line(video_info, ozone,
|
||||||
|
&y, title_column_x, data_column_x,
|
||||||
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
|
||||||
|
ozone->selection_lastplayed
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,14 +104,6 @@ static enum msg_hash_enums new_type = MSG_UNKNOWN;
|
|||||||
* in playlists */
|
* in playlists */
|
||||||
#define PL_LABEL_SPACER_DEFAULT " | "
|
#define PL_LABEL_SPACER_DEFAULT " | "
|
||||||
#define PL_LABEL_SPACER_RGUI " | "
|
#define PL_LABEL_SPACER_RGUI " | "
|
||||||
#if defined(__APPLE__)
|
|
||||||
/* UTF-8 support is currently broken on Apple devices... */
|
|
||||||
#define PL_LABEL_SPACER_OZONE " | "
|
|
||||||
#else
|
|
||||||
/* <EM SPACE><BULLET><EM SPACE>
|
|
||||||
* UCN equivalent: "\u2003\u2022\u2003" */
|
|
||||||
#define PL_LABEL_SPACER_OZONE "\xE2\x80\x83\xE2\x80\xA2\xE2\x80\x83"
|
|
||||||
#endif
|
|
||||||
#define PL_LABEL_SPACER_MAXLEN 37
|
#define PL_LABEL_SPACER_MAXLEN 37
|
||||||
|
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
@ -1316,7 +1308,8 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether core name should be added to playlist entries */
|
/* Check whether core name should be added to playlist entries */
|
||||||
if (!settings->bools.playlist_show_sublabels &&
|
if (!string_is_equal(settings->arrays.menu_driver, "ozone") &&
|
||||||
|
!settings->bools.playlist_show_sublabels &&
|
||||||
((settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS) ||
|
((settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS) ||
|
||||||
(!is_collection && !(settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_NEVER))))
|
(!is_collection && !(settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_NEVER))))
|
||||||
{
|
{
|
||||||
@ -1326,8 +1319,6 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
|||||||
* > Note: Only required when showing inline core names */
|
* > Note: Only required when showing inline core names */
|
||||||
if (is_rgui)
|
if (is_rgui)
|
||||||
strlcpy(label_spacer, PL_LABEL_SPACER_RGUI, sizeof(label_spacer));
|
strlcpy(label_spacer, PL_LABEL_SPACER_RGUI, sizeof(label_spacer));
|
||||||
else if (string_is_equal(settings->arrays.menu_driver, "ozone"))
|
|
||||||
strlcpy(label_spacer, PL_LABEL_SPACER_OZONE, sizeof(label_spacer));
|
|
||||||
else
|
else
|
||||||
strlcpy(label_spacer, PL_LABEL_SPACER_DEFAULT, sizeof(label_spacer));
|
strlcpy(label_spacer, PL_LABEL_SPACER_DEFAULT, sizeof(label_spacer));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user