(Ozone) Add option to toggle between static and scrolling content metadata

This commit is contained in:
jdgleaver 2019-09-23 15:33:20 +01:00
parent c78dcbd382
commit ef710442f1
12 changed files with 168 additions and 74 deletions

View File

@ -339,6 +339,7 @@
#ifdef HAVE_OZONE #ifdef HAVE_OZONE
#define DEFAULT_OZONE_COLLAPSE_SIDEBAR false #define DEFAULT_OZONE_COLLAPSE_SIDEBAR false
#define DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME true #define DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME true
#define DEFAULT_OZONE_SCROLL_CONTENT_METADATA false
#endif #endif
#define DEFAULT_SETTINGS_SHOW_DRIVERS true #define DEFAULT_SETTINGS_SHOW_DRIVERS true

View File

@ -1656,6 +1656,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#ifdef HAVE_OZONE #ifdef HAVE_OZONE
SETTING_BOOL("ozone_collapse_sidebar", &settings->bools.ozone_collapse_sidebar, true, DEFAULT_OZONE_COLLAPSE_SIDEBAR, false); SETTING_BOOL("ozone_collapse_sidebar", &settings->bools.ozone_collapse_sidebar, true, DEFAULT_OZONE_COLLAPSE_SIDEBAR, false);
SETTING_BOOL("ozone_truncate_playlist_name", &settings->bools.ozone_truncate_playlist_name, true, DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME, false); SETTING_BOOL("ozone_truncate_playlist_name", &settings->bools.ozone_truncate_playlist_name, true, DEFAULT_OZONE_TRUNCATE_PLAYLIST_NAME, false);
SETTING_BOOL("ozone_scroll_content_metadata",&settings->bools.ozone_scroll_content_metadata, true, DEFAULT_OZONE_SCROLL_CONTENT_METADATA, false);
#endif #endif
SETTING_BOOL("log_to_file", &settings->bools.log_to_file, true, DEFAULT_LOG_TO_FILE, false); SETTING_BOOL("log_to_file", &settings->bools.log_to_file, true, DEFAULT_LOG_TO_FILE, false);
SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_LOG_TO_FILE); SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_LOG_TO_FILE);

View File

@ -368,6 +368,7 @@ typedef struct settings
bool enable_device_vibration; bool enable_device_vibration;
bool ozone_collapse_sidebar; bool ozone_collapse_sidebar;
bool ozone_truncate_playlist_name; bool ozone_truncate_playlist_name;
bool ozone_scroll_content_metadata;
bool log_to_file; bool log_to_file;
bool log_to_file_timestamp; bool log_to_file_timestamp;

View File

@ -721,6 +721,8 @@ MSG_HASH(MENU_ENUM_LABEL_OZONE_COLLAPSE_SIDEBAR,
"ozone_collapse_sidebar") "ozone_collapse_sidebar")
MSG_HASH(MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME, MSG_HASH(MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME,
"ozone_truncate_playlist_name") "ozone_truncate_playlist_name")
MSG_HASH(MENU_ENUM_LABEL_OZONE_SCROLL_CONTENT_METADATA,
"ozone_scroll_content_metadata")
MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME, MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME,
"materialui_menu_color_theme") "materialui_menu_color_theme")
MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY, MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY,

View File

@ -8849,6 +8849,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_TRUNCATE_PLAYLIST_NAME, MENU_ENUM_SUBLABEL_OZONE_TRUNCATE_PLAYLIST_NAME,
"When enabled, will remove the system names from the playlists. For example, display 'PlayStation' instead of 'Sony - PlayStation'. Changes require a restart to take effect." "When enabled, will remove the system names from the playlists. For example, display 'PlayStation' instead of 'Sony - PlayStation'. Changes require a restart to take effect."
) )
MSG_HASH(
MENU_ENUM_LABEL_VALUE_OZONE_SCROLL_CONTENT_METADATA,
"Use Ticker Text For Content Metadata"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_SCROLL_CONTENT_METADATA,
"When enabled, each item of content metadata shown on the right sidebar of playlists (associated core, play time) will occupy a single line; strings exceeding the width of the sidebar will be displayed as scrolling ticker text. When disabled, each item of content metadata will be displayed statically, wrapped to occupy as many lines as required."
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
"Use preferred system color theme" "Use preferred system color theme"

View File

@ -483,6 +483,7 @@ default_sublabel_macro(action_bind_sublabel_menu_color_theme,
default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME)
default_sublabel_macro(action_bind_sublabel_ozone_collapse_sidebar, MENU_ENUM_SUBLABEL_OZONE_COLLAPSE_SIDEBAR) default_sublabel_macro(action_bind_sublabel_ozone_collapse_sidebar, MENU_ENUM_SUBLABEL_OZONE_COLLAPSE_SIDEBAR)
default_sublabel_macro(action_bind_sublabel_ozone_truncate_playlist_name, MENU_ENUM_SUBLABEL_OZONE_TRUNCATE_PLAYLIST_NAME) default_sublabel_macro(action_bind_sublabel_ozone_truncate_playlist_name, MENU_ENUM_SUBLABEL_OZONE_TRUNCATE_PLAYLIST_NAME)
default_sublabel_macro(action_bind_sublabel_ozone_scroll_content_metadata, MENU_ENUM_SUBLABEL_OZONE_SCROLL_CONTENT_METADATA)
default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_theme, MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_theme, MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME)
default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY)
default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY)
@ -1699,6 +1700,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME: case MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_truncate_playlist_name); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_truncate_playlist_name);
break; break;
case MENU_ENUM_LABEL_OZONE_SCROLL_CONTENT_METADATA:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_scroll_content_metadata);
break;
case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME: case MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME:
case MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME: case MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_color_theme); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_color_theme);

