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-08-10 14:04:56 +00:00
|
|
|
property int imageHeight: 44
|
|
|
|
property int imageWidth: 44
|
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-09-15 07:31:38 +00:00
|
|
|
property bool disabled: false
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2022-11-08 18:30:50 +00:00
|
|
|
property rect cropRect: undefined
|
|
|
|
|
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
|
2022-08-11 11:55:08 +00:00
|
|
|
asset {
|
2022-03-09 10:27:32 +00:00
|
|
|
width: root.imageWidth
|
|
|
|
height: root.imageHeight
|
2022-04-07 19:02:54 +00:00
|
|
|
color: Theme.palette.userCustomizationColors[root.colorId]
|
2022-08-11 11:55:08 +00:00
|
|
|
name: root.image
|
2022-03-09 10:27:32 +00:00
|
|
|
charactersLen: 2
|
2022-08-11 11:55:08 +00:00
|
|
|
isImage: true
|
2022-11-08 18:30:50 +00:00
|
|
|
cropRect: root.cropRect
|
2022-03-09 10:27:32 +00:00
|
|
|
}
|
|
|
|
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 {
|
2022-09-15 07:31:38 +00:00
|
|
|
cursorShape: hoverEnabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
hoverEnabled: !root.disabled
|
2022-07-21 10:57:41 +00:00
|
|
|
onClicked: {
|
2022-09-15 07:31:38 +00:00
|
|
|
if (!root.disabled) {
|
|
|
|
root.clicked()
|
|
|
|
}
|
2022-07-21 10:57:41 +00:00
|
|
|
}
|
2021-10-01 15:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|