lock: allow centering clock when not blurred

This commit is contained in:
end-4
2025-09-22 21:50:25 +02:00
parent a67a8d746f
commit 036d8b4852
5 changed files with 53 additions and 41 deletions
@@ -54,7 +54,7 @@ Variants {
property real clockX: (modelData.width / 2)
property real clockY: (modelData.height / 2)
property var textHorizontalAlignment: {
if ((Config.options.background.lockBlur.enable && Config.options.background.lockBlur.centerClock && GlobalStates.screenLocked) || wallpaperSafetyTriggered)
if ((Config.options.lock.centerClock && GlobalStates.screenLocked) || wallpaperSafetyTriggered)
return Text.AlignHCenter;
if (clockX < screen.width / 3)
return Text.AlignLeft;
@@ -63,7 +63,7 @@ Variants {
return Text.AlignHCenter;
}
// Colors
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.background.lockBlur.enable)
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable)
property color dominantColor: Appearance.colors.colPrimary
property bool dominantColorIsDark: dominantColor.hslLightness < 0.5
property color colText: {
@@ -230,9 +230,9 @@ Variants {
Loader {
id: blurLoader
active: Config.options.background.lockBlur.enable && (GlobalStates.screenLocked || scaleAnim.running)
active: Config.options.lock.blur.enable && (GlobalStates.screenLocked || scaleAnim.running)
anchors.fill: wallpaper
scale: GlobalStates.screenLocked ? Config.options.background.lockBlur.extraZoom : 1
scale: GlobalStates.screenLocked ? Config.options.lock.blur.extraZoom : 1
Behavior on scale {
NumberAnimation {
id: scaleAnim
@@ -243,7 +243,7 @@ Variants {
}
sourceComponent: GaussianBlur {
source: wallpaper
radius: GlobalStates.screenLocked ? Config.options.background.lockBlur.radius : 0
radius: GlobalStates.screenLocked ? Config.options.lock.blur.radius : 0
samples: radius * 2 + 1
Rectangle {
@@ -279,7 +279,7 @@ Variants {
}
states: State {
name: "centered"
when: (bgRoot.shouldBlur && Config.options.background.lockBlur.centerClock) || bgRoot.wallpaperSafetyTriggered
when: (GlobalStates.screenLocked && Config.options.lock.centerClock) || bgRoot.wallpaperSafetyTriggered
AnchorChanges {
target: clockLoader
anchors {
@@ -345,13 +345,19 @@ Variants {
}
Item {
Layout.alignment: Qt.AlignHCenter
Layout.alignment: {
if (bgRoot.textHorizontalAlignment === Text.AlignHCenter || root.clockStyle === "cookie")
return Qt.AlignHCenter;
return (bgRoot.textHorizontalAlignment === Text.AlignLeft ? Qt.AlignLeft : Qt.AlignRight)
}
Layout.leftMargin: -26
Layout.rightMargin: -26
implicitWidth: statusTextBg.implicitWidth
implicitHeight: statusTextBg.implicitHeight
StyledRectangularShadow {
target: statusTextBg
visible: statusTextBg.visible
visible: statusTextBg.visible && cookieClockLoader.active
opacity: statusTextBg.opacity
}
@@ -390,7 +396,7 @@ Variants {
}
ClockStatusText {
id: lockStatusText
shown: GlobalStates.screenLocked && (!Config.options.background.lockBlur.enable || Config.options.background.lockBlur.showLockedText)
shown: GlobalStates.screenLocked && Config.options.lock.showLockedText
statusIcon: "lock"
statusText: qsTr("Locked")
}
@@ -33,7 +33,7 @@ Item {
anchors.fill: source
horizontalOffset: 0
verticalOffset: 2
radius: 8
radius: 12
samples: radius * 2 + 1
color: Appearance.colors.colShadow
transparentBorder: true