View File

@ -1240,6 +1240,7 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
{ {
const char *core_name = NULL; const char *core_name = NULL;
const char *core_label = NULL; const char *core_label = NULL;
bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata;
menu_thumbnail_get_core_name(ozone->thumbnail_path_data, &core_name); menu_thumbnail_get_core_name(ozone->thumbnail_path_data, &core_name);
@ -1252,6 +1253,18 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
snprintf(ozone->selection_core_name, sizeof(ozone->selection_core_name), snprintf(ozone->selection_core_name, sizeof(ozone->selection_core_name),
"%s %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), core_label); "%s %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), core_label);
/* Word wrap core name string, if required */
if (!scroll_content_metadata)
{
unsigned metadata_len =
(ozone->dimensions.thumbnail_bar_width - ((ozone->dimensions.sidebar_entry_icon_padding * 2) * 2)) /
ozone->footer_font_glyph_width;
word_wrap(ozone->selection_core_name, ozone->selection_core_name, metadata_len, true, 0);
ozone->selection_core_name_lines = ozone_count_lines(ozone->selection_core_name);
}
else
ozone->selection_core_name_lines = 1;
ozone->selection_core_is_viewer = string_is_equal(core_label, "imageviewer") ozone->selection_core_is_viewer = string_is_equal(core_label, "imageviewer")
|| string_is_equal(core_label, "musicplayer") || string_is_equal(core_label, "musicplayer")
|| string_is_equal(core_label, "movieplayer"); || string_is_equal(core_label, "movieplayer");
@ -1281,6 +1294,20 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED)); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
} }
/* Word wrap last played string, if required */
if (!scroll_content_metadata)
{
/* Note: Have to use a fixed length of '30' here, to
* avoid awkward wrapping for certain last played time
* formats. Last played strings are well defined, however
* (unlike core names), so this should never overflow the
* side bar */
word_wrap(ozone->selection_lastplayed, ozone->selection_lastplayed, 30, true, 0);
ozone->selection_lastplayed_lines = ozone_count_lines(ozone->selection_lastplayed);
}
else
ozone->selection_lastplayed_lines = 1;
} }
} }

View File

@ -238,6 +238,8 @@ struct ozone_handle
char selection_core_name[255]; char selection_core_name[255];
char selection_playtime[255]; char selection_playtime[255];
char selection_lastplayed[255]; char selection_lastplayed[255];
unsigned selection_core_name_lines;
unsigned selection_lastplayed_lines;
bool selection_core_is_viewer; bool selection_core_is_viewer;
bool is_db_manager_list; bool is_db_manager_list;

View File

