Widgets: renamed SizeMultiplier => SizeRatio. Enforced read-only on size property

This commit is contained in:
LemmyCook 2025-08-25 22:43:02 -04:00
parent 269b2765cd
commit 1ab3463e6d
16 changed files with 27 additions and 23 deletions

View file

@ -50,7 +50,7 @@ NPanel {
NIconButton { NIconButton {
icon: "close" icon: "close"
tooltipText: "Close" tooltipText: "Close"
sizeMultiplier: 0.8 sizeRatio: 0.8
onClicked: root.close() onClicked: root.close()
} }
} }

View file

@ -12,7 +12,7 @@ NIconButton {
property ShellScreen screen property ShellScreen screen
property real scaling: ScalingService.scale(screen) property real scaling: ScalingService.scale(screen)
sizeMultiplier: 0.8 sizeRatio: 0.8
colorBg: Color.mSurfaceVariant colorBg: Color.mSurfaceVariant
colorFg: Color.mOnSurface colorFg: Color.mOnSurface
colorBorder: Color.transparent colorBorder: Color.transparent

View file

@ -14,7 +14,7 @@ NIconButton {
property real scaling: ScalingService.scale(screen) property real scaling: ScalingService.scale(screen)
visible: Settings.data.network.bluetoothEnabled visible: Settings.data.network.bluetoothEnabled
sizeMultiplier: 0.8 sizeRatio: 0.8
colorBg: Color.mSurfaceVariant colorBg: Color.mSurfaceVariant
colorFg: Color.mOnSurface colorFg: Color.mOnSurface
colorBorder: Color.transparent colorBorder: Color.transparent

View file

@ -13,7 +13,7 @@ NIconButton {
property ShellScreen screen property ShellScreen screen
property real scaling: ScalingService.scale(screen) property real scaling: ScalingService.scale(screen)
sizeMultiplier: 0.8 sizeRatio: 0.8
icon: "notifications" icon: "notifications"
tooltipText: "Notification History" tooltipText: "Notification History"
colorBg: Color.mSurfaceVariant colorBg: Color.mSurfaceVariant

View file

@ -14,7 +14,7 @@ NIconButton {
property var powerProfiles: PowerProfiles property var powerProfiles: PowerProfiles
readonly property bool hasPP: powerProfiles.hasPerformanceProfile readonly property bool hasPP: powerProfiles.hasPerformanceProfile
sizeMultiplier: 0.8 sizeRatio: 0.8
visible: hasPP visible: hasPP
function profileIcon() { function profileIcon() {

View file

@ -13,7 +13,7 @@ NIconButton {
visible: ScreenRecorderService.isRecording visible: ScreenRecorderService.isRecording
icon: "videocam" icon: "videocam"
tooltipText: "Screen Recording Active\nClick To Stop Recording" tooltipText: "Screen Recording Active\nClick To Stop Recording"
sizeMultiplier: 0.8 sizeRatio: 0.8
colorBg: Color.mPrimary colorBg: Color.mPrimary
colorFg: Color.mOnPrimary colorFg: Color.mOnPrimary
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

View file

@ -11,7 +11,7 @@ NIconButton {
icon: "widgets" icon: "widgets"
tooltipText: "Open Side Panel" tooltipText: "Open Side Panel"
sizeMultiplier: 0.8 sizeRatio: 0.8
colorBg: Color.mSurfaceVariant colorBg: Color.mSurfaceVariant
colorFg: Color.mOnSurface colorFg: Color.mOnSurface

View file

@ -15,7 +15,7 @@ NIconButton {
visible: Settings.data.network.wifiEnabled visible: Settings.data.network.wifiEnabled
sizeMultiplier: 0.8 sizeRatio: 0.8
Component.onCompleted: { Component.onCompleted: {
Logger.log("WiFi", "Widget component completed") Logger.log("WiFi", "Widget component completed")

View file

@ -45,7 +45,7 @@ NPanel {
NIconButton { NIconButton {
icon: BluetoothService.adapter && BluetoothService.adapter.discovering ? "stop_circle" : "refresh" icon: BluetoothService.adapter && BluetoothService.adapter.discovering ? "stop_circle" : "refresh"
tooltipText: "Refresh Devices" tooltipText: "Refresh Devices"
sizeMultiplier: 0.8 sizeRatio: 0.8
onClicked: { onClicked: {
if (BluetoothService.adapter) { if (BluetoothService.adapter) {
BluetoothService.adapter.discovering = !BluetoothService.adapter.discovering BluetoothService.adapter.discovering = !BluetoothService.adapter.discovering
@ -56,7 +56,7 @@ NPanel {
NIconButton { NIconButton {
icon: "close" icon: "close"
tooltipText: "Close" tooltipText: "Close"
sizeMultiplier: 0.8 sizeRatio: 0.8
onClicked: { onClicked: {
root.close() root.close()
} }

View file

@ -211,7 +211,7 @@ Variants {
NIconButton { NIconButton {
icon: "close" icon: "close"
tooltipText: "Close" tooltipText: "Close"
sizeMultiplier: 0.8 sizeRatio: 0.8
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
anchors.margins: Style.marginS * scaling anchors.margins: Style.marginS * scaling

View file

@ -46,14 +46,14 @@ NPanel {
NIconButton { NIconButton {
icon: "delete" icon: "delete"
tooltipText: "Clear History" tooltipText: "Clear History"
sizeMultiplier: 0.8 sizeRatio: 0.8
onClicked: NotificationService.clearHistory() onClicked: NotificationService.clearHistory()
} }
NIconButton { NIconButton {
icon: "close" icon: "close"
tooltipText: "Close" tooltipText: "Close"
sizeMultiplier: 0.8 sizeRatio: 0.8
onClicked: { onClicked: {
root.close() root.close()
} }
@ -159,7 +159,7 @@ NPanel {
NIconButton { NIconButton {
icon: "delete" icon: "delete"
tooltipText: "Delete Notification" tooltipText: "Delete Notification"
sizeMultiplier: 0.7 sizeRatio: 0.7
onClicked: { onClicked: {
Logger.log("NotificationHistory", "Removing notification:", summary) Logger.log("NotificationHistory", "Removing notification:", summary)

View file

@ -52,7 +52,7 @@ NPanel {
NIconButton { NIconButton {
icon: "refresh" icon: "refresh"
tooltipText: "Refresh Networks" tooltipText: "Refresh Networks"
sizeMultiplier: 0.8 sizeRatio: 0.8
enabled: Settings.data.network.wifiEnabled && !NetworkService.isLoading enabled: Settings.data.network.wifiEnabled && !NetworkService.isLoading
onClicked: { onClicked: {
NetworkService.refreshNetworks() NetworkService.refreshNetworks()
@ -62,7 +62,7 @@ NPanel {
NIconButton { NIconButton {
icon: "close" icon: "close"
tooltipText: "Close" tooltipText: "Close"
sizeMultiplier: 0.8 sizeRatio: 0.8
onClicked: { onClicked: {
root.close() root.close()
} }

View file

@ -8,8 +8,9 @@ Rectangle {
id: root id: root
// Multiplier to control how large the button container is relative to Style.baseWidgetSize // Multiplier to control how large the button container is relative to Style.baseWidgetSize
property real sizeMultiplier: 1.0 property real sizeRatio: 1.0
property real size: Style.baseWidgetSize * sizeMultiplier * scaling readonly property real size: Style.baseWidgetSize * sizeRatio * scaling
property string icon property string icon
property string tooltipText property string tooltipText
property bool enabled: true property bool enabled: true
@ -27,6 +28,9 @@ Rectangle {
signal exited signal exited
signal clicked signal clicked
implicitWidth: size implicitWidth: size
implicitHeight: size implicitHeight: size

View file

@ -14,7 +14,7 @@ Item {
property color iconCircleColor: Color.mPrimary property color iconCircleColor: Color.mPrimary
property color iconTextColor: Color.mSurface property color iconTextColor: Color.mSurface
property color collapsedIconColor: Color.mOnSurface property color collapsedIconColor: Color.mOnSurface
property real sizeMultiplier: 0.8 property real sizeRatio: 0.8
property bool autoHide: false property bool autoHide: false
property bool forceOpen: false property bool forceOpen: false
property bool disableOpen: false property bool disableOpen: false
@ -34,8 +34,8 @@ Item {
property bool shouldAnimateHide: false property bool shouldAnimateHide: false
// Exposed width logic // Exposed width logic
readonly property int pillHeight: Style.baseWidgetSize * sizeMultiplier * scaling readonly property int pillHeight: Style.baseWidgetSize * sizeRatio * scaling
readonly property int iconSize: Style.baseWidgetSize * sizeMultiplier * scaling readonly property int iconSize: Style.baseWidgetSize * sizeRatio * scaling
readonly property int pillPaddingHorizontal: Style.marginM * scaling readonly property int pillPaddingHorizontal: Style.marginM * scaling
readonly property int pillOverlap: iconSize * 0.5 readonly property int pillOverlap: iconSize * 0.5
readonly property int maxPillWidth: Math.max(1, textItem.implicitWidth + pillPaddingHorizontal * 2 + pillOverlap) readonly property int maxPillWidth: Math.max(1, textItem.implicitWidth + pillPaddingHorizontal * 2 + pillOverlap)

View file

@ -157,7 +157,7 @@ NBox {
NIconButton { NIconButton {
icon: "close" icon: "close"
size: 20 * scaling sizeRatio: 0.6
colorBorder: Color.applyOpacity(Color.mOutline, "40") colorBorder: Color.applyOpacity(Color.mOutline, "40")
colorBg: Color.mOnSurface colorBg: Color.mOnSurface
colorFg: Color.mOnPrimary colorFg: Color.mOnPrimary

View file

@ -177,7 +177,7 @@ Item {
color: Color.mOnSurface color: Color.mOnSurface
fontPointSize: Style.fontSize * scaling fontPointSize: Style.fontSize * scaling
sizeMultiplier: 0.8 sizeRatio: 0.8
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
onClicked: hide() onClicked: hide()