status-desktop/ui/shared/RoundedImage.qml
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

34 lines
717 B
QML

import QtQuick 2.12
import QtGraphicalEffects 1.0
Rectangle {
id: root
signal clicked
property alias source: imgStickerPackThumb.source
radius: width / 2
width: 24
height: 24
// apply rounded corners mask
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Rectangle {
x: root.x; y: root.y
width: root.width
height: root.height
radius: root.radius
}
}
ImageLoader {
id: imgStickerPackThumb
opacity: 1
smooth: false
radius: root.radius
anchors.fill: parent
source: "https://ipfs.infura.io/ipfs/" + thumbnail
onClicked: root.clicked()
}
}