2021-03-05 00:35:15 +01:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2021-03-07 05:57:56 +01:00
|
|
|
//
|
2021-03-05 00:35:15 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-02-14 01:28:28 +01:00
|
|
|
import QtQuick 2.12
|
2020-01-28 19:08:16 +01:00
|
|
|
import QtQuick.Controls 2.3
|
2021-01-12 15:03:39 +01:00
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import QtQuick.Window 2.2
|
2020-06-24 16:24:22 +02:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
2020-04-09 00:10:08 +02:00
|
|
|
Item {
|
2020-10-08 21:11:21 +02:00
|
|
|
id: replyComponent
|
|
|
|
|
|
|
|
property alias modelData: reply.modelData
|
|
|
|
property color userColor: "red"
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: replyContainer.height
|
|
|
|
|
2021-02-14 01:28:28 +01:00
|
|
|
TapHandler {
|
2021-04-29 19:09:16 +02:00
|
|
|
onSingleTapped: chat.model.showEvent(modelData.id)
|
2021-04-11 22:24:39 +02:00
|
|
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
2021-02-14 01:28:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CursorShape {
|
2020-10-08 21:11:21 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: colorLine
|
|
|
|
|
|
|
|
anchors.top: replyContainer.top
|
|
|
|
anchors.bottom: replyContainer.bottom
|
|
|
|
width: 4
|
|
|
|
color: TimelineManager.userColor(reply.modelData.userId, colors.window)
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: replyContainer
|
|
|
|
|
|
|
|
anchors.left: colorLine.right
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
width: parent.width - 8
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: userName
|
|
|
|
|
|
|
|
text: TimelineManager.escapeEmoji(reply.modelData.userName)
|
|
|
|
color: replyComponent.userColor
|
|
|
|
textFormat: Text.RichText
|
|
|
|
|
2021-02-14 01:28:28 +01:00
|
|
|
TapHandler {
|
|
|
|
onSingleTapped: chat.model.openUserProfile(reply.modelData.userId)
|
2021-04-11 22:24:39 +02:00
|
|
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
2020-10-08 21:11:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageDelegate {
|
|
|
|
id: reply
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
isReply: true
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: backgroundItem
|
|
|
|
|
|
|
|
z: -1
|
|
|
|
height: replyContainer.height
|
|
|
|
width: Math.min(Math.max(reply.implicitWidth, userName.implicitWidth) + 8 + 4, parent.width)
|
2020-11-21 01:18:55 +01:00
|
|
|
color: Qt.rgba(userColor.r, userColor.g, userColor.b, 0.1)
|
2020-10-08 21:11:21 +02:00
|
|
|
}
|
|
|
|
|
2020-01-28 19:08:16 +01:00
|
|
|
}
|