summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsslideplayer_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-03-16 13:48:46 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-03-16 12:55:40 +0000
commit9c03d5fa89a3b5f9ef19f4e278627b1ae3dcd89b (patch)
tree479df98091c767034d654f7495ab01529ddca9e0 /src/runtime/q3dsslideplayer_p.h
parent5edad9e98bd88a4ef527a1399ac6c06b846a54c1 (diff)
Implement the concept of "preceding" slide
Which is not the same as previous, but rather a go back to whatever was current previously (with a 1 level history). Change-Id: Ie4cbb0d2bb49773bf622b14e61afd34eaa540fe9 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/runtime/q3dsslideplayer_p.h')
-rw-r--r--src/runtime/q3dsslideplayer_p.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/runtime/q3dsslideplayer_p.h b/src/runtime/q3dsslideplayer_p.h
index 085d6f6..4670357 100644
--- a/src/runtime/q3dsslideplayer_p.h
+++ b/src/runtime/q3dsslideplayer_p.h
@@ -114,6 +114,7 @@ public Q_SLOTS:
void setPlaybackRate(float rate);
void nextSlide();
void previousSlide();
+ void precedingSlide();
void reload();
Q_SIGNALS:
@@ -220,6 +221,7 @@ public:
if (count < 1)
return;
+ m_previouslyActiveIndex = m_index;
m_index = index;
if (m_player)
@@ -235,8 +237,10 @@ public:
return nullptr;
}
- if (index != m_index)
+ if (index != m_index) {
+ m_previouslyActiveIndex = m_index;
m_index = index;
+ }
return static_cast<Q3DSSlide *>(m_masterSlide->childAtIndex(m_index));
}
@@ -250,6 +254,7 @@ public:
return nullptr;
if (m_index < slideCount() - 1) {
+ m_previouslyActiveIndex = m_index;
return static_cast<Q3DSSlide *>(m_masterSlide->childAtIndex(++m_index));
} else {
return nullptr;
@@ -265,12 +270,25 @@ public:
return nullptr;
if ((m_index > 0) && (m_index < slideCount())) {
+ m_previouslyActiveIndex = m_index;
return static_cast<Q3DSSlide *>(m_masterSlide->childAtIndex(--m_index));
} else {
return nullptr;
}
}
+ Q3DSSlide *precedingSlide()
+ {
+ // This is effectively a go-back-in-history with a 1 level history,
+ // i.e. go to the slide that was current before the current one - but
+ // going "back" from there would bring us back to what is current now.
+
+ if (m_previouslyActiveIndex == -1)
+ return nullptr;
+
+ return setCurrentIndex(m_previouslyActiveIndex);
+ }
+
int indexOfSlide(Q3DSSlide *slide)
{
Q_ASSERT(m_masterSlide);
@@ -328,6 +346,7 @@ private:
Q3DSSlide *m_masterSlide = nullptr;
Q3DSSlide *m_parent = nullptr;
int m_index = -1;
+ int m_previouslyActiveIndex = -1;
};
QT_END_NAMESPACE