Skip to content

Commit

Permalink
[Viewer] Display "Missing File" label when an image cannot be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
cbentejac committed Nov 10, 2023
1 parent 5e435ed commit 034cb11
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
7 changes: 5 additions & 2 deletions meshroom/ui/qml/Viewer/FloatImage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ AliceVision.FloatImageViewer {
property int paintedWidth: sourceSize.width
property int paintedHeight: sourceSize.height
property var status: {
if (root.loading)
return Image.Loading;
if (root.loading === AliceVision.FloatImageViewer.ELoadingStatus.TRUE)
return Image.Loading
else if (root.loading === AliceVision.FloatImageViewer.ELoadingStatus.ERROR) {
return Image.Error
}
else if ((root.source === "") ||
(root.sourceSize.height <= 0) ||
(root.sourceSize.width <= 0))
Expand Down
34 changes: 28 additions & 6 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,11 @@ FocusScope {
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue }),
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue }),
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue }),
'isPrincipalPointsDisplayed' : Qt.binding(function() { return lensDistortionImageToolbar.displayPrincipalPoint }),
'surface.displayGrid' : Qt.binding(function() { return lensDistortionImageToolbar.visible && lensDistortionImageToolbar.displayGrid }),
'surface.gridOpacity' : Qt.binding(function() { return lensDistortionImageToolbar.opacityValue }),
'surface.gridColor' : Qt.binding(function() { return lensDistortionImageToolbar.color }),
'surface.subdivisions' : Qt.binding(function() { return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue }),
'isPrincipalPointsDisplayed': Qt.binding(function() { return lensDistortionImageToolbar.displayPrincipalPoint }),
'surface.displayGrid': Qt.binding(function() { return lensDistortionImageToolbar.visible && lensDistortionImageToolbar.displayGrid }),
'surface.gridOpacity': Qt.binding(function() { return lensDistortionImageToolbar.opacityValue }),
'surface.gridColor': Qt.binding(function() { return lensDistortionImageToolbar.color }),
'surface.subdivisions': Qt.binding(function() { return root.useFloatImageViewer ? 1 : lensDistortionImageToolbar.subdivisionsValue }),
'viewerTypeString': Qt.binding(function() { return displayLensDistortionViewer.checked ? "distortion" : "hdr" }),
'sfmRequired': Qt.binding(function() { return displayLensDistortionViewer.checked ? true : false }),
'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null }),
Expand All @@ -476,7 +476,7 @@ FocusScope {
'cropFisheye': false,
'sequence': Qt.binding(function() { return ((root.enableSequencePlayer && _reconstruction && _reconstruction.viewpoints.count > 0) ? getSequence() : []) }),
'targetSize': Qt.binding(function() { return floatImageViewerLoader.targetSize }),
'useSequence': Qt.binding(function() { return root.enableSequencePlayer && !useExternal && _reconstruction }),
'useSequence': Qt.binding(function() { return root.enableSequencePlayer && !useExternal && _reconstruction })
})
} else {
// Forcing the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
Expand Down Expand Up @@ -745,6 +745,28 @@ FocusScope {
}
}
}

FloatingPane {
Layout.fillWidth: true
Layout.fillHeight: false
Layout.preferredHeight: childrenRect.height
visible: floatImageViewerLoader.item.status === Image.Error
Layout.alignment: Qt.AlignHCenter

RowLayout {
anchors.fill: parent

Label {
font.pointSize: 8
text: "Missing File"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
}
}
}

Item {
id: imgPlaceholder
Layout.fillWidth: true
Expand Down

0 comments on commit 034cb11

Please sign in to comment.