2020-07-15 21:04:14 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import "../../../../../shared"
|
2021-10-14 13:27:02 +00:00
|
|
|
import "../../../../../shared/controls"
|
2021-10-14 13:09:35 +00:00
|
|
|
import "../../../../../shared/panels"
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2020-12-08 15:45:43 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
2021-01-25 20:50:42 +00:00
|
|
|
property bool isHovered: false
|
2020-12-08 15:45:43 +00:00
|
|
|
height: childrenRect.height
|
2020-12-10 10:56:35 +00:00
|
|
|
width: chatName.width + (ensOrAlias.visible ? ensOrAlias.width + ensOrAlias.anchors.leftMargin : 0)
|
2020-12-08 15:45:43 +00:00
|
|
|
property alias label: chatName
|
2020-07-20 17:34:20 +00:00
|
|
|
visible: isMessage && authorCurrentMsg != authorPrevMsg
|
2020-12-08 15:45:43 +00:00
|
|
|
|
|
|
|
StyledTextEdit {
|
|
|
|
id: chatName
|
2021-04-29 19:08:57 +00:00
|
|
|
text: displayUserName
|
2020-12-11 18:15:40 +00:00
|
|
|
color: text.startsWith("@") || isCurrentUser || localName !== "" ? Style.current.blue : Style.current.secondaryText
|
2020-12-08 15:45:43 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: Style.current.secondaryTextFontSize
|
2021-01-25 20:50:42 +00:00
|
|
|
font.underline: root.isHovered
|
2020-12-08 15:45:43 +00:00
|
|
|
readOnly: true
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
selectByMouse: true
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
2021-01-25 20:50:42 +00:00
|
|
|
root.isHovered = true
|
2020-12-08 15:45:43 +00:00
|
|
|
}
|
|
|
|
onExited: {
|
2021-01-25 20:50:42 +00:00
|
|
|
root.isHovered = false
|
2020-12-08 15:45:43 +00:00
|
|
|
}
|
|
|
|
onClicked: {
|
2021-08-25 20:31:00 +00:00
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
|
|
|
messageContextMenu.parent = root
|
|
|
|
messageContextMenu.setXPosition = function() { return 0}
|
|
|
|
messageContextMenu.setYPosition = function() { return root.height + 4}
|
2020-12-08 15:45:43 +00:00
|
|
|
clickMessage(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: ensOrAlias
|
2020-12-11 18:15:40 +00:00
|
|
|
visible: localName !== "" && userName.startsWith("@")
|
|
|
|
text: userName
|
2020-12-08 15:45:43 +00:00
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.pixelSize: chatName.font.pixelSize
|
|
|
|
anchors.left: chatName.right
|
|
|
|
anchors.leftMargin: chatName.visible ? 4 : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|