qmlfmt with 120 chars width (rulers)

This commit is contained in:
quadbyte 2025-08-10 14:39:25 -04:00
parent def932c447
commit d3f66b1737
17 changed files with 77 additions and 126 deletions

View file

@ -8,8 +8,7 @@ Variants {
delegate: PanelWindow {
required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png")
visible: wallpaperSource !== ""
color: "transparent"

View file

@ -9,8 +9,7 @@ Variants {
delegate: PanelWindow {
required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png")
visible: wallpaperSource !== ""
color: "transparent"
@ -50,8 +49,7 @@ Variants {
Rectangle {
anchors.fill: parent
color: Qt.rgba(Colors.backgroundPrimary.r, Colors.backgroundPrimary.g,
Colors.backgroundPrimary.b, 0.5)
color: Qt.rgba(Colors.backgroundPrimary.r, Colors.backgroundPrimary.g, Colors.backgroundPrimary.b, 0.5)
}
}
}

View file

@ -17,8 +17,7 @@ Variants {
screen: modelData
implicitHeight: Style.barHeight * scaling
color: "transparent"
visible: Settings.data.bar.monitors.includes(modelData.name)
|| (Settings.data.bar.monitors.length === 0)
visible: Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)
anchors {
top: true

View file

@ -6,7 +6,7 @@ import qs.Services
import qs.Widgets
import "../../Helpers/Duration.js" as Duration
Item {
NPill {
id: root
// Test mode
@ -15,9 +15,7 @@ Item {
property bool testCharging: false
property var battery: UPower.displayDevice
property bool isReady: testMode ? true : (battery && battery.ready
&& battery.isLaptopBattery
&& battery.isPresent)
property bool isReady: testMode ? true : (battery && battery.ready && battery.isLaptopBattery && battery.isPresent)
property real percent: testMode ? testPercent : (isReady ? (battery.percentage * 100) : 0)
property bool charging: testMode ? testCharging : (isReady ? battery.state === UPowerDeviceState.Charging : false)
property bool show: isReady && percent > 0
@ -51,54 +49,44 @@ Item {
}
visible: testMode || (isReady && battery.isLaptopBattery)
width: pill.width
height: pill.height
NPill {
id: pill
icon: root.batteryIcon()
text: Math.round(root.percent) + "%"
pillColor: Colors.surfaceVariant
iconCircleColor: Colors.accentPrimary
iconTextColor: Colors.backgroundPrimary
textColor: charging ? Colors.accentPrimary : Colors.textPrimary
tooltipText: {
let lines = []
if (!root.isReady) {
return ""
}
if (root.battery.timeToEmpty > 0) {
lines.push("Time left: " + Time.formatVagueHumanReadableTime(
root.battery.timeToEmpty))
}
if (root.battery.timeToFull > 0) {
lines.push("Time until full: " + Time.formatVagueHumanReadableTime(
root.battery.timeToFull))
}
if (root.battery.changeRate !== undefined) {
const rate = root.battery.changeRate
if (rate > 0) {
lines.push(
root.charging ? "Charging rate: " + rate.toFixed(
2) + " W" : "Discharging rate: " + rate.toFixed(
2) + " W")
} else if (rate < 0) {
lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W")
} else {
lines.push("Estimating...")
}
} else {
lines.push(root.charging ? "Charging" : "Discharging")
}
if (root.battery.healthPercentage !== undefined
&& root.battery.healthPercentage > 0) {
lines.push("Health: " + Math.round(root.battery.healthPercentage) + "%")
}
return lines.join("\n")
icon: root.batteryIcon()
text: Math.round(root.percent) + "%"
pillColor: Colors.surfaceVariant
iconCircleColor: Colors.accentPrimary
iconTextColor: Colors.backgroundPrimary
textColor: charging ? Colors.accentPrimary : Colors.textPrimary
tooltipText: {
let lines = []
if (!root.isReady) {
return ""
}
if (root.battery.timeToEmpty > 0) {
lines.push("Time left: " + Time.formatVagueHumanReadableTime(root.battery.timeToEmpty))
}
if (root.battery.timeToFull > 0) {
lines.push("Time until full: " + Time.formatVagueHumanReadableTime(root.battery.timeToFull))
}
if (root.battery.changeRate !== undefined) {
const rate = root.battery.changeRate
if (rate > 0) {
lines.push(root.charging ? "Charging rate: " + rate.toFixed(2) + " W" : "Discharging rate: " + rate.toFixed(
2) + " W")
} else if (rate < 0) {
lines.push("Discharging rate: " + Math.abs(rate).toFixed(2) + " W")
} else {
lines.push("Estimating...")
}
} else {
lines.push(root.charging ? "Charging" : "Discharging")
}
if (root.battery.healthPercentage !== undefined && root.battery.healthPercentage > 0) {
lines.push("Health: " + Math.round(root.battery.healthPercentage) + "%")
}
return lines.join("\n")
}
}

View file

@ -123,8 +123,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
radius: Math.round(12 * s)
color: Colors.surfaceVariant
border.color: Qt.rgba(Colors.textPrimary.r, Colors.textPrimary.g,
Colors.textPrimary.b, 0.1)
border.color: Qt.rgba(Colors.textPrimary.r, Colors.textPrimary.g, Colors.textPrimary.b, 0.1)
border.width: Math.max(1, Math.round(1 * s))
layer.enabled: true
layer.effect: MultiEffect {
@ -252,10 +251,8 @@ Item {
radius: width / 2
color: "transparent"
border.color: root.effectColor
border.width: Math.max(1, Math.round(
(2 + 6 * (1.0 - root.masterProgress)) * s))
opacity: root.effectsActive
&& model.isFocused ? (1.0 - root.masterProgress) * 0.7 : 0
border.width: Math.max(1, Math.round((2 + 6 * (1.0 - root.masterProgress)) * s))
opacity: root.effectsActive && model.isFocused ? (1.0 - root.masterProgress) * 0.7 : 0
visible: root.effectsActive && model.isFocused
z: 1
}

View file

@ -59,9 +59,8 @@ NLoader {
// Place the panel just below the bar (overlay content starts below bar due to topMargin)
y: Style.marginSmall * scaling
// Center horizontally under the anchorX, clamped to the screen bounds
x: Math.max(Style.marginSmall * scaling, Math.min(
parent.width - width - Style.marginSmall * scaling,
Math.round(anchorX - width / 2)))
x: Math.max(Style.marginSmall * scaling, Math.min(parent.width - width - Style.marginSmall * scaling,
Math.round(anchorX - width / 2)))
// Prevent closing when clicking in the panel bg
MouseArea {