diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-04-22 02:14:24 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-04-22 02:14:24 +0200 |
commit | 719236d4f41735a96e5a0707c7d964335907ffee (patch) | |
tree | 8ae62a1eaab08338c8b1e2554e8a122026281af7 | |
parent | 19f3fe67bfa34f6e92961427c4618ecb047dc177 (diff) |
Main page dropdown buttons when not recording
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | include/gui/DropdownButton.hpp | 2 | ||||
-rw-r--r-- | src/Overlay.cpp | 6 | ||||
-rw-r--r-- | src/gui/DropdownButton.cpp | 15 |
4 files changed, 26 insertions, 3 deletions
@@ -159,4 +159,8 @@ If CursorTrackerWayland fails then fallback to getting focused monitor by window Maybe automatically switch to recording with the device that controls the monitor. In that case also add all monitors available to capture in the capture list and automatically choose the gpu that controls the monitor. -Support cjk font. Use fc-match to find the location of the font. This also works in flatpak, in which case the fonts are in /run/host/..., where it lists system fonts.
\ No newline at end of file +Support cjk font. Use fc-match to find the location of the font. This also works in flatpak, in which case the fonts are in /run/host/..., where it lists system fonts. + +Keyboard layout is incorrect on wayland when using kde plasma keyboard settings to setup multiple keyboards, for example when changing to french. + Text input is correct, but hotkey is incorrect. + Need to use "setxkbmap fr" as well.
\ No newline at end of file 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/src/Overlay.cpp b/src/Overlay.cpp index 53f9eae..4d8790b 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -1070,6 +1070,7 @@ namespace gsr { on_press_start_replay(false, false); } }; + button->set_item_enabled("save", false); main_buttons_list->add_widget(std::move(button)); } { @@ -1096,6 +1097,7 @@ namespace gsr { on_press_start_record(false); } }; + button->set_item_enabled("pause", false); main_buttons_list->add_widget(std::move(button)); } { @@ -1872,6 +1874,7 @@ namespace gsr { record_dropdown_button_ptr->set_activated(true); record_dropdown_button_ptr->set_description("Recording"); record_dropdown_button_ptr->set_item_icon("start", &get_theme().stop_texture); + record_dropdown_button_ptr->set_item_enabled("pause", true); } void Overlay::update_ui_recording_stopped() { @@ -1885,6 +1888,7 @@ namespace gsr { record_dropdown_button_ptr->set_item_label("pause", "Pause"); record_dropdown_button_ptr->set_item_icon("pause", &get_theme().pause_texture); + record_dropdown_button_ptr->set_item_enabled("pause", false); paused = false; } @@ -1916,6 +1920,7 @@ namespace gsr { replay_dropdown_button_ptr->set_activated(true); replay_dropdown_button_ptr->set_description("On"); replay_dropdown_button_ptr->set_item_icon("start", &get_theme().stop_texture); + replay_dropdown_button_ptr->set_item_enabled("save", true); } void Overlay::update_ui_replay_stopped() { @@ -1926,6 +1931,7 @@ namespace gsr { replay_dropdown_button_ptr->set_activated(false); replay_dropdown_button_ptr->set_description("Off"); replay_dropdown_button_ptr->set_item_icon("start", &get_theme().play_texture); + replay_dropdown_button_ptr->set_item_enabled("save", false); } static std::string get_date_str() { diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp index bdc4027..6721840 100644 --- a/src/gui/DropdownButton.cpp +++ b/src/gui/DropdownButton.cpp @@ -148,7 +148,7 @@ namespace gsr { window.draw(separator); } - if(mouse_inside_item == -1) { + if(mouse_inside_item == -1 && item.enabled) { const bool inside = mgl::FloatRect(item_position, item_size).contains({ (float)mouse_pos.x, (float)mouse_pos.y }); if(inside) { draw_rectangle_outline(window, item_position, item_size, get_color_theme().tint_color, border_size); @@ -161,16 +161,18 @@ namespace gsr { mgl::Sprite icon(item.icon_texture); icon.set_height((int)(item_size.y * 0.4f)); icon.set_position((item_position + mgl::vec2f(padding_left, item_size.y * 0.5f - icon.get_size().y * 0.5f)).floor()); + icon.set_color(item.enabled ? mgl::Color(255, 255, 255, 255) : mgl::Color(255, 255, 255, 80)); window.draw(icon); icon_offset = icon.get_size().x + icon_spacing; } item.text.set_position((item_position + mgl::vec2f(padding_left + icon_offset, item_size.y * 0.5f - text_bounds.size.y * 0.5f)).floor()); + item.text.set_color(item.enabled ? mgl::Color(255, 255, 255, 255) : mgl::Color(255, 255, 255, 80)); window.draw(item.text); const auto description_bounds = item.description_text.get_bounds(); item.description_text.set_position((item_position + mgl::vec2f(item_size.x - description_bounds.size.x - padding_right, item_size.y * 0.5f - description_bounds.size.y * 0.5f)).floor()); - item.description_text.set_color(mgl::Color(255, 255, 255, 120)); + item.description_text.set_color(item.enabled ? mgl::Color(255, 255, 255, 120) : mgl::Color(255, 255, 255, 40)); window.draw(item.description_text); item_position.y += item_size.y; @@ -210,6 +212,15 @@ namespace gsr { } } + void DropdownButton::set_item_enabled(const std::string &id, bool enabled) { + for(auto &item : items) { + if(item.id == id) { + item.enabled = enabled; + return; + } + } + } + void DropdownButton::set_description(std::string description_text) { description.set_string(std::move(description_text)); } |