2023-04-18 14:14:46 +08:00
|
|
|
#ifndef PLAYWIN_H
|
|
|
|
#define PLAYWIN_H
|
|
|
|
#include "elebase.h"
|
|
|
|
#include "synctimer.h"
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QMap>
|
|
|
|
|
|
|
|
class Page : public QWidget {
|
|
|
|
public:
|
|
|
|
explicit Page(QWidget *parent = nullptr);
|
|
|
|
int timeSpan{0};
|
|
|
|
QVector<EleBase> eles;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TimerValue{
|
|
|
|
public:
|
|
|
|
TimerValue(QWidget *ele = nullptr, bool visible = false): ele(ele), visible(visible){}
|
|
|
|
QWidget* ele;
|
|
|
|
bool visible;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PlayWin : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static PlayWin *self;
|
|
|
|
static PlayWin *newIns(int width, int height, QString dir, const QJsonObject &prog, QWidget *parent = nullptr);
|
|
|
|
PlayWin(int x, int y, int width, int height, QString dir, const QJsonObject &prog, QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
SyncTimer* timer = 0;
|
|
|
|
int cur = 0;
|
|
|
|
QVector<Page*> pages;
|
|
|
|
QMap<int,TimerValue> timerMap;
|
|
|
|
QPoint mPressRel;
|
|
|
|
QMenu *menu;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void sltNext();
|
|
|
|
void sltSetVisible(QWidget *wgt, bool visible){
|
|
|
|
wgt->setVisible(visible);
|
|
|
|
}
|
|
|
|
signals:
|
|
|
|
void sigSetVisible(QWidget *, bool);
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *) override;
|
|
|
|
void timerEvent(QTimerEvent *) override;
|
|
|
|
void mousePressEvent(QMouseEvent *) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *) override;
|
|
|
|
void leaveEvent(QEvent *) override;
|
|
|
|
void contextMenuEvent(QContextMenuEvent *) override;
|
|
|
|
void closeEvent(QCloseEvent *) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLAYWIN_H
|