notifs: show multiline summary on expand

Also fix action binding loop
This commit is contained in:
2 * r + 2 * t 2025-05-12 17:33:17 +10:00
parent 61c5c46b91
commit 6f7aff6f34
3 changed files with 18 additions and 13 deletions

View file

@ -13,7 +13,7 @@ Singleton {
component Sizes: QtObject { component Sizes: QtObject {
readonly property int width: 400 readonly property int width: 400
readonly property int image: 50 readonly property int image: 41
readonly property int badge: 20 readonly property int badge: 20
} }
} }

View file

@ -15,8 +15,7 @@ StyledRect {
required property Notifs.Notif modelData required property Notifs.Notif modelData
readonly property bool hasImage: modelData.image.length > 0 readonly property bool hasImage: modelData.image.length > 0
readonly property bool hasAppIcon: modelData.appIcon.length > 0 readonly property bool hasAppIcon: modelData.appIcon.length > 0
readonly property int imageSize: summary.height + bodyPreview.height readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
readonly property int nonAnimHeight: summary.height + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
property bool expanded property bool expanded
clip: true clip: true
@ -97,14 +96,14 @@ StyledRect {
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
width: root.imageSize width: NotifsConfig.sizes.image
height: root.imageSize height: NotifsConfig.sizes.image
visible: root.hasImage || root.hasAppIcon visible: root.hasImage || root.hasAppIcon
sourceComponent: ClippingRectangle { sourceComponent: ClippingRectangle {
radius: Appearance.rounding.full radius: Appearance.rounding.full
width: root.imageSize width: NotifsConfig.sizes.image
height: root.imageSize height: NotifsConfig.sizes.image
Image { Image {
anchors.fill: parent anchors.fill: parent
@ -130,8 +129,8 @@ StyledRect {
sourceComponent: StyledRect { sourceComponent: StyledRect {
radius: Appearance.rounding.full radius: Appearance.rounding.full
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer
implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image
implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image
Loader { Loader {
id: icon id: icon
@ -246,6 +245,10 @@ StyledRect {
name: "expanded" name: "expanded"
when: root.expanded when: root.expanded
PropertyChanges {
summary.maximumLineCount: undefined
}
AnchorChanges { AnchorChanges {
target: summary target: summary
anchors.top: appName.bottom anchors.top: appName.bottom
@ -253,6 +256,10 @@ StyledRect {
} }
transitions: Transition { transitions: Transition {
PropertyAction {
target: summary
property: "maximumLineCount"
}
AnchorAnimation { AnchorAnimation {
duration: Appearance.anim.durations.normal duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline easing.type: Easing.BezierSpline
@ -424,6 +431,8 @@ StyledRect {
Layout.preferredWidth: actionText.width + Appearance.padding.normal * 2 Layout.preferredWidth: actionText.width + Appearance.padding.normal * 2
Layout.preferredHeight: actionText.height + Appearance.padding.small * 2 Layout.preferredHeight: actionText.height + Appearance.padding.small * 2
implicitWidth: actionText.width + Appearance.padding.normal * 2
implicitHeight: actionText.height + Appearance.padding.small * 2
StateLayer { StateLayer {
radius: Appearance.rounding.full radius: Appearance.rounding.full

View file

@ -10,10 +10,6 @@ Singleton {
signal posChanged(screen: ShellScreen, x: int, y: int) signal posChanged(screen: ShellScreen, x: int, y: int)
function getPosForScreen(screen: ShellScreen): point {
return positions[screen] || Qt.point(0, 0);
}
function setPosForScreen(screen: ShellScreen, x: int, y: int): void { function setPosForScreen(screen: ShellScreen, x: int, y: int): void {
positions[screen] = Qt.point(x, y); positions[screen] = Qt.point(x, y);
posChanged(screen, x, y); posChanged(screen, x, y);