2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2020-08-18 18:46:11 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2020-06-18 15:31:52 +00:00
|
|
|
import "../../../imports"
|
2020-06-19 18:06:58 +00:00
|
|
|
import "../../../shared"
|
2020-05-28 14:54:42 +00:00
|
|
|
|
|
|
|
Item {
|
2020-08-18 18:46:11 +00:00
|
|
|
property bool isLoading: true
|
|
|
|
id: root
|
2020-07-28 18:19:46 +00:00
|
|
|
|
2020-07-30 20:46:25 +00:00
|
|
|
Loader {
|
2020-08-18 18:46:11 +00:00
|
|
|
active: true
|
|
|
|
sourceComponent: true || root.isLoading || walletModel.collectibles.rowCount() > 0 ? collectiblesListComponent
|
|
|
|
: noCollectiblesComponent
|
|
|
|
width: parent.width
|
2020-07-30 20:46:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
2020-08-18 18:46:11 +00:00
|
|
|
id: noCollectiblesComponent
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
text: qsTr("Collectibles will appear here")
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 15
|
|
|
|
visible: !root.isLoading && walletModel.collectibles.rowCount() === 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: collectiblesListComponent
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
property bool hovered: false
|
|
|
|
|
|
|
|
id: collectibleHeader
|
|
|
|
height: 64
|
|
|
|
width: parent.width
|
|
|
|
color: hovered ? Style.current.backgroundHover : Style.current.transparent
|
|
|
|
border.width: 0
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: collectibleIconImage
|
|
|
|
source: "../../img/collectibles/CryptoKitties.png"
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
text: "CryptoKitties"
|
|
|
|
anchors.left: collectibleIconImage.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
active: true
|
|
|
|
sourceComponent: root.isLoading ? loadingComponent : handleComponent
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loadingComponent
|
|
|
|
|
|
|
|
LoadingImage {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: handleComponent
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: element1
|
|
|
|
width: childrenRect.width
|
|
|
|
height: numberCollectibleText.height
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: numberCollectibleText
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
// TODO change with number of current collectible
|
|
|
|
text: "6"
|
|
|
|
font.pixelSize: 15
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: caretImg
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
source: "../../img/caret.svg"
|
|
|
|
width: 11
|
|
|
|
anchors.left: numberCollectibleText.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: caretImg
|
|
|
|
source: caretImg
|
|
|
|
color: Style.current.black
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
enabled: !root.isLoading
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
collectibleHeader.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
collectibleHeader.hovered = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
console.log('Open collectibles')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-28 18:19:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: walletModel
|
|
|
|
onLoadingCollectibles: {
|
2020-08-18 18:46:11 +00:00
|
|
|
root.isLoading= isLoading
|
2020-07-28 18:19:46 +00:00
|
|
|
}
|
2020-06-18 15:31:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: collectiblesViewDelegate
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: element
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 0
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 0
|
2020-06-25 13:23:17 +00:00
|
|
|
height: 132
|
2020-06-18 15:31:52 +00:00
|
|
|
|
2020-06-25 13:23:17 +00:00
|
|
|
SVGImage {
|
2020-06-18 15:31:52 +00:00
|
|
|
id: collectibleImage
|
2020-06-25 13:23:17 +00:00
|
|
|
width: 128
|
|
|
|
height: 128
|
2020-06-18 15:31:52 +00:00
|
|
|
source: image
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-18 15:31:52 +00:00
|
|
|
id: collectibleName
|
|
|
|
text: name
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: collectibleImage.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-18 15:24:44 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-18 15:24:44 +00:00
|
|
|
id: collectibleIdText
|
|
|
|
text: collectibleId
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-18 15:24:44 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: collectibleName.right
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.darkGrey
|
2020-06-18 15:31:52 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: exampleModel
|
|
|
|
|
|
|
|
ListElement {
|
|
|
|
name: "Kitty cat"
|
|
|
|
image: "../../img/token-icons/eth.svg"
|
2020-06-18 15:24:44 +00:00
|
|
|
collectibleId: "1337"
|
2020-06-18 15:31:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-18 18:46:11 +00:00
|
|
|
// ListView {
|
|
|
|
// id: assetListView
|
|
|
|
// spacing: Style.current.smallPadding
|
|
|
|
// anchors.topMargin: Style.current.bigPadding
|
|
|
|
// anchors.fill: parent
|
|
|
|
//// model: exampleModel
|
|
|
|
// model: walletModel.collectibles
|
|
|
|
// delegate: collectiblesViewDelegate
|
|
|
|
// }
|
2020-05-28 14:54:42 +00:00
|
|
|
}
|
2020-06-17 19:18:31 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-06-18 15:31:52 +00:00
|
|
|
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
|
2020-06-17 19:18:31 +00:00
|
|
|
}
|
|
|
|
##^##*/
|