From 82d71d65fa0616c5e40428b56e985dbf1e9528b3 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Thu, 28 Aug 2025 17:03:28 +0200 Subject: [PATCH] Replaced the old checkboxes in ArchUpdaterPanel with NCheckbox ArchUpdater: use NCheckbox to make things more uniform --- Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml | 16 +++++++++------- Widgets/NCheckbox.qml | 9 ++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml index c4c9539..67b6827 100644 --- a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml +++ b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml @@ -106,14 +106,16 @@ NPanel { anchors.margins: Style.marginS * scaling spacing: Style.marginS * scaling - // Checkbox for selection (pure bindings; no imperative state) - NIconButton { + // Checkbox for selection + NCheckbox { id: checkbox - icon: ArchUpdaterService.isPackageSelected(modelData.name) ? "check_box" : "check_box_outline_blank" - onClicked: ArchUpdaterService.togglePackageSelection(modelData.name) - colorBg: Color.transparent - colorFg: ArchUpdaterService.isPackageSelected( - modelData.name) ? ((modelData.source === "aur") ? Color.mSecondary : Color.mPrimary) : Color.mOnSurfaceVariant + label: "" + description: "" + checked: (ArchUpdaterService.selectedPackagesCount, ArchUpdaterService.isPackageSelected(modelData.name)) + onToggled: ArchUpdaterService.togglePackageSelection(modelData.name) + activeColor: (modelData.source === "aur") ? Color.mSecondary : Color.mPrimary + activeOnColor: (modelData.source === "aur") ? Color.mOnSecondary : Color.mOnPrimary + Layout.fillWidth: false Layout.preferredWidth: 30 * scaling Layout.preferredHeight: 30 * scaling } diff --git a/Widgets/NCheckbox.qml b/Widgets/NCheckbox.qml index 8bb3552..0f0a8e9 100644 --- a/Widgets/NCheckbox.qml +++ b/Widgets/NCheckbox.qml @@ -11,6 +11,9 @@ RowLayout { property string description: "" property bool checked: false property bool hovering: false + // Active state colors (allow override per-usage) + property color activeColor: Color.mPrimary + property color activeOnColor: Color.mOnPrimary // Smaller default footprint than NToggle property int baseSize: Math.max(Style.baseWidgetSize * 0.8, 14) @@ -31,15 +34,15 @@ RowLayout { implicitWidth: root.baseSize * scaling implicitHeight: root.baseSize * scaling radius: Math.max(2 * scaling, Style.radiusXS * scaling) - color: root.checked ? Color.mPrimary : Color.mSurface - border.color: root.checked ? Color.mPrimary : Color.mOutline + color: root.checked ? root.activeColor : Color.mSurface + border.color: root.checked ? root.activeColor : Color.mOutline border.width: Math.max(1, Style.borderM * scaling) NIcon { visible: root.checked anchors.centerIn: parent text: "check" - color: Color.mOnPrimary + color: root.activeOnColor font.pointSize: Math.max(Style.fontSizeS, root.baseSize * 0.7) * scaling }