summaryrefslogtreecommitdiffstats
path: root/vrplayer/mainwindow.h
blob: ed392ea2152053a6605dd31953900d1ca7cc7317 (plain)
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QFileDialog>
#include <QDebug>
#include <QMessageBox>
#include <QCloseEvent>
#include <QMoveEvent>
#include <QPoint>
#include <QRect>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QSlider>

#include "decoder.h"
#include "decoderthread.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void on_actionOpen_Media_File_triggered();
    void on_actionExit_triggered();
    void on_actionPlay_Media_triggered();
    void on_decoderError(QString title, QString msg);
    void on_btnPlayClicked(bool flag);
    void on_mediaDurationInSeconds(int duration);
    void on_elapsedTime(int secs);
    void on_sliderActionTriggered(int value);
    void on_sliderValueChanged(int value);

signals:
    void on_geometryChanged(int x, int y, int widht, int height);
    void on_mediaSeek(int value);

protected:
    void resizeEvent(QResizeEvent *e);
    void closeEvent(QCloseEvent *e);
    void moveEvent(QMoveEvent *e);
    void mouseMoveEvent(QMouseEvent *e);

private:
    Ui::MainWindow *ui;

    QString        filename;
    Decoder       *decoder;
    DecoderThread *decoderThread;

    /* for UI */
    QLabel        *lblCurrentPos;
    QLabel        *lblDuration;
    QLabel        *lblVideo;
    QHBoxLayout   *hboxLayoutTop;
    QHBoxLayout   *hboxLayoutMiddle;
    QHBoxLayout   *hboxLayoutBottom;
    QVBoxLayout   *vboxLayout;
    QPushButton   *btnPlay;
    QPushButton   *btnStop;
    QPushButton   *btnRewind;
    QSlider       *slider;
    QWidget       *window;
    bool           acceptSliderMove;

    /* private methods */
    void setupUI();
    void openMediaFile();
    void getVdoGeometry(QRect *rect);
};

#endif // MAINWINDOW_H