Show spinner for loading media event thumbnails

This commit is contained in:
miruka 2020-07-16 17:15:33 -04:00
parent 606fe3d022
commit 0515a94429
2 changed files with 11 additions and 6 deletions

View File

@ -15,7 +15,6 @@ Image {
property alias radius: roundMask.radius property alias radius: roundMask.radius
property alias showProgressBar: progressBarLoader.active property alias showProgressBar: progressBarLoader.active
property bool inderterminateProgressBar: false
readonly property int circleRadius: readonly property int circleRadius:
Math.ceil(Math.max(image.width, image.height)) Math.ceil(Math.max(image.width, image.height))
@ -104,15 +103,20 @@ Image {
HLoader { HLoader {
id: progressBarLoader id: progressBarLoader
readonly property alias progress: image.progress
readonly property Component determinate: HCircleProgressBar {
progress: image.progress
}
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(parent.width, parent.height) * 0.5 width: Math.min(parent.width, parent.height) * 0.5
height: width height: width
active: image.status === Image.Loading active: image.status === Image.Loading
sourceComponent: HBusyIndicator {}
sourceComponent: HCircleProgressBar { onProgressChanged:
id: progressBar if (progress > 0 && progress < 1) sourceComponent = determinate
progress: image.progress
}
} }
HIcon { HIcon {

View File

@ -56,8 +56,9 @@ HImage {
} }
inderterminateProgressBar: isMxc
source: sourceOverride || (show ? cachedPath : "") source: sourceOverride || (show ? cachedPath : "")
showProgressBar:
(isMxc && status === Image.Null) || status === Image.Loading
onWidthChanged: Qt.callLater(update) onWidthChanged: Qt.callLater(update)
onHeightChanged: Qt.callLater(update) onHeightChanged: Qt.callLater(update)