diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-02-22 13:31:51 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-02-22 13:31:51 +0100 |
commit | 189736c1a96a1ad0e571ad69f01039e96455011a (patch) | |
tree | 22e1a78f698209e2ce0ef462a5d281b5b3030897 /include/gui | |
parent | 8003c209fea16cd164817306cb33d46ac61a44f0 (diff) |
Add option to take a screenshot (default hotkey: alt+f1)
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/Button.hpp | 1 | ||||
-rw-r--r-- | include/gui/DropdownButton.hpp | 1 | ||||
-rw-r--r-- | include/gui/GlobalSettingsPage.hpp | 4 | ||||
-rw-r--r-- | include/gui/GsrPage.hpp | 5 | ||||
-rw-r--r-- | include/gui/ScreenshotSettingsPage.hpp | 78 | ||||
-rw-r--r-- | include/gui/SettingsPage.hpp | 2 |
6 files changed, 88 insertions, 3 deletions
diff --git a/include/gui/Button.hpp b/include/gui/Button.hpp index eb68e99..7070457 100644 --- a/include/gui/Button.hpp +++ b/include/gui/Button.hpp @@ -30,6 +30,7 @@ namespace gsr { std::function<void()> on_click; private: void scale_sprite_to_button_size(); + float get_button_height(); private: mgl::vec2f size; mgl::Color bg_color; diff --git a/include/gui/DropdownButton.hpp b/include/gui/DropdownButton.hpp index cbbcda2..486e811 100644 --- a/include/gui/DropdownButton.hpp +++ b/include/gui/DropdownButton.hpp @@ -20,6 +20,7 @@ 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_description(std::string description_text); void set_activated(bool activated); diff --git a/include/gui/GlobalSettingsPage.hpp b/include/gui/GlobalSettingsPage.hpp index 580e943..d0a0336 100644 --- a/include/gui/GlobalSettingsPage.hpp +++ b/include/gui/GlobalSettingsPage.hpp @@ -25,6 +25,7 @@ namespace gsr { RECORD_START_STOP, RECORD_PAUSE_UNPAUSE, STREAM_START_STOP, + TAKE_SCREENSHOT, SHOW_HIDE }; @@ -44,6 +45,7 @@ namespace gsr { 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(); @@ -55,6 +57,7 @@ namespace gsr { std::unique_ptr<List> create_replay_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_hotkey_control_buttons(); std::unique_ptr<Subsection> create_hotkey_subsection(ScrollablePage *parent_page); std::unique_ptr<Button> create_exit_program_button(); @@ -86,6 +89,7 @@ namespace gsr { 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 *show_hide_button_ptr = nullptr; ConfigHotkey configure_config_hotkey; 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/ScreenshotSettingsPage.hpp b/include/gui/ScreenshotSettingsPage.hpp new file mode 100644 index 0000000..1cfbf00 --- /dev/null +++ b/include/gui/ScreenshotSettingsPage.hpp @@ -0,0 +1,78 @@ +#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<List> create_select_window(); + 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 *select_window_list_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/SettingsPage.hpp b/include/gui/SettingsPage.hpp index ad5f05a..69ecc5a 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -52,7 +52,7 @@ 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(); + 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(); |