2020-09-29 09:06:57 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-09-29 09:06:57 +00:00
|
|
|
import "../../shared"
|
2021-10-14 12:14:11 +00:00
|
|
|
import "../../shared/panels"
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: root
|
2021-08-30 12:42:11 +00:00
|
|
|
height: (root.contentType === Constants.imageType) ?
|
|
|
|
replyToUsername.height + imageThumbnail.height + Style.current.padding :
|
|
|
|
(root.contentType === Constants.stickerType) ?
|
|
|
|
replyToUsername.height + stickerThumbnail.height + Style.current.padding : 50
|
2021-03-16 19:19:48 +00:00
|
|
|
color: Style.current.replyBackground
|
2020-09-29 09:06:57 +00:00
|
|
|
radius: 16
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
property string userName: ""
|
|
|
|
property string message : ""
|
|
|
|
property string identicon: ""
|
2021-08-30 12:42:11 +00:00
|
|
|
property string image: ""
|
|
|
|
property string sticker: ""
|
|
|
|
property int contentType: -1
|
2020-09-29 09:06:57 +00:00
|
|
|
|
|
|
|
signal closeButtonClicked()
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
color: parent.color
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.right: parent.right
|
|
|
|
height: parent.height / 2
|
|
|
|
width: 32
|
|
|
|
radius: Style.current.radius
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: replyToUsername
|
|
|
|
text: "↪ " + userName
|
2021-03-16 19:19:48 +00:00
|
|
|
color: Style.current.textColor
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
}
|
|
|
|
|
2021-03-23 18:15:26 +00:00
|
|
|
Rectangle {
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.left: replyToUsername.left
|
|
|
|
anchors.top: replyToUsername.bottom
|
2021-03-23 18:15:26 +00:00
|
|
|
anchors.topMargin: -3
|
2020-09-29 09:06:57 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.bottom: parent.bottom
|
2021-03-23 18:15:26 +00:00
|
|
|
clip: true
|
|
|
|
color: Style.current.transparent
|
2021-08-30 12:42:11 +00:00
|
|
|
visible: (root.contentType !== Constants.imageType) && (root.contentType !== Constants.stickerType)
|
2021-03-23 18:15:26 +00:00
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: replyText
|
|
|
|
text: Utils.getMessageWithStyle(Utils.linkifyAndXSS(Emoji.parse(message)), appSettings.useCompactMode, false)
|
|
|
|
anchors.fill: parent
|
|
|
|
elide: Text.ElideRight
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Normal
|
|
|
|
textFormat: Text.RichText
|
|
|
|
color: Style.current.textColor
|
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 12:42:11 +00:00
|
|
|
StatusChatImage {
|
|
|
|
id: imageThumbnail
|
|
|
|
anchors.left: replyToUsername.left
|
|
|
|
anchors.top: replyToUsername.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
imageWidth: 64
|
|
|
|
imageSource: root.image
|
|
|
|
chatHorizontalPadding: 0
|
|
|
|
container: root.container
|
|
|
|
visible: root.contentType === Constants.imageType
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusSticker {
|
|
|
|
id: stickerThumbnail
|
|
|
|
anchors.left: replyToUsername.left
|
|
|
|
anchors.top: replyToUsername.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
imageWidth: 64
|
|
|
|
imageHeight: 64
|
|
|
|
color: Style.current.transparent
|
|
|
|
contentType: root.contentType
|
|
|
|
}
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
RoundButton {
|
|
|
|
id: closeBtn
|
|
|
|
implicitWidth: 20
|
|
|
|
implicitHeight: 20
|
|
|
|
radius: 10
|
|
|
|
padding: 0
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 4
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 4
|
|
|
|
contentItem: SVGImage {
|
|
|
|
id: iconImg
|
2021-09-28 15:04:06 +00:00
|
|
|
source: Style.svg("close")
|
2020-09-29 09:06:57 +00:00
|
|
|
width: closeBtn.width
|
|
|
|
height: closeBtn.height
|
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: iconImg
|
|
|
|
source: iconImg
|
2021-03-16 19:19:48 +00:00
|
|
|
color: Style.current.textColor
|
2020-09-29 09:06:57 +00:00
|
|
|
antialiasing: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
|
|
|
color: "transparent"
|
|
|
|
width: closeBtn.width
|
|
|
|
height: closeBtn.height
|
|
|
|
radius: closeBtn.radius
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
root.userName = ""
|
|
|
|
root.message = ""
|
|
|
|
root.identicon = ""
|
|
|
|
root.closeButtonClicked()
|
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onPressed: mouse.accepted = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|