[ui] sequence player: draw cached frames indicator

This commit is contained in:
Loïc Vital 2023-04-17 18:23:45 +02:00
parent c22c5e918f
commit 8a3daed543
3 changed files with 32 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import Controls 1.0 import Controls 1.0
import MaterialIcons 2.2 import MaterialIcons 2.2
import Utils 1.0
/** /**
* The Sequence Player is a UI for manipulating * The Sequence Player is a UI for manipulating
@ -60,6 +61,9 @@ FloatingPane {
} }
} }
// Exposed properties
property var viewer: null
// Update the frame property // Update the frame property
// when the selected view ID is changed externally // when the selected view ID is changed externally
Connections { Connections {
@ -181,6 +185,30 @@ FloatingPane {
frameSlider.value = m.frame; frameSlider.value = m.frame;
} }
} }
property real frameLength: m.sortedViewIds.length > 0 ? width / m.sortedViewIds.length : 0
background: Rectangle {
x: frameSlider.leftPadding
y: frameSlider.topPadding + frameSlider.height / 2 - height / 2
width: frameSlider.availableWidth
height: 4
radius: 2
color: Colors.grey
Repeater {
model: viewer ? viewer.cachedFrames : []
Rectangle {
x: modelData * frameSlider.frameLength
y: 0
width: frameSlider.frameLength
height: 4
radius: 2
color: Colors.blue
}
}
}
} }
RowLayout { RowLayout {

View file

@ -434,7 +434,8 @@ FocusScope {
'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }), 'surface.msfmData': Qt.binding(function() { return (msfmDataLoader.status === Loader.Ready && msfmDataLoader.item != null && msfmDataLoader.item.status === 2) ? msfmDataLoader.item : null; }),
'canBeHovered': false, 'canBeHovered': false,
'idView': Qt.binding(function() { return (_reconstruction ? _reconstruction.selectedViewId : -1); }), 'idView': Qt.binding(function() { return (_reconstruction ? _reconstruction.selectedViewId : -1); }),
'cropFisheye': false 'cropFisheye': false,
'sequence': Qt.binding(function() { return ((_reconstruction && _reconstruction.viewpoints) ? _reconstruction.allImagePaths() : []) })
}) })
} else { } else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14 // Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14
@ -1301,6 +1302,7 @@ FocusScope {
id: sequencePlayer id: sequencePlayer
anchors.margins: 0 anchors.margins: 0
Layout.fillWidth: true Layout.fillWidth: true
viewer: floatImageViewerLoader.status === Loader.Ready ? floatImageViewerLoader.item : null
} }
} }
} }

View file

@ -696,6 +696,7 @@ class Reconstruction(UIGraph):
self.sfmAugmented.emit(first, last) self.sfmAugmented.emit(first, last)
return sfm[0], sfm[-1] return sfm[0], sfm[-1]
@Slot(result="QVariantList")
def allImagePaths(self): def allImagePaths(self):
""" Get all image paths in the reconstruction. """ """ Get all image paths in the reconstruction. """
return [vp.path.value for node in self._cameraInits for vp in node.viewpoints.value] return [vp.path.value for node in self._cameraInits for vp in node.viewpoints.value]