2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtGraphicalEffects 1.15
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-10-26 14:21:08 +00:00
|
|
|
import StatusQ.Components 0.1
|
2024-10-15 19:26:12 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-26 14:21:08 +00:00
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
2020-08-18 19:10:30 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2021-09-28 15:04:06 +00:00
|
|
|
property url collectibleIconSource: "CryptoKitties"
|
2020-08-18 19:10:30 +00:00
|
|
|
property string collectibleName: "CryptoKitties"
|
|
|
|
property bool isLoading: true
|
|
|
|
property bool hovered: false
|
2020-08-18 20:11:36 +00:00
|
|
|
property var toggleCollectible: function () {}
|
2020-08-19 21:09:11 +00:00
|
|
|
property int collectiblesQty: 6
|
2020-08-18 19:10:30 +00:00
|
|
|
|
|
|
|
id: collectibleHeader
|
|
|
|
height: 64
|
|
|
|
width: parent.width
|
2024-10-15 19:26:12 +00:00
|
|
|
color: hovered ? Theme.palette.backgroundHover : Theme.palette.transparent
|
2020-08-18 19:10:30 +00:00
|
|
|
border.width: 0
|
2024-10-15 19:26:12 +00:00
|
|
|
radius: Theme.radius
|
2020-08-18 19:10:30 +00:00
|
|
|
|
|
|
|
Image {
|
|
|
|
id: collectibleIconImage
|
|
|
|
source: collectibleHeader.collectibleIconSource
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
anchors.left: parent.left
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2020-08-18 19:10:30 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2023-04-26 15:33:24 +00:00
|
|
|
cache: false
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-25 16:52:06 +00:00
|
|
|
id: collectibleName
|
2020-08-18 19:10:30 +00:00
|
|
|
text: collectibleHeader.collectibleName
|
|
|
|
anchors.left: collectibleIconImage.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2020-08-18 19:10:30 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-09-25 16:52:06 +00:00
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
visible: collectiblesQty >= Constants.maxTokens
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Maximum number of collectibles to display reached")
|
2020-09-25 16:52:06 +00:00
|
|
|
font.pixelSize: 17
|
2024-10-15 19:26:12 +00:00
|
|
|
color: Theme.palette.secondaryText
|
2020-09-25 16:52:06 +00:00
|
|
|
anchors.left: collectibleName.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2020-09-25 16:52:06 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
active: true
|
|
|
|
sourceComponent: collectibleHeader.isLoading ? loadingComponent : handleComponent
|
|
|
|
anchors.right: parent.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.rightMargin: Theme.padding
|
2020-08-18 19:10:30 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loadingComponent
|
|
|
|
|
2021-04-26 10:25:01 +00:00
|
|
|
StatusLoadingIndicator {}
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: handleComponent
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: element1
|
|
|
|
width: childrenRect.width
|
|
|
|
height: numberCollectibleText.height
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: numberCollectibleText
|
2024-10-15 19:26:12 +00:00
|
|
|
color: Theme.palette.secondaryText
|
2020-08-24 20:50:49 +00:00
|
|
|
text: !!error ? "-" : collectibleHeader.collectiblesQty
|
2020-08-18 19:10:30 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: caretImg
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
source: Theme.svg("caret")
|
2020-08-18 19:10:30 +00:00
|
|
|
width: 11
|
|
|
|
anchors.left: numberCollectibleText.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.leftMargin: Theme.padding
|
2020-08-18 19:10:30 +00:00
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: caretImg
|
|
|
|
source: caretImg
|
2024-10-15 19:26:12 +00:00
|
|
|
color: Theme.palette.black
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
enabled: !collectibleHeader.isLoading
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
collectibleHeader.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
collectibleHeader.hovered = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
2020-08-18 20:11:36 +00:00
|
|
|
collectibleHeader.toggleCollectible()
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|