emizzle 5eabcd2725 feat: Add loading and reload states to stickers/packs
Related to: #586.

Adds a loading state to stickers, so that a loading indicator appears while the sticker is being downloaded from IPFS.

In the case of a network failure or timetout, a reload button is shown instead. Once network is restored and the reload button is clicked, the image is reloaded from the network, going through the same lifecycle of showing the loading state first.
2020-09-29 13:27:50 -04:00

35 lines
864 B
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import "../../../../imports"
import "../../../../shared"
GridView {
id: root
visible: count > 0
anchors.fill: parent
cellWidth: 88
cellHeight: 88
model: stickerList
focus: true
clip: true
signal stickerClicked(string hash, int packId)
delegate: Item {
width: stickerGrid.cellWidth
height: stickerGrid.cellHeight
Column {
anchors.fill: parent
anchors.topMargin: 4
anchors.leftMargin: 4
ImageLoader {
width: 80
height: 80
source: "https://ipfs.infura.io/ipfs/" + url
onClicked: {
root.stickerClicked(hash, packId)
}
}
}
}
}