summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsslideplayer_p.h
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2018-10-18 17:19:25 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-10-29 13:21:25 +0000
commit55b43d3e1c3a100f4ad41d94c132afd2a0d029b3 (patch)
treed3c88760174e575607c1b27eea10f7912e400efd /src/runtime/q3dsslideplayer_p.h
parent5e9132d5f61385ce5d624c6f5db2f136a1bb8c84 (diff)
Improve state handling
This is an attempt to clean up and make the state changes more sane, i.e., by trying do everything once and in the right order. There are still ugliness in this code, but it should be more easily to follow now, aided by extra inline commentary. This change should also improve some of the flickering seen in some examples when changing slides, as we try avoid re-setting stuff when we don't need to. Since time updates for the new slide is deferred until the first time callback, some of the test needed to be changed to their QTRY_* version. Also, there's now a clear distinction between stopped and paused, where paused means the slides progress is stopped at time t, as expected and stopped means the slides values and state is reset to it's initial state. Task-number: QT3DS-1866 Change-Id: I7a9b61ee3ad4a976e0e8d4de386704dcf0d526bf Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/runtime/q3dsslideplayer_p.h')
-rw-r--r--src/runtime/q3dsslideplayer_p.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/runtime/q3dsslideplayer_p.h b/src/runtime/q3dsslideplayer_p.h
index baddb25..2e8b637 100644
--- a/src/runtime/q3dsslideplayer_p.h
+++ b/src/runtime/q3dsslideplayer_p.h
@@ -69,9 +69,9 @@ public:
{
Idle,
Ready,
- Stopped,
+ Stopped, // Stopped means the player and it's slides are reset to the starting point.
Playing,
- Paused
+ Paused // Paused means the state it paused at time t, this is also true for "stopAtEnd" with t = duration
};
Q_ENUM(PlayerState)
@@ -141,10 +141,10 @@ private:
void onDurationChanged(float duration);
void onSlideFinished(Q3DSSlide *slide);
void setSlideTime(Q3DSSlide *slide, float time, bool forceUpdate = false);
+ void flushQueuedChanges();
void handleCurrentSlideChanged(Q3DSSlide *slide,
- Q3DSSlide *previousSlide,
- bool forceUpdate = false);
+ Q3DSSlide *previousSlide);
// TODO: Move out to a "slide manager"?
void sendPositionChanged(Q3DSSlide *slide, float pos);
@@ -170,6 +170,8 @@ private:
PlayerMode m_mode = PlayerMode::Viewer;
PlayerType m_type = PlayerType::Slide;
+ QVector<std::function<void()>> m_queuedChanges;
+
// This class handles animation callback from animationmanager and calls setSlideTime
friend class Q3DSSlidePositionCallback;
friend class Q3DSSceneManager;