aboutsummaryrefslogtreecommitdiff
path: root/src/Overlay.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-01 20:10:48 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-01 20:10:48 +0100
commit6fbd8b0dd369c704b21c8757c1f66e55dcf1cb91 (patch)
treef4b52fadb7d6cf2bf1139a17a73f8e70c10ad15b /src/Overlay.cpp
parent0815da6f2c50750c5e5df6245ab18694402fb7c1 (diff)
Add option to automatically turn on replay at system startup
Diffstat (limited to 'src/Overlay.cpp')
-rw-r--r--src/Overlay.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 7fce89f..a76a054 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -211,6 +211,9 @@ namespace gsr {
config = std::move(new_config.value());
gsr::init_color_theme(gsr_info);
+
+ if(config.replay_config.start_replay_automatically)
+ on_press_start_replay(true);
}
Overlay::~Overlay() {
@@ -423,7 +426,7 @@ namespace gsr {
} else if(id == "save") {
on_press_save_replay();
} else if(id == "start") {
- on_press_start_replay();
+ on_press_start_replay(false);
}
};
main_buttons_list->add_widget(std::move(button));
@@ -616,7 +619,7 @@ namespace gsr {
}
void Overlay::toggle_replay() {
- on_press_start_replay();
+ on_press_start_replay(false);
}
void Overlay::save_replay() {
@@ -868,16 +871,16 @@ namespace gsr {
show_notification("Replay saved", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::REPLAY);
}
- void Overlay::on_press_start_replay() {
+ void Overlay::on_press_start_replay(bool disable_notification) {
switch(recording_status) {
case RecordingStatus::NONE:
case RecordingStatus::REPLAY:
break;
case RecordingStatus::RECORD:
- show_notification("Unable to start replay when recording.\nStop recording before starting replay.", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
+ show_notification("Unable to start replay when recording.\nStop recording before starting replay.", 5.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
return;
case RecordingStatus::STREAM:
- show_notification("Unable to start replay when streaming.\nStop streaming before starting replay.", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::STREAM);
+ show_notification("Unable to start replay when streaming.\nStop streaming before starting replay.", 5.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::STREAM);
return;
}
@@ -978,7 +981,7 @@ namespace gsr {
// TODO: Do not run this is a daemon. Instead get the pid and when launching another notification close the current notification
// program and start another one. This can also be used to check when the notification has finished by checking with waitpid NOWAIT
// to see when the program has exit.
- if(config.replay_config.show_replay_started_notifications)
+ if(!disable_notification && config.replay_config.show_replay_started_notifications)
show_notification("Replay has started", 3.0, get_color_theme().tint_color, get_color_theme().tint_color, NotificationType::REPLAY);
}
@@ -988,10 +991,10 @@ namespace gsr {
case RecordingStatus::RECORD:
break;
case RecordingStatus::REPLAY:
- show_notification("Unable to start recording when replay is turned on.\nTurn off replay before starting recording.", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::REPLAY);
+ show_notification("Unable to start recording when replay is turned on.\nTurn off replay before starting recording.", 5.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::REPLAY);
return;
case RecordingStatus::STREAM:
- show_notification("Unable to start recording when streaming.\nStop streaming before starting recording.", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::STREAM);
+ show_notification("Unable to start recording when streaming.\nStop streaming before starting recording.", 5.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::STREAM);
return;
}
@@ -1141,10 +1144,10 @@ namespace gsr {
case RecordingStatus::STREAM:
break;
case RecordingStatus::REPLAY:
- show_notification("Unable to start streaming when replay is turned on.\nTurn off replay before starting streaming.", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::REPLAY);
+ show_notification("Unable to start streaming when replay is turned on.\nTurn off replay before starting streaming.", 5.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::REPLAY);
return;
case RecordingStatus::RECORD:
- show_notification("Unable to start streaming when recording.\nStop recording before starting streaming.", 3.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
+ show_notification("Unable to start streaming when recording.\nStop recording before starting streaming.", 5.0, mgl::Color(255, 255, 255), get_color_theme().tint_color, NotificationType::RECORD);
return;
}