Merge pull request #11991 from jdgleaver/notification-settings-cleanup

'On-Screen Notifications' menu clean-ups
This commit is contained in:
Autechre 2021-02-05 18:13:35 +01:00 committed by GitHub
commit 92693c7d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 81 additions and 60 deletions

View File

@ -152,7 +152,7 @@ GENERIC_DEFERRED_PUSH(deferred_push_input_overlay, DISPLAYLIST_
#ifdef HAVE_VIDEO_LAYOUT
GENERIC_DEFERRED_PUSH(deferred_push_video_layout_path, DISPLAYLIST_VIDEO_LAYOUT_PATH)
#endif
GENERIC_DEFERRED_PUSH(deferred_push_video_font_path, DISPLAYLIST_FONTS)
GENERIC_DEFERRED_PUSH(deferred_push_video_font_path, DISPLAYLIST_VIDEO_FONTS)
GENERIC_DEFERRED_PUSH(deferred_push_xmb_font_path, DISPLAYLIST_FONTS)
GENERIC_DEFERRED_PUSH(deferred_push_content_history_path, DISPLAYLIST_CONTENT_HISTORY)
GENERIC_DEFERRED_PUSH(deferred_push_disc_information, DISPLAYLIST_DISC_INFO)

View File

@ -1807,6 +1807,7 @@ static int menu_cbs_init_bind_get_string_representation_compare_type(
break;
#endif
case FILE_TYPE_FONT:
case FILE_TYPE_VIDEO_FONT:
BIND_ACTION_GET_VALUE(cbs,
menu_action_setting_disp_set_label_menu_file_font);
break;

View File

@ -1061,6 +1061,7 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs,
case FILE_TYPE_SCAN_DIRECTORY:
case FILE_TYPE_MANUAL_SCAN_DIRECTORY:
case FILE_TYPE_FONT:
case FILE_TYPE_VIDEO_FONT:
case MENU_SETTING_GROUP:
case MENU_SETTINGS_CORE_INFO_NONE:
if (

View File

@ -113,6 +113,7 @@ enum
#ifdef HAVE_VIDEO_LAYOUT
ACTION_OK_SET_PATH_VIDEO_LAYOUT,
#endif
ACTION_OK_SET_PATH_VIDEO_FONT,
ACTION_OK_SET_DIRECTORY,
ACTION_OK_SHOW_WIMP,
ACTION_OK_LOAD_CHEAT_FILE_APPEND,
@ -1901,6 +1902,10 @@ static int generic_action_ok(const char *path,
ret = set_path_generic(menu_label, action_path);
break;
#endif
case ACTION_OK_SET_PATH_VIDEO_FONT:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ONSCREEN_NOTIFICATIONS_SETTINGS_LIST);
ret = set_path_generic(menu_label, action_path);
break;
case ACTION_OK_SET_MANUAL_CONTENT_SCAN_DAT_FILE:
flush_char = msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MANUAL_CONTENT_SCAN_LIST);
ret = set_path_generic(menu_label, action_path);
@ -1959,6 +1964,7 @@ DEFAULT_ACTION_OK_SET(action_ok_set_path_overlay, ACTION_OK_SET_PATH_OVERLAY
#ifdef HAVE_VIDEO_LAYOUT
DEFAULT_ACTION_OK_SET(action_ok_set_path_video_layout,ACTION_OK_SET_PATH_VIDEO_LAYOUT, MSG_UNKNOWN)
#endif
DEFAULT_ACTION_OK_SET(action_ok_set_path_video_font, ACTION_OK_SET_PATH_VIDEO_FONT, MSG_UNKNOWN)
DEFAULT_ACTION_OK_SET(action_ok_set_path, ACTION_OK_SET_PATH, MSG_UNKNOWN)
DEFAULT_ACTION_OK_SET(action_ok_load_core, ACTION_OK_LOAD_CORE, MSG_UNKNOWN)
DEFAULT_ACTION_OK_SET(action_ok_config_load, ACTION_OK_LOAD_CONFIG_FILE, MSG_UNKNOWN)
@ -2643,10 +2649,10 @@ static int action_ok_menu_wallpaper(const char *path,
return action_ok_lookup_setting(path, label, type, idx, entry_idx);
}
static int action_ok_menu_font(const char *path,
static int action_ok_video_font(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
filebrowser_set_type(FILEBROWSER_SELECT_FONT);
filebrowser_set_type(FILEBROWSER_SELECT_VIDEO_FONT);
return action_ok_lookup_setting(path, label, type, idx, entry_idx);
}
@ -7363,7 +7369,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
{MENU_ENUM_LABEL_SWITCH_CPU_PROFILE, action_ok_push_default},
#endif
{MENU_ENUM_LABEL_MENU_WALLPAPER, action_ok_menu_wallpaper},
{MENU_ENUM_LABEL_VIDEO_FONT_PATH, action_ok_menu_font},
{MENU_ENUM_LABEL_VIDEO_FONT_PATH, action_ok_video_font},
{MENU_ENUM_LABEL_GOTO_FAVORITES, action_ok_goto_favorites},
{MENU_ENUM_LABEL_GOTO_MUSIC, action_ok_goto_music},
{MENU_ENUM_LABEL_GOTO_IMAGES, action_ok_goto_images},
@ -8035,6 +8041,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs,
case FILE_TYPE_FONT:
BIND_ACTION_OK(cbs, action_ok_set_path);
break;
case FILE_TYPE_VIDEO_FONT:
BIND_ACTION_OK(cbs, action_ok_set_path_video_font);
break;
case FILE_TYPE_OVERLAY:
BIND_ACTION_OK(cbs, action_ok_set_path_overlay);
break;

View File

@ -906,6 +906,7 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs,
case FILE_TYPE_SCAN_DIRECTORY:
case FILE_TYPE_MANUAL_SCAN_DIRECTORY:
case FILE_TYPE_FONT:
case FILE_TYPE_VIDEO_FONT:
case MENU_SETTING_GROUP:
case MENU_SETTINGS_CORE_INFO_NONE:
if (

View File

@ -303,8 +303,8 @@ static void filebrowser_parse(
break;
case RARCH_PLAIN_FILE:
default:
if (filebrowser_types == FILEBROWSER_SELECT_FONT)
file_type = FILE_TYPE_FONT;
if (filebrowser_types == FILEBROWSER_SELECT_VIDEO_FONT)
file_type = FILE_TYPE_VIDEO_FONT;
else
file_type = (enum msg_file_type)info->type_default;
switch (type)
@ -7956,13 +7956,13 @@ unsigned menu_displaylist_build_list(
bool video_msg_bgcolor_enable = settings->bools.video_msg_bgcolor_enable;
#ifdef HAVE_GFX_WIDGETS
bool widgets_supported = video_driver_has_widgets();
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
bool widgets_active = gfx_widgets_ready();
bool menu_widget_scale_auto = settings->bools.menu_widget_scale_auto;
#else
bool widgets_supported = false;
bool menu_enable_widgets = false;
bool widgets_active = false;
#endif
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS, PARSE_ACTION, true },
{MENU_ENUM_LABEL_VIDEO_FONT_ENABLE, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_MENU_WIDGETS_ENABLE, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_MENU_WIDGET_SCALE_AUTO, PARSE_ONLY_BOOL, false },
@ -7982,7 +7982,6 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN, PARSE_ONLY_UINT, false },
{MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE, PARSE_ONLY_UINT, false },
{MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY, PARSE_ONLY_FLOAT, false },
{MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS, PARSE_ACTION, false },
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@ -7991,33 +7990,27 @@ unsigned menu_displaylist_build_list(
{
#ifdef HAVE_GFX_WIDGETS
case MENU_ENUM_LABEL_MENU_WIDGETS_ENABLE:
if (widgets_supported)
if (video_font_enable && widgets_supported)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_MENU_WIDGET_SCALE_AUTO:
if (widgets_supported &&
menu_enable_widgets)
if (widgets_active)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR:
if (widgets_supported &&
menu_enable_widgets &&
!menu_widget_scale_auto)
if (widgets_active && !menu_widget_scale_auto)
build_list[i].checked = true;
break;
#if !(defined(RARCH_CONSOLE) || defined(RARCH_MOBILE))
case MENU_ENUM_LABEL_MENU_WIDGET_SCALE_FACTOR_WINDOWED:
if (widgets_supported &&
menu_enable_widgets &&
!menu_widget_scale_auto)
if (widgets_active && !menu_widget_scale_auto)
build_list[i].checked = true;
break;
#endif
#endif
case MENU_ENUM_LABEL_VIDEO_FONT_PATH:
case MENU_ENUM_LABEL_VIDEO_FONT_SIZE:
if (video_font_enable ||
(widgets_supported && menu_enable_widgets))
if (video_font_enable || widgets_active)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_VIDEO_MESSAGE_POS_X:
@ -8026,24 +8019,18 @@ unsigned menu_displaylist_build_list(
case MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_GREEN:
case MENU_ENUM_LABEL_VIDEO_MESSAGE_COLOR_BLUE:
case MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_ENABLE:
if ((!widgets_supported || !menu_enable_widgets) &&
video_font_enable)
if (!widgets_active && video_font_enable)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_RED:
case MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_GREEN:
case MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_BLUE:
case MENU_ENUM_LABEL_VIDEO_MESSAGE_BGCOLOR_OPACITY:
if ((!widgets_supported || !menu_enable_widgets) &&
if (!widgets_active &&
video_font_enable &&
video_msg_bgcolor_enable)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS:
if (video_font_enable ||
(widgets_supported && menu_enable_widgets))
build_list[i].checked = true;
break;
default:
break;
}
@ -8063,37 +8050,41 @@ unsigned menu_displaylist_build_list(
break;
case DISPLAYLIST_ONSCREEN_NOTIFICATIONS_VIEWS_SETTINGS_LIST:
{
settings_t *settings = config_get_ptr();
bool video_font_enable = settings->bools.video_font_enable;
bool video_fps_show = settings->bools.video_fps_show;
bool video_memory_show = settings->bools.video_memory_show;
settings_t *settings = config_get_ptr();
bool video_font_enable = settings->bools.video_font_enable;
bool video_fps_show = settings->bools.video_fps_show;
bool video_memory_show = settings->bools.video_memory_show;
#ifdef HAVE_GFX_WIDGETS
bool widgets_supported = video_driver_has_widgets();
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
bool widgets_active = gfx_widgets_ready();
bool notifications_active = video_font_enable || widgets_active;
#ifdef HAVE_SCREENSHOTS
bool notification_show_screenshot = settings->bools.notification_show_screenshot;
#endif
#else
bool notifications_active = video_font_enable;
#endif
menu_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_FPS_SHOW, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_FPS_SHOW, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL, PARSE_ONLY_UINT, false },
{MENU_ENUM_LABEL_FRAMECOUNT_SHOW, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_FRAMECOUNT_SHOW, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_STATISTICS_SHOW, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_MEMORY_SHOW, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_MEMORY_SHOW, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_MEMORY_UPDATE_INTERVAL, PARSE_ONLY_UINT, false },
{MENU_ENUM_LABEL_MENU_SHOW_LOAD_CONTENT_ANIMATION, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_AUTOCONFIG, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_CHEATS_APPLIED, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_REMAP_LOAD, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_AUTOCONFIG, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_CHEATS_APPLIED, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_REMAP_LOAD, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK, PARSE_ONLY_BOOL, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD, PARSE_ONLY_BOOL, false },
#ifdef HAVE_SCREENSHOTS
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT, PARSE_ONLY_BOOL, false },
#ifdef HAVE_GFX_WIDGETS
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION, PARSE_ONLY_UINT, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, PARSE_ONLY_UINT, false },
#endif
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE, PARSE_ONLY_BOOL, true },
#endif
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_REFRESH_RATE, PARSE_ONLY_BOOL, false },
};
for (i = 0; i < ARRAY_SIZE(build_list); i++)
@ -8101,39 +8092,36 @@ unsigned menu_displaylist_build_list(
switch (build_list[i].enum_idx)
{
case MENU_ENUM_LABEL_FPS_UPDATE_INTERVAL:
if (video_fps_show)
if (notifications_active && video_fps_show)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_MEMORY_UPDATE_INTERVAL:
if (video_memory_show)
if (notifications_active && video_memory_show)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_STATISTICS_SHOW:
if (video_font_enable)
if (notifications_active && video_font_enable)
build_list[i].checked = true;
break;
#ifdef HAVE_GFX_WIDGETS
case MENU_ENUM_LABEL_MENU_SHOW_LOAD_CONTENT_ANIMATION:
if (widgets_supported &&
menu_enable_widgets)
if (widgets_active)
build_list[i].checked = true;
break;
#ifdef HAVE_SCREENSHOTS
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION:
if ( widgets_supported &&
menu_enable_widgets &&
notification_show_screenshot
)
if (widgets_active && notification_show_screenshot)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH:
if ( widgets_supported &&
menu_enable_widgets)
if (widgets_active && notification_show_screenshot)
build_list[i].checked = true;
break;
#endif
#endif
default:
if (notifications_active)
build_list[i].checked = true;
break;
}
}
@ -12088,6 +12076,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
case DISPLAYLIST_RECORD_CONFIG_FILES:
case DISPLAYLIST_OVERLAYS:
case DISPLAYLIST_FONTS:
case DISPLAYLIST_VIDEO_FONTS:
case DISPLAYLIST_AUDIO_FILTERS:
case DISPLAYLIST_CHEAT_FILES:
case DISPLAYLIST_MANUAL_CONTENT_SCAN_DAT_FILES:
@ -12130,6 +12119,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
info->type_default = FILE_TYPE_FONT;
info->exts = strdup("ttf");
break;
case DISPLAYLIST_VIDEO_FONTS:
info->type_default = FILE_TYPE_VIDEO_FONT;
info->exts = strdup("ttf");
break;
case DISPLAYLIST_AUDIO_FILTERS:
info->type_default = FILE_TYPE_AUDIOFILTER;
info->exts = strdup("dsp");

View File

@ -128,6 +128,7 @@ enum menu_displaylist_ctl_state
DISPLAYLIST_CONTENT_HISTORY,
DISPLAYLIST_IMAGES,
DISPLAYLIST_FONTS,
DISPLAYLIST_VIDEO_FONTS,
DISPLAYLIST_LOAD_DISC,
DISPLAYLIST_DUMP_DISC,
DISPLAYLIST_OVERLAYS,
@ -259,7 +260,7 @@ enum filebrowser_enums
FILEBROWSER_SELECT_FILE,
FILEBROWSER_SELECT_FILE_SUBSYSTEM,
FILEBROWSER_SELECT_IMAGE,
FILEBROWSER_SELECT_FONT,
FILEBROWSER_SELECT_VIDEO_FONT,
FILEBROWSER_SELECT_COLLECTION
};

View File

@ -12847,6 +12847,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
CONFIG_BOOL(
list, list_info,
@ -12932,6 +12933,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh;
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
CONFIG_PATH(
list, list_info,
@ -12946,6 +12948,8 @@ static bool setting_append_list(
general_write_handler,
general_read_handler);
MENU_SETTINGS_LIST_CURRENT_ADD_VALUES(list, list_info, "ttf");
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_FONT_SELECTOR;
CONFIG_FLOAT(
list, list_info,
@ -12961,6 +12965,7 @@ static bool setting_append_list(
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
menu_settings_list_current_add_range(list, list_info, 1.00, 100.00, 1.0, true, true);
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(list, list_info, CMD_EVENT_REINIT);
CONFIG_FLOAT(
list, list_info,
@ -13321,7 +13326,6 @@ static bool setting_append_list(
SD_FLAG_NONE);
#ifdef HAVE_SCREENSHOTS
#ifdef HAVE_GFX_WIDGETS
CONFIG_BOOL(
list, list_info,
&settings->bools.notification_show_screenshot,
@ -13340,6 +13344,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh;
#ifdef HAVE_GFX_WIDGETS
CONFIG_UINT(
list, list_info,
&settings->uints.notification_show_screenshot_duration,

View File

@ -154,6 +154,8 @@ enum msg_file_type
FILE_TYPE_SIDELOAD_CORE,
FILE_TYPE_VIDEO_FONT,
FILE_TYPE_LAST
};

View File

@ -1951,6 +1951,7 @@ static int generic_menu_iterate(
switch (type)
{
case FILE_TYPE_FONT:
case FILE_TYPE_VIDEO_FONT:
enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_FONT;
break;
case FILE_TYPE_RDB:
@ -32508,6 +32509,7 @@ static void drivers_init(struct rarch_state *p_rarch, int flags)
bool video_is_threaded = VIDEO_DRIVER_IS_THREADED_INTERNAL();
settings_t *settings = p_rarch->configuration_settings;
#if defined(HAVE_GFX_WIDGETS)
bool video_font_enable = settings->bools.video_font_enable;
bool menu_enable_widgets = settings->bools.menu_enable_widgets;
/* By default, we want display widgets to persist through driver reinits. */
@ -32608,7 +32610,13 @@ static void drivers_init(struct rarch_state *p_rarch, int flags)
core_info_init_current_core();
#if defined(HAVE_GFX_WIDGETS)
if (menu_enable_widgets && video_driver_has_widgets())
/* Note that we only enable widgets if 'video_font_enable'
* is true. 'video_font_enable' corresponds to the generic
* 'On-Screen Notifications' setting, which should serve as
* a global notifications on/off toggle switch */
if (video_font_enable &&
menu_enable_widgets &&
video_driver_has_widgets())
{
bool rarch_force_fullscreen = p_rarch->rarch_force_fullscreen;
bool video_is_fullscreen = settings->bools.video_fullscreen ||