From 20097099e1bef60a1d2344caae439adb7257202a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 17 Jun 2025 23:20:29 +0200 Subject: [PATCH] refractor selection button to new file --- .../common/widgets/SelectionGroupButton.qml | 24 ++++++++++++++++ .config/quickshell/welcome.qml | 28 ++++--------------- 2 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 .config/quickshell/modules/common/widgets/SelectionGroupButton.qml diff --git a/.config/quickshell/modules/common/widgets/SelectionGroupButton.qml b/.config/quickshell/modules/common/widgets/SelectionGroupButton.qml new file mode 100644 index 000000000..77695ce3b --- /dev/null +++ b/.config/quickshell/modules/common/widgets/SelectionGroupButton.qml @@ -0,0 +1,24 @@ +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell +import Quickshell.Io +import Quickshell.Hyprland +import "root:/services/" +import "root:/modules/common/" +import "root:/modules/common/widgets/" + +GroupButton { + id: root + horizontalPadding: 12 + verticalPadding: 8 + bounce: false + property bool leftmost: false + property bool rightmost: false + leftRadius: (toggled || leftmost) ? (height / 2) : Appearance.rounding.unsharpenmore + rightRadius: (toggled || rightmost) ? (height / 2) : Appearance.rounding.unsharpenmore + colBackground: Appearance.colors.colSecondaryContainer + contentItem: StyledText { + color: parent.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnSecondaryContainer + text: root.buttonText + } +} diff --git a/.config/quickshell/welcome.qml b/.config/quickshell/welcome.qml index cbc5b4a32..d24a07c07 100644 --- a/.config/quickshell/welcome.qml +++ b/.config/quickshell/welcome.qml @@ -53,22 +53,6 @@ ApplicationWindow { } } - component SelectionConnectedButton: GroupButton { - id: selectionConnectedButtonRoot - horizontalPadding: 12 - verticalPadding: 8 - bounce: false - property bool leftmost: false - property bool rightmost: false - leftRadius: (toggled || leftmost) ? (height / 2) : Appearance.rounding.unsharpenmore - rightRadius: (toggled || rightmost) ? (height / 2) : Appearance.rounding.unsharpenmore - colBackground: Appearance.colors.colSecondaryContainer - contentItem: StyledText { - color: parent.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnSecondaryContainer - text: selectionConnectedButtonRoot.buttonText - } - } - component Section: ColumnLayout { id: sectionRoot property string title @@ -410,7 +394,7 @@ ApplicationWindow { id: weebPolicyBtnGroup property int selectedPolicy: ConfigOptions.policies.weeb spacing: 2 - SelectionConnectedButton { + SelectionGroupButton { property int value: 0 leftmost: true buttonText: "No" @@ -419,7 +403,7 @@ ApplicationWindow { ConfigLoader.setConfigValueAndSave("policies.weeb", value); } } - SelectionConnectedButton { + SelectionGroupButton { property int value: 1 buttonText: "Yes" toggled: (weebPolicyBtnGroup.selectedPolicy === value) @@ -427,7 +411,7 @@ ApplicationWindow { ConfigLoader.setConfigValueAndSave("policies.weeb", value); } } - SelectionConnectedButton { + SelectionGroupButton { property int value: 2 rightmost: true buttonText: "Closet" @@ -447,7 +431,7 @@ ApplicationWindow { id: aiPolicyBtnGroup property int selectedPolicy: ConfigOptions.policies.ai spacing: 2 - SelectionConnectedButton { + SelectionGroupButton { property int value: 0 leftmost: true buttonText: "No" @@ -456,7 +440,7 @@ ApplicationWindow { ConfigLoader.setConfigValueAndSave("policies.ai", value); } } - SelectionConnectedButton { + SelectionGroupButton { property int value: 1 buttonText: "Yes" toggled: (aiPolicyBtnGroup.selectedPolicy === value) @@ -464,7 +448,7 @@ ApplicationWindow { ConfigLoader.setConfigValueAndSave("policies.ai", value); } } - SelectionConnectedButton { + SelectionGroupButton { property int value: 2 rightmost: true buttonText: "Local only"