diff options
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/List.hpp | 5 | ||||
-rw-r--r-- | include/gui/Page.hpp | 4 | ||||
-rw-r--r-- | include/gui/ScrollablePage.hpp | 1 | ||||
-rw-r--r-- | include/gui/SettingsPage.hpp | 35 | ||||
-rw-r--r-- | include/gui/Subsection.hpp | 5 | ||||
-rw-r--r-- | include/gui/Widget.hpp | 6 |
6 files changed, 32 insertions, 24 deletions
diff --git a/include/gui/List.hpp b/include/gui/List.hpp index 72c5353..f79d165 100644 --- a/include/gui/List.hpp +++ b/include/gui/List.hpp @@ -21,19 +21,20 @@ namespace gsr { List(Orientation orientation, Alignment content_alignment = Alignment::START); List(const List&) = delete; List& operator=(const List&) = delete; + virtual ~List() override; bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; void draw(mgl::Window &window, mgl::vec2f offset) override; - //void remove_child_widget(Widget *widget) override; - void add_widget(std::unique_ptr<Widget> widget); void remove_widget(Widget *widget); + void replace_widget(Widget *widget, std::unique_ptr<Widget> new_widget); void clear(); // Return true from |callback| to continue void for_each_child_widget(std::function<bool(std::unique_ptr<Widget> &widget)> callback); // Returns nullptr if index is invalid Widget* get_child_widget_by_index(size_t index) const; + size_t get_num_children() const; void set_spacing(float spacing); diff --git a/include/gui/Page.hpp b/include/gui/Page.hpp index 0d8536a..00a53c6 100644 --- a/include/gui/Page.hpp +++ b/include/gui/Page.hpp @@ -10,13 +10,11 @@ namespace gsr { Page() = default; Page(const Page&) = delete; Page& operator=(const Page&) = delete; - virtual ~Page() = default; + virtual ~Page() override; virtual void on_navigate_to_page() {} virtual void on_navigate_away_from_page() {} - //void remove_child_widget(Widget *widget) override; - virtual void add_widget(std::unique_ptr<Widget> widget); protected: SafeVector<std::unique_ptr<Widget>> widgets; diff --git a/include/gui/ScrollablePage.hpp b/include/gui/ScrollablePage.hpp index 452d0e9..54ec2cb 100644 --- a/include/gui/ScrollablePage.hpp +++ b/include/gui/ScrollablePage.hpp @@ -12,6 +12,7 @@ namespace gsr { ScrollablePage(mgl::vec2f size); ScrollablePage(const ScrollablePage&) = delete; ScrollablePage& operator=(const ScrollablePage&) = delete; + virtual ~ScrollablePage() override; bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; void draw(mgl::Window &window, mgl::vec2f offset) override; diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index b9f5cde..fb705cc 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -18,6 +18,7 @@ namespace gsr { class ScrollablePage; class Label; class LineSeparator; + class Subsection; class SettingsPage : public StaticPage { public: @@ -54,19 +55,20 @@ namespace gsr { std::unique_ptr<Widget> create_change_video_resolution_section(); std::unique_ptr<Widget> create_capture_target_section(); std::unique_ptr<ComboBox> create_audio_device_selection_combobox(); - std::unique_ptr<Button> create_remove_audio_device_button(List *audio_device_list_ptr); - std::unique_ptr<List> create_audio_device(); - std::unique_ptr<Button> create_add_audio_device_button(); - std::unique_ptr<ComboBox> create_application_audio_selection_combobox(); - std::unique_ptr<List> create_application_audio(); - std::unique_ptr<List> create_custom_application_audio(); - std::unique_ptr<Button> create_add_application_audio_button(); - std::unique_ptr<Button> create_add_custom_application_audio_button(); - std::unique_ptr<List> create_add_audio_buttons(); - std::unique_ptr<List> create_audio_track_track_section(); - std::unique_ptr<CheckBox> create_split_audio_checkbox(); + std::unique_ptr<Button> create_remove_audio_device_button(List *audio_input_list_ptr, List *audio_device_list_ptr); + std::unique_ptr<List> create_audio_device(List *audio_input_list_ptr); + std::unique_ptr<Button> create_add_audio_track_button(); + std::unique_ptr<Button> create_add_audio_device_button(List *audio_input_list_ptr); + std::unique_ptr<ComboBox> create_application_audio_selection_combobox(List *application_audio_row); + std::unique_ptr<List> create_application_audio(List *audio_input_list_ptr); + std::unique_ptr<List> create_custom_application_audio(List *audio_input_list_ptr); + std::unique_ptr<Button> create_add_application_audio_button(List *audio_input_list_ptr); + std::unique_ptr<List> create_add_audio_buttons(List *audio_input_list_ptr); + std::unique_ptr<List> create_audio_input_section(); std::unique_ptr<CheckBox> create_application_audio_invert_checkbox(); - std::unique_ptr<Widget> create_audio_track_section(); + std::unique_ptr<List> create_audio_track_title_and_remove(Subsection *audio_track_subsection, const char *title); + std::unique_ptr<Subsection> create_audio_track_section(Widget *parent_widget); + std::unique_ptr<List> create_audio_track_section_list(); std::unique_ptr<Widget> create_audio_section(); std::unique_ptr<List> create_video_quality_box(); std::unique_ptr<List> create_video_bitrate_entry(); @@ -125,6 +127,8 @@ namespace gsr { void save_replay(); void save_record(); void save_stream(); + + void view_changed(bool advanced_view, Subsection *notifications_subsection_ptr); private: Type type; Config &config; @@ -152,11 +156,6 @@ namespace gsr { Entry *framerate_entry_ptr = nullptr; Entry *video_bitrate_entry_ptr = nullptr; List *video_bitrate_list_ptr = nullptr; - List *audio_track_list_ptr = nullptr; - Button *add_application_audio_button_ptr = nullptr; - Button *add_custom_application_audio_button_ptr = nullptr; - CheckBox *split_audio_checkbox_ptr = nullptr; - CheckBox *application_audio_invert_checkbox_ptr = nullptr; CheckBox *change_video_resolution_checkbox_ptr = nullptr; ComboBox *color_range_box_ptr = nullptr; ComboBox *video_quality_box_ptr = nullptr; @@ -189,6 +188,8 @@ namespace gsr { Entry *replay_time_entry_ptr = nullptr; Label *replay_time_label_ptr = nullptr; RadioButton *turn_on_replay_automatically_mode_ptr = nullptr; + Subsection *audio_section_ptr = nullptr; + List *audio_track_section_list_ptr = nullptr; PageStack *page_stack = nullptr; }; diff --git a/include/gui/Subsection.hpp b/include/gui/Subsection.hpp index 4da6baf..88953d2 100644 --- a/include/gui/Subsection.hpp +++ b/include/gui/Subsection.hpp @@ -11,15 +11,20 @@ namespace gsr { Subsection(const char *title, std::unique_ptr<Widget> inner_widget, mgl::vec2f size); Subsection(const Subsection&) = delete; Subsection& operator=(const Subsection&) = delete; + virtual ~Subsection() override; bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; void draw(mgl::Window &window, mgl::vec2f offset) override; mgl::vec2f get_size() override; mgl::vec2f get_inner_size() override; + + Widget* get_inner_widget(); + void set_bg_color(mgl::Color color); private: Label label; std::unique_ptr<Widget> inner_widget; mgl::vec2f size; + mgl::Color bg_color{25, 30, 34}; }; }
\ No newline at end of file diff --git a/include/gui/Widget.hpp b/include/gui/Widget.hpp index 57424cd..131e756 100644 --- a/include/gui/Widget.hpp +++ b/include/gui/Widget.hpp @@ -1,6 +1,7 @@ #pragma once #include <mglpp/system/vec.hpp> +#include <memory> namespace mgl { class Event; @@ -31,8 +32,6 @@ namespace gsr { virtual void draw(mgl::Window &window, mgl::vec2f offset) = 0; virtual void set_position(mgl::vec2f position); - //virtual void remove_child_widget(Widget *widget) { (void)widget; } - virtual mgl::vec2f get_position() const; virtual mgl::vec2f get_size() = 0; // This can be different from get_size, for example with ScrollablePage this excludes the margins @@ -61,4 +60,7 @@ namespace gsr { bool visible = true; }; + + void add_widget_to_remove(std::unique_ptr<Widget> widget); + void remove_widgets_to_be_removed(); }
\ No newline at end of file |