Qt-Scaling: first cleanup pass

This commit is contained in:
ItsLemmy
2025-10-12 08:23:24 -04:00
parent d5d654e010
commit f4b27380c3
135 changed files with 1562 additions and 1811 deletions
+131 -138
View File
@@ -49,8 +49,6 @@ Loader {
locked: lockScreen.active
WlSessionLockSurface {
readonly property real scaling: ScalingService.dynamicScale(screen)
Item {
id: batteryIndicator
property var battery: UPower.displayDevice
@@ -103,8 +101,8 @@ Loader {
visible: Settings.data.general.showScreenCorners
property color cornerColor: Settings.data.general.forceBlackScreenCorners ? Qt.rgba(0, 0, 0, 1) : Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
property real cornerRadius: Style.screenRadius * scaling
property real cornerSize: Style.screenRadius * scaling
property real cornerRadius: Style.screenRadius
property real cornerSize: Style.screenRadius
// Top-left concave corner
Canvas {
@@ -248,12 +246,12 @@ Loader {
// Time, Date, and User Profile Container
Rectangle {
width: Math.max(500 * scaling, contentRow.implicitWidth + 24 * scaling)
height: 120 * scaling
width: Math.max(500, contentRow.implicitWidth + 24)
height: 120
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 100 * scaling
radius: Style.radiusL * scaling
anchors.topMargin: 100
radius: Style.radiusL
color: Color.mSurface
border.color: Qt.alpha(Color.mOutline, 0.2)
border.width: 1
@@ -261,13 +259,13 @@ Loader {
RowLayout {
id: contentRow
anchors.fill: parent
anchors.margins: 12 * scaling
spacing: 8 * scaling
anchors.margins: 12
spacing: 8
// Left side: Avatar
Rectangle {
Layout.preferredWidth: 70 * scaling
Layout.preferredHeight: 70 * scaling
Layout.preferredWidth: 70
Layout.preferredHeight: 70
Layout.alignment: Qt.AlignVCenter
radius: width * 0.5
color: Color.transparent
@@ -296,8 +294,8 @@ Loader {
NImageCircled {
anchors.centerIn: parent
width: 66 * scaling
height: 66 * scaling
width: 66
height: 66
imagePath: Settings.data.general.avatarImage
fallbackIcon: "person"
@@ -320,12 +318,12 @@ Loader {
// Center: User Info Column (left-aligned text)
ColumnLayout {
Layout.alignment: Qt.AlignVCenter
spacing: 2 * scaling
spacing: 2
// Welcome back + Username on one line
NText {
text: I18n.tr("lock-screen.welcome-back") + " " + Quickshell.env("USER") + "!"
pointSize: Style.fontSizeXXXL * scaling
pointSize: Style.fontSizeXXXL
font.weight: Font.Medium
color: Color.mOnSurface
horizontalAlignment: Text.AlignLeft
@@ -334,22 +332,21 @@ Loader {
// Date below
NText {
text: Qt.locale().toString(Time.date, "dddd, MMMM d")
pointSize: Style.fontSizeXXL * scaling
pointSize: Style.fontSizeXXL
font.weight: Font.Medium
color: Color.mOnSurfaceVariant
horizontalAlignment: Text.AlignLeft
}
}
// Spacer to push time to the right
Item {
Layout.fillWidth: true
}
Item {
Layout.preferredWidth: 70 * scaling
Layout.preferredHeight: 70 * scaling
Layout.preferredWidth: 70
Layout.preferredHeight: 70
Layout.alignment: Qt.AlignVCenter
// Seconds circular progress
@@ -372,21 +369,21 @@ Loader {
var ctx = getContext("2d")
var centerX = width / 2
var centerY = height / 2
var radius = Math.min(width, height) / 2 - 3 * scaling
var radius = Math.min(width, height) / 2 - 3
ctx.reset()
// Background circle
ctx.beginPath()
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI)
ctx.lineWidth = 2.5 * scaling
ctx.lineWidth = 2.5
ctx.strokeStyle = Qt.alpha(Color.mOnSurface, 0.15)
ctx.stroke()
// Progress arc
ctx.beginPath()
ctx.arc(centerX, centerY, radius, -Math.PI / 2, -Math.PI / 2 + progress * 2 * Math.PI)
ctx.lineWidth = 2.5 * scaling
ctx.lineWidth = 2.5
ctx.strokeStyle = Color.mPrimary
ctx.lineCap = "round"
ctx.stroke()
@@ -403,7 +400,7 @@ Loader {
var t = Settings.data.location.use12hourFormat ? Qt.locale().toString(Time.date, "hh AP") : Qt.locale().toString(Time.date, "HH")
return t
}
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
font.weight: Style.fontWeightBold
color: Color.mOnSurface
horizontalAlignment: Text.AlignHCenter
@@ -412,7 +409,7 @@ Loader {
NText {
text: Qt.formatTime(Time.date, "mm")
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
font.weight: Style.fontWeightBold
color: Color.mOnSurfaceVariant
horizontalAlignment: Text.AlignHCenter
@@ -425,12 +422,12 @@ Loader {
// Error notification
Rectangle {
width: 450 * scaling
height: 60 * scaling
width: 450
height: 60
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 300 * scaling
radius: 30 * scaling
anchors.bottomMargin: 300
radius: 30
color: Color.mError
border.color: Color.mError
border.width: 1
@@ -439,18 +436,18 @@ Loader {
RowLayout {
anchors.centerIn: parent
spacing: 10 * scaling
spacing: 10
NIcon {
icon: "alert-circle"
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
color: Color.mOnError
}
NText {
text: lockContext.errorMessage || "Authentication failed"
color: Color.mOnError
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
font.weight: Font.Medium
horizontalAlignment: Text.AlignHCenter
}
@@ -469,62 +466,62 @@ Loader {
width: {
var hasBattery = UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent
var hasKeyboard = keyboardLayout.currentLayout !== "Unknown"
if (hasBattery && hasKeyboard) {
return 200 * scaling
return 200
} else if (hasBattery || hasKeyboard) {
return 120 * scaling
return 120
} else {
return 0
}
}
height: 40 * scaling
height: 40
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 96 * scaling + (Settings.data.general.compactLockScreen ? 116 * scaling : 220 * scaling)
topLeftRadius: Style.radiusL * scaling
topRightRadius: Style.radiusL * scaling
anchors.bottomMargin: 96 + (Settings.data.general.compactLockScreen ? 116 : 220)
topLeftRadius: Style.radiusL
topRightRadius: Style.radiusL
color: Color.mSurface
visible: Settings.data.general.compactLockScreen && ((UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent) || keyboardLayout.currentLayout !== "Unknown")
RowLayout {
anchors.centerIn: parent
spacing: 16 * scaling
spacing: 16
// Battery indicator
RowLayout {
spacing: 6 * scaling
spacing: 6
visible: UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent
NIcon {
icon: BatteryService.getIcon(Math.round(UPower.displayDevice.percentage * 100), UPower.displayDevice.state === UPowerDeviceState.Charging, true)
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: UPower.displayDevice.state === UPowerDeviceState.Charging ? Color.mPrimary : Color.mOnSurfaceVariant
}
NText {
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
color: Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
// Keyboard layout indicator
RowLayout {
spacing: 6 * scaling
spacing: 6
visible: keyboardLayout.currentLayout !== "Unknown"
NIcon {
icon: "keyboard"
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
}
NText {
text: keyboardLayout.currentLayout
color: Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
@@ -533,38 +530,38 @@ Loader {
// Bottom container with weather, password input and controls
Rectangle {
width: 750 * scaling
height: Settings.data.general.compactLockScreen ? 120 * scaling : 220 * scaling
width: 750
height: Settings.data.general.compactLockScreen ? 120 : 220
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 100 * scaling
radius: Style.radiusL * scaling
anchors.bottomMargin: 100
radius: Style.radiusL
color: Color.mSurface
ColumnLayout {
anchors.fill: parent
anchors.margins: 14 * scaling
spacing: 14 * scaling
anchors.margins: 14
spacing: 14
// Weather section
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: 65 * scaling
spacing: 18 * scaling
Layout.preferredHeight: 65
spacing: 18
visible: !Settings.data.general.compactLockScreen && LocationService.coordinatesReady && LocationService.data.weather !== null
// Media widget with visualizer
Rectangle {
Layout.preferredWidth: 220 * scaling
Layout.preferredHeight: 50 * scaling
radius: 25 * scaling
Layout.preferredWidth: 220
Layout.preferredHeight: 50
radius: 25
color: Color.transparent
clip: true
visible: MediaService.currentPlayer && MediaService.canPlay
Loader {
anchors.fill: parent
anchors.margins: 4 * scaling
anchors.margins: 4
active: Settings.data.audio.visualizerType === "linear"
z: 0
sourceComponent: LinearSpectrum {
@@ -577,7 +574,7 @@ Loader {
Loader {
anchors.fill: parent
anchors.margins: 4 * scaling
anchors.margins: 4
active: Settings.data.audio.visualizerType === "mirrored"
z: 0
sourceComponent: MirroredSpectrum {
@@ -590,7 +587,7 @@ Loader {
Loader {
anchors.fill: parent
anchors.margins: 4 * scaling
anchors.margins: 4
active: Settings.data.audio.visualizerType === "wave"
z: 0
sourceComponent: WaveSpectrum {
@@ -603,35 +600,35 @@ Loader {
RowLayout {
anchors.fill: parent
anchors.margins: 8 * scaling
spacing: 8 * scaling
anchors.margins: 8
spacing: 8
z: 1
Rectangle {
Layout.preferredWidth: 34 * scaling
Layout.preferredHeight: 34 * scaling
Layout.preferredWidth: 34
Layout.preferredHeight: 34
radius: width * 0.5
color: Color.transparent
clip: true
NImageCircled {
anchors.fill: parent
anchors.margins: 2 * scaling
anchors.margins: 2
imagePath: MediaService.trackArtUrl
fallbackIcon: "disc"
fallbackIconSize: Style.fontSizeM * scaling
fallbackIconSize: Style.fontSizeM
borderColor: Color.mOutline
borderWidth: Math.max(1, Style.borderS * scaling)
borderWidth: Math.max(1, Style.borderS)
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: 2 * scaling
spacing: 2
NText {
text: MediaService.trackTitle || "No media"
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Style.fontWeightMedium
color: Color.mOnSurface
Layout.fillWidth: true
@@ -640,7 +637,7 @@ Loader {
NText {
text: MediaService.trackArtist || ""
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
Layout.fillWidth: true
elide: Text.ElideRight
@@ -652,46 +649,46 @@ Loader {
Rectangle {
Layout.preferredWidth: 1
Layout.fillHeight: true
Layout.rightMargin: 4 * scaling
Layout.rightMargin: 4
color: Qt.alpha(Color.mOutline, 0.3)
visible: MediaService.currentPlayer && MediaService.canPlay
}
Item {
Layout.preferredWidth: Style.marginM * scaling
Layout.preferredWidth: Style.marginM
visible: !(MediaService.currentPlayer && MediaService.canPlay)
}
// Current weather
RowLayout {
Layout.preferredWidth: 180 * scaling
spacing: 8 * scaling
Layout.preferredWidth: 180
spacing: 8
NIcon {
Layout.alignment: Qt.AlignVCenter
icon: LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode)
pointSize: Style.fontSizeXXXL * scaling
pointSize: Style.fontSizeXXXL
color: Color.mPrimary
}
ColumnLayout {
Layout.fillWidth: true
spacing: 2 * scaling
spacing: 2
RowLayout {
Layout.fillWidth: true
spacing: 12 * scaling
spacing: 12
NText {
text: Math.round(LocationService.data.weather.current_weather.temperature) + "°"
pointSize: Style.fontSizeXL * scaling
pointSize: Style.fontSizeXL
font.weight: Style.fontWeightBold
color: Color.mOnSurface
}
NText {
text: LocationService.data.weather.current_weather.windspeed + " km/h"
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
font.weight: Font.Normal
}
@@ -699,17 +696,17 @@ Loader {
RowLayout {
Layout.fillWidth: true
spacing: 8 * scaling
spacing: 8
NText {
text: Settings.data.location.name.split(",")[0]
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
}
NText {
text: (LocationService.data.weather.current && LocationService.data.weather.current.relativehumidity_2m) ? LocationService.data.weather.current.relativehumidity_2m + "% humidity" : ""
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
}
}
@@ -718,19 +715,19 @@ Loader {
// 3-day forecast
RowLayout {
Layout.preferredWidth: 260 * scaling
Layout.rightMargin: 8 * scaling
spacing: 4 * scaling
Layout.preferredWidth: 260
Layout.rightMargin: 8
spacing: 4
Repeater {
model: 3
delegate: ColumnLayout {
Layout.fillWidth: true
spacing: 3 * scaling
spacing: 3
NText {
text: Qt.locale().toString(new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/")), "ddd")
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
@@ -739,13 +736,13 @@ Loader {
NIcon {
Layout.alignment: Qt.AlignHCenter
icon: LocationService.weatherSymbolFromCode(LocationService.data.weather.daily.weathercode[index])
pointSize: Style.fontSizeXL * scaling
pointSize: Style.fontSizeXL
color: Color.mOnSurfaceVariant
}
NText {
text: Math.round(LocationService.data.weather.daily.temperature_2m_max[index]) + "°/" + Math.round(LocationService.data.weather.daily.temperature_2m_min[index]) + "°"
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Style.fontWeightMedium
color: Color.mOnSurfaceVariant
horizontalAlignment: Text.AlignHCenter
@@ -757,78 +754,75 @@ Loader {
// Battery and Keyboard Layout (full mode only)
RowLayout {
Layout.preferredWidth: 60 * scaling
spacing: 4 * scaling
Layout.preferredWidth: 60
spacing: 4
// Battery
RowLayout {
spacing: 4 * scaling
spacing: 4
visible: UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent
NIcon {
icon: BatteryService.getIcon(Math.round(UPower.displayDevice.percentage * 100), UPower.displayDevice.state === UPowerDeviceState.Charging, true)
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: UPower.displayDevice.state === UPowerDeviceState.Charging ? Color.mPrimary : Color.mOnSurfaceVariant
}
NText {
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
color: Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
// Keyboard Layout
RowLayout {
spacing: 4 * scaling
spacing: 4
visible: keyboardLayout.currentLayout !== "Unknown"
NIcon {
icon: "keyboard"
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnSurfaceVariant
}
NText {
text: keyboardLayout.currentLayout
color: Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
}
}
// Password input
RowLayout {
Layout.fillWidth: true
spacing: 0
Item {
Layout.preferredWidth: Style.marginM * scaling
Layout.preferredWidth: Style.marginM
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: 48
radius: 24
color: Color.mSurface
border.color: passwordInput.activeFocus ? Color.mPrimary : Qt.alpha(Color.mOutline, 0.3)
border.width: passwordInput.activeFocus ? 2 : 1
Row {
anchors.left: parent.left
anchors.leftMargin: 18 * scaling
anchors.leftMargin: 18
anchors.verticalCenter: parent.verticalCenter
spacing: 14 * scaling
spacing: 14
NIcon {
icon: "lock"
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
color: passwordInput.activeFocus ? Color.mPrimary : Color.mOnSurfaceVariant
anchors.verticalCenter: parent.verticalCenter
}
@@ -840,7 +834,7 @@ Loader {
height: 0
visible: false
enabled: !lockContext.unlockInProgress
font.pointSize: Style.fontSizeM * scaling
font.pointSize: Style.fontSizeM
color: Color.mPrimary
echoMode: TextInput.Password
passwordCharacter: "•"
@@ -861,8 +855,8 @@ Loader {
spacing: 0
Rectangle {
width: 2 * scaling
height: 20 * scaling
width: 2
height: 20
color: Color.mPrimary
visible: passwordInput.activeFocus && passwordInput.text.length === 0
anchors.verticalCenter: parent.verticalCenter
@@ -882,7 +876,7 @@ Loader {
}
Row {
spacing: 6 * scaling
spacing: 6
visible: passwordInput.text.length > 0
anchors.verticalCenter: parent.verticalCenter
@@ -891,7 +885,7 @@ Loader {
NIcon {
icon: "circle-filled"
pointSize: Style.fontSizeS * scaling
pointSize: Style.fontSizeS
color: Color.mPrimary
opacity: 1.0
}
@@ -899,8 +893,8 @@ Loader {
}
Rectangle {
width: 2 * scaling
height: 20 * scaling
width: 2
height: 20
color: Color.mPrimary
visible: passwordInput.activeFocus && passwordInput.text.length > 0
anchors.verticalCenter: parent.verticalCenter
@@ -923,10 +917,10 @@ Loader {
Rectangle {
anchors.right: parent.right
anchors.rightMargin: 8 * scaling
anchors.rightMargin: 8
anchors.verticalCenter: parent.verticalCenter
width: 36 * scaling
height: 36 * scaling
width: 36
height: 36
radius: width * 0.5
color: submitButtonArea.containsMouse ? Color.mPrimary : Qt.alpha(Color.mPrimary, 0.8)
border.color: Color.mPrimary
@@ -936,7 +930,7 @@ Loader {
NIcon {
anchors.centerIn: parent
icon: "arrow-forward"
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
color: Color.mOnPrimary
}
@@ -956,42 +950,41 @@ Loader {
}
}
Item {
Layout.preferredWidth: Style.marginM * scaling
Layout.preferredWidth: Style.marginM
}
}
// System control buttons
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
spacing: 10 * scaling
Layout.preferredHeight: 48
spacing: 10
Item {
Layout.preferredWidth: Style.marginM * scaling
Layout.preferredWidth: Style.marginM
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: 48
radius: 24
color: logoutButtonArea.containsMouse ? Color.mTertiary : "transparent"
RowLayout {
anchors.centerIn: parent
spacing: 6 * scaling
spacing: 6
NIcon {
icon: "logout"
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
color: logoutButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant
}
NText {
text: I18n.tr("session-menu.logout")
color: logoutButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
@@ -1013,24 +1006,24 @@ Loader {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: 48
radius: 24
color: rebootButtonArea.containsMouse ? Color.mTertiary : "transparent"
RowLayout {
anchors.centerIn: parent
spacing: 6 * scaling
spacing: 6
NIcon {
icon: "reboot"
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
color: rebootButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant
}
NText {
text: I18n.tr("session-menu.reboot")
color: rebootButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
@@ -1052,26 +1045,26 @@ Loader {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: 48
radius: 24
color: shutdownButtonArea.containsMouse ? Color.mError : "transparent"
border.color: shutdownButtonArea.containsMouse ? Color.mError : Color.transparent
border.width: 1
RowLayout {
anchors.centerIn: parent
spacing: 6 * scaling
spacing: 6
NIcon {
icon: "shutdown"
pointSize: Style.fontSizeL * scaling
pointSize: Style.fontSizeL
color: shutdownButtonArea.containsMouse ? Color.mOnError : Color.mOnSurfaceVariant
}
NText {
text: I18n.tr("session-menu.shutdown")
color: shutdownButtonArea.containsMouse ? Color.mOnError : Color.mOnSurfaceVariant
pointSize: Style.fontSizeM * scaling
pointSize: Style.fontSizeM
font.weight: Font.Medium
}
}
@@ -1099,7 +1092,7 @@ Loader {
}
Item {
Layout.preferredWidth: Style.marginM * scaling
Layout.preferredWidth: Style.marginM
}
}
}