-
Notifications
You must be signed in to change notification settings - Fork 0
/
DialogVideoPlayer.h
143 lines (115 loc) · 3.36 KB
/
DialogVideoPlayer.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef DIALOGVIDEOPLAYER_H
#define DIALOGVIDEOPLAYER_H
#include <QtGui/QMovie>
#include <QtWidgets/QWidget>
#include <QDialog>
#include <qmediaplayer.h>
#include <QFileDialog>
#include "GrafixProject.h"
#include <QGraphicsView>
#include <QGraphicsVideoItem>
#include <QGLWidget>
namespace Ui {
class DialogVideoPlayer;
}
class DialogVideoPlayer : public QDialog
{
Q_OBJECT
public:
explicit DialogVideoPlayer(QWidget *parent = 0);
~DialogVideoPlayer();
void loadData(GrafixParticipant* participant, mat &p_roughM_in, mat &p_smoothM_in, mat &p_fixAllM_in, mat &p_segmentsM_in);
void resizeEvent (QResizeEvent *event);
void closeEvent(QCloseEvent *event);
void mousePressEvent(QMouseEvent *mouseEvent);
private:
typedef enum {
PlayModeSegment,
PlayModeFragment,
PlayModeWholeFile
} PlayMode;
GrafixParticipant* _participant;
mat* p_roughM;
mat* p_smoothM;
mat* p_fixAllM;
mat segmentsM;
int secsFragment;
int hz;
int samplesPerFragment;
int expWidth;
int expHeight;
double firstSampleMS;
double playStartSampleMS;
int clockStartTime;
// Play settings
PlayMode settingPlayMode;
bool settingPlaySmooth;
bool settingLoop;
double dotSizePercentage;
double actualDotSize;
// State of playback
bool playing;
int playOnOff;
double currentTimeMS;
double movieOffsetMS;
int currentIndex;
int currentFragment;
int currentSegment;
QVariantMap pathsImages;
// Playing - Movie driven or by timer
void stopPlaying();
void startPlaying();
int getMilliCount();
// Pens
QPen* smoothPens;
QPen* roughPens;
QPen whitePen;
// Update state of playback
void repaintAll();
void updatePlaybackStateTime(double newTimeMS);
void updatePlaybackState(int index, bool resetTimeSource);
// Painting
void paintCurrentVisualizationFrame();
void paintCurrentTimeLineLineFrame();
void paintNoFrameFound();
void paintTimeLine();
void paintFixations();
void paintBackgroundImage();
void clearBackgroundImage();
void loadImages();
public slots:
void openMoviePress();
bool loadMovie(QString path);
void playButtonPress();
void openImageFilePress();
private slots:
void changeMovieMode();
void settingChanged();
void sliderDotSizeChanged();
void handleError();
void resizeDisplay();
void spinBoxIndexChanged(int value);
void spinBoxSegmentChanged(int value);
void spinBoxFragmentChanged(int value);
void spinBoxTimeOffsetChanged(int value);
private:
int display_width;
int display_height;
int vid_offset_x;
int vid_offset_y;
int vid_width;
int vid_height;
QMediaPlayer *mediaPlayer;
QGraphicsScene *visualizationScene;
QGraphicsScene *timeLineScene;
QGraphicsScene *fixationsScene;
QGraphicsPixmapItem *backgroundImageItem;
QGraphicsVideoItem *visualizationVideoItem;
QGraphicsRectItem *screenLayerItem;
QGraphicsPixmapItem *visualizationPixmapItem;
QGraphicsLineItem *timeLineTimeItem;
QGraphicsPixmapItem *timeLinePixmapItem;
QGraphicsPixmapItem *fixationsPixmapItem;
Ui::DialogVideoPlayer *ui;
};
#endif // DIALOGVIDEOPLAYER_H