FaceAccess/Linguist/recoUi/recoUiScreensaver.h
2024-07-11 11:27:12 +08:00

78 lines
1.9 KiB
C++

#ifndef RECOUISCREENSAVER_H
#define RECOUISCREENSAVER_H
#include <QWidget>
#include <QLabel>
#include "UiConfig.h"
#include "UiTools.h"
#include "QThread"
class BgLoadThread : public QObject
{
Q_OBJECT
public:
BgLoadThread(QObject* parent = nullptr);
~BgLoadThread();
public slots:
void slotloadBGs(const QStringList& pics, const QSize& bgSize);
signals:
void signalOneBGReady(const QPixmap&);
void signalAllBGDone();
};
class Screensaver : public QWidget
{
Q_OBJECT
public:
explicit Screensaver(const QString& pic, QWidget *parent = nullptr);
explicit Screensaver(const QPixmap& pic, QWidget *parent = nullptr);
};
class recoUiScreensaver : public WidgetWithBackstageInterface
{
Q_OBJECT
public:
static const int DEFAULT_SCREENSAVER_QUANTITY = 3;
static const QString SCREENSAVER[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][DEFAULT_SCREENSAVER_QUANTITY];
static const QString AD_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
explicit recoUiScreensaver(int sourceType, QWidget *parent = nullptr);
~recoUiScreensaver();
void setBackstageUiinterface(BackstageInterfaceForUi* interface);
public slots:
void slotUpdateScreenSaver();
void slotTimer();
void slotOneBGReady(const QPixmap&);
void slotAllBGDone();
private:
//QLabel* m_label_background;
//QLabel* m_label_logo;
//QLabel* m_label_time;
QStackedWidget* m_stack_scPage;
QTimer* m_timer;
int m_iTimerInterval;
int m_ilastBgQty;
BgLoadThread* m_oLoadBg = nullptr;
QThread* m_thLoadBg = nullptr;
QString m_lastPics = "default";
const int m_sourceType;
bool m_isLoading = false;
void startThread();
bool eventFilter(QObject *watched, QEvent *event);
bool event(QEvent *event);
signals:
void signalLoadBGs(const QStringList&, const QSize& bgSize);
void signalCurrentChange(int index);
};
#endif // RECOUISCREENSAVER_H