diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-09-22 18:17:46 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-09-22 18:17:46 +0200 |
commit | 61c9b4918ed81a6ad439748f8bcb1c6f9b0cf65e (patch) | |
tree | 7b54793153fb8f3b608e59a0c27ddec63fb817f5 /include | |
parent | 5d6d57b8810a6ef88fb5e155d4610345f7df288d (diff) |
Save recording status to file to reload it when gsr overlay restarts
Diffstat (limited to 'include')
-rw-r--r-- | include/Overlay.hpp | 20 | ||||
-rw-r--r-- | include/Process.hpp | 3 | ||||
-rw-r--r-- | include/Utils.hpp | 5 |
3 files changed, 27 insertions, 1 deletions
diff --git a/include/Overlay.hpp b/include/Overlay.hpp index bb366e7..bf3600f 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -15,6 +15,13 @@ namespace gsr { class DropdownButton; + enum class RecordingStatus { + NONE, + REPLAY, + RECORD, + STREAM + }; + class Overlay { public: Overlay(mgl::Window &window, std::string resources_path, GsrInfo gsr_info, egl_functions egl_funcs, mgl::Color bg_color); @@ -30,6 +37,17 @@ namespace gsr { void toggle_show(); bool is_open() const; private: + void update_gsr_process_status(); + + void load_program_status(); + void save_program_status(); + void load_program_pid(); + void save_program_pid(); + void recording_stopped_remove_runtime_files(); + + void update_ui_recording_started(); + void update_ui_recording_stopped(); + void on_press_start_replay(const std::string &id); void on_press_start_record(const std::string &id); void on_press_start_stream(const std::string &id); @@ -60,5 +78,7 @@ namespace gsr { DropdownButton *replay_dropdown_button_ptr = nullptr; DropdownButton *record_dropdown_button_ptr = nullptr; DropdownButton *stream_dropdown_button_ptr = nullptr; + + RecordingStatus recording_status = RecordingStatus::NONE; }; }
\ No newline at end of file diff --git a/include/Process.hpp b/include/Process.hpp index bd76306..125a880 100644 --- a/include/Process.hpp +++ b/include/Process.hpp @@ -14,5 +14,6 @@ namespace gsr { bool exec_program_daemonized(const char **args); // Arguments ending with NULL pid_t exec_program(const char **args); - bool is_gpu_screen_recorder_running(pid_t &gsr_pid, GsrMode &mode); + // |output_buffer| should be at least PATH_MAX in size + bool read_cmdline_arg0(const char *filepath, char *output_buffer); }
\ No newline at end of file diff --git a/include/Utils.hpp b/include/Utils.hpp index b18ab8e..8ca38b5 100644 --- a/include/Utils.hpp +++ b/include/Utils.hpp @@ -4,6 +4,7 @@ #include <string_view> #include <map> #include <string> +#include <optional> namespace gsr { struct KeyValue { @@ -23,10 +24,14 @@ namespace gsr { std::map<std::string, std::string> get_xdg_variables(); std::string get_videos_dir(); + // Returns 0 on success int create_directory_recursive(char *path); bool file_get_content(const char *filepath, std::string &file_content); + bool file_overwrite(const char *filepath, const std::string &data); // Returns the path to the parent directory (ignoring trailing /) // of "." if there is no parent directory and the directory path is relative std::string get_parent_directory(std::string_view directory); + + std::optional<std::string> get_gsr_runtime_dir(); }
\ No newline at end of file |