Widgets: renamed SizeMultiplier => SizeRatio. Enforced read-only on size property
This commit is contained in:
parent
269b2765cd
commit
1ab3463e6d
16 changed files with 27 additions and 23 deletions
|
|
@ -50,7 +50,7 @@ NPanel {
|
|||
NIconButton {
|
||||
icon: "close"
|
||||
tooltipText: "Close"
|
||||
sizeMultiplier: 0.8
|
||||
sizeRatio: 0.8
|
||||
onClicked: root.close()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ NIconButton {
|
|||
|
||||
icon: "widgets"
|
||||
tooltipText: "Open Side Panel"
|
||||
sizeMultiplier: 0.8
|
||||
sizeRatio: 0.8
|
||||
|
||||
colorBg: Color.mSurfaceVariant
|
||||
colorFg: Color.mOnSurface
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ NIconButton {
|
|||
|
||||
visible: Settings.data.network.wifiEnabled
|
||||
|
||||
sizeMultiplier: 0.8
|
||||
sizeRatio: 0.8
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.log("WiFi", "Widget component completed")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ Item {
|
|||
color: Color.mOnSurface
|
||||
|
||||
fontPointSize: Style.fontSize * scaling
|
||||
sizeMultiplier: 0.8
|
||||
sizeRatio: 0.8
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
onClicked: hide()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue