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

231 lines
8.3 KiB
C++

#ifndef RECOUIRECOGNIZETYPEBASE_H
#define RECOUIRECOGNIZETYPEBASE_H
#include <QWidget>
#include "UiTools.h"
#include "recoUiRecognize.h"
#include "recoUiScreensaver.h"
class RecoResultWidget : public QWidget
{
Q_OBJECT
public:
static const int FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString RECO_OK_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString RECO_FAIL_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString RECO_WARN_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString MASK_OK_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString MASK_NULL_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString TEMP_OK_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString TEMP_ABN_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
RecoResultWidget(QWidget *parent = nullptr);
void showIdentityResult(GLOBAL_RECO_STATE state, const QString& msg = QString());
void showMaskResult(bool hasMask, const QString& msg);
void showTempResult(const QString& msg, float temp, bool isNormal, bool isC);
void reset();
private:
QLabel* m_label_identity_icon;
QLabel* m_label_identity_word;
QLabel* m_label_mask_icon;
QLabel* m_label_mask_word;
QLabel* m_label_temp_icon;
QLabel* m_label_temp_word;
};
class DndModeCountDownItem;
class RecoMsgWidget : public QWidget
{
Q_OBJECT
public:
static const int TIME_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int DATE_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int MSG_WIDGET_HEIGHT[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int PIC_WIDGET_H_W[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString PIC_WIDGET_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString IDLE_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString OK_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString FAIL_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString WARN_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString T1_IDLE_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString T1_OK_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString T1_FAIL_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString T1_WARN_BG_IMG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
RecoMsgWidget(bool hasFacePic, bool enTimeType, int bgImgType, QWidget *parent = nullptr);
void showFacePic(const QString& picPath);
void showFacePic(const unsigned char* jpgDate, int len);
void facePicReset();
void showIdentityResult(GLOBAL_RECO_STATE state, const QString& msg = QString());
void showMaskResult(bool hasMask, const QString& msg);
void showTempResult(const QString& msg, float temp, bool isNormal, bool isC);
void setDndMode(bool dndMode, const std::chrono::system_clock::time_point &endTime);
void reset();
void switchBg(int type);
protected:
private:
const int m_bgImgType;
QWidget* m_widget_pic;
QStackedWidget* m_stackWgt_msg;
RecoResultWidget* m_widget_result;
TimeWidget* m_widget_time;
DndModeCountDownItem *m_dndItem = nullptr;
};
class RecoTypeResultWidget : public QWidget
{
Q_OBJECT
public:
static const QString RESULT_OK_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString RESULT_FAIL_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString RESULT_WARN_RES_FILE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
explicit RecoTypeResultWidget(QWidget *parent = nullptr);
void showResult(int type);
protected:
private:
};
class recoUiRecognizeTypeBase : public PageAcceptMouseAndTouch
{
Q_OBJECT
public:
static const int TOP_MSG_WIDGET_HEIGHT[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int AD_WIDGET_HEIGHT[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString TOP_MSG_WIDGET_BG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int SWIP_CARD_WIDGET_WIDTH[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int SWIP_CARD_WIDGET_HEIGHT[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString SWIP_CARD_DAY_MODE_WIDGET_BG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString SWIP_CARD_NIGHT_MODE_WIDGET_BG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
explicit recoUiRecognizeTypeBase(bool isNightMode, bool hasPwdBtn, bool hasCallBtn, int type, QWidget *parent = nullptr);
virtual ~recoUiRecognizeTypeBase();
virtual int setCamVideoWind() = 0;
signals:
void signalChangePage();
void signalShowPwdPage(const QString& name);
void signalScreenTouch();
void callDialButtonClicked(); // 呼叫设备按钮
void callPlatformButtonClicked(const QString &name); // 呼叫管理处
public slots:
void slotsNoSuccessPage(int nPage);
void slotsSuccessPage(const int nPage, const QString& name);
void slotsDrawScanner(const int nPage, const bool faceAvailable);
//void handleRecoResShowTime();
void slotsInteractionChange(const INTERACION_OPTION& interaction, int nSelectRes);
void slotShowNormalTemp(const float temp, const bool isC);
void slotShowAbnormalTemp(const float temp, const bool isHigh, const bool isC);
void slotUpdateLogo(const int);
void slotUpdatePlatformConnectionStatus(const int);
void slotsResetRecoUi();
//void slotShowQRCodeMsg(const int);
//void slotChangeRecoUiMode();
//void slotTimerQRCodeScanline();
//void slotQRCodeSwitchToStandbyStatusFromOvertimeStatus();
void slotUpdateRecoUiIpDisplay(const bool);
//void slotShowFeatureUpdateProgress(const unsigned current, const unsigned all);
//void slotCloseFeatureUpdateProgress();
void slotShowRecoUiMask(int maskType);
void slotNotiMsg(const int nPage, const QString& msg, int color);
void slotLongPressShowSetting();
void slotCenterMsg(const int nPage, const QString& msg);
void slotPwdBtnClicked();
void slotSetUserPwdButton(bool visible);
//void slotShowOrHideFaceFrame(bool show);
void slotShowFinalResult(bool pass);
void slotShowCallBtn(bool show);
void slotShowRecoUiDevIdAndVer(bool show);
protected:
RecoMsgWidget* m_widget_reco = nullptr;
recoUiScreensaver* m_widget_ad;
MsgWidget* m_widget_msg;
QVBoxLayout *m_vlay = nullptr;
QWidget* m_wgtCardUnderScreen = nullptr;
private:
const int m_uiType;
QWidget* m_wgtBack;
QWidget* m_wgtBtnPwd;
CenterMsgWidget* m_widget_cMsg;
RecoTypeResultWidget* m_widget_result;
//QWidget* m_wgtCallDial;
RoundedWidget* m_wgtCallDialDev;
RoundedWidget* m_wgtCallMngCenter;
QString m_name;
int m_clickCount;
QTime _preTime;
bool isTouched;
QString recoUiTextCfg(RecoUiTextCfg::enTextType type);
bool eventFilter(QObject *watched, QEvent *event);
bool event(QEvent *event);
bool multiPressToSettingPage();
bool longPressToSettingPage();
void uiReset();
void setMsgWidgetBg(int bgType);
void setCardReaderUnderScreenInstructions(bool isNightMode);
};
class recoUiRecognizeTypeColor : public recoUiRecognizeTypeBase
{
Q_OBJECT
public:
explicit recoUiRecognizeTypeColor(bool isNightMode, bool hasPwdBtn, bool hasCallBtn, QWidget *parent = nullptr);
int setCamVideoWind();
void setBackstageUiinterface(BackstageInterfaceForUi *interface);
signals:
public slots:
void slotShowRecoUiColorFaceSnapshot(const QString& path);
void slotShowRecoUiColorFaceSnapshot(const unsigned char* jpgDate, int len);
private:
};
class recoUiRecognizeTypeAd : public recoUiRecognizeTypeBase
{
Q_OBJECT
public:
static const int CAM_WIN[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][4];
explicit recoUiRecognizeTypeAd(bool isNightMode, bool hasPwdBtn, bool hasCallBtn, QWidget *parent = nullptr);
int setCamVideoWind();
void setBackstageUiinterface(BackstageInterfaceForUi *interface);
void updateAdWidget();
void setDndMode(bool dndMode, const std::chrono::system_clock::time_point &endTime);
signals:
void signalUpdateScreenSaver();
public slots:
void slotCurrentChange(int index);
};
#endif // RECOUIRECOGNIZETYPEBASE_H