bg: clock: fix funny overlapping status row (#2413)

This commit is contained in:
end-4
2025-11-13 21:23:42 +01:00
parent 6194ef912b
commit 5ad3508d3e
2 changed files with 59 additions and 56 deletions
@@ -38,13 +38,14 @@ AbstractBackgroundWidget {
Column { Column {
id: contentColumn id: contentColumn
anchors.centerIn: parent anchors.centerIn: parent
spacing: 6 spacing: 10
FadeLoader { FadeLoader {
id: cookieClockLoader id: cookieClockLoader
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
shown: root.clockStyle === "cookie" && (root.shouldShow) shown: root.clockStyle === "cookie" && (root.shouldShow)
sourceComponent: Column { sourceComponent: Column {
spacing: 10
CookieClock { CookieClock {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
@@ -88,61 +89,64 @@ AbstractBackgroundWidget {
} }
} }
} }
Item { StatusRow {
id: statusText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
implicitHeight: statusTextBg.implicitHeight }
implicitWidth: statusTextBg.implicitWidth }
StyledRectangularShadow {
target: statusTextBg component StatusRow: Item {
visible: statusTextBg.visible && root.clockStyle === "cookie" id: statusText
opacity: statusTextBg.opacity implicitHeight: statusTextBg.implicitHeight
implicitWidth: statusTextBg.implicitWidth
StyledRectangularShadow {
target: statusTextBg
visible: statusTextBg.visible && root.clockStyle === "cookie"
opacity: statusTextBg.opacity
}
Rectangle {
id: statusTextBg
anchors.centerIn: parent
clip: true
opacity: (safetyStatusText.shown || lockStatusText.shown) ? 1 : 0
visible: opacity > 0
implicitHeight: statusTextRow.implicitHeight + 5 * 2
implicitWidth: statusTextRow.implicitWidth + 5 * 2
radius: Appearance.rounding.small
color: ColorUtils.transparentize(Appearance.colors.colSecondaryContainer, root.clockStyle === "cookie" ? 0 : 1)
Behavior on implicitWidth {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
} }
Rectangle { Behavior on implicitHeight {
id: statusTextBg animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
}
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
RowLayout {
id: statusTextRow
anchors.centerIn: parent anchors.centerIn: parent
clip: true spacing: 14
opacity: (safetyStatusText.shown || lockStatusText.shown) ? 1 : 0 Item {
visible: opacity > 0 Layout.fillWidth: root.textHorizontalAlignment !== Text.AlignLeft
implicitHeight: statusTextRow.implicitHeight + 5 * 2 implicitWidth: 1
implicitWidth: statusTextRow.implicitWidth + 5 * 2
radius: Appearance.rounding.small
color: ColorUtils.transparentize(Appearance.colors.colSecondaryContainer, root.clockStyle === "cookie" ? 0 : 1)
Behavior on implicitWidth {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
} }
Behavior on implicitHeight { ClockStatusText {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this) id: safetyStatusText
shown: root.wallpaperSafetyTriggered
statusIcon: "hide_image"
statusText: Translation.tr("Wallpaper safety enforced")
} }
Behavior on opacity { ClockStatusText {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) id: lockStatusText
shown: GlobalStates.screenLocked && Config.options.lock.showLockedText
statusIcon: "lock"
statusText: Translation.tr("Locked")
} }
Item {
RowLayout { Layout.fillWidth: root.textHorizontalAlignment !== Text.AlignRight
id: statusTextRow implicitWidth: 1
anchors.centerIn: parent
spacing: 14
Item {
Layout.fillWidth: root.textHorizontalAlignment !== Text.AlignLeft
implicitWidth: 1
}
ClockStatusText {
id: safetyStatusText
shown: root.wallpaperSafetyTriggered
statusIcon: "hide_image"
statusText: Translation.tr("Wallpaper safety enforced")
}
ClockStatusText {
id: lockStatusText
shown: GlobalStates.screenLocked && Config.options.lock.showLockedText
statusIcon: "lock"
statusText: Translation.tr("Locked")
}
Item {
Layout.fillWidth: root.textHorizontalAlignment !== Text.AlignRight
implicitWidth: 1
}
} }
} }
} }
@@ -12,9 +12,6 @@ Item {
implicitWidth: quoteBox.implicitWidth implicitWidth: quoteBox.implicitWidth
implicitHeight: quoteBox.implicitHeight implicitHeight: quoteBox.implicitHeight
anchors.bottom: parent.bottom
anchors.bottomMargin: -24
DropShadow { DropShadow {
source: quoteBox source: quoteBox
anchors.fill: quoteBox anchors.fill: quoteBox
@@ -29,14 +26,16 @@ Item {
Rectangle { Rectangle {
id: quoteBox id: quoteBox
implicitWidth: quoteStyledText.width + quoteIcon.width + 16 // for spacing on both sides implicitWidth: quoteRow.implicitWidth + 8 * 2
implicitHeight: quoteStyledText.height + 8 implicitHeight: quoteRow.implicitHeight + 4 * 2
radius: Appearance.rounding.small radius: Appearance.rounding.small
color: Appearance.colors.colSecondaryContainer color: Appearance.colors.colSecondaryContainer
Row { Row {
id: quoteRow
anchors.centerIn: parent anchors.centerIn: parent
spacing: 4 spacing: 4
MaterialSymbol { MaterialSymbol {
id: quoteIcon id: quoteIcon
anchors.top: parent.top anchors.top: parent.top