From d65068cf15bf58d54e848dc185458601fda1c6b5 Mon Sep 17 00:00:00 2001 From: natinusala Date: Thu, 14 Mar 2019 15:07:13 +0100 Subject: [PATCH] ozone: new content metadata layout --- menu/drivers/ozone/ozone.c | 14 ++++++---- menu/drivers/ozone/ozone.h | 4 +-- menu/drivers/ozone/ozone_entries.c | 44 +++++++++++------------------- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index cf53e0b78e..1ab7215f5a 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -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); } diff --git a/menu/drivers/ozone/ozone.h b/menu/drivers/ozone/ozone.h index 0f931e9857..929468b058 100644 --- a/menu/drivers/ozone/ozone.h +++ b/menu/drivers/ozone/ozone.h @@ -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; }; diff --git a/menu/drivers/ozone/ozone_entries.c b/menu/drivers/ozone/ozone_entries.c index c4a79eb4c8..c836c92c9c 100644 --- a/menu/drivers/ozone/ozone_entries.c +++ b/menu/drivers/ozone/ozone_entries.c @@ -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 ); } }