teleport/client/tp-player/mainwindow.h

92 lines
2.0 KiB
C
Raw Normal View History

2019-10-31 17:45:17 +00:00
#ifndef MAINWINDOW_H
2019-09-02 21:40:52 +00:00
#define MAINWINDOW_H
#include <QMainWindow>
2019-09-16 05:53:27 +00:00
#include <QMessageBox>
#include <QTimer>
2019-09-06 12:07:13 +00:00
#include "bar.h"
2019-09-02 21:40:52 +00:00
#include "thr_play.h"
2019-10-31 17:45:17 +00:00
#include "thr_data.h"
2019-09-02 21:40:52 +00:00
#include "update_data.h"
#include "record_format.h"
2019-10-13 19:41:35 +00:00
#include "util.h"
2019-10-31 17:45:17 +00:00
#include "downloader.h"
2019-09-02 21:40:52 +00:00
#define PLAY_STATE_UNKNOWN 0
#define PLAY_STATE_RUNNING 1
#define PLAY_STATE_PAUSE 2
#define PLAY_STATE_STOP 3
2019-09-02 21:40:52 +00:00
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
2019-09-16 05:53:27 +00:00
void set_resource(const QString& res);
void pause();
void resume(bool relocate, uint32_t ms);
void restart();
void set_speed(int s);
void set_skip(bool s);
2019-10-31 17:45:17 +00:00
2019-11-03 19:34:11 +00:00
// TODO: 将thr_data移动到thr_play线程由play线程进行管理
ThrData* get_thr_data() {return m_thr_data;}
2019-09-02 21:40:52 +00:00
private:
void paintEvent(QPaintEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
// void _start_play_thread();
2019-09-02 21:40:52 +00:00
private slots:
2019-09-16 05:53:27 +00:00
void _do_first_run(); // 默认界面加载完成后,开始播放操作(可能会进行数据下载)
2019-10-31 17:45:17 +00:00
void _do_update_data(UpdateData*);
void _do_bar_fade();
void _do_bar_delay_hide();
2019-09-02 21:40:52 +00:00
private:
Ui::MainWindow *ui;
2019-09-16 05:53:27 +00:00
bool m_show_default;
bool m_bar_shown;
QPixmap m_default_bg;
2019-09-02 21:40:52 +00:00
2019-09-16 05:53:27 +00:00
QString m_res;
2019-10-31 17:45:17 +00:00
ThrPlay* m_thr_play;
ThrData* m_thr_data;
2019-09-02 21:40:52 +00:00
2019-09-04 12:28:16 +00:00
QPixmap m_canvas;
2019-09-06 12:07:13 +00:00
Bar m_bar;
2019-09-02 21:40:52 +00:00
TS_RECORD_HEADER m_rec_hdr;
2019-09-03 12:19:09 +00:00
QPixmap m_pt_normal;
2019-09-02 21:40:52 +00:00
TS_RECORD_RDP_POINTER m_pt;
2019-09-16 05:53:27 +00:00
QTimer m_timer_first_run;
QTimer m_timer_bar_fade;
QTimer m_timer_bar_delay_hide;
bool m_bar_fade_in;
bool m_bar_fading;
qreal m_bar_opacity;
int m_play_state;
2019-09-16 05:53:27 +00:00
2019-10-31 17:45:17 +00:00
bool m_show_message;
2019-09-17 16:51:22 +00:00
QPixmap m_img_message;
QRect m_rc_message;
2019-09-02 21:40:52 +00:00
};
#endif // MAINWINDOW_H