2012-12-09 04:36:41 +04:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2012-12-27 06:48:17 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#define __STDC_CONSTANT_MACROS
|
|
|
|
#ifdef _STDINT_H
|
|
|
|
#undef _STDINT_H
|
|
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
|
|
|
|
2012-12-09 04:36:41 +04:00
|
|
|
#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>
|
2012-12-27 06:48:17 +04:00
|
|
|
#include <QTimer>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QPainter>
|
2013-06-28 04:48:52 +04:00
|
|
|
#include <QFile>
|
|
|
|
#include <QTimer>
|
2012-12-09 04:36:41 +04:00
|
|
|
|
2012-12-27 06:48:17 +04:00
|
|
|
#include "xrdpapi.h"
|
|
|
|
#include "xrdpvr.h"
|
2012-12-09 04:36:41 +04:00
|
|
|
#include "decoder.h"
|
2012-12-27 06:48:17 +04:00
|
|
|
#include "ourinterface.h"
|
|
|
|
#include "playvideo.h"
|
2013-07-20 04:38:36 +04:00
|
|
|
#include "dlgabout.h"
|
2012-12-27 06:48:17 +04:00
|
|
|
|
|
|
|
/* ffmpeg related stuff */
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#include <libavformat/avformat.h>
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
}
|
2012-12-09 04:36:41 +04:00
|
|
|
|
2012-12-27 06:48:17 +04:00
|
|
|
#define VCR_PLAY 1
|
|
|
|
#define VCR_PAUSE 2
|
|
|
|
#define VCR_STOP 3
|
|
|
|
#define VCR_REWIND 4
|
|
|
|
#define VCR_POWER_OFF 5
|
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainWindow;
|
2012-12-09 04:36:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainWindow(QWidget *parent = 0);
|
|
|
|
~MainWindow();
|
|
|
|
|
2012-12-27 06:48:17 +04:00
|
|
|
signals:
|
|
|
|
void onGeometryChanged(int x, int y, int widht, int height);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void onSliderValueChanged(int value);
|
|
|
|
|
2012-12-09 04:36:41 +04:00
|
|
|
private slots:
|
|
|
|
void on_actionOpen_Media_File_triggered();
|
|
|
|
void on_actionExit_triggered();
|
|
|
|
|
2012-12-27 06:48:17 +04:00
|
|
|
void onBtnPlayClicked(bool flag);
|
|
|
|
void onBtnRewindClicked(bool flag);
|
|
|
|
void onBtnStopClicked(bool flag);
|
|
|
|
|
|
|
|
void onMediaDurationInSeconds(int duration);
|
|
|
|
void onElapsedTime(int secs);
|
|
|
|
void onSliderActionTriggered(int value);
|
2013-06-28 04:48:52 +04:00
|
|
|
void onMoveCompleted();
|
2012-12-09 04:36:41 +04:00
|
|
|
|
2013-07-19 09:20:34 +04:00
|
|
|
void on_actionAbout_triggered();
|
|
|
|
|
2013-07-20 04:38:36 +04:00
|
|
|
void onVolSliderValueChanged(int value);
|
|
|
|
|
2012-12-09 04:36:41 +04:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
void moveEvent(QMoveEvent *e);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
|
|
|
|
|
|
|
/* for UI */
|
|
|
|
QLabel *lblCurrentPos;
|
|
|
|
QLabel *lblDuration;
|
|
|
|
QLabel *lblVideo;
|
|
|
|
QHBoxLayout *hboxLayoutTop;
|
|
|
|
QHBoxLayout *hboxLayoutMiddle;
|
|
|
|
QHBoxLayout *hboxLayoutBottom;
|
|
|
|
QVBoxLayout *vboxLayout;
|
|
|
|
QPushButton *btnPlay;
|
|
|
|
QPushButton *btnStop;
|
|
|
|
QPushButton *btnRewind;
|
|
|
|
QSlider *slider;
|
2013-07-20 04:38:36 +04:00
|
|
|
QSlider *volSlider;
|
2012-12-09 04:36:41 +04:00
|
|
|
QWidget *window;
|
|
|
|
bool acceptSliderMove;
|
2013-06-28 04:48:52 +04:00
|
|
|
QTimer *moveResizeTimer;
|
2012-12-09 04:36:41 +04:00
|
|
|
|
2012-12-27 06:48:17 +04:00
|
|
|
/* private stuff */
|
|
|
|
OurInterface *interface;
|
|
|
|
PlayVideo *playVideo;
|
|
|
|
QString filename;
|
|
|
|
bool oneTimeInitSuccess;
|
|
|
|
bool remoteClientInited;
|
|
|
|
void *channel;
|
|
|
|
int stream_id;
|
|
|
|
int64_t elapsedTime; /* elapsed time in usecs since play started */
|
|
|
|
int vcrFlag;
|
2013-06-28 04:48:52 +04:00
|
|
|
bool gotMediaOnCmdline;
|
2012-12-27 06:48:17 +04:00
|
|
|
|
2012-12-09 04:36:41 +04:00
|
|
|
/* private methods */
|
|
|
|
void setupUI();
|
|
|
|
void openMediaFile();
|
|
|
|
void getVdoGeometry(QRect *rect);
|
2012-12-27 06:48:17 +04:00
|
|
|
void clearDisplay();
|
2012-12-09 04:36:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|