notifications: fix spacing/eliding

This commit is contained in:
end-4
2025-06-07 14:10:31 +02:00
parent e03800cf64
commit 643b197d02
@@ -154,42 +154,56 @@ Item { // Notification group area
ColumnLayout { // Content ColumnLayout { // Content
Layout.fillWidth: true Layout.fillWidth: true
spacing: expanded ? spacing: expanded ? (root.multipleNotifications ?
((root.multipleNotifications && (notificationGroup?.notifications[root.notificationCount - 1].image != "") ? 35 :
notificationGroup?.notifications[root.notificationCount - 1].image != "") ? 35 : 5 : 0) : 0
5) : 0 // spacing: 00
Behavior on spacing { Behavior on spacing {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
} }
RowLayout { // App name (or summary when there's only 1 notif) and time Item { // App name (or summary when there's only 1 notif) and time
id: topRow id: topRow
spacing: 0 // spacing: 0
Layout.fillWidth: true
property real fontSize: Appearance.font.pixelSize.smaller property real fontSize: Appearance.font.pixelSize.smaller
property bool showAppName: root.multipleNotifications property bool showAppName: root.multipleNotifications
implicitHeight: Math.max(topTextRow.implicitHeight, expandButton.implicitHeight)
StyledText { RowLayout {
id: appName id: topTextRow
text: (topRow.showAppName ? anchors.left: parent.left
notificationGroup?.appName : anchors.right: expandButton.left
notificationGroup?.notifications[0]?.summary) || "" anchors.verticalCenter: parent.verticalCenter
font.pixelSize: topRow.showAppName ? spacing: 5
topRow.fontSize : StyledText {
Appearance.font.pixelSize.small id: appName
color: topRow.showAppName ? elide: Text.ElideRight
Appearance.colors.colSubtext : Layout.fillWidth: true
Appearance.colors.colOnLayer2 text: (topRow.showAppName ?
notificationGroup?.appName :
notificationGroup?.notifications[0]?.summary) || ""
font.pixelSize: topRow.showAppName ?
topRow.fontSize :
Appearance.font.pixelSize.small
color: topRow.showAppName ?
Appearance.colors.colSubtext :
Appearance.colors.colOnLayer2
}
StyledText {
id: timeText
// Layout.fillWidth: true
Layout.rightMargin: 10
horizontalAlignment: Text.AlignLeft
text: NotificationUtils.getFriendlyNotifTimeString(notificationGroup?.time)
font.pixelSize: topRow.fontSize
color: Appearance.colors.colSubtext
}
} }
StyledText {
id: timeText
text: " • " + NotificationUtils.getFriendlyNotifTimeString(notificationGroup?.time)
font.pixelSize: topRow.fontSize
color: Appearance.colors.colSubtext
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
}
Item { Layout.fillWidth: true }
NotificationGroupExpandButton { NotificationGroupExpandButton {
id: expandButton
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
count: root.notificationCount count: root.notificationCount
expanded: root.expanded expanded: root.expanded
fontSize: topRow.fontSize fontSize: topRow.fontSize