| 1 |
// SPDX-FileCopyrightText: Nheko Contributors |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
import ".." |
| 6 |
import QtQuick 2.15 |
| 7 |
import QtQuick.Controls 2.15 |
| 8 |
import QtQuick.Layouts 1.15 |
| 9 |
import im.nheko 1.0 |
| 10 |
|
| 11 |
ApplicationWindow { |
| 12 |
id: readReceiptsRoot |
| 13 |
|
| 14 |
property ReadReceiptsProxy readReceipts |
| 15 |
property Room room |
| 16 |
|
| 17 |
height: 380 |
| 18 |
width: 340 |
| 19 |
minimumHeight: 380 |
| 20 |
minimumWidth: headerTitle.width + 2 * Nheko.paddingMedium |
| 21 |
color: palette.window |
| 22 |
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint |
| 23 |
|
| 24 |
Shortcut { |
| 25 |
sequence: StandardKey.Cancel |
| 26 |
onActivated: readReceiptsRoot.close() |
| 27 |
} |
| 28 |
|
| 29 |
ColumnLayout { |
| 30 |
anchors.fill: parent |
| 31 |
anchors.margins: Nheko.paddingMedium |
| 32 |
spacing: Nheko.paddingMedium |
| 33 |
|
| 34 |
Label { |
| 35 |
id: headerTitle |
| 36 |
|
| 37 |
color: palette.text |
| 38 |
Layout.alignment: Qt.AlignCenter |
| 39 |
text: qsTr("Read receipts") |
| 40 |
font.pointSize: fontMetrics.font.pointSize * 1.5 |
| 41 |
} |
| 42 |
|
| 43 |
ScrollView { |
| 44 |
padding: Nheko.paddingMedium |
| 45 |
ScrollBar.horizontal.visible: false |
| 46 |
Layout.fillHeight: true |
| 47 |
Layout.minimumHeight: 200 |
| 48 |
Layout.fillWidth: true |
| 49 |
|
| 50 |
ListView { |
| 51 |
id: readReceiptsList |
| 52 |
|
| 53 |
clip: true |
| 54 |
boundsBehavior: Flickable.StopAtBounds |
| 55 |
model: readReceipts |
| 56 |
|
| 57 |
delegate: ItemDelegate { |
| 58 |
id: del |
| 59 |
|
| 60 |
onClicked: room.openUserProfile(model.mxid) |
| 61 |
padding: Nheko.paddingMedium |
| 62 |
width: ListView.view.width |
| 63 |
height: receiptLayout.implicitHeight + Nheko.paddingSmall * 2 |
| 64 |
hoverEnabled: true |
| 65 |
ToolTip.visible: hovered |
| 66 |
ToolTip.text: model.mxid |
| 67 |
background: Rectangle { |
| 68 |
color: del.hovered ? palette.dark : readReceiptsRoot.color |
| 69 |
} |
| 70 |
|
| 71 |
RowLayout { |
| 72 |
id: receiptLayout |
| 73 |
|
| 74 |
spacing: Nheko.paddingMedium |
| 75 |
anchors.fill: parent |
| 76 |
anchors.margins: Nheko.paddingSmall |
| 77 |
|
| 78 |
Avatar { |
| 79 |
id: avatar |
| 80 |
|
| 81 |
Layout.preferredWidth: Nheko.avatarSize |
| 82 |
Layout.preferredHeight: Nheko.avatarSize |
| 83 |
userid: model.mxid |
| 84 |
url: model.avatarUrl.replace("mxc://", "image://MxcImage/") |
| 85 |
displayName: model.displayName |
| 86 |
enabled: false |
| 87 |
} |
| 88 |
|
| 89 |
ColumnLayout { |
| 90 |
spacing: Nheko.paddingSmall |
| 91 |
Layout.fillWidth: true |
| 92 |
|
| 93 |
ElidedLabel { |
| 94 |
fullText: model.displayName |
| 95 |
color: TimelineManager.userColor(model ? model.mxid : "", palette.window) |
| 96 |
font.pointSize: fontMetrics.font.pointSize |
| 97 |
elideWidth: del.width - Nheko.paddingMedium - avatar.width |
| 98 |
Layout.fillWidth: true |
| 99 |
} |
| 100 |
|
| 101 |
ElidedLabel { |
| 102 |
fullText: model.timestamp |
| 103 |
color: palette.buttonText |
| 104 |
font.pointSize: fontMetrics.font.pointSize * 0.9 |
| 105 |
elideWidth: del.width - Nheko.paddingMedium - avatar.width |
| 106 |
Layout.fillWidth: true |
| 107 |
} |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
} |
| 112 |
|
| 113 |
NhekoCursorShape { |
| 114 |
anchors.fill: parent |
| 115 |
cursorShape: Qt.PointingHandCursor |
| 116 |
} |
| 117 |
|
| 118 |
} |
| 119 |
|
| 120 |
} |
| 121 |
|
| 122 |
} |
| 123 |
|
| 124 |
} |
| 125 |
|
| 126 |
footer: DialogButtonBox { |
| 127 |
standardButtons: DialogButtonBox.Ok |
| 128 |
onAccepted: readReceiptsRoot.close() |
| 129 |
} |
| 130 |
|
| 131 |
} |