From 234cc3391eba6be67964e5c98beeecd318b8e779 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 11 Sep 2024 01:49:10 +0200 Subject: Load settings from config file --- TODO | 2 + depends/mglpp | 2 +- include/SafeVector.hpp | 2 + include/gui/List.hpp | 1 + include/gui/SettingsPage.hpp | 24 +++++--- src/gui/List.cpp | 4 ++ src/gui/SettingsPage.cpp | 127 +++++++++++++++++++++++++++++++++++++------ 7 files changed, 136 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index 09f80fb..8a97c51 100644 --- a/TODO +++ b/TODO @@ -30,3 +30,5 @@ Make hotkeys configurable. Move hotkey to gsr-overlay-daemon which should execute gpu-screen-recorder --info on start, write that output to /tmp/blabla (or $XDG_RUNTIME_DIR) and gsr-overlay should read that tmp file. gsr-overlay should remove show/hide functions for overlay and run show on startup. + +Combobox shouldn't show all items if its the combobox at the bottom and scrolling is needed to show them all. \ No newline at end of file diff --git a/depends/mglpp b/depends/mglpp index 818092c..23b7590 160000 --- a/depends/mglpp +++ b/depends/mglpp @@ -1 +1 @@ -Subproject commit 818092cd16431ed258e8de51fa24a5c6b0743179 +Subproject commit 23b75905a53abb2e4d5a44b16e0496e7fa4c7e3d diff --git a/include/SafeVector.hpp b/include/SafeVector.hpp index 916b547..6cb4725 100644 --- a/include/SafeVector.hpp +++ b/include/SafeVector.hpp @@ -15,6 +15,7 @@ public: } // Safe to call when vector is empty + // TODO: Make this iterator safe void pop_back() { if(!data.empty()) data.pop_back(); @@ -37,6 +38,7 @@ public: return &data.back(); } + // TODO: Make this iterator safe void clear() { data.clear(); remove_queue.clear(); diff --git a/include/gui/List.hpp b/include/gui/List.hpp index 55a5b84..72c5353 100644 --- a/include/gui/List.hpp +++ b/include/gui/List.hpp @@ -29,6 +29,7 @@ namespace gsr { void add_widget(std::unique_ptr widget); void remove_widget(Widget *widget); + void clear(); // Return true from |callback| to continue void for_each_child_widget(std::function &widget)> callback); // Returns nullptr if index is invalid diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index a9d79bc..ebbc98c 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -23,10 +23,11 @@ namespace gsr { STREAM }; - SettingsPage(Type type, const GsrInfo &gsr_info, const std::vector &audio_devices, std::optional &config, PageStack *page_stack); + SettingsPage(Type type, const GsrInfo &gsr_info, std::vector audio_devices, std::optional &config, PageStack *page_stack); SettingsPage(const SettingsPage&) = delete; SettingsPage& operator=(const SettingsPage&) = delete; + void load(); void save(); void on_navigate_away_from_page() override; private: @@ -41,13 +42,13 @@ namespace gsr { std::unique_ptr create_restore_portal_session_checkbox(); std::unique_ptr create_restore_portal_session_section(); std::unique_ptr create_capture_target(const GsrInfo &gsr_info); - std::unique_ptr create_audio_track_selection_checkbox(const std::vector &audio_devices); + std::unique_ptr create_audio_track_selection_checkbox(); std::unique_ptr