Add options to customize Screenshot notifications

This commit is contained in:
Ryunam 2020-07-19 23:42:16 +02:00
parent f1fed5397a
commit 5014f90e4d
13 changed files with 213 additions and 6 deletions

View file

@ -761,6 +761,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

View file

@ -1479,6 +1479,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);
@ -1916,6 +1918,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);

View file

@ -165,6 +165,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;
@ -559,6 +561,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;

View file

@ -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);

View file

@ -4340,6 +4340,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"

View file

@ -3444,6 +3444,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"

View file

@ -387,6 +387,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)
@ -3007,6 +3010,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;

View file

@ -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,

View file

@ -7566,6 +7566,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++)
@ -7586,6 +7589,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;

View file

@ -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)
{
@ -12664,6 +12688,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;

View file

@ -2569,6 +2569,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),

View file

@ -379,7 +379,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));
}

View file

@ -65,6 +65,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);