notifcenter: show one line per notification in collapsed group preview

This commit is contained in:
Damocles 2026-04-17 10:40:44 +02:00
parent 87aeed2ee5
commit 47dbffad0f

View file

@ -116,7 +116,7 @@ M.HoverPanel {
appIcon: g.appIcon,
count: g.notifs.length,
collapsed: collapsed,
summaries: g.notifs.map(n => n.summary || "").filter(Boolean).join(" · ")
summaries: g.notifs.map(n => n.summary || "")
});
if (!collapsed) {
for (const n of g.notifs)
@ -241,7 +241,7 @@ M.HoverPanel {
readonly property real _targetHeight: {
if (_type === "header")
return modelData.collapsed ? (28 + M.Theme.fontSize + 4) : 28;
return modelData.collapsed ? (28 + modelData.count * (M.Theme.fontSize + 4)) : 28;
return _notifCard.implicitHeight;
}
@ -386,22 +386,26 @@ M.HoverPanel {
}
}
// Collapsed preview: notification summaries on a subtitle row
Text {
visible: notifDelegate._type === "header" && notifDelegate.modelData.collapsed
anchors.left: parent.left
anchors.leftMargin: 10
anchors.right: parent.right
anchors.rightMargin: 10
anchors.top: parent.top
anchors.topMargin: 28
height: M.Theme.fontSize + 4
verticalAlignment: Text.AlignVCenter
text: notifDelegate._type === "header" ? (notifDelegate.modelData.summaries ?? "") : ""
elide: Text.ElideRight
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
color: M.Theme.base04
// Collapsed preview: one line per notification summary
Repeater {
model: (notifDelegate._type === "header" && notifDelegate.modelData.collapsed) ? notifDelegate.modelData.summaries : []
Text {
required property string modelData
required property int index
anchors.left: parent.left
anchors.leftMargin: 10
anchors.right: parent.right
anchors.rightMargin: 10
y: 28 + index * (M.Theme.fontSize + 4)
height: M.Theme.fontSize + 4
verticalAlignment: Text.AlignVCenter
text: modelData
elide: Text.ElideRight
font.pixelSize: M.Theme.fontSize - 2
font.family: M.Theme.fontFamily
color: M.Theme.base04
}
}
}