-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_controller.h
89 lines (64 loc) · 2.24 KB
/
view_controller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Controls the currently viewed slide
// Author: Max Schwarz <[email protected]>
#ifndef VIEW_CONTROLLER_H
#define VIEW_CONTROLLER_H
#include <QObject>
#include "rendering_pool.h"
class ViewController : public QObject
{
Q_OBJECT
Q_PROPERTY(int currentSlideNumber READ currentSlideNumber WRITE setCurrentSlideNumber NOTIFY currentSlideNumberChanged)
Q_PROPERTY(int slideCount READ slideCount CONSTANT)
Q_PROPERTY(QObject* currentPage READ currentPage NOTIFY currentSlideNumberChanged)
Q_PROPERTY(QObject* nextPage READ nextPage NOTIFY currentSlideNumberChanged)
Q_PROPERTY(QString elapsedTimeString READ elapsedTimeString NOTIFY elapsedTimeChanged)
Q_PROPERTY(bool slideSelectorActive READ slideSelectorActive WRITE setSlideSelectorActive NOTIFY slideSelectorActiveChanged)
Q_PROPERTY(QList<QObject*> allPages READ allPages CONSTANT)
public:
explicit ViewController(RenderingPool* renderingPool, QObject* parent = 0);
int currentSlideNumber() const
{ return m_slideNumber; }
int slideCount() const
{ return m_renderingPool->count(); }
QObject* currentPage() const
{ return (*m_renderingPool)[m_slideNumber]; }
QObject* nextPage() const;
QString elapsedTimeString() const;
bool slideSelectorActive() const
{ return m_slideSelectorActive; }
const QList<QObject*>& allPages() const
{ return *m_renderingPool; }
public Q_SLOTS:
void nextSlide();
void previousSlide();
void setCurrentSlideNumber(int number);
void quit();
void resetTime();
void setSlideSelectorActive(bool on)
{ m_slideSelectorActive = on; slideSelectorActiveChanged(); }
void triggerVideoPause() { videoPause(); }
void triggerVideoFaster() { videoFaster(); }
void triggerVideoSlower() { videoSlower(); }
void triggerVideoSeekBack() { videoSeekBack(); }
void triggerVideoSeekFwd() { videoSeekFwd(); }
Q_SIGNALS:
void currentSlideNumberChanged(int number);
void elapsedTimeChanged();
void slideSelectorActiveChanged();
void videoPause();
void videoFaster();
void videoSlower();
void videoSeekBack();
void videoSeekFwd();
private Q_SLOTS:
void timerTick();
private:
RenderingPool* m_renderingPool;
int m_slideNumber = 0;
int m_elapsedSeconds = 0;
int m_elapsedMinutes = 0;
int m_elapsedHours = 0;
QTimer* m_timer;
bool m_slideSelectorActive = false;
};
#endif