@ -708,8 +708,10 @@ 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, static void ozone_content_metadata_line(video_frame_info_t *video_info, ozone_handle_t *ozone,
unsigned *y, unsigned column_x, const char *text) unsigned *y, unsigned column_x, const char *text, unsigned lines_count)
{ {
int line_height = font_driver_get_line_height(ozone->fonts.footer, 1);
ozone_draw_text(video_info, ozone, ozone_draw_text(video_info, ozone,
text, text,
column_x, column_x,
@ -721,7 +723,8 @@ static void ozone_content_metadata_line(video_frame_info_t *video_info, ozone_ha
true true
); );
*y += font_driver_get_line_height(ozone->fonts.footer, 1) * 1.5; if (lines_count > 0)
*y += (unsigned)(line_height * (lines_count - 1)) + (unsigned)((float)line_height * 1.5f);
} }
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)
@ -816,11 +819,14 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
static const char* const ticker_spacer = OZONE_TICKER_SPACER; static const char* const ticker_spacer = OZONE_TICKER_SPACER;
unsigned ticker_x_offset = 0; unsigned ticker_x_offset = 0;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool scroll_content_metadata = settings->bools.ozone_scroll_content_metadata;
bool use_smooth_ticker = settings->bools.menu_ticker_smooth; bool use_smooth_ticker = settings->bools.menu_ticker_smooth;
unsigned y = video_info->height / 2 + ozone->dimensions.sidebar_entry_icon_padding / 2; unsigned y = video_info->height / 2 + ozone->dimensions.sidebar_entry_icon_padding / 2;
unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2; unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2;
unsigned column_x = x_position + separator_padding; unsigned column_x = x_position + separator_padding;
if (scroll_content_metadata)
{
/* Initial ticker configuration */ /* Initial ticker configuration */
if (use_smooth_ticker) if (use_smooth_ticker)
{ {
@ -847,6 +853,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
ticker.len = (sidebar_width - (separator_padding * 2)) / ozone->footer_font_glyph_width; ticker.len = (sidebar_width - (separator_padding * 2)) / ozone->footer_font_glyph_width;
ticker.s = ticker_buf; ticker.s = ticker_buf;
} }
}
/* Content metadata */ /* Content metadata */
y += 10; y += 10;
@ -860,6 +867,8 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
y += 18; y += 18;
if (scroll_content_metadata)
{
/* Core association */ /* Core association */
ticker_buf[0] = '\0'; ticker_buf[0] = '\0';
@ -876,9 +885,13 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_content_metadata_line(video_info, ozone, ozone_content_metadata_line(video_info, ozone,
&y, ticker_x_offset + column_x, &y, ticker_x_offset + column_x,
ticker_buf); ticker_buf, 1);
/* Playtime */ /* Playtime
* Note: It is essentially impossible for this string
* to exceed the width of the sidebar, but since we
* are ticker-texting everything else, we include this
* by default */
ticker_buf[0] = '\0'; ticker_buf[0] = '\0';
if (use_smooth_ticker) if (use_smooth_ticker)
@ -894,7 +907,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_content_metadata_line(video_info, ozone, ozone_content_metadata_line(video_info, ozone,
&y, ticker_x_offset + column_x, &y, ticker_x_offset + column_x,
ticker_buf); ticker_buf, 1);
/* Last played */ /* Last played */
ticker_buf[0] = '\0'; ticker_buf[0] = '\0';
@ -912,7 +925,25 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
ozone_content_metadata_line(video_info, ozone, ozone_content_metadata_line(video_info, ozone,
&y, ticker_x_offset + column_x, &y, ticker_x_offset + column_x,
ticker_buf); ticker_buf, 1);
}
else
{
/* Core association */
ozone_content_metadata_line(video_info, ozone,
&y, column_x,
ozone->selection_core_name, ozone->selection_core_name_lines);
/* Playtime */
ozone_content_metadata_line(video_info, ozone,
&y, column_x,
ozone->selection_playtime, 1);
/* Last played */
ozone_content_metadata_line(video_info, ozone,
&y, column_x,
ozone->selection_lastplayed, ozone->selection_lastplayed_lines);
}
} }
} }

View File

@ -5435,6 +5435,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
{MENU_ENUM_LABEL_MENU_TICKER_TYPE, PARSE_ONLY_UINT }, {MENU_ENUM_LABEL_MENU_TICKER_TYPE, PARSE_ONLY_UINT },
{MENU_ENUM_LABEL_MENU_TICKER_SPEED, PARSE_ONLY_FLOAT}, {MENU_ENUM_LABEL_MENU_TICKER_SPEED, PARSE_ONLY_FLOAT},
{MENU_ENUM_LABEL_MENU_TICKER_SMOOTH, PARSE_ONLY_BOOL }, {MENU_ENUM_LABEL_MENU_TICKER_SMOOTH, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_OZONE_SCROLL_CONTENT_METADATA, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_MENU_RGUI_EXTENDED_ASCII, PARSE_ONLY_BOOL }, {MENU_ENUM_LABEL_MENU_RGUI_EXTENDED_ASCII, PARSE_ONLY_BOOL },
}; };

View File

@ -12903,6 +12903,21 @@ static bool setting_append_list(
general_write_handler, general_write_handler,
general_read_handler, general_read_handler,
SD_FLAG_NONE); SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.ozone_scroll_content_metadata,
MENU_ENUM_LABEL_OZONE_SCROLL_CONTENT_METADATA,
MENU_ENUM_LABEL_VALUE_OZONE_SCROLL_CONTENT_METADATA,
DEFAULT_OZONE_SCROLL_CONTENT_METADATA,
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);
} }
#endif #endif

View File

@ -965,6 +965,7 @@ enum msg_hash_enums
MENU_LABEL(OZONE_MENU_COLOR_THEME), MENU_LABEL(OZONE_MENU_COLOR_THEME),
MENU_LABEL(OZONE_COLLAPSE_SIDEBAR), MENU_LABEL(OZONE_COLLAPSE_SIDEBAR),
MENU_LABEL(OZONE_TRUNCATE_PLAYLIST_NAME), MENU_LABEL(OZONE_TRUNCATE_PLAYLIST_NAME),
MENU_LABEL(OZONE_SCROLL_CONTENT_METADATA),
MENU_LABEL(MATERIALUI_MENU_COLOR_THEME), MENU_LABEL(MATERIALUI_MENU_COLOR_THEME),
MENU_LABEL(QUICK_MENU_OVERRIDE_OPTIONS), MENU_LABEL(QUICK_MENU_OVERRIDE_OPTIONS),
MENU_LABEL(SETTINGS_SHOW_DRIVERS), MENU_LABEL(SETTINGS_SHOW_DRIVERS),