mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Add option to not save screenshot to disk (only clipboard), refactor webcam ui code
This commit is contained in:
@@ -148,6 +148,7 @@ namespace gsr {
|
|||||||
|
|
||||||
bool save_screenshot_in_game_folder = false;
|
bool save_screenshot_in_game_folder = false;
|
||||||
bool save_screenshot_to_clipboard = false;
|
bool save_screenshot_to_clipboard = false;
|
||||||
|
bool save_screenshot_to_disk = true;
|
||||||
bool show_notifications = true;
|
bool show_notifications = true;
|
||||||
bool use_led_indicator = false;
|
bool use_led_indicator = false;
|
||||||
std::string save_directory;
|
std::string save_directory;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace gsr {
|
|||||||
std::unique_ptr<Widget> create_file_info_section();
|
std::unique_ptr<Widget> create_file_info_section();
|
||||||
std::unique_ptr<CheckBox> create_save_screenshot_in_game_folder();
|
std::unique_ptr<CheckBox> create_save_screenshot_in_game_folder();
|
||||||
std::unique_ptr<CheckBox> create_save_screenshot_to_clipboard();
|
std::unique_ptr<CheckBox> create_save_screenshot_to_clipboard();
|
||||||
|
std::unique_ptr<CheckBox> create_save_screenshot_to_disk();
|
||||||
std::unique_ptr<Widget> create_notifications();
|
std::unique_ptr<Widget> create_notifications();
|
||||||
std::unique_ptr<Widget> create_led_indicator();
|
std::unique_ptr<Widget> create_led_indicator();
|
||||||
std::unique_ptr<Widget> create_general_section();
|
std::unique_ptr<Widget> create_general_section();
|
||||||
@@ -76,6 +77,7 @@ namespace gsr {
|
|||||||
Button *save_directory_button_ptr = nullptr;
|
Button *save_directory_button_ptr = nullptr;
|
||||||
CheckBox *save_screenshot_in_game_folder_checkbox_ptr = nullptr;
|
CheckBox *save_screenshot_in_game_folder_checkbox_ptr = nullptr;
|
||||||
CheckBox *save_screenshot_to_clipboard_checkbox_ptr = nullptr;
|
CheckBox *save_screenshot_to_clipboard_checkbox_ptr = nullptr;
|
||||||
|
CheckBox *save_screenshot_to_disk_checkbox_ptr = nullptr;
|
||||||
CheckBox *show_notification_checkbox_ptr = nullptr;
|
CheckBox *show_notification_checkbox_ptr = nullptr;
|
||||||
CheckBox *led_indicator_checkbox_ptr = nullptr;
|
CheckBox *led_indicator_checkbox_ptr = nullptr;
|
||||||
Entry *create_custom_script_screenshot_entry_ptr = nullptr;
|
Entry *create_custom_script_screenshot_entry_ptr = nullptr;
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ namespace gsr {
|
|||||||
std::unique_ptr<Widget> create_capture_target_section();
|
std::unique_ptr<Widget> create_capture_target_section();
|
||||||
std::unique_ptr<List> create_webcam_sources();
|
std::unique_ptr<List> create_webcam_sources();
|
||||||
std::unique_ptr<List> create_webcam_video_format();
|
std::unique_ptr<List> create_webcam_video_format();
|
||||||
|
std::unique_ptr<Widget> create_webcam_location_widget();
|
||||||
|
std::unique_ptr<CheckBox> create_flip_camera_checkbox();
|
||||||
|
std::unique_ptr<List> create_webcam_body();
|
||||||
std::unique_ptr<Widget> create_webcam_section();
|
std::unique_ptr<Widget> create_webcam_section();
|
||||||
std::unique_ptr<ComboBox> create_audio_device_selection_combobox(AudioDeviceType device_type);
|
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<Button> create_remove_audio_device_button(List *audio_input_list_ptr, List *audio_device_list_ptr);
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ namespace gsr {
|
|||||||
{"screenshot.restore_portal_session", &config.screenshot_config.restore_portal_session},
|
{"screenshot.restore_portal_session", &config.screenshot_config.restore_portal_session},
|
||||||
{"screenshot.save_screenshot_in_game_folder", &config.screenshot_config.save_screenshot_in_game_folder},
|
{"screenshot.save_screenshot_in_game_folder", &config.screenshot_config.save_screenshot_in_game_folder},
|
||||||
{"screenshot.save_screenshot_to_clipboard", &config.screenshot_config.save_screenshot_to_clipboard},
|
{"screenshot.save_screenshot_to_clipboard", &config.screenshot_config.save_screenshot_to_clipboard},
|
||||||
|
{"screenshot.save_screenshot_to_disk", &config.screenshot_config.save_screenshot_to_disk},
|
||||||
{"screenshot.show_notifications", &config.screenshot_config.show_notifications},
|
{"screenshot.show_notifications", &config.screenshot_config.show_notifications},
|
||||||
{"screenshot.use_led_indicator", &config.screenshot_config.use_led_indicator},
|
{"screenshot.use_led_indicator", &config.screenshot_config.use_led_indicator},
|
||||||
{"screenshot.save_directory", &config.screenshot_config.save_directory},
|
{"screenshot.save_directory", &config.screenshot_config.save_directory},
|
||||||
|
|||||||
@@ -2167,7 +2167,7 @@ namespace gsr {
|
|||||||
exit_code = WEXITSTATUS(status);
|
exit_code = WEXITSTATUS(status);
|
||||||
|
|
||||||
if(exit_code == 0) {
|
if(exit_code == 0) {
|
||||||
if(config.screenshot_config.save_screenshot_in_game_folder) {
|
if(config.screenshot_config.save_screenshot_in_game_folder && config.screenshot_config.save_screenshot_to_disk) {
|
||||||
save_video_in_current_game_directory(screenshot_filepath, NotificationType::SCREENSHOT);
|
save_video_in_current_game_directory(screenshot_filepath, NotificationType::SCREENSHOT);
|
||||||
} else if(config.screenshot_config.show_notifications) {
|
} else if(config.screenshot_config.show_notifications) {
|
||||||
char msg[512];
|
char msg[512];
|
||||||
@@ -3359,7 +3359,12 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Validate input, fallback to valid values
|
// TODO: Validate input, fallback to valid values
|
||||||
const std::string output_file = config.screenshot_config.save_directory + "/Screenshot_" + get_date_str() + "." + config.screenshot_config.image_format; // TODO: Validate image format
|
std::string output_file;
|
||||||
|
if(config.screenshot_config.save_screenshot_to_disk)
|
||||||
|
output_file = config.screenshot_config.save_directory + "/Screenshot_" + get_date_str() + "." + config.screenshot_config.image_format; // TODO: Validate image format
|
||||||
|
else
|
||||||
|
output_file = "/tmp/gsr_ui_clipboard_screenshot." + config.screenshot_config.image_format;
|
||||||
|
|
||||||
const bool capture_cursor = force_type == ScreenshotForceType::NONE && config.screenshot_config.record_cursor;
|
const bool capture_cursor = force_type == ScreenshotForceType::NONE && config.screenshot_config.record_cursor;
|
||||||
|
|
||||||
std::vector<const char*> args = {
|
std::vector<const char*> args = {
|
||||||
|
|||||||
@@ -221,6 +221,13 @@ namespace gsr {
|
|||||||
return checkbox;
|
return checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<CheckBox> ScreenshotSettingsPage::create_save_screenshot_to_disk() {
|
||||||
|
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Save screenshot to disk");
|
||||||
|
save_screenshot_to_disk_checkbox_ptr = checkbox.get();
|
||||||
|
checkbox->set_checked(true);
|
||||||
|
return checkbox;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<Widget> ScreenshotSettingsPage::create_notifications() {
|
std::unique_ptr<Widget> ScreenshotSettingsPage::create_notifications() {
|
||||||
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Show screenshot notifications");
|
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Show screenshot notifications");
|
||||||
checkbox->set_checked(true);
|
checkbox->set_checked(true);
|
||||||
@@ -239,6 +246,7 @@ namespace gsr {
|
|||||||
auto list = std::make_unique<List>(List::Orientation::VERTICAL);
|
auto list = std::make_unique<List>(List::Orientation::VERTICAL);
|
||||||
list->add_widget(create_save_screenshot_in_game_folder());
|
list->add_widget(create_save_screenshot_in_game_folder());
|
||||||
list->add_widget(create_save_screenshot_to_clipboard());
|
list->add_widget(create_save_screenshot_to_clipboard());
|
||||||
|
list->add_widget(create_save_screenshot_to_disk());
|
||||||
return std::make_unique<Subsection>("General", std::move(list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
|
return std::make_unique<Subsection>("General", std::move(list), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +281,7 @@ namespace gsr {
|
|||||||
std::unique_ptr<Widget> ScreenshotSettingsPage::create_settings() {
|
std::unique_ptr<Widget> ScreenshotSettingsPage::create_settings() {
|
||||||
auto page_list = std::make_unique<List>(List::Orientation::VERTICAL);
|
auto page_list = std::make_unique<List>(List::Orientation::VERTICAL);
|
||||||
page_list->set_spacing(0.018f);
|
page_list->set_spacing(0.018f);
|
||||||
auto scrollable_page = std::make_unique<ScrollablePage>(content_page_ptr->get_inner_size() - mgl::vec2f(0.0f, page_list->get_size().y + 0.018f * get_theme().window_height));
|
auto scrollable_page = std::make_unique<ScrollablePage>(content_page_ptr->get_inner_size() - mgl::vec2f(0.0f, page_list->get_size().y));
|
||||||
settings_scrollable_page_ptr = scrollable_page.get();
|
settings_scrollable_page_ptr = scrollable_page.get();
|
||||||
page_list->add_widget(std::move(scrollable_page));
|
page_list->add_widget(std::move(scrollable_page));
|
||||||
|
|
||||||
@@ -327,6 +335,7 @@ namespace gsr {
|
|||||||
save_directory_button_ptr->set_text(config.screenshot_config.save_directory);
|
save_directory_button_ptr->set_text(config.screenshot_config.save_directory);
|
||||||
save_screenshot_in_game_folder_checkbox_ptr->set_checked(config.screenshot_config.save_screenshot_in_game_folder);
|
save_screenshot_in_game_folder_checkbox_ptr->set_checked(config.screenshot_config.save_screenshot_in_game_folder);
|
||||||
save_screenshot_to_clipboard_checkbox_ptr->set_checked(config.screenshot_config.save_screenshot_to_clipboard);
|
save_screenshot_to_clipboard_checkbox_ptr->set_checked(config.screenshot_config.save_screenshot_to_clipboard);
|
||||||
|
save_screenshot_to_disk_checkbox_ptr->set_checked(config.screenshot_config.save_screenshot_to_disk);
|
||||||
show_notification_checkbox_ptr->set_checked(config.screenshot_config.show_notifications);
|
show_notification_checkbox_ptr->set_checked(config.screenshot_config.show_notifications);
|
||||||
led_indicator_checkbox_ptr->set_checked(config.screenshot_config.use_led_indicator);
|
led_indicator_checkbox_ptr->set_checked(config.screenshot_config.use_led_indicator);
|
||||||
|
|
||||||
@@ -358,7 +367,8 @@ namespace gsr {
|
|||||||
config.screenshot_config.restore_portal_session = restore_portal_session_checkbox_ptr->is_checked();
|
config.screenshot_config.restore_portal_session = restore_portal_session_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.save_directory = save_directory_button_ptr->get_text();
|
config.screenshot_config.save_directory = save_directory_button_ptr->get_text();
|
||||||
config.screenshot_config.save_screenshot_in_game_folder = save_screenshot_in_game_folder_checkbox_ptr->is_checked();
|
config.screenshot_config.save_screenshot_in_game_folder = save_screenshot_in_game_folder_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.save_screenshot_to_clipboard = save_screenshot_to_clipboard_checkbox_ptr->is_checked();
|
config.screenshot_config.save_screenshot_to_clipboard = save_screenshot_to_disk_checkbox_ptr->is_checked();
|
||||||
|
config.screenshot_config.save_screenshot_to_disk = save_screenshot_to_clipboard_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.show_notifications = show_notification_checkbox_ptr->is_checked();
|
config.screenshot_config.show_notifications = show_notification_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.use_led_indicator = led_indicator_checkbox_ptr->is_checked();
|
config.screenshot_config.use_led_indicator = led_indicator_checkbox_ptr->is_checked();
|
||||||
config.screenshot_config.custom_script = create_custom_script_screenshot_entry_ptr->get_text();
|
config.screenshot_config.custom_script = create_custom_script_screenshot_entry_ptr->get_text();
|
||||||
|
|||||||
@@ -249,15 +249,7 @@ namespace gsr {
|
|||||||
return ll;
|
return ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Widget> SettingsPage::create_webcam_section() {
|
std::unique_ptr<Widget> SettingsPage::create_webcam_location_widget() {
|
||||||
auto ll = std::make_unique<List>(List::Orientation::VERTICAL);
|
|
||||||
|
|
||||||
ll->add_widget(create_webcam_sources());
|
|
||||||
|
|
||||||
auto body_list = std::make_unique<List>(List::Orientation::VERTICAL);
|
|
||||||
body_list->set_visible(false);
|
|
||||||
webcam_body_list_ptr = body_list.get();
|
|
||||||
{
|
|
||||||
const float camera_screen_width = std::min(400.0f, (float)settings_scrollable_page_ptr->get_inner_size().x * 0.90f);
|
const float camera_screen_width = std::min(400.0f, (float)settings_scrollable_page_ptr->get_inner_size().x * 0.90f);
|
||||||
camera_screen_size = mgl::vec2f(camera_screen_width, camera_screen_width * 0.5625);
|
camera_screen_size = mgl::vec2f(camera_screen_width, camera_screen_width * 0.5625);
|
||||||
|
|
||||||
@@ -383,20 +375,30 @@ namespace gsr {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
body_list->add_widget(std::move(camera_location_widget));
|
return camera_location_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
body_list->add_widget(std::make_unique<Label>(&get_theme().body_font, "* Right click in the bottom right corner to resize the webcam", get_color_theme().text_color));
|
std::unique_ptr<CheckBox> SettingsPage::create_flip_camera_checkbox() {
|
||||||
|
|
||||||
{
|
|
||||||
auto flip_camera_horizontally_checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Flip camera horizontally");
|
auto flip_camera_horizontally_checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "Flip camera horizontally");
|
||||||
flip_camera_horizontally_checkbox_ptr = flip_camera_horizontally_checkbox.get();
|
flip_camera_horizontally_checkbox_ptr = flip_camera_horizontally_checkbox.get();
|
||||||
body_list->add_widget(std::move(flip_camera_horizontally_checkbox));
|
return flip_camera_horizontally_checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<List> SettingsPage::create_webcam_body() {
|
||||||
|
auto body_list = std::make_unique<List>(List::Orientation::VERTICAL);
|
||||||
|
webcam_body_list_ptr = body_list.get();
|
||||||
|
body_list->set_visible(false);
|
||||||
|
body_list->add_widget(create_webcam_location_widget());
|
||||||
|
body_list->add_widget(std::make_unique<Label>(&get_theme().body_font, "* Right click in the bottom right corner to resize the webcam", get_color_theme().text_color));
|
||||||
|
body_list->add_widget(create_flip_camera_checkbox());
|
||||||
body_list->add_widget(create_webcam_video_format());
|
body_list->add_widget(create_webcam_video_format());
|
||||||
ll->add_widget(std::move(body_list));
|
return body_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Widget> SettingsPage::create_webcam_section() {
|
||||||
|
auto ll = std::make_unique<List>(List::Orientation::VERTICAL);
|
||||||
|
ll->add_widget(create_webcam_sources());
|
||||||
|
ll->add_widget(create_webcam_body());
|
||||||
return std::make_unique<Subsection>("Webcam", std::move(ll), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
|
return std::make_unique<Subsection>("Webcam", std::move(ll), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user