2021-10-01 15:58:36 +00:00
|
|
|
import QtQuick 2.3
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
import StatusQ.Components 0.1
|
2022-04-07 19:02:54 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
Loader {
|
|
|
|
id: root
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2022-04-14 08:26:46 +00:00
|
|
|
property int imageHeight: 36
|
|
|
|
property int imageWidth: 36
|
2022-03-09 10:27:32 +00:00
|
|
|
|
|
|
|
property string name
|
|
|
|
property string pubkey
|
2022-03-30 15:30:28 +00:00
|
|
|
property string image
|
2022-04-07 19:02:54 +00:00
|
|
|
property bool showRing: true
|
2022-03-09 10:27:32 +00:00
|
|
|
property bool interactive: true
|
2022-07-21 10:57:41 +00:00
|
|
|
property var messageContextMenu
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2022-04-07 19:02:54 +00:00
|
|
|
property int colorId: Utils.colorIdForPubkey(pubkey)
|
|
|
|
property var colorHash: Utils.getColorHashAsJson(pubkey)
|
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
signal clicked()
|
|
|
|
|
|
|
|
sourceComponent: StatusSmartIdenticon {
|
|
|
|
name: root.name
|
|
|
|
image {
|
|
|
|
width: root.imageWidth
|
|
|
|
height: root.imageHeight
|
2022-03-30 15:30:28 +00:00
|
|
|
source: root.image
|
2022-03-09 10:27:32 +00:00
|
|
|
}
|
|
|
|
icon {
|
|
|
|
width: root.imageWidth
|
|
|
|
height: root.imageHeight
|
2022-04-07 19:02:54 +00:00
|
|
|
color: Theme.palette.userCustomizationColors[root.colorId]
|
2022-03-09 10:27:32 +00:00
|
|
|
charactersLen: 2
|
|
|
|
}
|
|
|
|
ringSettings {
|
2022-04-07 19:02:54 +00:00
|
|
|
ringSpecModel: root.showRing ? root.colorHash : undefined
|
2022-03-09 10:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
active: root.interactive
|
2021-12-09 12:53:40 +00:00
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
sourceComponent: MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
2022-07-21 10:57:41 +00:00
|
|
|
onClicked: {
|
|
|
|
if (!!root.messageContextMenu) {
|
|
|
|
// Set parent, X & Y positions for the messageContextMenu
|
|
|
|
root.messageContextMenu.parent = root
|
|
|
|
root.messageContextMenu.setXPosition = function() { return root.width + 4 }
|
|
|
|
root.messageContextMenu.setYPosition = function() { return 0 }
|
|
|
|
}
|
|
|
|
root.clicked()
|
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|