nheko/resources/qml/dialogs/ReadReceipts.qml

132 lines
3.8 KiB
QML
Raw Normal View History

// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
import ".."
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
ApplicationWindow {
id: readReceiptsRoot
property ReadReceiptsProxy readReceipts
property Room room
height: 380
width: 340
minimumHeight: 380
minimumWidth: headerTitle.width + 2 * Nheko.paddingMedium
palette: Nheko.colors
color: Nheko.colors.window
2021-08-19 16:55:54 +02:00
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
2021-07-25 00:38:22 +02:00
Shortcut {
sequence: StandardKey.Cancel
onActivated: readReceiptsRoot.close()
}
ColumnLayout {
anchors.fill: parent
anchors.margins: Nheko.paddingMedium
spacing: Nheko.paddingMedium
Label {
id: headerTitle
2021-07-30 14:14:44 +02:00
color: Nheko.colors.text
Layout.alignment: Qt.AlignCenter
text: qsTr("Read receipts")
font.pointSize: fontMetrics.font.pointSize * 1.5
}
ScrollView {
palette: Nheko.colors
padding: Nheko.paddingMedium
ScrollBar.horizontal.visible: false
Layout.fillHeight: true
Layout.minimumHeight: 200
Layout.fillWidth: true
ListView {
id: readReceiptsList
clip: true
boundsBehavior: Flickable.StopAtBounds
model: readReceipts
2021-11-06 00:35:13 +01:00
delegate: ItemDelegate {
2021-11-13 20:05:27 +01:00
id: del
2021-11-06 00:35:13 +01:00
onClicked: room.openUserProfile(model.mxid)
padding: Nheko.paddingMedium
2021-11-13 20:05:27 +01:00
width: ListView.view.width
2021-11-13 20:38:22 +01:00
height: receiptLayout.implicitHeight + Nheko.paddingSmall * 2
2021-11-06 00:35:13 +01:00
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: model.mxid
2021-11-13 20:05:27 +01:00
background: Rectangle {
color: del.hovered ? Nheko.colors.dark : readReceiptsRoot.color
}
2021-11-06 00:35:13 +01:00
RowLayout {
id: receiptLayout
2021-11-06 00:35:13 +01:00
spacing: Nheko.paddingMedium
2021-11-16 01:04:33 +01:00
anchors.fill: parent
anchors.margins: Nheko.paddingSmall
2021-11-06 00:35:13 +01:00
Avatar {
width: Nheko.avatarSize
height: Nheko.avatarSize
userid: model.mxid
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: model.displayName
2021-11-09 03:26:35 +01:00
enabled: false
2021-11-06 00:35:13 +01:00
}
ColumnLayout {
spacing: Nheko.paddingSmall
2021-11-06 00:35:13 +01:00
Label {
text: model.displayName
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
font.pointSize: fontMetrics.font.pointSize
}
2021-11-06 00:35:13 +01:00
Label {
text: model.timestamp
color: Nheko.colors.buttonText
font.pointSize: fontMetrics.font.pointSize * 0.9
}
}
2021-11-16 01:04:33 +01:00
Item {
Layout.fillWidth: true
}
2021-11-06 00:35:13 +01:00
}
2021-11-06 00:35:13 +01:00
CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}
}
}
}
}
2021-07-24 18:51:45 +02:00
footer: DialogButtonBox {
standardButtons: DialogButtonBox.Ok
onAccepted: readReceiptsRoot.close()
}
}