Verified Commit 37b3433c authored by Linus Jahn's avatar Linus Jahn 🔌
Browse files

ChatPage: Group messages from same author

A message group has only one avatar (displayed next to the first
message) and messages from the message group have smaller spacing.
parent 27450b0a
Pipeline #79595 passed with stage
in 2 minutes and 56 seconds
......@@ -302,7 +302,7 @@ ChatPageBase {
ListView {
id: messageListView
verticalLayoutDirection: ListView.BottomToTop
spacing: Kirigami.Units.smallSpacing * 1.5
spacing: 0
// Highlighting of the message containing a searched string.
highlight: Component {
......
......@@ -69,6 +69,10 @@ RowLayout {
property alias bodyLabel: bodyLabel
property string deliveryStateName
property url deliveryStateIcon
property bool isGroupBegin: {
return modelIndex < 1 ||
MessageModel.data(MessageModel.index(modelIndex - 1, 0), MessageModel.Sender) !== senderJid
}
signal messageEditRequested(string id, string body)
signal quoteRequested(string body)
......@@ -76,20 +80,26 @@ RowLayout {
// Own messages are on the right, others on the left side.
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
width: ListView.view.width
height: implicitHeight + (isGroupBegin ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing)
// placeholder
Item {
Layout.preferredWidth: 5
}
Avatar {
id: avatar
Item {
visible: !isOwn
jid: root.senderJid
name: root.senderName
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.preferredHeight: Kirigami.Units.gridUnit * 2.2
Layout.preferredWidth: Kirigami.Units.gridUnit * 2.2
Avatar {
id: avatar
visible: !isOwn && isGroupBegin
anchors.fill: parent
jid: root.senderJid
name: root.senderName
}
}
// message bubble
......@@ -107,6 +117,7 @@ RowLayout {
background: MessageBackground {
message: root
showTail: !isOwn && isGroupBegin
MouseArea {
anchors.fill: parent
......
......@@ -44,7 +44,7 @@ Item {
property QtObject message
property color color: message.isOwn ? rightMessageBubbleColor : primaryBackgroundColor
property int tailSize: Kirigami.Units.largeSpacing
property bool showTail: !message.isOwn
property bool showTail: true
property alias dummy: dummy
readonly property alias metaInfoWidth: metaInfo.width
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment