104 lines
2.2 KiB
C
104 lines
2.2 KiB
C
|
#ifndef MAINWINDOW_H
|
||
|
#define MAINWINDOW_H
|
||
|
|
||
|
#include <QMainWindow>
|
||
|
|
||
|
#include <QElapsedTimer>
|
||
|
#include <QMouseEvent>
|
||
|
#include <QMap>
|
||
|
#include <QLabel>
|
||
|
#include <QPropertyAnimation>
|
||
|
#include <QTimer>
|
||
|
|
||
|
#include "PhotoDisplay.h"
|
||
|
#include "qevent.h"
|
||
|
#include "ZMQClient.h"
|
||
|
#include "VlcMediaPlayer.h"
|
||
|
|
||
|
namespace Ui {
|
||
|
class MainWindow;
|
||
|
}
|
||
|
|
||
|
class MainWindow : public QMainWindow
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit MainWindow(QWidget *parent = nullptr);
|
||
|
~MainWindow();
|
||
|
|
||
|
static MainWindow& Get();
|
||
|
static int GetScreenIndex() { return 0; }
|
||
|
|
||
|
int GetRoopPort() const {
|
||
|
return m_roopPort;
|
||
|
}
|
||
|
|
||
|
bool GetPaperIPAndPort(QString* ip, int* port) {
|
||
|
*ip = m_paperIp;
|
||
|
*port = m_paperPort;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
void DisplayPhoto(const QString& fileName);
|
||
|
void SendHeaderPhoto(const QString& fileName);
|
||
|
void Tranform(const QByteArray& message);
|
||
|
|
||
|
public:
|
||
|
void slotSetOneFrame(QImage image) {
|
||
|
videoImage_ = image;
|
||
|
}
|
||
|
void PlayDefualtVideo();
|
||
|
|
||
|
protected:
|
||
|
void closeEvent(QCloseEvent* event) override;
|
||
|
void mousePressEvent(QMouseEvent* event) override;
|
||
|
void keyReleaseEvent(QKeyEvent* event) override;
|
||
|
void paintEvent(QPaintEvent* event) override;
|
||
|
|
||
|
void OnStop();
|
||
|
|
||
|
public:
|
||
|
void OnPositionChanged(qint64 position);
|
||
|
|
||
|
private:
|
||
|
Ui::MainWindow *ui;
|
||
|
PhotoDisplay* m_photoDisplay;
|
||
|
QPixmap m_defaultImage;
|
||
|
|
||
|
class NetClient* m_netClient{nullptr};
|
||
|
|
||
|
VlcMediaPlayer vlcPlayer_;
|
||
|
QImage videoImage_;
|
||
|
QTimer videoUpdate_;
|
||
|
|
||
|
bool m_photoIng{ false };
|
||
|
bool m_requestImg{ false };
|
||
|
bool m_photoImg{ false };
|
||
|
bool m_trans{ false };
|
||
|
|
||
|
QString m_defualtVideo;
|
||
|
QString m_photoVideo;
|
||
|
QString m_photoPath;
|
||
|
QString m_photoHeaderPath;
|
||
|
QVector<QByteArray> m_transMessage;
|
||
|
QString m_printIP;
|
||
|
int m_showImage = 51;
|
||
|
int m_phototime = 28;
|
||
|
int m_photoOuttime = 28;
|
||
|
int m_aminationTime = 2;
|
||
|
int m_roopPort = 9531;
|
||
|
QString m_paperIp;
|
||
|
int m_paperPort = 9532;
|
||
|
int m_left2right = 1;
|
||
|
|
||
|
class TokenRequest* m_tokenRequest{ nullptr };
|
||
|
QPropertyAnimation* m_animation;
|
||
|
|
||
|
bool m_isConnected{ false };
|
||
|
bool isPhotoing{false};
|
||
|
ZMQClient zmqClient_;
|
||
|
};
|
||
|
|
||
|
#endif // MAINWINDOW_H
|