From 59dfd87c21026ef4dc713c3e0648cfa89d534557 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 27 Oct 2024 13:09:06 +0100 Subject: Add hotkeys for replay and streaming, finish everything --- src/Config.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/Config.cpp') diff --git a/src/Config.cpp b/src/Config.cpp index 0e256a9..4f68fa1 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -1,5 +1,6 @@ #include "../include/Config.hpp" #include "../include/Utils.hpp" +#include "../include/GsrInfo.hpp" #include #include #include @@ -12,11 +13,23 @@ #define CONFIG_FILE_VERSION 1 namespace gsr { - Config::Config() { + Config::Config(const GsrInfo &gsr_info) { const std::string default_save_directory = get_videos_dir(); + streaming_config.record_options.video_quality = "custom"; + streaming_config.record_options.audio_tracks.push_back("default_output"); + record_config.save_directory = default_save_directory; + record_config.record_options.audio_tracks.push_back("default_output"); + replay_config.save_directory = default_save_directory; + replay_config.record_options.audio_tracks.push_back("default_output"); + + if(!gsr_info.supported_capture_options.monitors.empty()) { + streaming_config.record_options.record_area_option = gsr_info.supported_capture_options.monitors.front().name; + record_config.record_options.record_area_option = gsr_info.supported_capture_options.monitors.front().name; + replay_config.record_options.record_area_option = gsr_info.supported_capture_options.monitors.front().name; + } } static std::optional parse_key_value(std::string_view line) { @@ -117,7 +130,7 @@ namespace gsr { }; } - std::optional read_config() { + std::optional read_config(const GsrInfo &gsr_info) { std::optional config; const std::string config_path = get_config_dir() + "/config_ui"; @@ -127,7 +140,11 @@ namespace gsr { return config; } - config = Config(); + config = Config(gsr_info); + config->streaming_config.record_options.audio_tracks.clear(); + config->record_config.record_options.audio_tracks.clear(); + config->replay_config.record_options.audio_tracks.clear(); + auto config_options = get_config_options(config.value()); string_split_char(file_content, '\n', [&](std::string_view line) { -- cgit v1.2.3