2020-06-17 15:56:48 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import Qt.labs.platform 1.1
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-25 14:33:41 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1 as StatusQControls
|
2021-10-20 22:47:23 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
2022-04-07 19:05:33 +00:00
|
|
|
import shared.controls.chat 1.0
|
2020-06-17 15:56:48 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2022-04-07 19:05:33 +00:00
|
|
|
id: root
|
|
|
|
|
2020-06-17 15:56:48 +00:00
|
|
|
property string pubKey: "0x123456"
|
|
|
|
property string name: "Jotaro Kujo"
|
2022-03-30 15:30:28 +00:00
|
|
|
property string image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
|
2020-06-17 15:56:48 +00:00
|
|
|
|
2020-06-22 12:16:44 +00:00
|
|
|
property bool isContact: true
|
2020-06-17 15:56:48 +00:00
|
|
|
property bool isUser: false
|
|
|
|
property bool isVisible: true
|
|
|
|
|
|
|
|
property bool showCheckbox: true
|
2021-01-19 19:26:59 +00:00
|
|
|
property bool clickable: true
|
2020-06-17 15:56:48 +00:00
|
|
|
property bool isChecked: false
|
2021-01-19 19:26:59 +00:00
|
|
|
property bool isHovered: false
|
2020-06-17 15:56:48 +00:00
|
|
|
property var onItemChecked: (function(pubKey, itemChecked) { console.log(pubKey, itemChecked) })
|
|
|
|
|
2021-02-08 12:21:23 +00:00
|
|
|
property var onContactClicked
|
|
|
|
|
2020-06-22 12:16:44 +00:00
|
|
|
visible: isVisible && (isContact || isUser)
|
|
|
|
height: visible ? 64 : 0
|
2020-06-17 15:56:48 +00:00
|
|
|
border.width: 0
|
2020-07-02 15:14:31 +00:00
|
|
|
radius: Style.current.radius
|
2021-01-19 19:26:59 +00:00
|
|
|
color: isHovered ? Style.current.backgroundHover : Style.current.transparent
|
2020-06-17 15:56:48 +00:00
|
|
|
|
2022-04-07 19:05:33 +00:00
|
|
|
UserImage {
|
2020-06-17 15:56:48 +00:00
|
|
|
id: accountImage
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-01-19 19:26:59 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2022-04-07 19:05:33 +00:00
|
|
|
|
|
|
|
pubkey: root.pubKey
|
|
|
|
name: root.name
|
|
|
|
image: root.image
|
2020-06-17 15:56:48 +00:00
|
|
|
}
|
2022-02-09 09:43:23 +00:00
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-17 15:56:48 +00:00
|
|
|
id: usernameText
|
|
|
|
text: name
|
|
|
|
elide: Text.ElideRight
|
2022-04-13 08:06:23 +00:00
|
|
|
anchors.right: assetCheck.visible ? assetCheck.left : parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-17 15:56:48 +00:00
|
|
|
font.pixelSize: 17
|
|
|
|
anchors.top: accountImage.top
|
|
|
|
anchors.topMargin: 10
|
|
|
|
anchors.left: accountImage.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-17 15:56:48 +00:00
|
|
|
}
|
|
|
|
|
2021-10-25 14:33:41 +00:00
|
|
|
StatusQControls.StatusCheckBox {
|
2020-06-17 15:56:48 +00:00
|
|
|
id: assetCheck
|
2021-01-19 19:26:59 +00:00
|
|
|
visible: showCheckbox && !isUser
|
2020-06-17 15:56:48 +00:00
|
|
|
anchors.top: accountImage.top
|
|
|
|
anchors.topMargin: 6
|
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-17 15:56:48 +00:00
|
|
|
checked: isChecked
|
|
|
|
onClicked: {
|
|
|
|
isChecked = !isChecked
|
|
|
|
onItemChecked(pubKey, isChecked)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-17 15:56:48 +00:00
|
|
|
visible: isUser
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Admin")
|
2020-06-17 15:56:48 +00:00
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-17 15:56:48 +00:00
|
|
|
font.pixelSize: 15
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.darkGrey
|
2020-06-17 15:56:48 +00:00
|
|
|
anchors.top: accountImage.top
|
|
|
|
anchors.topMargin: 10
|
|
|
|
}
|
2020-09-08 12:00:38 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
2021-01-19 19:26:59 +00:00
|
|
|
enabled: root.clickable || root.showCheckbox
|
|
|
|
hoverEnabled: root.clickable || root.showCheckbox
|
|
|
|
onEntered: root.isHovered = true
|
|
|
|
onExited: root.isHovered = false
|
2021-02-08 12:21:23 +00:00
|
|
|
onClicked: {
|
|
|
|
if (typeof root.onContactClicked !== "function") {
|
|
|
|
return assetCheck.clicked()
|
|
|
|
}
|
|
|
|
root.onContactClicked()
|
|
|
|
}
|
2020-09-08 12:00:38 +00:00
|
|
|
}
|
2020-06-17 15:56:48 +00:00
|
|
|
}
|