aboutsummaryrefslogtreecommitdiff
path: root/include/gui/SettingsPage.hpp
blob: 467463f7e4d85e17be6cfee82c4ce3429a3a8984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#pragma once

#include "StaticPage.hpp"
#include "List.hpp"
#include "ComboBox.hpp"
#include "Entry.hpp"
#include "RadioButton.hpp"
#include "CheckBox.hpp"
#include "Button.hpp"
#include "../GsrInfo.hpp"
#include "../Config.hpp"

namespace gsr {
    class GsrPage;
    class PageStack;
    class ScrollablePage;
    class Label;

    class SettingsPage : public StaticPage {
    public:
        enum class Type {
            REPLAY,
            RECORD,
            STREAM
        };

        SettingsPage(Type type, const GsrInfo &gsr_info, std::vector<AudioDevice> audio_devices, Config &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:
        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<Entry> create_area_width_entry();
        std::unique_ptr<Entry> create_area_height_entry();
        std::unique_ptr<List> create_area_size();
        std::unique_ptr<List> create_area_size_section();
        std::unique_ptr<Entry> create_video_width_entry();
        std::unique_ptr<Entry> create_video_height_entry();
        std::unique_ptr<List> create_video_resolution();
        std::unique_ptr<List> create_video_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_video_resolution_section();
        std::unique_ptr<Widget> create_capture_target(const GsrInfo &gsr_info);
        std::unique_ptr<ComboBox> create_audio_track_selection_checkbox();
        std::unique_ptr<Button> create_remove_audio_track_button(List *audio_device_list_ptr);
        std::unique_ptr<List> create_audio_track();
        std::unique_ptr<Button> create_add_audio_track_button();
        std::unique_ptr<List> create_audio_track_section();
        std::unique_ptr<CheckBox> create_merge_audio_tracks_checkbox();
        std::unique_ptr<Widget> create_audio_device_section();
        std::unique_ptr<List> create_video_quality_box();
        std::unique_ptr<Entry> 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_audio_codec_box();
        std::unique_ptr<List> create_audio_codec();
        std::unique_ptr<Entry> create_framerate_entry();
        std::unique_ptr<List> create_framerate();
        std::unique_ptr<ComboBox> create_framerate_mode_box();
        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);

        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();
        std::unique_ptr<CheckBox> create_start_replay_on_startup();
        std::unique_ptr<CheckBox> create_save_replay_in_game_folder();
        std::unique_ptr<Label> create_estimated_file_size();
        void update_estimated_file_size();
        std::unique_ptr<CheckBox> create_save_recording_in_game_folder();
        void add_replay_widgets();
        void add_record_widgets();

        std::unique_ptr<ComboBox> create_streaming_service_box();
        std::unique_ptr<List> create_streaming_service_section();
        std::unique_ptr<List> create_stream_key_section();
        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();

        void load_audio_tracks(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();
    private:
        Type type;
        Config &config;
        std::vector<AudioDevice> audio_devices;

        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;
        List *color_range_list_ptr = nullptr;
        Widget *video_codec_ptr = nullptr;
        Widget *audio_codec_ptr = nullptr;
        List *framerate_mode_list_ptr = nullptr;
        ComboBox *record_area_box_ptr = nullptr;
        Entry *area_width_entry_ptr = nullptr;
        Entry *area_height_entry_ptr = nullptr;
        Entry *video_width_entry_ptr = nullptr;
        Entry *video_height_entry_ptr = nullptr;
        Entry *framerate_entry_ptr = nullptr;
        Entry *video_bitrate_entry_ptr = nullptr;
        List *video_bitrate_list_ptr = nullptr;
        List *audio_devices_list_ptr = nullptr;
        CheckBox *merge_audio_tracks_checkbox_ptr = nullptr;
        CheckBox *change_video_resolution_checkbox_ptr = nullptr;
        ComboBox *color_range_box_ptr = nullptr;
        ComboBox *video_quality_box_ptr = nullptr;
        ComboBox *video_codec_box_ptr = nullptr;
        ComboBox *audio_codec_box_ptr = nullptr;
        ComboBox *framerate_mode_box_ptr = nullptr;
        RadioButton *view_radio_button_ptr = nullptr;
        CheckBox *record_cursor_checkbox_ptr = nullptr;
        CheckBox *restore_portal_session_checkbox_ptr = nullptr;
        ComboBox *container_box_ptr = nullptr;
        ComboBox *streaming_service_box_ptr = nullptr;
        List *stream_key_list_ptr = nullptr;
        List *stream_url_list_ptr = nullptr;
        List *container_list_ptr = nullptr;
        CheckBox *start_replay_automatically_ptr = nullptr;
        CheckBox *save_replay_in_game_folder_ptr = nullptr;
        Label *estimated_file_size_ptr = nullptr;
        CheckBox *show_replay_started_notification_checkbox_ptr = nullptr;
        CheckBox *show_replay_stopped_notification_checkbox_ptr = nullptr;
        CheckBox *show_replay_saved_notification_checkbox_ptr = nullptr;
        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_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 *stream_url_entry_ptr = nullptr;
        Entry *replay_time_entry_ptr = nullptr;

        PageStack *page_stack = nullptr;

        mgl::Text settings_title_text;
    };
}