From 1ab3463e6dfae34e72a0a2f55bbd013ba41ee3ed Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Mon, 25 Aug 2025 22:43:02 -0400 Subject: [PATCH] Widgets: renamed SizeMultiplier => SizeRatio. Enforced read-only on size property --- Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml | 2 +- Modules/Bar/Widgets/ArchUpdater.qml | 2 +- Modules/Bar/Widgets/Bluetooth.qml | 2 +- Modules/Bar/Widgets/NotificationHistory.qml | 2 +- Modules/Bar/Widgets/PowerProfile.qml | 2 +- Modules/Bar/Widgets/ScreenRecorderIndicator.qml | 2 +- Modules/Bar/Widgets/SidePanelToggle.qml | 2 +- Modules/Bar/Widgets/WiFi.qml | 2 +- Modules/BluetoothPanel/BluetoothPanel.qml | 4 ++-- Modules/Notification/Notification.qml | 2 +- Modules/Notification/NotificationHistoryPanel.qml | 6 +++--- Modules/WiFiPanel/WiFiPanel.qml | 4 ++-- Widgets/NIconButton.qml | 8 ++++++-- Widgets/NPill.qml | 6 +++--- Widgets/NSectionEditor.qml | 2 +- Widgets/NToast.qml | 2 +- 16 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml index 7e0264e..679b592 100644 --- a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml +++ b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml @@ -50,7 +50,7 @@ NPanel { NIconButton { icon: "close" tooltipText: "Close" - sizeMultiplier: 0.8 + sizeRatio: 0.8 onClicked: root.close() } } diff --git a/Modules/Bar/Widgets/ArchUpdater.qml b/Modules/Bar/Widgets/ArchUpdater.qml index 4636840..70124ea 100644 --- a/Modules/Bar/Widgets/ArchUpdater.qml +++ b/Modules/Bar/Widgets/ArchUpdater.qml @@ -12,7 +12,7 @@ NIconButton { property ShellScreen screen property real scaling: ScalingService.scale(screen) - sizeMultiplier: 0.8 + sizeRatio: 0.8 colorBg: Color.mSurfaceVariant colorFg: Color.mOnSurface colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/Bluetooth.qml b/Modules/Bar/Widgets/Bluetooth.qml index f977128..c507b22 100644 --- a/Modules/Bar/Widgets/Bluetooth.qml +++ b/Modules/Bar/Widgets/Bluetooth.qml @@ -14,7 +14,7 @@ NIconButton { property real scaling: ScalingService.scale(screen) visible: Settings.data.network.bluetoothEnabled - sizeMultiplier: 0.8 + sizeRatio: 0.8 colorBg: Color.mSurfaceVariant colorFg: Color.mOnSurface colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index 15adeea..c3b33bb 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -13,7 +13,7 @@ NIconButton { property ShellScreen screen property real scaling: ScalingService.scale(screen) - sizeMultiplier: 0.8 + sizeRatio: 0.8 icon: "notifications" tooltipText: "Notification History" colorBg: Color.mSurfaceVariant diff --git a/Modules/Bar/Widgets/PowerProfile.qml b/Modules/Bar/Widgets/PowerProfile.qml index 47fab43..b22b52d 100644 --- a/Modules/Bar/Widgets/PowerProfile.qml +++ b/Modules/Bar/Widgets/PowerProfile.qml @@ -14,7 +14,7 @@ NIconButton { property var powerProfiles: PowerProfiles readonly property bool hasPP: powerProfiles.hasPerformanceProfile - sizeMultiplier: 0.8 + sizeRatio: 0.8 visible: hasPP function profileIcon() { diff --git a/Modules/Bar/Widgets/ScreenRecorderIndicator.qml b/Modules/Bar/Widgets/ScreenRecorderIndicator.qml index 2df0ef3..38ed2c7 100644 --- a/Modules/Bar/Widgets/ScreenRecorderIndicator.qml +++ b/Modules/Bar/Widgets/ScreenRecorderIndicator.qml @@ -13,7 +13,7 @@ NIconButton { visible: ScreenRecorderService.isRecording icon: "videocam" tooltipText: "Screen Recording Active\nClick To Stop Recording" - sizeMultiplier: 0.8 + sizeRatio: 0.8 colorBg: Color.mPrimary colorFg: Color.mOnPrimary anchors.verticalCenter: parent.verticalCenter diff --git a/Modules/Bar/Widgets/SidePanelToggle.qml b/Modules/Bar/Widgets/SidePanelToggle.qml index 5b985b8..0a6e6b3 100644 --- a/Modules/Bar/Widgets/SidePanelToggle.qml +++ b/Modules/Bar/Widgets/SidePanelToggle.qml @@ -11,7 +11,7 @@ NIconButton { icon: "widgets" tooltipText: "Open Side Panel" - sizeMultiplier: 0.8 + sizeRatio: 0.8 colorBg: Color.mSurfaceVariant colorFg: Color.mOnSurface diff --git a/Modules/Bar/Widgets/WiFi.qml b/Modules/Bar/Widgets/WiFi.qml index 845a110..f099710 100644 --- a/Modules/Bar/Widgets/WiFi.qml +++ b/Modules/Bar/Widgets/WiFi.qml @@ -15,7 +15,7 @@ NIconButton { visible: Settings.data.network.wifiEnabled - sizeMultiplier: 0.8 + sizeRatio: 0.8 Component.onCompleted: { Logger.log("WiFi", "Widget component completed") diff --git a/Modules/BluetoothPanel/BluetoothPanel.qml b/Modules/BluetoothPanel/BluetoothPanel.qml index eeb4c7f..e793196 100644 --- a/Modules/BluetoothPanel/BluetoothPanel.qml +++ b/Modules/BluetoothPanel/BluetoothPanel.qml @@ -45,7 +45,7 @@ NPanel { NIconButton { icon: BluetoothService.adapter && BluetoothService.adapter.discovering ? "stop_circle" : "refresh" tooltipText: "Refresh Devices" - sizeMultiplier: 0.8 + sizeRatio: 0.8 onClicked: { if (BluetoothService.adapter) { BluetoothService.adapter.discovering = !BluetoothService.adapter.discovering @@ -56,7 +56,7 @@ NPanel { NIconButton { icon: "close" tooltipText: "Close" - sizeMultiplier: 0.8 + sizeRatio: 0.8 onClicked: { root.close() } diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index def931b..cdde06e 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -211,7 +211,7 @@ Variants { NIconButton { icon: "close" tooltipText: "Close" - sizeMultiplier: 0.8 + sizeRatio: 0.8 anchors.top: parent.top anchors.right: parent.right anchors.margins: Style.marginS * scaling diff --git a/Modules/Notification/NotificationHistoryPanel.qml b/Modules/Notification/NotificationHistoryPanel.qml index b49de08..8001d39 100644 --- a/Modules/Notification/NotificationHistoryPanel.qml +++ b/Modules/Notification/NotificationHistoryPanel.qml @@ -46,14 +46,14 @@ NPanel { NIconButton { icon: "delete" tooltipText: "Clear History" - sizeMultiplier: 0.8 + sizeRatio: 0.8 onClicked: NotificationService.clearHistory() } NIconButton { icon: "close" tooltipText: "Close" - sizeMultiplier: 0.8 + sizeRatio: 0.8 onClicked: { root.close() } @@ -159,7 +159,7 @@ NPanel { NIconButton { icon: "delete" tooltipText: "Delete Notification" - sizeMultiplier: 0.7 + sizeRatio: 0.7 onClicked: { Logger.log("NotificationHistory", "Removing notification:", summary) diff --git a/Modules/WiFiPanel/WiFiPanel.qml b/Modules/WiFiPanel/WiFiPanel.qml index b617b14..3780b6f 100644 --- a/Modules/WiFiPanel/WiFiPanel.qml +++ b/Modules/WiFiPanel/WiFiPanel.qml @@ -52,7 +52,7 @@ NPanel { NIconButton { icon: "refresh" tooltipText: "Refresh Networks" - sizeMultiplier: 0.8 + sizeRatio: 0.8 enabled: Settings.data.network.wifiEnabled && !NetworkService.isLoading onClicked: { NetworkService.refreshNetworks() @@ -62,7 +62,7 @@ NPanel { NIconButton { icon: "close" tooltipText: "Close" - sizeMultiplier: 0.8 + sizeRatio: 0.8 onClicked: { root.close() } diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index a502c7d..4925b7d 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -8,8 +8,9 @@ Rectangle { id: root // Multiplier to control how large the button container is relative to Style.baseWidgetSize - property real sizeMultiplier: 1.0 - property real size: Style.baseWidgetSize * sizeMultiplier * scaling + property real sizeRatio: 1.0 + readonly property real size: Style.baseWidgetSize * sizeRatio * scaling + property string icon property string tooltipText property bool enabled: true @@ -27,6 +28,9 @@ Rectangle { signal exited signal clicked + + + implicitWidth: size implicitHeight: size diff --git a/Widgets/NPill.qml b/Widgets/NPill.qml index 8f6c3d4..bbf334c 100644 --- a/Widgets/NPill.qml +++ b/Widgets/NPill.qml @@ -14,7 +14,7 @@ Item { property color iconCircleColor: Color.mPrimary property color iconTextColor: Color.mSurface property color collapsedIconColor: Color.mOnSurface - property real sizeMultiplier: 0.8 + property real sizeRatio: 0.8 property bool autoHide: false property bool forceOpen: false property bool disableOpen: false @@ -34,8 +34,8 @@ Item { property bool shouldAnimateHide: false // Exposed width logic - readonly property int pillHeight: Style.baseWidgetSize * sizeMultiplier * scaling - readonly property int iconSize: Style.baseWidgetSize * sizeMultiplier * scaling + readonly property int pillHeight: Style.baseWidgetSize * sizeRatio * scaling + readonly property int iconSize: Style.baseWidgetSize * sizeRatio * scaling readonly property int pillPaddingHorizontal: Style.marginM * scaling readonly property int pillOverlap: iconSize * 0.5 readonly property int maxPillWidth: Math.max(1, textItem.implicitWidth + pillPaddingHorizontal * 2 + pillOverlap) diff --git a/Widgets/NSectionEditor.qml b/Widgets/NSectionEditor.qml index 9103dcd..2af1a23 100644 --- a/Widgets/NSectionEditor.qml +++ b/Widgets/NSectionEditor.qml @@ -157,7 +157,7 @@ NBox { NIconButton { icon: "close" - size: 20 * scaling + sizeRatio: 0.6 colorBorder: Color.applyOpacity(Color.mOutline, "40") colorBg: Color.mOnSurface colorFg: Color.mOnPrimary diff --git a/Widgets/NToast.qml b/Widgets/NToast.qml index 2483c33..ff38263 100644 --- a/Widgets/NToast.qml +++ b/Widgets/NToast.qml @@ -177,7 +177,7 @@ Item { color: Color.mOnSurface fontPointSize: Style.fontSize * scaling - sizeMultiplier: 0.8 + sizeRatio: 0.8 Layout.alignment: Qt.AlignTop onClicked: hide()