diff --git a/config.def.h b/config.def.h index 9763d42493..3c8bc83712 100644 --- a/config.def.h +++ b/config.def.h @@ -767,6 +767,16 @@ static const bool audio_enable_menu_bgm = false; * content */ #define DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD true +/*Display a notification when taking a screenshot*/ +#define DEFAULT_NOTIFICATION_SHOW_SCREENSHOT true + +/*Desired duration of the screenshot notification*/ +static const unsigned notification_show_screenshot_duration = NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL; + +/* Display a white flashing effect when + * taking a screenshot*/ +#define DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH true + /* Output samplerate. */ #ifdef GEKKO #define DEFAULT_OUTPUT_RATE 32000 diff --git a/configuration.c b/configuration.c index 8ca9937439..ad83a1fba8 100644 --- a/configuration.c +++ b/configuration.c @@ -1480,6 +1480,8 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("notification_show_config_override_load", &settings->bools.notification_show_config_override_load, true, DEFAULT_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD, false); SETTING_BOOL("notification_show_set_initial_disk", &settings->bools.notification_show_set_initial_disk, true, DEFAULT_NOTIFICATION_SHOW_SET_INITIAL_DISK, false); SETTING_BOOL("notification_show_fast_forward", &settings->bools.notification_show_fast_forward, true, DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD, false); + SETTING_BOOL("notification_show_screenshot", &settings->bools.notification_show_screenshot, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT, false); + SETTING_BOOL("notification_show_screenshot_flash", &settings->bools.notification_show_screenshot_flash, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH, false); SETTING_BOOL("menu_widget_scale_auto", &settings->bools.menu_widget_scale_auto, true, DEFAULT_MENU_WIDGET_SCALE_AUTO, false); SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false); SETTING_BOOL("audio_enable_menu_ok", &settings->bools.audio_enable_menu_ok, true, audio_enable_menu_ok, false); @@ -1918,6 +1920,7 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("video_rotation", &settings->uints.video_rotation, true, ORIENTATION_NORMAL, false); SETTING_UINT("screen_orientation", &settings->uints.screen_orientation, true, ORIENTATION_NORMAL, false); SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, DEFAULT_ASPECT_RATIO_IDX, false); + SETTING_UINT("notification_show_screenshot_duration", &settings->uints.notification_show_screenshot_duration, true, notification_show_screenshot_duration, false); #ifdef HAVE_NETWORKING SETTING_UINT("netplay_ip_port", &settings->uints.netplay_port, true, RARCH_DEFAULT_PORT, false); SETTING_OVERRIDE(RARCH_OVERRIDE_SETTING_NETPLAY_IP_PORT); diff --git a/configuration.h b/configuration.h index 552f1ea5ba..0f51dffef1 100644 --- a/configuration.h +++ b/configuration.h @@ -166,6 +166,8 @@ typedef struct settings bool notification_show_config_override_load; bool notification_show_set_initial_disk; bool notification_show_fast_forward; + bool notification_show_screenshot; + bool notification_show_screenshot_flash; bool menu_widget_scale_auto; bool menu_show_start_screen; bool menu_pause_libretro; @@ -561,6 +563,7 @@ typedef struct settings unsigned video_overscan_correction_bottom; #endif unsigned video_shader_delay; + unsigned notification_show_screenshot_duration; /* Accessibility */ unsigned accessibility_narrator_speech_speed; diff --git a/gfx/widgets/gfx_widget_screenshot.c b/gfx/widgets/gfx_widget_screenshot.c index f24103b7fc..5c999f138d 100644 --- a/gfx/widgets/gfx_widget_screenshot.c +++ b/gfx/widgets/gfx_widget_screenshot.c @@ -18,11 +18,11 @@ #include "../gfx_widgets.h" #include "../gfx_animation.h" #include "../gfx_display.h" +#include "../../configuration.h" #include "../../retroarch.h" #define SCREENSHOT_DURATION_IN 66 #define SCREENSHOT_DURATION_OUT SCREENSHOT_DURATION_IN*10 -#define SCREENSHOT_NOTIFICATION_DURATION 6000 struct gfx_widget_screenshot_state { @@ -110,12 +110,18 @@ void gfx_widget_screenshot_taken( void *data, const char *shotname, const char *filename) { + settings_t *settings = config_get_ptr(); dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data; gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr(); - gfx_widgets_play_screenshot_flash(p_dispwidget); - strlcpy(state->filename, filename, sizeof(state->filename)); - strlcpy(state->shotname, shotname, sizeof(state->shotname)); + if (settings->bools.notification_show_screenshot_flash) + gfx_widgets_play_screenshot_flash(p_dispwidget); + + if (settings->bools.notification_show_screenshot) + { + strlcpy(state->filename, filename, sizeof(state->filename)); + strlcpy(state->shotname, shotname, sizeof(state->shotname)); + } } static void gfx_widget_screenshot_dispose(void *userdata) @@ -241,6 +247,7 @@ static void gfx_widget_screenshot_iterate( const char *dir_assets, char *font_path, bool is_threaded) { + settings_t *settings = config_get_ptr(); dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data; gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr(); unsigned padding = gfx_widgets_get_padding(p_dispwidget); @@ -275,7 +282,23 @@ static void gfx_widget_screenshot_iterate( state->y = 0.0f; timer.cb = gfx_widget_screenshot_end; - timer.duration = SCREENSHOT_NOTIFICATION_DURATION; + + switch (settings->uints.notification_show_screenshot_duration) + { + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL: + timer.duration = 6000; + break; + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST: + timer.duration = 2000; + break; + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST: + timer.duration = 500; + break; + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT: + timer.duration = 1; + break; + } + timer.userdata = p_dispwidget; gfx_timer_start(&state->timer, &timer); diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 25e818353e..f028cc51ea 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -4344,6 +4344,18 @@ MSG_HASH( MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD, "notification_show_fast_forward" ) +MSG_HASH( + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT, + "notification_show_screenshot" + ) +MSG_HASH( + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION, + "notification_show_screenshot_duration" + ) +MSG_HASH( + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, + "notification_show_screenshot_flash" + ) MSG_HASH( MENU_ENUM_LABEL_VIDEO_SHADERS_ENABLE, "video_shader_enable" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 72b96f9879..424fbf85b2 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3460,6 +3460,46 @@ MSG_HASH( MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_FAST_FORWARD, "Display an on-screen indicator when fast-forwarding content." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT, + "Screenshot Notifications" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT, + "Display an on-screen message when taking a screenshot." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION, + "Screenshot Notification Persistence" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION, + "Define the duration of the on-screen screenshot message." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL, + "Normal" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST, + "Fast" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST, + "Very Fast" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT, + "Instant" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH, + "Screenshot Flash Effect" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, + "Display a white flashing effect on-screen when taking a screenshot." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH, "Notification Font" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 66689861f9..7bcfac4c31 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -391,6 +391,9 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_remap_load, MENU_ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_config_override_load, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_set_initial_disk, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_fast_forward, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_FAST_FORWARD) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot_duration, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_notification_show_screenshot_flash, MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_width, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_WIDTH) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_window_height, MENU_ENUM_SUBLABEL_VIDEO_WINDOW_HEIGHT) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_fullscreen_x, MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN_X) @@ -3016,6 +3019,15 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_fast_forward); break; + case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_screenshot); + break; + case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_screenshot_duration); + break; + case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_notification_show_screenshot_flash); + break; case MENU_ENUM_LABEL_RESTART_RETROARCH: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_restart_retroarch); break; diff --git a/menu/menu_defines.h b/menu/menu_defines.h index c92eddd7d4..e944c551b3 100644 --- a/menu/menu_defines.h +++ b/menu/menu_defines.h @@ -122,6 +122,15 @@ enum menu_timedate_date_separator_type MENU_TIMEDATE_DATE_SEPARATOR_LAST }; +enum notification_show_screenshot_duration +{ + NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL = 0, + NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST, + NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST, + NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT, + NOTIFICATION_SHOW_SCREENSHOT_DURATION_LAST +}; + enum rgui_color_theme { RGUI_THEME_CUSTOM = 0, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 8f0eedf605..676a58d600 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7571,6 +7571,9 @@ unsigned menu_displaylist_build_list( {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_SCREENSHOT, PARSE_ONLY_BOOL, true }, + {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION, PARSE_ONLY_UINT, false }, + {MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, PARSE_ONLY_BOOL, false }, }; for (i = 0; i < ARRAY_SIZE(build_list); i++) @@ -7595,6 +7598,16 @@ unsigned menu_displaylist_build_list( menu_enable_widgets) build_list[i].checked = true; break; + case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION: + if (widgets_supported && + menu_enable_widgets) + build_list[i].checked = true; + break; + case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH: + if (widgets_supported && + menu_enable_widgets) + build_list[i].checked = true; + break; #endif default: break; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 1040540d0f..7e519e0c51 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4506,6 +4506,30 @@ static void setting_get_string_representation_uint_xmb_shader_pipeline( #endif #endif +static void setting_get_string_representation_uint_notification_show_screenshot_duration( + rarch_setting_t *setting, + char *s, size_t len) +{ + if (!setting) + return; + + switch (*setting->value.target.unsigned_integer) + { + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL: + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL), len); + break; + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST: + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST), len); + break; + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST: + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST), len); + break; + case NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT: + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT), len); + break; + } +} + static void setting_get_string_representation_uint_video_monitor_index(rarch_setting_t *setting, char *s, size_t len) { @@ -12696,6 +12720,53 @@ static bool setting_append_list( general_read_handler, SD_FLAG_NONE); + CONFIG_BOOL( + list, list_info, + &settings->bools.notification_show_screenshot, + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT, + DEFAULT_NOTIFICATION_SHOW_SCREENSHOT, + 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); + + CONFIG_UINT( + list, list_info, + &settings->uints.notification_show_screenshot_duration, + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION, + notification_show_screenshot_duration, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; + (*list)[list_info->index - 1].get_string_representation = + &setting_get_string_representation_uint_notification_show_screenshot_duration; + menu_settings_list_current_add_range(list, list_info, 0, NOTIFICATION_SHOW_SCREENSHOT_DURATION_LAST-1, 1, true, true); + (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX; + + CONFIG_BOOL( + list, list_info, + &settings->bools.notification_show_screenshot_flash, + MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH, + DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH, + 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); + END_SUB_GROUP(list, list_info, parent_group); END_GROUP(list, list_info, parent_group); break; diff --git a/msg_hash.h b/msg_hash.h index c7ce495eef..1d2e61a6d1 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -2571,6 +2571,14 @@ enum msg_hash_enums MENU_LABEL(NOTIFICATION_SHOW_CONFIG_OVERRIDE_LOAD), MENU_LABEL(NOTIFICATION_SHOW_SET_INITIAL_DISK), MENU_LABEL(NOTIFICATION_SHOW_FAST_FORWARD), + MENU_LABEL(NOTIFICATION_SHOW_SCREENSHOT), + MENU_LABEL(NOTIFICATION_SHOW_SCREENSHOT_DURATION), + MENU_LABEL(NOTIFICATION_SHOW_SCREENSHOT_FLASH), + + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST, + MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT, MENU_LABEL(SELECT_FILE), MENU_LABEL(SELECT_FROM_PLAYLIST), diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index e8ed7e6060..f0b5606d00 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -383,7 +383,7 @@ static bool screenshot_dump( else #endif { - if (!savestate) + if (!savestate & settings->bools.notification_show_screenshot) task->title = strdup(msg_hash_to_str(MSG_TAKING_SCREENSHOT)); } diff --git a/ui/drivers/qt/options/osd.cpp b/ui/drivers/qt/options/osd.cpp index 512c57ddda..f4f2a19b8d 100644 --- a/ui/drivers/qt/options/osd.cpp +++ b/ui/drivers/qt/options/osd.cpp @@ -66,6 +66,9 @@ QWidget *NotificationsPage::widget() notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SET_INITIAL_DISK); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_FAST_FORWARD); notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_CHEATS_APPLIED); + notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT); + notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION); + notificationsGroup->add(MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH); layout->addWidget(notificationsGroup);