aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Config.hpp20
-rw-r--r--include/CursorTracker/CursorTracker.hpp (renamed from include/CursorTracker.hpp)0
-rw-r--r--include/CursorTracker/CursorTrackerWayland.hpp (renamed from include/CursorTrackerWayland.hpp)0
-rw-r--r--include/CursorTracker/CursorTrackerX11.hpp (renamed from include/CursorTrackerX11.hpp)0
-rw-r--r--include/GlobalHotkeys/GlobalHotkeys.hpp (renamed from include/GlobalHotkeys.hpp)0
-rw-r--r--include/GlobalHotkeys/GlobalHotkeysJoystick.hpp (renamed from include/GlobalHotkeysJoystick.hpp)6
-rw-r--r--include/GlobalHotkeys/GlobalHotkeysLinux.hpp (renamed from include/GlobalHotkeysLinux.hpp)2
-rw-r--r--include/GlobalHotkeys/GlobalHotkeysX11.hpp (renamed from include/GlobalHotkeysX11.hpp)0
-rw-r--r--include/Overlay.hpp16
-rw-r--r--include/SafeVector.hpp137
-rw-r--r--include/Theme.hpp3
-rw-r--r--include/Utils.hpp2
-rw-r--r--include/gui/DropdownButton.hpp2
-rw-r--r--include/gui/GlobalSettingsPage.hpp5
-rw-r--r--include/gui/List.hpp5
-rw-r--r--include/gui/Page.hpp4
-rw-r--r--include/gui/RadioButton.hpp3
-rw-r--r--include/gui/ScrollablePage.hpp1
-rw-r--r--include/gui/SettingsPage.hpp47
-rw-r--r--include/gui/Subsection.hpp5
-rw-r--r--include/gui/Widget.hpp6
21 files changed, 189 insertions, 75 deletions
diff --git a/include/Config.hpp b/include/Config.hpp
index 0e8e4eb..2bb79fb 100644
--- a/include/Config.hpp
+++ b/include/Config.hpp
@@ -6,7 +6,7 @@
#include <vector>
#include <optional>
-#define GSR_CONFIG_FILE_VERSION 1
+#define GSR_CONFIG_FILE_VERSION 2
namespace gsr {
struct SupportedCaptureOptions;
@@ -30,6 +30,14 @@ namespace gsr {
std::string to_string(bool spaces = true, bool modifier_side = true) const;
};
+ struct AudioTrack {
+ std::vector<std::string> audio_inputs; // ids
+ bool application_audio_invert = false;
+
+ bool operator==(const AudioTrack &other) const;
+ bool operator!=(const AudioTrack &other) const;
+ };
+
struct RecordOptions {
std::string record_area_option = "screen";
int32_t record_area_width = 0;
@@ -38,10 +46,11 @@ namespace gsr {
int32_t video_height = 0;
int32_t fps = 60;
int32_t video_bitrate = 15000;
- bool merge_audio_tracks = true; // Currently unused for streaming because all known streaming sites only support 1 audio track
- bool application_audio_invert = false;
+ bool merge_audio_tracks = true; // TODO: Remove in the future
+ bool application_audio_invert = false; // TODO: Remove in the future
bool change_video_resolution = false;
- std::vector<std::string> audio_tracks;
+ std::vector<std::string> audio_tracks; // ids, TODO: Remove in the future
+ std::vector<AudioTrack> audio_tracks_list;
std::string color_range = "limited";
std::string video_quality = "very_high";
std::string video_codec = "auto";
@@ -108,8 +117,11 @@ namespace gsr {
std::string save_directory;
std::string container = "mp4";
int32_t replay_time = 60;
+ std::string replay_storage = "ram";
ConfigHotkey start_stop_hotkey;
ConfigHotkey save_hotkey;
+ ConfigHotkey save_1_min_hotkey;
+ ConfigHotkey save_10_min_hotkey;
};
struct ScreenshotConfig {
diff --git a/include/CursorTracker.hpp b/include/CursorTracker/CursorTracker.hpp
index ff7374f..ff7374f 100644
--- a/include/CursorTracker.hpp
+++ b/include/CursorTracker/CursorTracker.hpp
diff --git a/include/CursorTrackerWayland.hpp b/include/CursorTracker/CursorTrackerWayland.hpp
index 1eeee83..1eeee83 100644
--- a/include/CursorTrackerWayland.hpp
+++ b/include/CursorTracker/CursorTrackerWayland.hpp
diff --git a/include/CursorTrackerX11.hpp b/include/CursorTracker/CursorTrackerX11.hpp
index 66618c4..66618c4 100644
--- a/include/CursorTrackerX11.hpp
+++ b/include/CursorTracker/CursorTrackerX11.hpp
diff --git a/include/GlobalHotkeys.hpp b/include/GlobalHotkeys/GlobalHotkeys.hpp
index 2927fa7..2927fa7 100644
--- a/include/GlobalHotkeys.hpp
+++ b/include/GlobalHotkeys/GlobalHotkeys.hpp
diff --git a/include/GlobalHotkeysJoystick.hpp b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp
index 30a7689..4b266cb 100644
--- a/include/GlobalHotkeysJoystick.hpp
+++ b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "GlobalHotkeys.hpp"
-#include "Hotplug.hpp"
+#include "../Hotplug.hpp"
#include <unordered_map>
#include <thread>
#include <poll.h>
@@ -21,6 +21,8 @@ namespace gsr {
bool start();
// Currently valid ids:
// save_replay
+ // save_1_min_replay
+ // save_10_min_replay
// take_screenshot
// toggle_record
// toggle_replay
@@ -56,6 +58,8 @@ namespace gsr {
bool right_pressed = false;
bool save_replay = false;
+ bool save_1_min_replay = false;
+ bool save_10_min_replay = false;
bool take_screenshot = false;
bool toggle_record = false;
bool toggle_replay = false;
diff --git a/include/GlobalHotkeysLinux.hpp b/include/GlobalHotkeys/GlobalHotkeysLinux.hpp
index c9428de..959d095 100644
--- a/include/GlobalHotkeysLinux.hpp
+++ b/include/GlobalHotkeys/GlobalHotkeysLinux.hpp
@@ -22,6 +22,8 @@ namespace gsr {
void unbind_all_keys() override;
void poll_events() override;
private:
+ void close_fds();
+ private:
pid_t process_id = 0;
int read_pipes[2];
int write_pipes[2];
diff --git a/include/GlobalHotkeysX11.hpp b/include/GlobalHotkeys/GlobalHotkeysX11.hpp
index 610399a..610399a 100644
--- a/include/GlobalHotkeysX11.hpp
+++ b/include/GlobalHotkeys/GlobalHotkeysX11.hpp
diff --git a/include/Overlay.hpp b/include/Overlay.hpp
index ac9d2b1..4cfab1d 100644
--- a/include/Overlay.hpp
+++ b/include/Overlay.hpp
@@ -6,10 +6,10 @@
#include "Config.hpp"
#include "window_texture.h"
#include "WindowUtils.hpp"
-#include "GlobalHotkeysJoystick.hpp"
+#include "GlobalHotkeys/GlobalHotkeysJoystick.hpp"
#include "AudioPlayer.hpp"
#include "RegionSelector.hpp"
-#include "CursorTracker.hpp"
+#include "CursorTracker/CursorTracker.hpp"
#include <mglpp/window/Window.hpp>
#include <mglpp/window/Event.hpp>
@@ -59,6 +59,8 @@ namespace gsr {
void toggle_stream();
void toggle_replay();
void save_replay();
+ void save_replay_1_min();
+ void save_replay_10_min();
void take_screenshot();
void take_screenshot_region();
void show_notification(const char *str, double timeout_seconds, mgl::Color icon_color, mgl::Color bg_color, NotificationType notification_type, const char *capture_target = nullptr);
@@ -87,7 +89,7 @@ namespace gsr {
void update_notification_process_status();
void save_video_in_current_game_directory(const char *video_filepath, NotificationType notification_type);
void on_replay_saved(const char *replay_saved_filepath);
- void update_gsr_replay_save();
+ void process_gsr_output();
void update_gsr_process_status();
void update_gsr_screenshot_process_status();
@@ -96,7 +98,7 @@ namespace gsr {
void update_power_supply_status();
void update_system_startup_status();
- void on_stop_recording(int exit_code);
+ void on_stop_recording(int exit_code, const std::string &video_filepath);
void update_ui_recording_paused();
void update_ui_recording_unpaused();
@@ -110,7 +112,10 @@ namespace gsr {
void update_ui_replay_started();
void update_ui_replay_stopped();
+ void prepare_gsr_output_for_reading();
void on_press_save_replay();
+ void on_press_save_replay_1_min_replay();
+ void on_press_save_replay_10_min_replay();
bool on_press_start_replay(bool disable_notification, bool finished_region_selection);
void on_press_start_record(bool finished_region_selection);
void on_press_start_stream(bool finished_region_selection);
@@ -204,6 +209,8 @@ namespace gsr {
bool replay_save_show_notification = false;
ReplayStartupMode replay_startup_mode = ReplayStartupMode::TURN_ON_AT_SYSTEM_STARTUP;
bool try_replay_startup = true;
+ bool replay_recording = false;
+ int replay_save_duration_min = 0;
AudioPlayer audio_player;
RegionSelector region_selector;
@@ -211,7 +218,6 @@ namespace gsr {
std::function<void()> on_region_selected;
std::string recording_capture_target;
- std::string replay_capture_target;
std::string screenshot_capture_target;
std::unique_ptr<CursorTracker> cursor_tracker;
diff --git a/include/SafeVector.hpp b/include/SafeVector.hpp
index 6cb4725..63125ad 100644
--- a/include/SafeVector.hpp
+++ b/include/SafeVector.hpp
@@ -1,8 +1,15 @@
#pragma once
#include <vector>
-#include <memory>
#include <functional>
+#include <assert.h>
+#include "gui/Widget.hpp"
+
+template <typename T>
+struct SafeVectorItem {
+ T item;
+ bool alive = false;
+};
// A vector that can be modified while iterating
template <typename T>
@@ -10,64 +17,84 @@ class SafeVector {
public:
using PointerType = typename std::pointer_traits<T>::element_type*;
+ SafeVector() = default;
+ SafeVector(const SafeVector&) = delete;
+ SafeVector& operator=(const SafeVector&) = delete;
+ ~SafeVector() {
+ clear();
+ }
+
void push_back(T item) {
- data.push_back(std::move(item));
+ data.push_back({std::move(item), true});
+ ++num_items_alive;
}
// Safe to call when vector is empty
// TODO: Make this iterator safe
void pop_back() {
- if(!data.empty())
+ if(!data.empty()) {
+ gsr::add_widget_to_remove(std::move(data.back().item));
data.pop_back();
+ --num_items_alive;
+ }
}
// Might not remove the data immediately if inside for_each loop.
// In that case the item is removed at the end of the loop.
void remove(PointerType item_to_remove) {
- if(for_each_depth == 0)
+ if(for_each_depth == 0) {
remove_item(item_to_remove);
- else
- remove_queue.push_back(item_to_remove);
+ return;
+ }
+
+ SafeVectorItem<T> *item = get_item(item_to_remove);
+ if(item && item->alive) {
+ item->alive = false;
+ --num_items_alive;
+ has_items_to_remove = true;
+ }
}
// Safe to call when vector is empty, in which case it returns nullptr
T* back() {
- if(data.empty())
- return nullptr;
- else
- return &data.back();
+ for(auto it = data.rbegin(), end = data.rend(); it != end; ++it) {
+ if(it->alive)
+ return &it->item;
+ }
+ return nullptr;
}
// TODO: Make this iterator safe
void clear() {
+ for(auto &item : data) {
+ gsr::add_widget_to_remove(std::move(item.item));
+ }
data.clear();
- remove_queue.clear();
+ num_items_alive = 0;
}
// Return true from |callback| to continue. This function returns false if |callback| returned false
- bool for_each(std::function<bool(T &t)> callback) {
+ bool for_each(std::function<bool(T &t)> callback, bool include_dead = false) {
bool result = true;
++for_each_depth;
for(size_t i = 0; i < data.size(); ++i) {
- result = callback(data[i]);
- if(!result)
- break;
+ if(data[i].alive || include_dead) {
+ result = callback(data[i].item);
+ if(!result)
+ break;
+ }
}
--for_each_depth;
- if(for_each_depth == 0) {
- for(PointerType item_to_remove : remove_queue) {
- remove_item(item_to_remove);
- }
- remove_queue.clear();
- }
+ if(for_each_depth == 0)
+ remove_dead_items();
return result;
}
// Return true from |callback| to continue. This function returns false if |callback| returned false
- bool for_each_reverse(std::function<bool(T &t)> callback) {
+ bool for_each_reverse(std::function<bool(T &t)> callback, bool include_dead = false) {
bool result = true;
++for_each_depth;
@@ -80,50 +107,84 @@ public:
if(i < 0)
break;
- result = callback(data[i]);
- if(!result)
- break;
+ if(data[i].alive || include_dead) {
+ result = callback(data[i].item);
+ if(!result)
+ break;
+ }
--i;
}
--for_each_depth;
- if(for_each_depth == 0) {
- for(PointerType item_to_remove : remove_queue) {
- remove_item(item_to_remove);
- }
- remove_queue.clear();
- }
+ if(for_each_depth == 0)
+ remove_dead_items();
return result;
}
T& operator[](size_t index) {
- return data[index];
+ assert(index < data.size());
+ return data[index].item;
}
const T& operator[](size_t index) const {
- return data[index];
+ assert(index < data.size());
+ return data[index].item;
}
size_t size() const {
- return data.size();
+ return (size_t)num_items_alive;
}
bool empty() const {
- return data.empty();
+ return num_items_alive == 0;
+ }
+
+ void replace_item(PointerType item_to_replace, T new_item) {
+ SafeVectorItem<T> *item = get_item(item_to_replace);
+ if(item->alive) {
+ gsr::add_widget_to_remove(std::move(item->item));
+ item->item = std::move(new_item);
+ }
}
private:
void remove_item(PointerType item_to_remove) {
for(auto it = data.begin(), end = data.end(); it != end; ++it) {
- if(&*(*it) == item_to_remove) {
+ if(&*(it->item) == item_to_remove) {
+ gsr::add_widget_to_remove(std::move(it->item));
data.erase(it);
+ --num_items_alive;
return;
}
}
}
+
+ SafeVectorItem<T>* get_item(PointerType item_to_remove) {
+ for(auto &item : data) {
+ if(&*(item.item) == item_to_remove)
+ return &item;
+ }
+ return nullptr;
+ }
+
+ void remove_dead_items() {
+ if(!has_items_to_remove)
+ return;
+
+ for(auto it = data.begin(); it != data.end();) {
+ if(it->alive) {
+ ++it;
+ } else {
+ gsr::add_widget_to_remove(std::move(it->item));
+ it = data.erase(it);
+ }
+ }
+ has_items_to_remove = false;
+ }
private:
- std::vector<T> data;
- std::vector<PointerType> remove_queue;
+ std::vector<SafeVectorItem<T>> data;
int for_each_depth = 0;
+ int num_items_alive = 0;
+ bool has_items_to_remove = false;
}; \ No newline at end of file
diff --git a/include/Theme.hpp b/include/Theme.hpp
index 4305072..249ad3d 100644
--- a/include/Theme.hpp
+++ b/include/Theme.hpp
@@ -42,6 +42,7 @@ namespace gsr {
mgl::Texture pause_texture;
mgl::Texture save_texture;
mgl::Texture screenshot_texture;
+ mgl::Texture trash_texture;
mgl::Texture ps4_home_texture;
mgl::Texture ps4_options_texture;
@@ -49,6 +50,8 @@ namespace gsr {
mgl::Texture ps4_dpad_down_texture;
mgl::Texture ps4_dpad_left_texture;
mgl::Texture ps4_dpad_right_texture;
+ mgl::Texture ps4_cross_texture;
+ mgl::Texture ps4_triangle_texture;
double double_click_timeout_seconds = 0.4;
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 19700df..38088be 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -14,6 +14,8 @@ namespace gsr {
using StringSplitCallback = std::function<bool(std::string_view line)>;
void string_split_char(std::string_view str, char delimiter, StringSplitCallback callback_func);
+ bool starts_with(std::string_view str, const char *substr);
+ bool ends_with(std::string_view str, const char *substr);
std::string get_home_dir();
std::string get_config_dir();
diff --git a/include/gui/DropdownButton.hpp b/include/gui/DropdownButton.hpp
index 486e811..f613d86 100644
--- a/include/gui/DropdownButton.hpp
+++ b/include/gui/DropdownButton.hpp
@@ -21,6 +21,7 @@ namespace gsr {
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);
@@ -36,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
index 5df5b9c..d96397d 100644
--- a/include/gui/GlobalSettingsPage.hpp
+++ b/include/gui/GlobalSettingsPage.hpp
@@ -22,6 +22,8 @@ namespace gsr {
NONE,
REPLAY_START_STOP,
REPLAY_SAVE,
+ REPLAY_SAVE_1_MIN,
+ REPLAY_SAVE_10_MIN,
RECORD_START_STOP,
RECORD_PAUSE_UNPAUSE,
STREAM_START_STOP,
@@ -56,6 +58,7 @@ namespace gsr {
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();
@@ -89,6 +92,8 @@ namespace gsr {
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;
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 16d638e..e319aa0 100644
--- a/include/gui/RadioButton.hpp
+++ b/include/gui/RadioButton.hpp
@@ -23,7 +23,8 @@ 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;
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..2a78802 100644
--- a/include/gui/SettingsPage.hpp
+++ b/include/gui/SettingsPage.hpp
@@ -18,6 +18,12 @@ namespace gsr {
class ScrollablePage;
class Label;
class LineSeparator;
+ class Subsection;
+
+ enum class AudioDeviceType {
+ OUTPUT,
+ INPUT
+ };
class SettingsPage : public StaticPage {
public:
@@ -53,20 +59,22 @@ namespace gsr {
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_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<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<List> create_video_bitrate_entry();
@@ -95,11 +103,12 @@ namespace gsr {
std::unique_ptr<List> create_container_section();
std::unique_ptr<List> create_replay_time_entry();
std::unique_ptr<List> create_replay_time();
+ 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();
+ 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();
@@ -125,6 +134,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 +163,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;
@@ -187,8 +193,11 @@ namespace gsr {
Entry *youtube_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;
};
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