| 1 |
// SPDX-FileCopyrightText: Nheko Contributors |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
import QtQuick |
| 6 |
import QtQuick.Controls |
| 7 |
import QtQuick.Layouts |
| 8 |
import im.nheko |
| 9 |
|
| 10 |
Control { |
| 11 |
id: msgRoot |
| 12 |
|
| 13 |
property int metadataWidth: 0 |
| 14 |
property bool fitsMetadata: false //parent.width - redactedLayout.width > metadataWidth + 4 |
| 15 |
|
| 16 |
required property string eventId |
| 17 |
required property Room room |
| 18 |
|
| 19 |
contentItem: RowLayout { |
| 20 |
id: redactedLayout |
| 21 |
spacing: Nheko.paddingSmall |
| 22 |
|
| 23 |
Image { |
| 24 |
id: trashImg |
| 25 |
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter |
| 26 |
Layout.preferredWidth: fontMetrics.font.pixelSize |
| 27 |
Layout.preferredHeight: fontMetrics.font.pixelSize |
| 28 |
source: "image://colorimage/:/icons/icons/ui/delete.svg?" + palette.text |
| 29 |
} |
| 30 |
Label { |
| 31 |
id: redactedLabel |
| 32 |
Layout.margins: 0 |
| 33 |
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight |
| 34 |
Layout.maximumWidth: implicitWidth + 1 |
| 35 |
Layout.fillWidth: true |
| 36 |
property var redactedPair: msgRoot.room.formatRedactedEvent(msgRoot.eventId) |
| 37 |
text: redactedPair["first"] |
| 38 |
color: palette.text |
| 39 |
wrapMode: Label.WordWrap |
| 40 |
|
| 41 |
ToolTip.text: redactedPair["second"] |
| 42 |
ToolTip.visible: hh.hovered |
| 43 |
HoverHandler { |
| 44 |
id: hh |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
padding: Nheko.paddingSmall |
| 50 |
|
| 51 |
Layout.maximumWidth: redactedLayout.Layout.maximumWidth + padding * 2 |
| 52 |
|
| 53 |
background: Rectangle { |
| 54 |
color: palette.alternateBase |
| 55 |
radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall |
| 56 |
} |
| 57 |
} |