2020-08-18 20:11:36 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2020-08-19 21:09:11 +00:00
|
|
|
import QtQml.Models 2.13
|
2020-08-18 20:11:36 +00:00
|
|
|
import "../../../../../imports"
|
|
|
|
import "../../../../../shared"
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
property var collectibles: [{
|
|
|
|
name: "Kitty cat1",
|
|
|
|
image: "../../../../img/collectibles/placeholders/kitty.png",
|
2020-08-19 15:58:25 +00:00
|
|
|
collectibleId: "1337",
|
|
|
|
description: "Avast ye! I'm the dread pirate Furbeard, and I'll most likely sleep"
|
2020-08-18 20:11:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Kitty cat2",
|
|
|
|
image: "../../../../img/collectibles/placeholders/kitty.png",
|
2020-08-19 15:58:25 +00:00
|
|
|
collectibleId: "1338",
|
|
|
|
description: "Avast ye! I'm the dread pirate Furbeard, and I'll most likely sleep"
|
2020-08-18 20:11:36 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Kitty cat3",
|
|
|
|
image: "../../../../img/collectibles/placeholders/kitty.png",
|
2020-08-19 15:58:25 +00:00
|
|
|
collectibleId: "1339",
|
|
|
|
description: "Avast ye! I'm the dread pirate Furbeard, and I'll most likely sleep"
|
2020-08-18 20:11:36 +00:00
|
|
|
}]
|
|
|
|
readonly property int imageSize: 164
|
2020-08-19 21:09:11 +00:00
|
|
|
property string collectibleType: "cryptokitty"
|
2020-08-19 15:58:25 +00:00
|
|
|
property var collectiblesModal
|
|
|
|
property string buttonText: "View in Cryptokitties"
|
|
|
|
property var getLink: function () {}
|
2020-08-19 21:09:11 +00:00
|
|
|
property alias collectiblesQty: collectibleModel.count
|
2020-08-18 20:11:36 +00:00
|
|
|
|
|
|
|
id: root
|
2020-08-19 21:09:11 +00:00
|
|
|
height: visible ? contentRow.height : 0
|
2020-08-18 20:11:36 +00:00
|
|
|
width: parent.width
|
|
|
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
Row {
|
|
|
|
id: contentRow
|
|
|
|
bottomPadding: Style.current.padding
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
Repeater {
|
2020-08-19 21:09:11 +00:00
|
|
|
model: collectibleModel
|
|
|
|
}
|
|
|
|
|
|
|
|
DelegateModel {
|
|
|
|
id: collectibleModel
|
|
|
|
model: walletModel.collectibles
|
|
|
|
items.includeByDefault: false
|
|
|
|
|
|
|
|
groups: [
|
|
|
|
DelegateModelGroup {
|
|
|
|
id: uncheckedItems
|
|
|
|
name: "unchecked"
|
|
|
|
includeByDefault: true
|
|
|
|
onChanged: {
|
|
|
|
while (uncheckedItems.count > 0) {
|
|
|
|
var currentItem = uncheckedItems.get(0)
|
|
|
|
if (currentItem.model.collectibleType === root.collectibleType) {
|
|
|
|
currentItem.groups = "items"
|
|
|
|
} else {
|
|
|
|
currentItem.groups = "bad"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
DelegateModelGroup {
|
|
|
|
id: badCollectibleGroup
|
|
|
|
name: "bad"
|
|
|
|
includeByDefault: true
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
2020-08-18 20:11:36 +00:00
|
|
|
|
2020-08-19 21:09:11 +00:00
|
|
|
delegate: Rectangle {
|
2020-08-18 20:11:36 +00:00
|
|
|
radius: 16
|
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
|
|
|
color: Style.current.background
|
|
|
|
width: collectibleImage.width
|
|
|
|
height: collectibleImage.height
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: collectibleImage
|
|
|
|
width: root.imageSize
|
|
|
|
height: root.imageSize
|
2020-08-19 21:09:11 +00:00
|
|
|
source: image
|
2020-08-18 20:11:36 +00:00
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
}
|
2020-08-19 15:58:25 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
collectiblesModal.openModal({
|
2020-08-19 21:09:11 +00:00
|
|
|
name: name,
|
|
|
|
id: collectibleId,
|
|
|
|
// TODO do we even have a description?
|
|
|
|
description: "",
|
2020-08-19 15:58:25 +00:00
|
|
|
buttonText: root.buttonText,
|
2020-08-19 21:09:11 +00:00
|
|
|
link: root.getLink(collectibleId),
|
|
|
|
image: image
|
2020-08-19 15:58:25 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2020-08-18 20:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|