2024-09-18 08:19:08 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2022-05-06 06:46:41 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2024-05-13 08:05:53 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2022-05-06 06:46:41 +00:00
|
|
|
|
|
|
|
import shared.controls.chat 1.0
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-08-22 15:35:39 +00:00
|
|
|
Item {
|
2022-05-06 06:46:41 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property string label: ""
|
|
|
|
property string colorId: ""
|
|
|
|
property var colorHash
|
2022-08-11 11:55:08 +00:00
|
|
|
property string image: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
property bool keycardCreatedAccount: false
|
2022-09-09 12:51:10 +00:00
|
|
|
|
2022-08-11 11:55:08 +00:00
|
|
|
property StatusAssetSettings asset: StatusAssetSettings {
|
2024-09-18 08:19:08 +00:00
|
|
|
name: "add"
|
2022-05-11 14:45:15 +00:00
|
|
|
}
|
2022-09-09 12:51:10 +00:00
|
|
|
|
2022-05-06 06:46:41 +00:00
|
|
|
signal clicked()
|
|
|
|
|
2024-09-18 08:19:08 +00:00
|
|
|
implicitWidth: parent.width
|
2022-05-06 06:46:41 +00:00
|
|
|
height: 64
|
2022-12-01 16:58:37 +00:00
|
|
|
|
2022-08-22 15:35:39 +00:00
|
|
|
Rectangle {
|
|
|
|
anchors.fill: root
|
2022-12-01 16:58:37 +00:00
|
|
|
color: sensor.containsMouse ? Theme.palette.statusSelect.menuItemHoverBackgroundColor
|
|
|
|
: Theme.palette.statusSelect.menuItemBackgroundColor
|
2022-05-06 06:46:41 +00:00
|
|
|
}
|
2022-08-22 15:35:39 +00:00
|
|
|
|
2022-05-06 06:46:41 +00:00
|
|
|
Loader {
|
|
|
|
id: userImageOrIcon
|
|
|
|
sourceComponent: !!root.image.toString() || !!root.colorId ? userImage : addIcon
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: addIcon
|
|
|
|
StatusRoundIcon {
|
2022-09-09 12:51:10 +00:00
|
|
|
asset.name: root.asset.name
|
2022-05-06 06:46:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: userImage
|
|
|
|
UserImage {
|
|
|
|
name: root.label
|
|
|
|
image: root.image
|
|
|
|
colorId: root.colorId
|
|
|
|
colorHash: root.colorHash
|
2022-08-09 14:41:23 +00:00
|
|
|
imageHeight: Constants.onboarding.userImageHeight
|
|
|
|
imageWidth: Constants.onboarding.userImageWidth
|
2022-05-06 06:46:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
2024-05-13 08:05:53 +00:00
|
|
|
text: StatusQUtils.Emoji.parse(root.label)
|
2022-05-06 06:46:41 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: userImageOrIcon.right
|
2022-07-21 11:29:18 +00:00
|
|
|
anchors.right: root.keycardCreatedAccount? keycardIcon.left : parent.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2024-09-18 08:19:08 +00:00
|
|
|
anchors.rightMargin: root.keycardCreatedAccount ? 0 : Style.current.padding
|
2022-05-06 06:46:41 +00:00
|
|
|
color: !!root.colorId ? Theme.palette.directColor1 : Theme.palette.primaryColor1
|
2022-07-21 11:29:18 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: keycardIcon
|
|
|
|
active: root.keycardCreatedAccount
|
|
|
|
sourceComponent: keycardIconComponent
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardIconComponent
|
|
|
|
StatusIcon {
|
|
|
|
icon: "keycard"
|
|
|
|
height: Style.current.padding
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
2022-05-06 06:46:41 +00:00
|
|
|
}
|
2024-05-13 08:05:53 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: sensor
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: root
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
root.clicked()
|
|
|
|
}
|
|
|
|
}
|
2022-05-06 06:46:41 +00:00
|
|
|
}
|
|
|
|
|