Warning, /network/tokodon/src/content/ui/StatusDelegate/UserInteractionLabel.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtQuick.Controls 2 as QQC2
0007
0008 import org.kde.kirigami 2 as Kirigami
0009 import org.kde.kirigamiaddons.components 1 as KirigamiComponents
0010
0011 import org.kde.tokodon
0012 import org.kde.tokodon.private
0013
0014 // The label that sits above posts, e.g. "FooBar replied to" or "BarFoo boosted"
0015 RowLayout {
0016 id: root
0017
0018 readonly property var identity: {
0019 if (replyAuthorIdentity) {
0020 return replyAuthorIdentity;
0021 } else if (boostAuthorIdentity) {
0022 return boostAuthorIdentity;
0023 }
0024 }
0025
0026 required property bool isBoosted
0027 required property bool isReply
0028 required property var type
0029 required property var boostAuthorIdentity
0030 required property var replyAuthorIdentity
0031
0032 Layout.fillWidth: true
0033
0034 Kirigami.Icon {
0035 source: {
0036 if (root.isBoosted) {
0037 return "tokodon-post-boost"
0038 } else if (root.isReply) {
0039 return "tokodon-post-reply"
0040 }
0041
0042 return ''
0043 }
0044
0045 isMask: true
0046 color: Kirigami.Theme.disabledTextColor
0047
0048 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
0049 Layout.preferredHeight: Kirigami.Units.largeSpacing * 2
0050 Layout.preferredWidth: Kirigami.Units.largeSpacing * 2
0051 }
0052
0053 QQC2.AbstractButton {
0054 contentItem: RowLayout {
0055 KirigamiComponents.AvatarButton {
0056 implicitHeight: Math.round(Kirigami.Units.gridUnit * 1.5)
0057 implicitWidth: implicitHeight
0058
0059 name: root.identity ? root.identity.displayName : ''
0060 source: root.identity ? root.identity.avatarUrl : ''
0061 cache: true
0062
0063 onClicked: Navigation.openAccount(root.identity.id)
0064
0065 QQC2.ToolTip.text: i18n("View Profile")
0066 QQC2.ToolTip.visible: hovered
0067 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0068 }
0069 QQC2.Label {
0070 text: {
0071 if (root.isBoosted) {
0072 return root.identity ? i18n("%1 boosted", root.identity.displayNameHtml) : '';
0073 } else if (root.isReply) {
0074 return root.identity ? i18n("In reply to %1", root.identity.displayNameHtml) : '';
0075 }
0076 }
0077 color: Kirigami.Theme.disabledTextColor
0078 font: Config.defaultFont
0079
0080 Layout.alignment: Qt.AlignBaseline
0081 Layout.fillWidth: true
0082 }
0083 }
0084 }
0085 }