mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
messages: add read receipt support
Change-Id: Ide4b1336a13972a9291cb1e9e2bf881b32b97198 GitLab: #468
This commit is contained in:
parent
4a2bf0d61e
commit
f69df3416c
7 changed files with 76 additions and 3 deletions
1
qml.qrc
1
qml.qrc
|
@ -167,6 +167,7 @@
|
|||
<file>src/constant/MsgSeq.qml</file>
|
||||
<file>src/commoncomponents/SBSContextMenu.qml</file>
|
||||
<file>src/commoncomponents/SBSMessageBase.qml</file>
|
||||
<file>src/commoncomponents/ReadStatus.qml</file>
|
||||
<file>src/commoncomponents/GeneratedMessageDelegate.qml</file>
|
||||
<file>src/commoncomponents/DataTransferMessageDelegate.qml</file>
|
||||
<file>src/mainview/components/ScrollToBottomButton.qml</file>
|
||||
|
|
|
@ -36,6 +36,7 @@ const QString defaultDownloadPath = QStandardPaths::writableLocation(
|
|||
X(DownloadPath, defaultDownloadPath) \
|
||||
X(EnableNotifications, true) \
|
||||
X(EnableTypingIndicator, true) \
|
||||
X(EnableReadReceipt, true) \
|
||||
X(AllowFromUntrusted, false) \
|
||||
X(AcceptTransferBelow, 20) \
|
||||
X(AutoAcceptFiles, true) \
|
||||
|
|
|
@ -70,6 +70,7 @@ Loader {
|
|||
location: Body
|
||||
transferName: TransferName
|
||||
transferId: Id
|
||||
readers: Readers
|
||||
formattedTime: MessagesAdapter.getFormattedTime(Timestamp)
|
||||
extraHeight: progressBar.visible ? 18 : 0
|
||||
innerContent.children: [
|
||||
|
@ -239,6 +240,7 @@ Loader {
|
|||
location: Body
|
||||
transferName: TransferName
|
||||
transferId: Id
|
||||
readers: Readers
|
||||
formattedTime: MessagesAdapter.getFormattedTime(Timestamp)
|
||||
bubble.visible: false
|
||||
innerContent.children: [
|
||||
|
|
46
src/commoncomponents/ReadStatus.qml
Normal file
46
src/commoncomponents/ReadStatus.qml
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2021 by Savoir-faire Linux
|
||||
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
import net.jami.Models 1.1
|
||||
import net.jami.Adapters 1.1
|
||||
import net.jami.Constants 1.1
|
||||
|
||||
ListView {
|
||||
id: root
|
||||
|
||||
property var readers: []
|
||||
model: readers
|
||||
orientation: ListView.Horizontal
|
||||
Layout.alignment: Qt.AlignRight
|
||||
spacing: -(JamiTheme.avatarReadReceiptSize/3)
|
||||
|
||||
delegate: Avatar {
|
||||
width: JamiTheme.avatarReadReceiptSize
|
||||
height: JamiTheme.avatarReadReceiptSize
|
||||
z: -index
|
||||
|
||||
imageId: modelData
|
||||
showPresenceIndicator: false
|
||||
mode: Avatar.Mode.Contact
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ Control {
|
|||
property string formattedTime
|
||||
property string location
|
||||
property string hoveredLink
|
||||
property var readers: []
|
||||
|
||||
readonly property real senderMargin: 64
|
||||
readonly property real avatarSize: 32
|
||||
|
@ -106,11 +107,18 @@ Control {
|
|||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
ListView {
|
||||
id: infoCell
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: childrenRect.height
|
||||
orientation: ListView.Horizontal
|
||||
Layout.preferredHeight: {
|
||||
if (showTime || seq === MsgSeq.last)
|
||||
return childrenRect.height
|
||||
else if (reads.visible)
|
||||
return JamiTheme.avatarReadReceiptSize
|
||||
return 0
|
||||
}
|
||||
|
||||
Label {
|
||||
text: formattedTime
|
||||
|
@ -119,11 +127,24 @@ Control {
|
|||
height: visible * implicitHeight
|
||||
font.pointSize: 9
|
||||
|
||||
anchors.right: !isOutgoing ? undefined : parent.right
|
||||
anchors.right: !isOutgoing ? undefined : reads.left
|
||||
anchors.rightMargin: 8
|
||||
anchors.left: isOutgoing ? undefined : parent.left
|
||||
anchors.leftMargin: avatarBlockWidth + 6
|
||||
}
|
||||
ReadStatus {
|
||||
id: reads
|
||||
visible: root.readers.length !== 0 && CurrentAccount.sendReadReceipt
|
||||
width: {
|
||||
if (root.readers.length === 0)
|
||||
return 0
|
||||
var nbAvatars = root.readers.length
|
||||
var margin = JamiTheme.avatarReadReceiptSize / 3
|
||||
return nbAvatars * JamiTheme.avatarReadReceiptSize - (nbAvatars - 1) * margin
|
||||
}
|
||||
anchors.right: parent.right
|
||||
readers: root.readers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ SBSMessageBase {
|
|||
|
||||
isOutgoing: Author === ""
|
||||
author: Author
|
||||
readers: Readers
|
||||
formattedTime: MessagesAdapter.getFormattedTime(Timestamp)
|
||||
extraHeight: extraContent.active && !isRemoteImage ? msgRadius : -isRemoteImage
|
||||
innerContent.children: [
|
||||
|
|
|
@ -242,6 +242,7 @@ Item {
|
|||
property int mosaicButtonPreferredWidth: 70
|
||||
property int mosaicButtonMaxWidth: 100
|
||||
property real avatarPresenceRatio: 0.26
|
||||
property int avatarReadReceiptSize: 18
|
||||
|
||||
property int menuItemsPreferredWidth: 220
|
||||
property int menuItemsPreferredHeight: 48
|
||||
|
|
Loading…
Add table
Reference in a new issue