Properly honor notification settings (when not saving video in game folder). Add pause/unpause notification option

This commit is contained in:
dec05eba
2025-05-16 18:09:39 +02:00
parent cae1c47643
commit 9ac14c963e
5 changed files with 17 additions and 5 deletions

View File

@@ -100,6 +100,7 @@ namespace gsr {
bool save_video_in_game_folder = false; bool save_video_in_game_folder = false;
bool show_recording_started_notifications = true; bool show_recording_started_notifications = true;
bool show_video_saved_notifications = true; bool show_video_saved_notifications = true;
bool show_video_paused_notifications = true;
std::string save_directory; std::string save_directory;
std::string container = "mp4"; std::string container = "mp4";
ConfigHotkey start_stop_hotkey; ConfigHotkey start_stop_hotkey;

View File

@@ -186,6 +186,7 @@ namespace gsr {
CheckBox *save_recording_in_game_folder_ptr = nullptr; CheckBox *save_recording_in_game_folder_ptr = nullptr;
CheckBox *show_recording_started_notification_checkbox_ptr = nullptr; CheckBox *show_recording_started_notification_checkbox_ptr = nullptr;
CheckBox *show_video_saved_notification_checkbox_ptr = nullptr; CheckBox *show_video_saved_notification_checkbox_ptr = nullptr;
CheckBox *show_video_paused_notification_checkbox_ptr = nullptr;
CheckBox *show_streaming_started_notification_checkbox_ptr = nullptr; CheckBox *show_streaming_started_notification_checkbox_ptr = nullptr;
CheckBox *show_streaming_stopped_notification_checkbox_ptr = nullptr; CheckBox *show_streaming_stopped_notification_checkbox_ptr = nullptr;
Button *save_directory_button_ptr = nullptr; Button *save_directory_button_ptr = nullptr;

View File

@@ -229,6 +229,7 @@ namespace gsr {
{"record.save_video_in_game_folder", &config.record_config.save_video_in_game_folder}, {"record.save_video_in_game_folder", &config.record_config.save_video_in_game_folder},
{"record.show_recording_started_notifications", &config.record_config.show_recording_started_notifications}, {"record.show_recording_started_notifications", &config.record_config.show_recording_started_notifications},
{"record.show_video_saved_notifications", &config.record_config.show_video_saved_notifications}, {"record.show_video_saved_notifications", &config.record_config.show_video_saved_notifications},
{"record.show_video_paused_notifications", &config.record_config.show_video_paused_notifications},
{"record.save_directory", &config.record_config.save_directory}, {"record.save_directory", &config.record_config.save_directory},
{"record.container", &config.record_config.container}, {"record.container", &config.record_config.container},
{"record.start_stop_hotkey", &config.record_config.start_stop_hotkey}, {"record.start_stop_hotkey", &config.record_config.start_stop_hotkey},

View File

@@ -1382,9 +1382,11 @@ namespace gsr {
if(paused) { if(paused) {
update_ui_recording_unpaused(); update_ui_recording_unpaused();
if(config.record_config.show_video_paused_notifications)
show_notification("Recording has been unpaused", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD); show_notification("Recording has been unpaused", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
} else { } else {
update_ui_recording_paused(); update_ui_recording_paused();
if(config.record_config.show_video_paused_notifications)
show_notification("Recording has been paused", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD); show_notification("Recording has been paused", notification_timeout_seconds, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
} }
@@ -1684,7 +1686,7 @@ namespace gsr {
replay_save_show_notification = false; replay_save_show_notification = false;
if(config.replay_config.save_video_in_game_folder) { if(config.replay_config.save_video_in_game_folder) {
save_video_in_current_game_directory(replay_saved_filepath, NotificationType::REPLAY); save_video_in_current_game_directory(replay_saved_filepath, NotificationType::REPLAY);
} else { } else if(config.replay_config.show_replay_saved_notifications) {
char duration[32]; char duration[32];
if(replay_save_duration_min > 0) if(replay_save_duration_min > 0)
snprintf(duration, sizeof(duration), " %d minute ", replay_save_duration_min); snprintf(duration, sizeof(duration), " %d minute ", replay_save_duration_min);
@@ -1814,7 +1816,7 @@ namespace gsr {
if(exit_code == 0) { if(exit_code == 0) {
if(config.screenshot_config.save_screenshot_in_game_folder) { if(config.screenshot_config.save_screenshot_in_game_folder) {
save_video_in_current_game_directory(screenshot_filepath.c_str(), NotificationType::SCREENSHOT); save_video_in_current_game_directory(screenshot_filepath.c_str(), NotificationType::SCREENSHOT);
} else { } else if(config.screenshot_config.show_screenshot_saved_notifications) {
char msg[512]; char msg[512];
if(is_capture_target_monitor(screenshot_capture_target.c_str())) if(is_capture_target_monitor(screenshot_capture_target.c_str()))
snprintf(msg, sizeof(msg), "Saved a screenshot of this monitor"); snprintf(msg, sizeof(msg), "Saved a screenshot of this monitor");
@@ -1916,7 +1918,7 @@ namespace gsr {
if(exit_code == 0) { if(exit_code == 0) {
if(config.record_config.save_video_in_game_folder) { if(config.record_config.save_video_in_game_folder) {
save_video_in_current_game_directory(video_filepath.c_str(), NotificationType::RECORD); save_video_in_current_game_directory(video_filepath.c_str(), NotificationType::RECORD);
} else { } else if(config.record_config.show_video_saved_notifications) {
char msg[512]; char msg[512];
if(is_capture_target_monitor(recording_capture_target.c_str())) if(is_capture_target_monitor(recording_capture_target.c_str()))
snprintf(msg, sizeof(msg), "Saved a recording of this monitor"); snprintf(msg, sizeof(msg), "Saved a recording of this monitor");

View File

@@ -940,6 +940,11 @@ namespace gsr {
show_video_saved_notification_checkbox_ptr = show_video_saved_notification_checkbox.get(); show_video_saved_notification_checkbox_ptr = show_video_saved_notification_checkbox.get();
checkboxes_list->add_widget(std::move(show_video_saved_notification_checkbox)); checkboxes_list->add_widget(std::move(show_video_saved_notification_checkbox));
auto show_video_paused_notification_checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Show video paused/unpaused notification");
show_video_paused_notification_checkbox->set_checked(true);
show_video_paused_notification_checkbox_ptr = show_video_paused_notification_checkbox.get();
checkboxes_list->add_widget(std::move(show_video_paused_notification_checkbox));
auto notifications_subsection = std::make_unique<Subsection>("Notifications", std::move(checkboxes_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)); auto notifications_subsection = std::make_unique<Subsection>("Notifications", std::move(checkboxes_list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
Subsection *notifications_subsection_ptr = notifications_subsection.get(); Subsection *notifications_subsection_ptr = notifications_subsection.get();
settings_list_ptr->add_widget(std::move(notifications_subsection)); settings_list_ptr->add_widget(std::move(notifications_subsection));
@@ -1239,6 +1244,7 @@ namespace gsr {
save_recording_in_game_folder_ptr->set_checked(config.record_config.save_video_in_game_folder); save_recording_in_game_folder_ptr->set_checked(config.record_config.save_video_in_game_folder);
show_recording_started_notification_checkbox_ptr->set_checked(config.record_config.show_recording_started_notifications); show_recording_started_notification_checkbox_ptr->set_checked(config.record_config.show_recording_started_notifications);
show_video_saved_notification_checkbox_ptr->set_checked(config.record_config.show_video_saved_notifications); show_video_saved_notification_checkbox_ptr->set_checked(config.record_config.show_video_saved_notifications);
show_video_paused_notification_checkbox_ptr->set_checked(config.record_config.show_video_paused_notifications);
save_directory_button_ptr->set_text(config.record_config.save_directory); save_directory_button_ptr->set_text(config.record_config.save_directory);
container_box_ptr->set_selected_item(config.record_config.container); container_box_ptr->set_selected_item(config.record_config.container);
} }
@@ -1379,6 +1385,7 @@ namespace gsr {
config.record_config.save_video_in_game_folder = save_recording_in_game_folder_ptr->is_checked(); config.record_config.save_video_in_game_folder = save_recording_in_game_folder_ptr->is_checked();
config.record_config.show_recording_started_notifications = show_recording_started_notification_checkbox_ptr->is_checked(); config.record_config.show_recording_started_notifications = show_recording_started_notification_checkbox_ptr->is_checked();
config.record_config.show_video_saved_notifications = show_video_saved_notification_checkbox_ptr->is_checked(); config.record_config.show_video_saved_notifications = show_video_saved_notification_checkbox_ptr->is_checked();
config.record_config.show_video_paused_notifications = show_video_paused_notification_checkbox_ptr->is_checked();
config.record_config.save_directory = save_directory_button_ptr->get_text(); config.record_config.save_directory = save_directory_button_ptr->get_text();
config.record_config.container = container_box_ptr->get_selected_id(); config.record_config.container = container_box_ptr->get_selected_id();
} }