2020-07-15 21:04:14 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import "../../../../../shared"
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2020-09-30 20:40:54 +00:00
|
|
|
Loader {
|
2021-04-23 15:49:05 +00:00
|
|
|
property int imageHeight: 36
|
|
|
|
property int imageWidth: 36
|
|
|
|
property string identiconImageSource: identicon
|
|
|
|
property string profileImage: profileImageSource
|
|
|
|
property bool isReplyImage: false
|
|
|
|
|
|
|
|
id: root
|
2021-02-09 14:53:54 +00:00
|
|
|
active: isMessage
|
2020-09-30 20:40:54 +00:00
|
|
|
height: active ? item.height : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2020-09-30 20:40:54 +00:00
|
|
|
sourceComponent: Component {
|
2020-11-30 17:03:52 +00:00
|
|
|
Item {
|
2020-09-30 20:40:54 +00:00
|
|
|
id: chatImage
|
|
|
|
width: identiconImage.width
|
|
|
|
height: identiconImage.height
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
RoundedImage {
|
2020-09-30 20:40:54 +00:00
|
|
|
id: identiconImage
|
2021-04-23 15:49:05 +00:00
|
|
|
width: root.imageWidth
|
|
|
|
height: root.imageHeight
|
2020-11-30 17:03:52 +00:00
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
|
|
|
source: {
|
2021-04-23 15:49:05 +00:00
|
|
|
if (root.profileImage) {
|
|
|
|
return root.profileImage
|
2020-11-30 17:03:52 +00:00
|
|
|
}
|
2021-01-28 20:13:20 +00:00
|
|
|
identiconImage.showLoadingIndicator = false
|
2021-04-23 15:49:05 +00:00
|
|
|
return !isCurrentUser || isReplyImage ? root.identiconImageSource : profileModel.profile.identicon
|
2020-11-30 17:03:52 +00:00
|
|
|
}
|
2020-09-30 20:40:54 +00:00
|
|
|
smooth: false
|
|
|
|
antialiasing: true
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2021-08-25 20:31:00 +00:00
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
|
|
|
messageContextMenu.parent = root
|
|
|
|
messageContextMenu.setXPosition = function() { return root.width + 4}
|
|
|
|
messageContextMenu.setYPosition = function() { return root.height/2 + 4}
|
2021-07-28 09:52:25 +00:00
|
|
|
clickMessage(true, false, false, null, false, false, isReplyImage)
|
2020-09-30 20:40:54 +00:00
|
|
|
}
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|