aboutsummaryrefslogtreecommitdiff
path: root/include/gui
diff options
context:
space:
mode:
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/Button.hpp10
-rw-r--r--include/gui/DropdownButton.hpp3
-rw-r--r--include/gui/GlobalSettingsPage.hpp110
-rw-r--r--include/gui/GsrPage.hpp5
-rw-r--r--include/gui/Image.hpp29
-rw-r--r--include/gui/List.hpp5
-rw-r--r--include/gui/Page.hpp4
-rw-r--r--include/gui/RadioButton.hpp6
-rw-r--r--include/gui/ScreenshotSettingsPage.hpp76
-rw-r--r--include/gui/ScrollablePage.hpp1
-rw-r--r--include/gui/SettingsPage.hpp115
-rw-r--r--include/gui/Subsection.hpp5
-rw-r--r--include/gui/Utils.hpp5
-rw-r--r--include/gui/Widget.hpp6
14 files changed, 318 insertions, 62 deletions
diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp
index bc1dd94..f412521 100644
--- a/include/gui/Button.hpp
+++ b/include/gui/Button.hpp
@@ -5,6 +5,7 @@
#include <mglpp/graphics/Color.hpp>
#include <mglpp/graphics/Text.hpp>
+#include <mglpp/graphics/Sprite.hpp>
namespace gsr {
class Button : public Widget {
@@ -20,15 +21,24 @@ namespace gsr {
mgl::vec2f get_size() override;
void set_border_scale(float scale);
+ void set_icon_padding_scale(float scale);
+ void set_bg_hover_color(mgl::Color color);
+ void set_icon(mgl::Texture *texture);
const std::string& get_text() const;
void set_text(std::string str);
std::function<void()> on_click;
private:
+ void scale_sprite_to_button_size();
+ float get_button_height();
+ private:
mgl::vec2f size;
mgl::Color bg_color;
+ mgl::Color bg_hover_color;
mgl::Text text;
+ mgl::Sprite sprite;
float border_scale = 0.0015f;
+ float icon_padding_scale = 1.0f;
};
} \ No newline at end of file
diff --git a/include/gui/DropdownButton.hpp b/include/gui/DropdownButton.hpp
index cbbcda2..f613d86 100644
--- a/include/gui/DropdownButton.hpp
+++ b/include/gui/DropdownButton.hpp
@@ -20,6 +20,8 @@ namespace gsr {
void add_item(const std::string &text, const std::string &id, const std::string &description = "");
void set_item_label(const std::string &id, const std::string &new_label);
void set_item_icon(const std::string &id, mgl::Texture *texture);
+ void set_item_description(const std::string &id, const std::string &new_description);
+ void set_item_enabled(const std::string &id, bool enabled);
void set_description(std::string description_text);
void set_activated(bool activated);
@@ -35,6 +37,7 @@ namespace gsr {
mgl::Text description_text;
mgl::Texture *icon_texture = nullptr;
std::string id;
+ bool enabled = true;
};
std::vector<Item> items;
diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp
new file mode 100644
index 0000000..d96397d
--- /dev/null
+++ b/include/gui/GlobalSettingsPage.hpp
@@ -0,0 +1,110 @@
+#pragma once
+
+#include "StaticPage.hpp"
+#include "../GsrInfo.hpp"
+#include "../Config.hpp"
+
+#include <functional>
+#include <mglpp/window/Event.hpp>
+
+namespace gsr {
+ class Overlay;
+ class GsrPage;
+ class PageStack;
+ class ScrollablePage;
+ class Subsection;
+ class RadioButton;
+ class Button;
+ class List;
+ class CustomRendererWidget;
+
+ enum ConfigureHotkeyType {
+ NONE,
+ REPLAY_START_STOP,
+ REPLAY_SAVE,
+ REPLAY_SAVE_1_MIN,
+ REPLAY_SAVE_10_MIN,
+ RECORD_START_STOP,
+ RECORD_PAUSE_UNPAUSE,
+ STREAM_START_STOP,
+ TAKE_SCREENSHOT,
+ TAKE_SCREENSHOT_REGION,
+ SHOW_HIDE
+ };
+
+ class GlobalSettingsPage : public StaticPage {
+ public:
+ GlobalSettingsPage(Overlay *overlay, const GsrInfo *gsr_info, Config &config, PageStack *page_stack);
+ GlobalSettingsPage(const GlobalSettingsPage&) = delete;
+ GlobalSettingsPage& operator=(const GlobalSettingsPage&) = delete;
+
+ void load();
+ void save();
+ void on_navigate_away_from_page() override;
+
+ bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override;
+
+ std::function<void(bool enable, int exit_status)> on_startup_changed;
+ std::function<void(const char *reason)> on_click_exit_program_button;
+ std::function<void(const char *hotkey_option)> on_keyboard_hotkey_changed;
+ std::function<void(const char *hotkey_option)> on_joystick_hotkey_changed;
+ std::function<void()> on_page_closed;
+ private:
+ void load_hotkeys();
+
+ std::unique_ptr<Subsection> create_appearance_subsection(ScrollablePage *parent_page);
+ std::unique_ptr<Subsection> create_startup_subsection(ScrollablePage *parent_page);
+ std::unique_ptr<RadioButton> create_enable_keyboard_hotkeys_button();
+ std::unique_ptr<RadioButton> create_enable_joystick_hotkeys_button();
+ std::unique_ptr<List> create_show_hide_hotkey_options();
+ std::unique_ptr<List> create_replay_hotkey_options();
+ std::unique_ptr<List> create_replay_partial_save_hotkey_options();
+ std::unique_ptr<List> create_record_hotkey_options();
+ std::unique_ptr<List> create_stream_hotkey_options();
+ std::unique_ptr<List> create_screenshot_hotkey_options();
+ std::unique_ptr<List> create_screenshot_region_hotkey_options();
+ std::unique_ptr<List> create_hotkey_control_buttons();
+ std::unique_ptr<Subsection> create_keyboard_hotkey_subsection(ScrollablePage *parent_page);
+ std::unique_ptr<Subsection> create_controller_hotkey_subsection(ScrollablePage *parent_page);
+ std::unique_ptr<Button> create_exit_program_button();
+ std::unique_ptr<Button> create_go_back_to_old_ui_button();
+ std::unique_ptr<Subsection> create_application_options_subsection(ScrollablePage *parent_page);
+ std::unique_ptr<Subsection> create_application_info_subsection(ScrollablePage *parent_page);
+ void add_widgets();
+
+ Button* configure_hotkey_get_button_by_active_type();
+ ConfigHotkey* configure_hotkey_get_config_by_active_type();
+ void for_each_config_hotkey(std::function<void(ConfigHotkey *config_hotkey)> callback);
+ void configure_hotkey_start(ConfigureHotkeyType hotkey_type);
+ void configure_hotkey_cancel();
+ void configure_hotkey_stop_and_save();
+ private:
+ Overlay *overlay = nullptr;
+ Config &config;
+ const GsrInfo *gsr_info = nullptr;
+
+ GsrPage *content_page_ptr = nullptr;
+ PageStack *page_stack = nullptr;
+ RadioButton *tint_color_radio_button_ptr = nullptr;
+ RadioButton *startup_radio_button_ptr = nullptr;
+ RadioButton *enable_keyboard_hotkeys_radio_button_ptr = nullptr;
+ RadioButton *enable_joystick_hotkeys_radio_button_ptr = nullptr;
+
+ Button *turn_replay_on_off_button_ptr = nullptr;
+ Button *save_replay_button_ptr = nullptr;
+ Button *save_replay_1_min_button_ptr = nullptr;
+ Button *save_replay_10_min_button_ptr = nullptr;
+ Button *start_stop_recording_button_ptr = nullptr;
+ Button *pause_unpause_recording_button_ptr = nullptr;
+ Button *start_stop_streaming_button_ptr = nullptr;
+ Button *take_screenshot_button_ptr = nullptr;
+ Button *take_screenshot_region_button_ptr = nullptr;
+ Button *show_hide_button_ptr = nullptr;
+
+ ConfigHotkey configure_config_hotkey;
+ ConfigureHotkeyType configure_hotkey_type = ConfigureHotkeyType::NONE;
+
+ CustomRendererWidget *hotkey_overlay_ptr = nullptr;
+ std::string hotkey_configure_action_name;
+ };
+} \ No newline at end of file
diff --git a/include/gui/GsrPage.hpp b/include/gui/GsrPage.hpp
index 1d298f4..76c28a6 100644
--- a/include/gui/GsrPage.hpp
+++ b/include/gui/GsrPage.hpp
@@ -9,7 +9,7 @@
namespace gsr {
class GsrPage : public Page {
public:
- GsrPage();
+ GsrPage(const char *top_text, const char *bottom_text);
GsrPage(const GsrPage&) = delete;
GsrPage& operator=(const GsrPage&) = delete;
@@ -42,7 +42,8 @@ namespace gsr {
float margin_bottom_scale = 0.0f;
float margin_left_scale = 0.0f;
float margin_right_scale = 0.0f;
- mgl::Text label_text;
+ mgl::Text top_text;
+ mgl::Text bottom_text;
std::vector<ButtonItem> buttons;
};
} \ No newline at end of file
diff --git a/include/gui/Image.hpp b/include/gui/Image.hpp
new file mode 100644
index 0000000..d72c5c1
--- /dev/null
+++ b/include/gui/Image.hpp
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "Widget.hpp"
+
+#include <mglpp/graphics/Sprite.hpp>
+
+namespace gsr {
+ class Image : public Widget {
+ public:
+ enum class ScaleBehavior {
+ SCALE,
+ CLAMP
+ };
+
+ // Set size to {0.0f, 0.0f} for no limit. The image is scaled to the size while keeping its aspect ratio
+ Image(mgl::Texture *texture, mgl::vec2f size, ScaleBehavior scale_behavior);
+ Image(const Image&) = delete;
+ Image& operator=(const Image&) = delete;
+
+ 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;
+ private:
+ mgl::Sprite sprite;
+ mgl::vec2f size;
+ ScaleBehavior scale_behavior;
+ };
+} \ No newline at end of file
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/RadioButton.hpp b/include/gui/RadioButton.hpp
index a009eab..e319aa0 100644
--- a/include/gui/RadioButton.hpp
+++ b/include/gui/RadioButton.hpp
@@ -23,11 +23,13 @@ namespace gsr {
void add_item(const std::string &text, const std::string &id);
void set_selected_item(const std::string &id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true);
- const std::string get_selected_id() const;
+ const std::string& get_selected_id() const;
+ const std::string& get_selected_text() const;
mgl::vec2f get_size() override;
- std::function<void(const std::string &text, const std::string &id)> on_selection_changed;
+ // Return false to revert the change
+ std::function<bool(const std::string &text, const std::string &id)> on_selection_changed;
private:
void update_if_dirty();
private:
diff --git a/include/gui/ScreenshotSettingsPage.hpp b/include/gui/ScreenshotSettingsPage.hpp
new file mode 100644
index 0000000..db66d66
--- /dev/null
+++ b/include/gui/ScreenshotSettingsPage.hpp
@@ -0,0 +1,76 @@
+#pragma once
+
+#include "StaticPage.hpp"
+#include "List.hpp"
+#include "ComboBox.hpp"
+#include "Entry.hpp"
+#include "CheckBox.hpp"
+#include "../GsrInfo.hpp"
+#include "../Config.hpp"
+
+namespace gsr {
+ class PageStack;
+ class GsrPage;
+ class ScrollablePage;
+ class Button;
+
+ class ScreenshotSettingsPage : public StaticPage {
+ public:
+ ScreenshotSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack);
+ ScreenshotSettingsPage(const ScreenshotSettingsPage&) = delete;
+ ScreenshotSettingsPage& operator=(const ScreenshotSettingsPage&) = delete;
+
+ void load();
+ void save();
+ void on_navigate_away_from_page() override;
+ private:
+ std::unique_ptr<ComboBox> create_record_area_box();
+ std::unique_ptr<Widget> create_record_area();
+ std::unique_ptr<Entry> create_image_width_entry();
+ std::unique_ptr<Entry> create_image_height_entry();
+ std::unique_ptr<List> create_image_resolution();
+ std::unique_ptr<List> create_image_resolution_section();
+ std::unique_ptr<CheckBox> create_restore_portal_session_checkbox();
+ std::unique_ptr<List> create_restore_portal_session_section();
+ std::unique_ptr<Widget> create_change_image_resolution_section();
+ std::unique_ptr<Widget> create_capture_target_section();
+ std::unique_ptr<List> create_image_quality_section();
+ std::unique_ptr<Widget> create_record_cursor_section();
+ std::unique_ptr<Widget> create_image_section();
+ std::unique_ptr<List> create_save_directory(const char *label);
+ std::unique_ptr<ComboBox> create_image_format_box();
+ std::unique_ptr<List> create_image_format_section();
+ std::unique_ptr<Widget> create_file_info_section();
+ std::unique_ptr<CheckBox> create_save_screenshot_in_game_folder();
+ std::unique_ptr<Widget> create_general_section();
+ std::unique_ptr<Widget> create_notifications_section();
+ std::unique_ptr<Widget> create_settings();
+ void add_widgets();
+
+ void save(RecordOptions &record_options);
+ private:
+ Config &config;
+ const GsrInfo *gsr_info = nullptr;
+ SupportedCaptureOptions capture_options;
+
+ GsrPage *content_page_ptr = nullptr;
+ ScrollablePage *settings_scrollable_page_ptr = nullptr;
+ List *image_resolution_list_ptr = nullptr;
+ List *restore_portal_session_list_ptr = nullptr;
+ List *color_range_list_ptr = nullptr;
+ Widget *image_format_ptr = nullptr;
+ ComboBox *record_area_box_ptr = nullptr;
+ Entry *image_width_entry_ptr = nullptr;
+ Entry *image_height_entry_ptr = nullptr;
+ CheckBox *record_cursor_checkbox_ptr = nullptr;
+ CheckBox *restore_portal_session_checkbox_ptr = nullptr;
+ CheckBox *change_image_resolution_checkbox_ptr = nullptr;
+ ComboBox *image_quality_box_ptr = nullptr;
+ ComboBox *image_format_box_ptr = nullptr;
+ Button *save_directory_button_ptr = nullptr;
+ CheckBox *save_screenshot_in_game_folder_checkbox_ptr = nullptr;
+ CheckBox *show_screenshot_saved_notification_checkbox_ptr = nullptr;
+
+ PageStack *page_stack = nullptr;
+ };
+} \ No newline at end of file
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 f18ff65..1810de5 100644
--- a/include/gui/SettingsPage.hpp
+++ b/include/gui/SettingsPage.hpp
@@ -10,12 +10,20 @@
#include "../GsrInfo.hpp"
#include "../Config.hpp"
+#include <functional>
+
namespace gsr {
class GsrPage;
class PageStack;
class ScrollablePage;
class Label;
class LineSeparator;
+ class Subsection;
+
+ enum class AudioDeviceType {
+ OUTPUT,
+ INPUT
+ };
class SettingsPage : public StaticPage {
public:
@@ -25,18 +33,19 @@ namespace gsr {
STREAM
};
- SettingsPage(Type type, const GsrInfo &gsr_info, Config &config, PageStack *page_stack);
+ SettingsPage(Type type, const GsrInfo *gsr_info, Config &config, PageStack *page_stack);
SettingsPage(const SettingsPage&) = delete;
SettingsPage& operator=(const SettingsPage&) = delete;
- void load(const GsrInfo &gsr_info);
+ void load();
void save();
void on_navigate_away_from_page() override;
+
+ std::function<void()> on_config_changed;
private:
std::unique_ptr<RadioButton> create_view_radio_button();
- std::unique_ptr<ComboBox> create_record_area_box(const GsrInfo &gsr_info);
- std::unique_ptr<Widget> create_record_area(const GsrInfo &gsr_info);
- std::unique_ptr<List> create_select_window();
+ std::unique_ptr<ComboBox> create_record_area_box();
+ std::unique_ptr<Widget> create_record_area();
std::unique_ptr<Entry> create_area_width_entry();
std::unique_ptr<Entry> create_area_height_entry();
std::unique_ptr<List> create_area_size();
@@ -48,30 +57,32 @@ namespace gsr {
std::unique_ptr<CheckBox> create_restore_portal_session_checkbox();
std::unique_ptr<List> create_restore_portal_session_section();
std::unique_ptr<Widget> create_change_video_resolution_section();
- std::unique_ptr<Widget> create_capture_target(const GsrInfo &gsr_info);
- 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_merge_audio_tracks_checkbox();
+ std::unique_ptr<Widget> create_capture_target_section();
+ std::unique_ptr<ComboBox> create_audio_device_selection_combobox(AudioDeviceType device_type);
+ 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(AudioDeviceType device_type, List *audio_input_list_ptr);
+ std::unique_ptr<Button> create_add_audio_track_button();
+ std::unique_ptr<Button> create_add_audio_output_device_button(List *audio_input_list_ptr);
+ std::unique_ptr<Button> create_add_audio_input_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<Entry> create_video_bitrate_entry();
+ std::unique_ptr<List> create_video_bitrate_entry();
std::unique_ptr<List> create_video_bitrate();
std::unique_ptr<ComboBox> create_color_range_box();
std::unique_ptr<List> create_color_range();
std::unique_ptr<List> create_video_quality_section();
- std::unique_ptr<ComboBox> create_video_codec_box(const GsrInfo &gsr_info);
- std::unique_ptr<List> create_video_codec(const GsrInfo &gsr_info);
+ std::unique_ptr<ComboBox> create_video_codec_box();
+ std::unique_ptr<List> create_video_codec();
std::unique_ptr<ComboBox> create_audio_codec_box();
std::unique_ptr<List> create_audio_codec();
std::unique_ptr<Entry> create_framerate_entry();
@@ -80,24 +91,29 @@ namespace gsr {
std::unique_ptr<List> create_framerate_mode();
std::unique_ptr<List> create_framerate_section();
std::unique_ptr<Widget> create_record_cursor_section();
- std::unique_ptr<Widget> create_video_section(const GsrInfo &gsr_info);
- std::unique_ptr<Widget> create_settings(const GsrInfo &gsr_info);
- void add_widgets(const GsrInfo &gsr_info);
+ std::unique_ptr<Widget> create_video_section();
+ std::unique_ptr<Widget> create_settings();
+ void add_widgets();
- void add_page_specific_widgets(const GsrInfo &gsr_info);
+ void add_page_specific_widgets();
std::unique_ptr<List> create_save_directory(const char *label);
std::unique_ptr<ComboBox> create_container_box();
std::unique_ptr<List> create_container_section();
- std::unique_ptr<Entry> create_replay_time_entry();
+ std::unique_ptr<List> create_replay_time_entry();
std::unique_ptr<List> create_replay_time();
- std::unique_ptr<RadioButton> create_start_replay_automatically(const GsrInfo &gsr_info);
- std::unique_ptr<CheckBox> create_save_replay_in_game_folder(const GsrInfo &gsr_info);
- std::unique_ptr<Label> create_estimated_file_size();
- void update_estimated_file_size();
- std::unique_ptr<CheckBox> create_save_recording_in_game_folder(const GsrInfo &gsr_info);
- void add_replay_widgets(const GsrInfo &gsr_info);
- void add_record_widgets(const GsrInfo &gsr_info);
+ std::unique_ptr<List> create_replay_storage();
+ std::unique_ptr<RadioButton> create_start_replay_automatically();
+ std::unique_ptr<CheckBox> create_save_replay_in_game_folder();
+ std::unique_ptr<CheckBox> create_restart_replay_on_save();
+ std::unique_ptr<Label> create_estimated_replay_file_size();
+ void update_estimated_replay_file_size(const std::string &replay_storage_type);
+ void update_replay_time_text();
+ std::unique_ptr<CheckBox> create_save_recording_in_game_folder();
+ std::unique_ptr<Label> create_estimated_record_file_size();
+ void update_estimated_record_file_size();
+ void add_replay_widgets();
+ void add_record_widgets();
std::unique_ptr<ComboBox> create_streaming_service_box();
std::unique_ptr<List> create_streaming_service_section();
@@ -105,28 +121,31 @@ namespace gsr {
std::unique_ptr<List> create_stream_url_section();
std::unique_ptr<ComboBox> create_stream_container_box();
std::unique_ptr<List> create_stream_container_section();
- void add_stream_widgets(const GsrInfo &gsr_info);
+ void add_stream_widgets();
- void load_audio_tracks(const RecordOptions &record_options, const GsrInfo &gsr_info);
- void load_common(RecordOptions &record_options, const GsrInfo &gsr_info);
- void load_replay(const GsrInfo &gsr_info);
- void load_record(const GsrInfo &gsr_info);
- void load_stream(const GsrInfo &gsr_info);
+ void load_audio_tracks(const RecordOptions &record_options);
+ void load_common(RecordOptions &record_options);
+ void load_replay();
+ void load_record();
+ void load_stream();
void save_common(RecordOptions &record_options);
void save_replay();
void save_record();
void save_stream();
+
+ void view_changed(bool advanced_view, Subsection *notifications_subsection_ptr);
private:
Type type;
Config &config;
+ const GsrInfo *gsr_info = nullptr;
std::vector<AudioDevice> audio_devices;
std::vector<std::string> application_audio;
+ SupportedCaptureOptions capture_options;
GsrPage *content_page_ptr = nullptr;
ScrollablePage *settings_scrollable_page_ptr = nullptr;
List *settings_list_ptr = nullptr;
- List *select_window_list_ptr = nullptr;
List *area_size_list_ptr = nullptr;
List *video_resolution_list_ptr = nullptr;
List *restore_portal_session_list_ptr = nullptr;
@@ -142,11 +161,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 *merge_audio_tracks_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;
@@ -162,6 +176,7 @@ namespace gsr {
List *stream_url_list_ptr = nullptr;
List *container_list_ptr = nullptr;
CheckBox *save_replay_in_game_folder_ptr = nullptr;
+ CheckBox *restart_replay_on_save = nullptr;
Label *estimated_file_size_ptr = nullptr;
CheckBox *show_replay_started_notification_checkbox_ptr = nullptr;
CheckBox *show_replay_stopped_notification_checkbox_ptr = nullptr;
@@ -169,17 +184,21 @@ namespace gsr {
CheckBox *save_recording_in_game_folder_ptr = nullptr;
CheckBox *show_recording_started_notification_checkbox_ptr = nullptr;
CheckBox *show_video_saved_notification_checkbox_ptr = nullptr;
+ CheckBox *show_video_paused_notification_checkbox_ptr = nullptr;
CheckBox *show_streaming_started_notification_checkbox_ptr = nullptr;
CheckBox *show_streaming_stopped_notification_checkbox_ptr = nullptr;
Button *save_directory_button_ptr = nullptr;
Entry *twitch_stream_key_entry_ptr = nullptr;
Entry *youtube_stream_key_entry_ptr = nullptr;
+ Entry *rumble_stream_key_entry_ptr = nullptr;
Entry *stream_url_entry_ptr = nullptr;
Entry *replay_time_entry_ptr = nullptr;
+ RadioButton *replay_storage_button_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;
-
- mgl::Text settings_title_text;
};
} \ No newline at end of file
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/Utils.hpp b/include/gui/Utils.hpp
index 6963bc5..542e4ea 100644
--- a/include/gui/Utils.hpp
+++ b/include/gui/Utils.hpp
@@ -3,9 +3,6 @@
#include <mglpp/system/vec.hpp>
#include <mglpp/graphics/Color.hpp>
-#include <functional>
-#include <string_view>
-
namespace mgl {
class Window;
}
@@ -15,4 +12,6 @@ namespace gsr {
void draw_rectangle_outline(mgl::Window &window, mgl::vec2f pos, mgl::vec2f size, mgl::Color color, float border_size);
double get_frame_delta_seconds();
void set_frame_delta_seconds(double frame_delta);
+ mgl::vec2f scale_keep_aspect_ratio(mgl::vec2f from, mgl::vec2f to);
+ mgl::vec2f clamp_keep_aspect_ratio(mgl::vec2f from, mgl::vec2f to);
} \ 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