From 6c03137610ff70623a22e786a072e89bee4e33e8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 3 Jan 2025 22:35:49 +0100 Subject: Add option to disable hotkeys, add gsr-ui-cli tool to control gsr-ui remotely --- src/gui/GlobalSettingsPage.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/GlobalSettingsPage.cpp b/src/gui/GlobalSettingsPage.cpp index 7c8b902..5153981 100644 --- a/src/gui/GlobalSettingsPage.cpp +++ b/src/gui/GlobalSettingsPage.cpp @@ -88,6 +88,27 @@ namespace gsr { return std::make_unique("Startup", std::move(list), mgl::vec2f(parent_page->get_inner_size().x, 0.0f)); } + std::unique_ptr GlobalSettingsPage::create_hotkey_subsection(ScrollablePage *parent_page) { + auto list = std::make_unique(List::Orientation::VERTICAL); + auto enable_hotkeys_radio_button = std::make_unique(&get_theme().body_font, RadioButton::Orientation::HORIZONTAL); + enable_hotkeys_radio_button_ptr = enable_hotkeys_radio_button.get(); + enable_hotkeys_radio_button->add_item("Enable hotkeys and restart", "enable_hotkeys"); + enable_hotkeys_radio_button->add_item("Disable hotkeys and restart", "disable_hotkeys"); + enable_hotkeys_radio_button->on_selection_changed = [&](const std::string&, const std::string &id) { + if(!on_click_exit_program_button) + return true; + + if(id == "enable_hotkeys") + on_click_exit_program_button("restart"); + else if(id == "disable_hotkeys") + on_click_exit_program_button("restart"); + + return true; + }; + list->add_widget(std::move(enable_hotkeys_radio_button)); + return std::make_unique("Hotkeys", std::move(list), mgl::vec2f(parent_page->get_inner_size().x, 0.0f)); + } + std::unique_ptr