mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[ui] sequence player: play-pause sequence using a timer
This commit is contained in:
parent
45a95b5114
commit
47d3089e5b
1 changed files with 35 additions and 1 deletions
|
@ -7,6 +7,8 @@ import Controls 1.0
|
||||||
FloatingPane {
|
FloatingPane {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property real fps: 4
|
||||||
|
|
||||||
function sequence(vps) {
|
function sequence(vps) {
|
||||||
let objs = []
|
let objs = []
|
||||||
for (let i = 0; i < vps.count; i++) {
|
for (let i = 0; i < vps.count; i++) {
|
||||||
|
@ -27,16 +29,48 @@ FloatingPane {
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: m
|
id: m
|
||||||
|
|
||||||
property var currentCameraInit: _reconstruction && _reconstruction.cameraInit ? _reconstruction.cameraInit : undefined
|
property var currentCameraInit: _reconstruction && _reconstruction.cameraInit ? _reconstruction.cameraInit : undefined
|
||||||
property var viewpoints: currentCameraInit ? currentCameraInit.attribute('viewpoints').value : undefined
|
property var viewpoints: currentCameraInit ? currentCameraInit.attribute('viewpoints').value : undefined
|
||||||
property var sortedViewIds: viewpoints ? sequence(viewpoints) : []
|
property var sortedViewIds: viewpoints ? sequence(viewpoints) : []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
|
||||||
|
repeat: true
|
||||||
|
running: false
|
||||||
|
interval: 1000 / fps
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
viewSlider.value = viewSlider.value + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: playButton
|
||||||
|
|
||||||
|
checkable: true
|
||||||
|
checked: false
|
||||||
|
text: checked ? "pause" : "play"
|
||||||
|
|
||||||
|
onCheckedChanged: {
|
||||||
|
if (checked) {
|
||||||
|
timer.running = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
timer.running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Slider {
|
Slider {
|
||||||
|
id: viewSlider
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
@ -45,7 +79,7 @@ FloatingPane {
|
||||||
live: true
|
live: true
|
||||||
|
|
||||||
from: 0
|
from: 0
|
||||||
to: Math.max(m.sortedViewIds.length, 1)
|
to: m.sortedViewIds.length + 1
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
let idx = Math.floor(value);
|
let idx = Math.floor(value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue