#include "../../include/gui/ScreenshotSettingsPage.hpp" #include "../../include/gui/GsrPage.hpp" #include "../../include/gui/PageStack.hpp" #include "../../include/Theme.hpp" #include "../../include/GsrInfo.hpp" #include "../../include/Utils.hpp" #include "../../include/Translation.hpp" #include "../../include/gui/List.hpp" #include "../../include/gui/ScrollablePage.hpp" #include "../../include/gui/Label.hpp" #include "../../include/gui/Subsection.hpp" #include "../../include/gui/FileChooser.hpp" namespace gsr { ScreenshotSettingsPage::ScreenshotSettingsPage(const GsrInfo *gsr_info, Config &config, PageStack *page_stack, bool supports_window_title) : StaticPage(mgl::vec2f(get_theme().window_width, get_theme().window_height).floor()), config(config), gsr_info(gsr_info), page_stack(page_stack), supports_window_title(supports_window_title) { capture_options = get_supported_capture_options(*gsr_info); auto content_page = std::make_unique(TR("Screenshot"), TR("Settings")); content_page->add_button(TR("Back"), "back", get_color_theme().page_bg_color); content_page->on_click = [page_stack](const std::string &id) { if(id == "back") page_stack->pop(); }; content_page_ptr = content_page.get(); add_widget(std::move(content_page)); add_widgets(); load(); } std::unique_ptr ScreenshotSettingsPage::create_record_area_box() { auto record_area_box = std::make_unique(&get_theme().body_font); // TODO: Show options not supported but disable them if(capture_options.window) record_area_box->add_item(TR("Window"), "window"); if(capture_options.region) record_area_box->add_item(TR("Region"), "region"); if(!capture_options.monitors.empty()) record_area_box->add_item(TR("Focused monitor"), "focused_monitor"); for(const auto &monitor : capture_options.monitors) { char name[256]; snprintf(name, sizeof(name), TR("Monitor %s (%dx%d)"), monitor.name.c_str(), monitor.size.x, monitor.size.y); record_area_box->add_item(name, monitor.name); } if(capture_options.portal) record_area_box->add_item(TR("Desktop portal"), "portal"); record_area_box_ptr = record_area_box.get(); return record_area_box; } std::unique_ptr ScreenshotSettingsPage::create_record_area() { auto record_area_list = std::make_unique(List::Orientation::VERTICAL); record_area_list->add_widget(std::make_unique