LockScreen: make compact version buttons not overflow & edit clock

CalendarPanel: edit clock
Autoformat
This commit is contained in:
lysec
2025-10-12 16:01:31 +02:00
parent d5d654e010
commit 14af84ffbe
5 changed files with 56 additions and 38 deletions
+6 -4
View File
@@ -10,6 +10,8 @@ import qs.Widgets
NPanel {
id: root
readonly property var now: Time.date
preferredWidth: Settings.data.location.showWeekNumberInCalendar ? 400 : 380
preferredHeight: 520
@@ -193,12 +195,12 @@ NPanel {
Canvas {
id: secondsProgress
anchors.fill: parent
property real progress: Time.date.getSeconds() / 60
property real progress: now.getSeconds() / 60
onProgressChanged: requestPaint()
Connections {
target: Time
function onDateChanged() {
const total = Time.date.getSeconds() * 1000 + Time.date.getMilliseconds()
const total = now.getSeconds() * 1000 + now.getMilliseconds()
secondsProgress.progress = total / 60000
}
}
@@ -233,7 +235,7 @@ NPanel {
NText {
text: {
var t = Settings.data.location.use12hourFormat ? Qt.locale().toString(Time.date, "hh AP") : Qt.locale().toString(Time.date, "HH")
var t = Settings.data.location.use12hourFormat ? Qt.locale().toString(now, "hh AP") : Qt.locale().toString(now, "HH")
return t.split(" ")[0]
}
@@ -245,7 +247,7 @@ NPanel {
}
NText {
text: Qt.formatTime(Time.date, "mm")
text: Qt.formatTime(now, "mm")
pointSize: Style.fontSizeXXS * scaling
font.weight: Style.fontWeightBold
color: Color.mOnPrimary
+35 -21
View File
@@ -50,6 +50,7 @@ Loader {
WlSessionLockSurface {
readonly property real scaling: ScalingService.dynamicScale(screen)
readonly property var now: Time.date
Item {
id: batteryIndicator
@@ -341,7 +342,6 @@ Loader {
}
}
// Spacer to push time to the right
Item {
Layout.fillWidth: true
@@ -469,7 +469,7 @@ Loader {
width: {
var hasBattery = UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent
var hasKeyboard = keyboardLayout.currentLayout !== "Unknown"
if (hasBattery && hasKeyboard) {
return 200 * scaling
} else if (hasBattery || hasKeyboard) {
@@ -729,7 +729,7 @@ Loader {
spacing: 3 * scaling
NText {
text: Qt.locale().toString(new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/")), "ddd")
text: Qt.locale().toString(now, "ddd")
pointSize: Style.fontSizeM * scaling
color: Color.mOnSurfaceVariant
horizontalAlignment: Text.AlignHCenter
@@ -798,10 +798,8 @@ Loader {
}
}
}
}
// Password input
RowLayout {
Layout.fillWidth: true
@@ -811,7 +809,6 @@ Loader {
Layout.preferredWidth: Style.marginM * scaling
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
@@ -956,7 +953,6 @@ Loader {
}
}
Item {
Layout.preferredWidth: Style.marginM * scaling
}
@@ -965,7 +961,7 @@ Loader {
// System control buttons
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling
spacing: 10 * scaling
Item {
@@ -974,9 +970,11 @@ Loader {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling
radius: Settings.data.general.compactLockScreen ? 18 * scaling : 24 * scaling
color: logoutButtonArea.containsMouse ? Color.mTertiary : "transparent"
border.color: Color.mOutline
border.width: 1
RowLayout {
anchors.centerIn: parent
@@ -984,14 +982,14 @@ Loader {
NIcon {
icon: "logout"
pointSize: Style.fontSizeL * scaling
pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM * scaling : Style.fontSizeL * scaling
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: Settings.data.general.compactLockScreen ? Style.fontSizeS * scaling : Style.fontSizeM * scaling
font.weight: Font.Medium
}
}
@@ -1009,13 +1007,22 @@ Loader {
easing.type: Easing.OutCubic
}
}
Behavior on border.color {
ColorAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling
radius: Settings.data.general.compactLockScreen ? 18 * scaling : 24 * scaling
color: rebootButtonArea.containsMouse ? Color.mTertiary : "transparent"
border.color: Color.mOutline
border.width: 1
RowLayout {
anchors.centerIn: parent
@@ -1023,14 +1030,14 @@ Loader {
NIcon {
icon: "reboot"
pointSize: Style.fontSizeL * scaling
pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM * scaling : Style.fontSizeL * scaling
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: Settings.data.general.compactLockScreen ? Style.fontSizeS * scaling : Style.fontSizeM * scaling
font.weight: Font.Medium
}
}
@@ -1048,14 +1055,21 @@ Loader {
easing.type: Easing.OutCubic
}
}
Behavior on border.color {
ColorAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 48 * scaling
radius: 24 * scaling
Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling
radius: Settings.data.general.compactLockScreen ? 18 * scaling : 24 * scaling
color: shutdownButtonArea.containsMouse ? Color.mError : "transparent"
border.color: shutdownButtonArea.containsMouse ? Color.mError : Color.transparent
border.color: shutdownButtonArea.containsMouse ? Color.mError : Color.mOutline
border.width: 1
RowLayout {
@@ -1064,14 +1078,14 @@ Loader {
NIcon {
icon: "shutdown"
pointSize: Style.fontSizeL * scaling
pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM * scaling : Style.fontSizeL * scaling
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: Settings.data.general.compactLockScreen ? Style.fontSizeS * scaling : Style.fontSizeM * scaling
font.weight: Font.Medium
}
}
+4 -2
View File
@@ -139,6 +139,7 @@ Variants {
})()
Component.onCompleted: {
}
Connections {
@@ -151,6 +152,7 @@ Variants {
}
Component.onDestruction: {
}
// Anchor selection based on location (window edges)
@@ -548,12 +550,12 @@ Variants {
function onBrightnessChanged(newBrightness) {
root.lastUpdatedBrightness = newBrightness
if (!brightnessInitialized) {
brightnessInitialized = true
return
}
showOSD("brightness")
}
+3 -3
View File
@@ -27,12 +27,12 @@ Rectangle {
// Repaint gauge when the bound value changes
onValueChanged: gauge.requestPaint()
// Force repaint when scaling changes
onScalingChanged: {
Qt.callLater(() => {
gauge.requestPaint()
})
gauge.requestPaint()
})
}
ColumnLayout {
+8 -8
View File
@@ -146,12 +146,12 @@ Loader {
Logger.log("NPanel", "Opened", root.objectName, "on", screen.name)
dimmingOpacity = Style.opacityHeavy
root.scaling = scaling = ScalingService.getScreenScale(screen)
// Force refresh panel content when scaling is applied
Qt.callLater(() => {
panelContentLoader.active = false
panelContentLoader.active = true
})
panelContentLoader.active = false
panelContentLoader.active = true
})
}
Connections {
@@ -159,12 +159,12 @@ Loader {
function onScaleChanged(screenName, scale) {
if ((screen !== null) && (screenName === screen.name)) {
root.scaling = scaling = scale
// Force refresh panel content when scaling changes
Qt.callLater(() => {
panelContentLoader.active = false
panelContentLoader.active = true
})
panelContentLoader.active = false
panelContentLoader.active = true
})
}
}
}