2024-09-18 08:19:08 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
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
|
2022-03-30 15:30:28 +00:00
|
|
|
property string image
|
2024-01-05 15:34:20 +00:00
|
|
|
property bool showRing: !ensVerified && !root.isBridgedAccount
|
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-12-01 10:24:25 +00:00
|
|
|
property bool ensVerified: false
|
2023-04-06 07:56:50 +00:00
|
|
|
property bool loading: false
|
2024-01-05 15:34:20 +00:00
|
|
|
property bool isBridgedAccount: false
|
2024-02-09 15:52:28 +00:00
|
|
|
property int onlineStatus: Constants.onlineStatus.unknown
|
2022-03-09 10:27:32 +00:00
|
|
|
|
2024-11-06 20:08:22 +00:00
|
|
|
property int colorId
|
|
|
|
property var colorHash: []
|
2022-04-07 19:02:54 +00:00
|
|
|
|
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-12-01 10:24:25 +00:00
|
|
|
color: Utils.colorForColorId(root.colorId)
|
2022-08-11 11:55:08 +00:00
|
|
|
name: root.image
|
|
|
|
isImage: true
|
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
|
|
|
}
|
2023-04-06 07:56:50 +00:00
|
|
|
loading: root.loading
|
2024-02-09 15:52:28 +00:00
|
|
|
|
|
|
|
badge.visible: root.onlineStatus !== Constants.onlineStatus.unknown && !root.isBridgedAccount
|
|
|
|
badge.width: root.imageWidth/4
|
|
|
|
badge.height: root.imageWidth/4
|
|
|
|
badge.border.width: 0.05 * root.imageWidth
|
|
|
|
badge.border.color: Theme.palette.statusBadge.foregroundColor
|
|
|
|
badge.color: {
|
|
|
|
if (root.onlineStatus === Constants.onlineStatus.online)
|
2024-10-15 19:26:12 +00:00
|
|
|
return Theme.palette.successColor1
|
|
|
|
return Theme.palette.baseColor1
|
2024-02-09 15:52:28 +00:00
|
|
|
}
|
|
|
|
badge.anchors.rightMargin: badge.border.width/2
|
|
|
|
badge.anchors.bottomMargin: badge.border.width/2
|
|
|
|
|
2024-01-05 15:34:20 +00:00
|
|
|
bridgeBadge.visible: root.isBridgedAccount
|
2024-10-15 19:26:12 +00:00
|
|
|
bridgeBadge.image.source: Theme.svg("discord-bridge")
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|