-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideoplayer.h
47 lines (37 loc) · 1 KB
/
videoplayer.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
// videoplayer.h
#ifndef VIDEOPLAYER_H
#define VIDEOPLAYER_H
#include <QWidget>
#include <QMediaPlayer>
#include <QVideoWidget>
#include <QPushButton>
#include <QSlider>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QFileDialog>
#include <QShortcut>
#include <QKeySequence>
class VideoPlayer : public QWidget {
// Q_OBJECT
public:
VideoPlayer(const QString& filename = nullptr, bool can_open = true, QWidget* parent = nullptr);
private slots:
void openFile(const QString& fileName = nullptr);
void selectFile();
void play();
void mediaStateChanged(QMediaPlayer::State state);
void positionChanged(qint64 position);
void durationChanged(qint64 duration);
void setPosition(int position);
void handleError();
private:
QMediaPlayer* mediaPlayer;
QVideoWidget* videoWidget;
QPushButton* playBtn;
QSlider* positionSlider;
QHBoxLayout* controlLayout;
QVBoxLayout* layout;
QShortcut* shortcut_open;
void initUI();
};
#endif // VIDEOPLAYER_H