ozone: new content metadata layout

This commit is contained in:
natinusala 2019-03-14 15:07:13 +01:00
parent 53268540f8
commit d65068cf15
3 changed files with 26 additions and 36 deletions

View File

@ -461,9 +461,9 @@ static void ozone_update_thumbnail_path(void *data, unsigned i, char pos)
core_label = core_name;
snprintf(ozone->selection_core_name, sizeof(ozone->selection_core_name),
"%s", core_label);
"%s %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), core_label);
word_wrap(ozone->selection_core_name, ozone->selection_core_name, (unsigned)((float)ozone->dimensions.thumbnail_bar_width * (float)0.66) / ozone->footer_font_glyph_width, false);
word_wrap(ozone->selection_core_name, ozone->selection_core_name, (unsigned)((float)ozone->dimensions.thumbnail_bar_width * (float)0.85) / ozone->footer_font_glyph_width, false);
ozone->selection_core_name_lines = ozone_count_lines(ozone->selection_core_name);
/* Fill play time if applicable */
@ -485,18 +485,20 @@ static void ozone_update_thumbnail_path(void *data, unsigned i, char pos)
&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);
snprintf(ozone->selection_playtime, sizeof(ozone->selection_playtime), "%s %02u:%02u:%02u",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME), 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",
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
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",
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s %04u/%02u/%02u -\n%02u:%02u:%02u",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
last_played_year, last_played_month, last_played_day,
last_played_hour, last_played_minute, last_played_second);
}

View File

@ -238,8 +238,8 @@ struct ozone_handle
uintptr_t left_thumbnail;
char selection_core_name[255];
char selection_playtime[64];
char selection_lastplayed[64];
char selection_playtime[255];
char selection_lastplayed[255];
unsigned selection_core_name_lines;
};

View File

@ -138,7 +138,13 @@ void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node
video_driver_get_size(NULL, &video_info_height);
current_selection_middle_onscreen = ozone->dimensions.header_height + ozone->dimensions.entry_padding_vertical + ozone->animations.scroll_y + node->position_y + node->height / 2;
current_selection_middle_onscreen =
ozone->dimensions.header_height +
ozone->dimensions.entry_padding_vertical +
ozone->animations.scroll_y +
node->position_y +
node->height / 2;
bottom_boundary = video_info_height - ozone->dimensions.header_height - 1 - ozone->dimensions.footer_height;
entries_middle = video_info_height/2;
@ -639,12 +645,12 @@ 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, unsigned lines_count)
unsigned *y, unsigned column_x,
const char *text, unsigned lines_count)
{
ozone_draw_text(video_info, ozone,
title,
title_column_x,
text,
column_x,
*y + FONT_SIZE_FOOTER,
TEXT_ALIGN_LEFT,
video_info->width, video_info->height,
@ -653,20 +659,6 @@ static void ozone_content_metadata_line(video_frame_info_t *video_info, ozone_ha
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) * lines_count;
}
@ -758,8 +750,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
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;
unsigned column_x = x_position + content_metadata_padding;
/* Content metadata */
y += 10;
@ -775,26 +766,23 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
/* 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),
&y, column_x,
ozone->selection_core_name,
ozone->selection_core_name_lines
);
/* 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),
&y, column_x,
ozone->selection_playtime,
1
);
/* 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),
&y, column_x,
ozone->selection_lastplayed,
1
2
);
}
}