2020-06-17 15:18:31 -04:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-06-03 16:50:59 -04:00
|
|
|
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
2022-04-07 21:02:54 +02:00
|
|
|
import shared.controls.chat 1.0
|
2021-10-12 20:26:02 +02:00
|
|
|
|
2021-10-25 14:30:23 +02:00
|
|
|
import StatusQ.Controls 0.1 as StatusQControls
|
2021-10-21 00:47:23 +02:00
|
|
|
import StatusQ.Components 0.1
|
2021-10-25 14:30:23 +02:00
|
|
|
|
2021-10-14 10:04:15 +02:00
|
|
|
Rectangle {
|
2022-04-01 13:46:32 +02:00
|
|
|
id: root
|
2021-10-12 20:26:02 +02:00
|
|
|
|
2020-06-03 16:50:59 -04:00
|
|
|
property string username: "Jotaro Kujo"
|
2021-07-26 09:17:49 +02:00
|
|
|
property string keyUid: "0x123345677890987654321123456"
|
|
|
|
property string address: ""
|
2022-04-07 21:02:54 +02:00
|
|
|
property var colorHash
|
|
|
|
property int colorId
|
2022-03-30 17:30:28 +02:00
|
|
|
property url image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAg0lEQVR4nOzXwQmAMBAFURV7sQybsgybsgyr0QYUlE1g+Mw7ioQMe9lMQwhDaAyhMYTGEJqYkPnrj/t5XE/ft2UdW1yken7MRAyhMYTGEBpDaAyhKe9JbzvSX9WdLWYihtAYQuMLkcYQGkPUScxEDKExhMYQGkNoDKExhMYQmjsAAP//ZfIUZgXTZXQAAAAASUVORK5CYII="
|
2020-06-04 09:00:17 -04:00
|
|
|
property var onAccountSelect: function() {}
|
2020-06-13 11:17:54 -04:00
|
|
|
property var isSelected: function() {}
|
|
|
|
property bool selected: {
|
2021-10-14 10:04:15 +02:00
|
|
|
return isSelected(index, keyUid)
|
2020-06-13 11:17:54 -04:00
|
|
|
}
|
2020-06-11 17:23:27 -04:00
|
|
|
property bool isHovered: false
|
2020-06-03 16:50:59 -04:00
|
|
|
|
2020-06-11 17:23:27 -04:00
|
|
|
height: 64
|
2020-06-03 16:50:59 -04:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
2020-06-11 17:23:27 -04:00
|
|
|
border.width: 0
|
2020-09-29 16:39:29 +10:00
|
|
|
color: getBgColor()
|
2020-07-02 11:14:31 -04:00
|
|
|
radius: Style.current.radius
|
2020-06-03 16:50:59 -04:00
|
|
|
|
2020-09-29 16:39:29 +10:00
|
|
|
function getBgColor() {
|
|
|
|
if (selected) return Style.current.secondaryBackground
|
|
|
|
if (isHovered) return Style.current.backgroundHover
|
|
|
|
return Style.current.transparent
|
|
|
|
}
|
|
|
|
|
2022-04-07 21:02:54 +02:00
|
|
|
UserImage {
|
2020-06-11 17:23:27 -04:00
|
|
|
id: accountImage
|
2022-04-07 21:02:54 +02:00
|
|
|
|
2020-06-11 17:23:27 -04:00
|
|
|
anchors.left: parent.left
|
2020-07-02 11:14:31 -04:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-11 17:23:27 -04:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2022-04-07 21:02:54 +02:00
|
|
|
|
2022-04-01 13:46:32 +02:00
|
|
|
name: root.username
|
2022-04-07 21:02:54 +02:00
|
|
|
image: root.image
|
|
|
|
colorId: root.colorId
|
|
|
|
colorHash: root.colorHash
|
2020-06-11 17:23:27 -04:00
|
|
|
}
|
2021-10-21 00:47:23 +02:00
|
|
|
|
2020-06-19 14:06:58 -04:00
|
|
|
StyledText {
|
2020-06-11 17:23:27 -04:00
|
|
|
id: usernameText
|
|
|
|
text: username
|
2020-06-13 11:17:54 -04:00
|
|
|
elide: Text.ElideRight
|
|
|
|
anchors.right: parent.right
|
2020-09-29 16:39:29 +10:00
|
|
|
anchors.rightMargin: Style.current.padding + radio.width
|
2020-06-11 17:23:27 -04:00
|
|
|
font.pixelSize: 17
|
|
|
|
anchors.top: accountImage.top
|
|
|
|
anchors.left: accountImage.right
|
2020-07-02 11:14:31 -04:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-11 17:23:27 -04:00
|
|
|
}
|
|
|
|
|
2020-06-19 14:06:58 -04:00
|
|
|
StyledText {
|
2020-06-11 17:23:27 -04:00
|
|
|
id: addressText
|
|
|
|
width: 108
|
|
|
|
text: address
|
2022-09-15 17:23:51 +02:00
|
|
|
font.family: Style.current.monoFont.name
|
2020-06-11 17:23:27 -04:00
|
|
|
elide: Text.ElideMiddle
|
|
|
|
anchors.bottom: accountImage.bottom
|
|
|
|
anchors.bottomMargin: 0
|
|
|
|
anchors.left: usernameText.left
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
font.pixelSize: 15
|
2021-03-24 12:42:41 +01:00
|
|
|
color: Style.current.secondaryText
|
2020-06-11 17:23:27 -04:00
|
|
|
}
|
|
|
|
|
2021-10-25 14:30:23 +02:00
|
|
|
StatusQControls.StatusRadioButton {
|
2020-09-29 16:39:29 +10:00
|
|
|
id: radio
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2022-04-01 13:46:32 +02:00
|
|
|
checked: root.selected
|
2020-09-29 16:39:29 +10:00
|
|
|
}
|
|
|
|
|
2020-06-11 17:23:27 -04:00
|
|
|
MouseArea {
|
|
|
|
hoverEnabled: true
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
2021-10-14 10:04:15 +02:00
|
|
|
onAccountSelect(index)
|
2020-06-03 16:50:59 -04:00
|
|
|
}
|
2020-06-11 17:23:27 -04:00
|
|
|
onEntered: {
|
2022-04-01 13:46:32 +02:00
|
|
|
root.isHovered = true
|
2020-06-03 16:50:59 -04:00
|
|
|
}
|
2020-06-11 17:23:27 -04:00
|
|
|
onExited: {
|
2022-04-01 13:46:32 +02:00
|
|
|
root.isHovered = false
|
2020-06-03 16:50:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|