[Panorama Viewer] Loading indicator added

This commit is contained in:
Thomas Zorroche 2021-03-03 10:41:09 +01:00 committed by Fabien Castan
parent 1c3fbaa6e1
commit 3fe862834e
2 changed files with 28 additions and 4 deletions

View file

@ -18,7 +18,21 @@ AliceVision.PanoramaViewer {
// paintedWidth / paintedHeight / status for compatibility with standard Image
property int paintedWidth: textureSize.width
property int paintedHeight: textureSize.height
property var status: Image.Null
property var status: {
if (readyToLoad === Image.Ready && root.imagesLoaded === root.pathList.length) {
for (var i = 0; i < repeater.model; i++) {
if (repeater.itemAt(i).item.status !== Image.Ready) return Image.Loading;
}
return Image.Ready;
}
else if (readyToLoad === Image.Ready) {
return Image.Loading;
}
else {
return Image.Null;
}
}
property var readyToLoad: Image.Null
// Value from ui button
property int downscaleValueQML: 0
@ -195,6 +209,7 @@ AliceVision.PanoramaViewer {
property var pathList : []
property var idList : []
property int imagesLoaded: 0
Item {
id: panoImages
@ -205,7 +220,7 @@ AliceVision.PanoramaViewer {
id: imgPano
Loader {
id: floatOneLoader
active: root.status
active: root.readyToLoad
visible: (floatOneLoader.status === Loader.Ready)
z:0
//anchors.centerIn: parent
@ -226,6 +241,9 @@ AliceVision.PanoramaViewer {
setSource("", {})
}
}
onLoaded: {
imagesLoaded++;
}
}
}
Repeater {
@ -237,6 +255,7 @@ AliceVision.PanoramaViewer {
Connections {
target: root
onImagesDataChanged: {
root.imagesLoaded = 0;
//We receive the map<ImgPath, idView> from C++
//Resetting arrays to avoid problem with push
@ -255,7 +274,7 @@ AliceVision.PanoramaViewer {
//Changing the repeater model (number of elements)
panoImages.updateRepeater()
root.status = Image.Ready;
root.readyToLoad = Image.Ready;
}
}

View file

@ -891,7 +891,12 @@ FocusScope {
anchors.centerIn: parent
// running property binding seems broken, only dynamic binding assignment works
Component.onCompleted: {
running = Qt.binding(function() { return imgContainer.image && imgContainer.image.status === Image.Loading })
if (root.usePanoramaViewer) {
running = Qt.binding(function() { return imgContainer.panoramaViewerLoader.status === Image.Loading })
} else {
running = Qt.binding(function() { return imgContainer.image && imgContainer.image.status === Image.Loading })
}
}
// disable the visibility when unused to avoid stealing the mouseEvent to the image color picker
visible: running