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

72 lines
2.7 KiB
C++

#ifndef RECOUIPASSWORD_H
#define RECOUIPASSWORD_H
#include "UiTools.h"
#include "UiConfig.h"
class recoUiPassword : public WidgetWithBackstageInterface
{
Q_OBJECT
public:
static const int PERSON_NAME_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][UiConfig::SUPPORT_LANGUAGE_QUANTITY];
static const int WEL_MSG_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][UiConfig::SUPPORT_LANGUAGE_QUANTITY];
static const int PASSWORD_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][UiConfig::SUPPORT_LANGUAGE_QUANTITY];
static const int NUM_BTN_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][UiConfig::SUPPORT_LANGUAGE_QUANTITY];
static const int CONFIRM_BTN_FONT_SIZE[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY][UiConfig::SUPPORT_LANGUAGE_QUANTITY];
static const QString PWD_BG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString CONFIRM_BTN_BG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString CONFIRM_BTN_DISABLE_BG[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int CONFIRM_BTN_W[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int CONFIRM_BTN_H[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString BACK_BTN[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int BACK_BTN_W[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int BACK_BTN_H[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString DEL_BTN[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int DEL_BTN_W[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const int DEL_BTN_H[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
static const QString NUM_BTN[UiConfig::SUPPORT_SCREEN_SIZE_QUANTITY];
explicit recoUiPassword(QWidget *parent = nullptr);
void reset(const QString& name);
signals:
void signalShowRecognizePage();
public slots:
void slotBtnClicked();
void slotBtnPressed();
void slotBtnReleased();
void slotTimeout();
void slotShowPwdUiPersonName(const QString& name);
void slotShowUserPwdError(int type, int color);
private:
enum{
NUM_BTNS_QTY = 10,
TIMEOUT = 1000,
BACKSTAGE_PROC_OVERTIME = 5, //BACKSTAGE_PROC_OVERTIME * TIMEOUT
PROC_OVERTIME = 10, //PROC_OVERTIME * TIMEOUT
PWD_LEN_MIN = 4,
PWD_LEN_MAX = 16,
TRY_TIME = 5
};
QPushButton* m_btnBack;
QLabel* m_labelName;
QLabel* m_labelWelStr;
QPasswordLineEdit* m_editPwd;
QPushButton* m_btnsNum[NUM_BTNS_QTY];
//QPushButton* m_btnClear;
QPushButton* m_btnBackspace;
QPushButton* m_btnConfirm;
QString m_pwd;
QTimer* m_timer;
int m_timeCnt = 0;
int m_tryTime = 0;
bool m_need2ResetDecisionCenterTimer = false;
};
#endif // RECOUIPASSWORD_H