From 6f7aff6f3425cf8c98ffeb91fb9603605b1128fb Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 12 May 2025 17:33:17 +1000 Subject: notifs: show multiline summary on expand Also fix action binding loop --- config/NotifsConfig.qml | 2 +- modules/notifications/Notification.qml | 25 +++++++++++++++++-------- services/Drawers.qml | 4 ---- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/config/NotifsConfig.qml b/config/NotifsConfig.qml index 10d0a4f..34b9226 100644 --- a/config/NotifsConfig.qml +++ b/config/NotifsConfig.qml @@ -13,7 +13,7 @@ Singleton { component Sizes: QtObject { readonly property int width: 400 - readonly property int image: 50 + readonly property int image: 41 readonly property int badge: 20 } } diff --git a/modules/notifications/Notification.qml b/modules/notifications/Notification.qml index a39b522..d78b327 100644 --- a/modules/notifications/Notification.qml +++ b/modules/notifications/Notification.qml @@ -15,8 +15,7 @@ StyledRect { required property Notifs.Notif modelData readonly property bool hasImage: modelData.image.length > 0 readonly property bool hasAppIcon: modelData.appIcon.length > 0 - readonly property int imageSize: summary.height + bodyPreview.height - readonly property int nonAnimHeight: summary.height + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2 + readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2 property bool expanded clip: true @@ -97,14 +96,14 @@ StyledRect { anchors.left: parent.left anchors.top: parent.top - width: root.imageSize - height: root.imageSize + width: NotifsConfig.sizes.image + height: NotifsConfig.sizes.image visible: root.hasImage || root.hasAppIcon sourceComponent: ClippingRectangle { radius: Appearance.rounding.full - width: root.imageSize - height: root.imageSize + width: NotifsConfig.sizes.image + height: NotifsConfig.sizes.image Image { anchors.fill: parent @@ -130,8 +129,8 @@ StyledRect { sourceComponent: StyledRect { radius: Appearance.rounding.full 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 - implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : root.imageSize + implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image + implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image Loader { id: icon @@ -246,6 +245,10 @@ StyledRect { name: "expanded" when: root.expanded + PropertyChanges { + summary.maximumLineCount: undefined + } + AnchorChanges { target: summary anchors.top: appName.bottom @@ -253,6 +256,10 @@ StyledRect { } transitions: Transition { + PropertyAction { + target: summary + property: "maximumLineCount" + } AnchorAnimation { duration: Appearance.anim.durations.normal easing.type: Easing.BezierSpline @@ -424,6 +431,8 @@ StyledRect { Layout.preferredWidth: actionText.width + Appearance.padding.normal * 2 Layout.preferredHeight: actionText.height + Appearance.padding.small * 2 + implicitWidth: actionText.width + Appearance.padding.normal * 2 + implicitHeight: actionText.height + Appearance.padding.small * 2 StateLayer { radius: Appearance.rounding.full diff --git a/services/Drawers.qml b/services/Drawers.qml index ac88b6c..6155d5d 100644 --- a/services/Drawers.qml +++ b/services/Drawers.qml @@ -10,10 +10,6 @@ Singleton { 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 { positions[screen] = Qt.point(x, y); posChanged(screen, x, y); -- cgit v1.2.3-freya