matrixion/qml/dialogs/ReadReceipts.qml

117 lines
3.9 KiB
QML
Raw Normal View History

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