diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-07-28 19:30:13 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-08-25 19:03:15 +0200 |
commit | 466d3cd52c2d7262449921817c829d22f5721160 (patch) | |
tree | 43daf1a9fb1c59fcd0fcac527a14078416888fe9 /resources | |
parent | Port state events and images (diff) | |
download | nheko-466d3cd52c2d7262449921817c829d22f5721160.tar.xz |
Port redacted messages
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/MessageView.qml | 13 | ||||
-rw-r--r-- | resources/qml/delegates/Redacted.qml | 31 |
2 files changed, 31 insertions, 13 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 2d4f592c..41d996c1 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -287,6 +287,19 @@ Item { EventDelegateChoice { roleValues: [ + MtxEvent.Redacted + ] + + Redacted { + Layout.fillWidth: true + + required property string userId + required property string userName + } + } + + EventDelegateChoice { + roleValues: [ ] MatrixText { Layout.fillWidth: true diff --git a/resources/qml/delegates/Redacted.qml b/resources/qml/delegates/Redacted.qml index 4a9700dc..a09e4c3f 100644 --- a/resources/qml/delegates/Redacted.qml +++ b/resources/qml/delegates/Redacted.qml @@ -7,20 +7,16 @@ import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import im.nheko 1.0 -Rectangle{ +Control { + id: msgRoot - height: redactedLayout.implicitHeight + Nheko.paddingSmall - implicitWidth: redactedLayout.implicitWidth + 2 * Nheko.paddingMedium - width: Math.min(parent.width,implicitWidth+1) - radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall - color: palette.alternateBase - property int metadataWidth - property bool fitsMetadata: parent.width - redactedLayout.width > metadataWidth + 4 + property int metadataWidth: 0 + property bool fitsMetadata: false //parent.width - redactedLayout.width > metadataWidth + 4 - RowLayout { + required property string eventId + + contentItem: RowLayout { id: redactedLayout - anchors.centerIn: parent - width: parent.width - 2 * Nheko.paddingMedium spacing: Nheko.paddingSmall Image { @@ -34,9 +30,9 @@ Rectangle{ id: redactedLabel Layout.margins: 0 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - Layout.preferredWidth: implicitWidth + Layout.maximumWidth: implicitWidth + 1 Layout.fillWidth: true - property var redactedPair: room.formatRedactedEvent(eventId) + property var redactedPair: room.formatRedactedEvent(msgRoot.eventId) text: redactedPair["first"] wrapMode: Label.WordWrap color: palette.text @@ -48,4 +44,13 @@ Rectangle{ } } } + + padding: Nheko.paddingSmall + + Layout.maximumWidth: redactedLayout.Layout.maximumWidth + padding * 2 + + background: Rectangle { + color: palette.alternateBase + radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall + } } |