827 lines
22 KiB
C++
827 lines
22 KiB
C++
#include "mainUi.h"
|
||
#include <QDebug>
|
||
#include <QThread>
|
||
#include <QVBoxLayout>
|
||
#include <QTimer>
|
||
#include "UiTools.h"
|
||
#include "UiConfig.h"
|
||
#include <QApplication>
|
||
|
||
|
||
SplashScreenWithMsg::SplashScreenWithMsg(const int languageType)
|
||
{
|
||
m_label_msg = new QLabel(this);
|
||
QPalette palette(this->palette());
|
||
palette.setColor(QPalette::WindowText,QColor(0x0e, 0xbc, 0xf8, 0xFF));
|
||
|
||
QFont ft;
|
||
//need to adjust font size
|
||
m_label_msg->setText(tr("人脸识别终端"));
|
||
int fontSize = 10;
|
||
if(UiConfig::SUPPORT_LANGUAGE_QUANTITY > languageType)
|
||
{
|
||
fontSize = UiConfig::DEV_NAME_FONT_SIZE[UiConfig::GetInstance()->getScreenConfigIndex()][languageType];
|
||
}
|
||
ft.setPointSize(fontSize);
|
||
m_label_msg->setFont(ft);
|
||
m_label_msg->setPalette(palette);
|
||
m_label_msg->setAlignment(Qt::AlignCenter);
|
||
m_label_msg->setFixedWidth(UiConfig::GetInstance()->getUiWidth());
|
||
m_label_msg->move(0, UiConfig::GetInstance()->getUiHeight() / 4);
|
||
|
||
setPixmap(QPixmap(UiConfig::GetInstance()->getWelcome()));
|
||
show();
|
||
}
|
||
|
||
SplashScreenWithMsg::~SplashScreenWithMsg()
|
||
{
|
||
|
||
}
|
||
|
||
mainUi::mainUi(const int languageType, bool needSetupWizard)
|
||
: m_reTryTimes(0), pwdAcceptDelay(false), m_isPasswordDialogShowed(false), m_settingUi(nullptr)
|
||
{
|
||
qDebug() << "mainUi()";
|
||
|
||
#if 0
|
||
setCursor(QCursor(Qt::BlankCursor));
|
||
#endif
|
||
|
||
UiConfig::GetInstance()->setLanguageType(languageType);
|
||
setFixedSize(UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight());
|
||
|
||
//this->setWindowOpacity(1);
|
||
//this->setAttribute(Qt::WA_TranslucentBackground);
|
||
QPalette pal = palette();
|
||
pal.setColor(QPalette::Background, Qt::transparent);
|
||
setPalette(pal);
|
||
QPalette palette(this->palette());
|
||
palette.setColor(QPalette::WindowText,Qt::black);
|
||
|
||
m_stackWidget_mainUi = new QStackedWidget(this);
|
||
//m_splash_startPage = new SplashScreenWithMsg(languageType);
|
||
m_splash_startPage = nullptr;
|
||
|
||
//计算启动时间
|
||
m_time_startupCost = new QTime();
|
||
m_time_startupCost->start();
|
||
|
||
if(needSetupWizard){
|
||
m_setupUi = new SetupUi(this);
|
||
connect(m_setupUi, SIGNAL(signalSetupDone()), this, SLOT(slotSetupDone()));
|
||
m_stackWidget_mainUi->addWidget(m_setupUi);
|
||
}
|
||
|
||
m_recoUi = new recoUi(this);
|
||
m_stackWidget_mainUi->addWidget(m_recoUi);
|
||
|
||
connect(m_recoUi, SIGNAL(signalShowSettingPage()), this, SLOT(slotShowSettingPage()));
|
||
connect(this, SIGNAL(signalShowRecoUiPage(int)), m_recoUi, SLOT(slotShowRecoUiPage(int)));
|
||
connect(this, SIGNAL(signalNoSuccessPage(int)), m_recoUi, SLOT(slotNoSuccessPage(int)));
|
||
connect(this, SIGNAL(signalSuccessPage(const int, const QString&)), \
|
||
m_recoUi, SIGNAL(signalSuccessPage(const int, const QString&)));
|
||
connect(this, SIGNAL(signalUpdatePlatformConnectionStatus(const int)), m_recoUi, SLOT(slotUpdatePlatformConnectionStatus(const int)));
|
||
|
||
connect(this, SIGNAL(signalShowUserCandidate(const QString&, const QStringList&)), this,
|
||
SLOT(slotShowUserCandidate(const QString&, const QStringList&)));
|
||
connect(this, SIGNAL(signalRecoUiswitchToType(int)), m_recoUi, SLOT(slotRecoUiswitchToType(int)));
|
||
connect(this, SIGNAL(signalCreateAndShowDevTestPage(const QString&)), this, SLOT(slotCreateAndShowDevTestPage(const QString&)));
|
||
connect(this, SIGNAL(signalDelayResetRecoUi()), this, SLOT(slotDelayResetRecoUi()));
|
||
connect(this, SIGNAL(signalShowAntiDismantleDetect(bool)), this, SLOT(slotShowAntiDismantleDetect(bool)));
|
||
connect(this, SIGNAL(signalShowCallDialPage()), m_recoUi, SLOT(slotShowCallDialPage()));
|
||
connect(this, SIGNAL(signalSetCallConsoleStatus(int, const QString&)), m_recoUi, SLOT(slotSetCallConsoleStatus(int, const QString&)));
|
||
connect(this, SIGNAL(signalShowUserItemChoose(const QStringList&)), this, SLOT(slotShowUserItemChoose(const QStringList&)));
|
||
#if 0
|
||
m_settingUi = new settingUi(this); //nullptr; //
|
||
m_stackWidget_mainUi->addWidget(m_settingUi);
|
||
connect(m_settingUi, SIGNAL(signalShowRecoPage()), this, SLOT(slotShowRecoPage()));
|
||
connect(m_settingUi, SIGNAL(signalChangeRecoUiMode()), m_recoUi, SIGNAL(signalChangeRecoUiMode()));
|
||
connect(m_settingUi, SIGNAL(signalUpdateRecoUiIpDisplay(bool)), m_recoUi, SIGNAL(signalUpdateRecoUiIpDisplay(bool)));
|
||
#endif
|
||
|
||
QVBoxLayout* vbLayout = new QVBoxLayout();
|
||
vbLayout->addWidget(m_stackWidget_mainUi);
|
||
vbLayout->setMargin(0);
|
||
setLayout(vbLayout);
|
||
|
||
m_timer = new QTimer(this);
|
||
connect( m_timer, SIGNAL(timeout()), this, SLOT(slotPwdAcceptDelayUpdate()) );
|
||
|
||
//int startPageShowTime = (START_SCREEN_TIMEOUT - m_time_startupCost->elapsed() > 0 ? START_SCREEN_TIMEOUT - m_time_startupCost->elapsed() : 1);
|
||
//QTimer::singleShot(startPageShowTime, this, SLOT(slotCloseStartPage()) );
|
||
slotCloseStartPage();
|
||
}
|
||
|
||
mainUi::~mainUi()
|
||
{
|
||
qDebug() << "~mainUi()";
|
||
if(nullptr != m_splash_startPage)
|
||
{
|
||
delete m_splash_startPage;
|
||
m_splash_startPage = nullptr;
|
||
}
|
||
}
|
||
|
||
void mainUi::createSettingUi()
|
||
{
|
||
if(m_settingUi){
|
||
return;
|
||
}
|
||
qDebug() << "create setting Ui";
|
||
m_settingUi = new settingUi(this);
|
||
m_stackWidget_mainUi->addWidget(m_settingUi);
|
||
connect(m_settingUi, SIGNAL(signalShowRecoPage()), this, SLOT(slotShowRecoPage()));
|
||
connect(m_settingUi, SIGNAL(signalChangeRecoUiMode()), m_recoUi, SIGNAL(signalChangeRecoUiMode()));
|
||
connect(m_settingUi, SIGNAL(signalUpdateRecoUiIpDisplay(bool)), m_recoUi, SIGNAL(signalUpdateRecoUiIpDisplay(bool)));
|
||
connect(this, SIGNAL(signalShowDevTestPage()), m_settingUi, SLOT(slotShowDevTestPage()));
|
||
qDebug() << "setting ui setBackstageUiinterface before ...";
|
||
m_settingUi->setBackstageUiinterface(m_backstageIf);
|
||
qDebug() << "setting ui setBackstageUiinterface after ...";
|
||
}
|
||
|
||
void mainUi::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||
{
|
||
m_backstageIf = interface;
|
||
if(m_setupUi){
|
||
m_setupUi->setBackstageUiinterface(interface);
|
||
}
|
||
m_recoUi->setBackstageUiinterface(interface);
|
||
|
||
#if 0
|
||
m_settingUi->setBackstageUiinterface(interface);
|
||
#endif
|
||
|
||
updateAllOption();
|
||
}
|
||
|
||
void mainUi::slotCloseStartPage()
|
||
{
|
||
if(m_splash_startPage)
|
||
{
|
||
m_splash_startPage->finish(this);
|
||
delete m_splash_startPage;
|
||
m_splash_startPage = nullptr;
|
||
}
|
||
|
||
if(m_time_startupCost)
|
||
{
|
||
delete m_time_startupCost;
|
||
m_time_startupCost = nullptr;
|
||
}
|
||
|
||
show();
|
||
QTimer::singleShot(100, this, SLOT(slotShowRecoPage()));
|
||
}
|
||
|
||
void mainUi::slotShowRecoPage()
|
||
{
|
||
m_stackWidget_mainUi->setCurrentIndex(MAIN_UI_PAGE_RECOGNIZE);
|
||
|
||
m_recoUi->updateVideoWind();
|
||
|
||
if(!m_setupUi){
|
||
qDebug() << "m_backstageIf->startIdentyState()";
|
||
m_backstageIf->startIdentyState();
|
||
}
|
||
keyboard::preLoad();
|
||
}
|
||
|
||
int mainUi::settingPageAuthentication(const QString& dialogTitle, const QString& okBtn, const QString& cancelBtn, bool overtimeClose)
|
||
{
|
||
if(pwdAcceptDelay){
|
||
InfoDialog(tr("由于之前多次密码验证错误,请稍后再重试!"), m_settingUi, tr("知道了"), 30000).exec();
|
||
return -1;
|
||
}
|
||
|
||
if(m_isPasswordDialogShowed){
|
||
qDebug() << "isPasswordDialogShowed";
|
||
return -1;
|
||
}
|
||
m_isPasswordDialogShowed = true;
|
||
|
||
m_backstageIf->stopIdentyState();
|
||
|
||
QString userInput;
|
||
QString devId(tr("设备编码:"));
|
||
char buf[64] = {'\0'};
|
||
if(0 == m_backstageIf->getDeviceId(buf, sizeof(buf))){
|
||
devId += buf;
|
||
}
|
||
|
||
do{
|
||
PasswordDialog pwd_check(dialogTitle, tr("admin"), overtimeClose ? UiConfig::NO_OPERATION_OVERTIME_RETURN * 1000 : 0,
|
||
m_settingUi, userInput, devId, okBtn, cancelBtn);
|
||
//connect(&pwd_check, SIGNAL(signalRestoreFactory()), m_settingUi, SLOT(slotRestoreFactory()));
|
||
int ret = pwd_check.exec();
|
||
if(QDialog::Rejected == ret){
|
||
slotShowRecoPage();
|
||
m_isPasswordDialogShowed = false;
|
||
return -1;
|
||
}
|
||
|
||
userInput = pwd_check.getPwd();
|
||
#if 0
|
||
if(0 == userInput.compare(SPECIAL_PWD_1))
|
||
{
|
||
emit signalShowLogoChooseDialogBySpecialPwd();
|
||
emit signalResetRecoUi();
|
||
reOpen = false;
|
||
}
|
||
else{
|
||
#endif
|
||
if(0 == m_backstageIf->verifyFactorySettingPwd(userInput.toStdString().c_str())){
|
||
emit signalResetRecoUi();
|
||
m_isPasswordDialogShowed = false;
|
||
return 0;
|
||
}else {
|
||
InfoDialog(tr("密码错误,请重试"), m_settingUi).exec();
|
||
if(overtimeClose && ++m_reTryTimes >= RETRY_TIMES_MAX_PER_GROUP){
|
||
m_reTryTimes = 0;
|
||
pwdAcceptDelay = true;
|
||
m_timer->start(PWD_ACCEPT_DELAY_TIME);
|
||
slotShowRecoPage();
|
||
m_isPasswordDialogShowed = false;
|
||
return -1;
|
||
}
|
||
}
|
||
|
||
}while(true);
|
||
return -1;
|
||
}
|
||
|
||
void mainUi::slotShowSettingPage()
|
||
{
|
||
if(m_backstageIf->isDevSettingDisable()){
|
||
#if 0
|
||
m_backstageIf->stopIdentyState();
|
||
InfoDialog(tr("设备设置页面已被禁用!"), m_settingUi, tr("知道了"), 30000).exec();
|
||
m_backstageIf->startIdentyState();
|
||
#endif
|
||
return;
|
||
}
|
||
|
||
if(0 == settingPageAuthentication(tr("请输入密码"), tr("确定"), tr("取消"), true)){
|
||
//m_settingUi->reset();
|
||
m_stackWidget_mainUi->setCurrentIndex(MAIN_UI_PAGE_SETTING);
|
||
}
|
||
}
|
||
|
||
void mainUi::slotPwdAcceptDelayUpdate()
|
||
{
|
||
pwdAcceptDelay = false;
|
||
}
|
||
|
||
void mainUi::slotUpdateIp()
|
||
{
|
||
if(m_settingUi){
|
||
m_settingUi->update_IpBar();
|
||
}
|
||
|
||
if(m_recoUi){
|
||
m_recoUi->update_IpBar();
|
||
}
|
||
}
|
||
|
||
//设置接口后刷新页面
|
||
void mainUi::updateAllOption()
|
||
{
|
||
|
||
}
|
||
|
||
|
||
//ui接口
|
||
long long mainUi::getUiVersion()
|
||
{
|
||
return UiConfig::UI_VERSION;
|
||
}
|
||
|
||
//switch from standby to reco
|
||
void mainUi::showRecoMsgReco()
|
||
{
|
||
//qDebug()<<"void mainUi::showRecoMsgReco()";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_IN);
|
||
}
|
||
|
||
void mainUi::showRecoMsgRetry()
|
||
{
|
||
//qDebug()<<"void mainUi::showRecoMsgRetry()";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_CHECK);
|
||
}
|
||
|
||
void mainUi::showRecoMsgFail(int failType)
|
||
{
|
||
//qDebug()<<"void mainUi::showRecoMsgFail()" << failType;
|
||
GLOBAL_RECO_STATE state = (GLOBAL_RECO_STATE)(GLOBAL_RECO_END_NO + failType);
|
||
if(state >= GLOBAL_RECO_END_NO && failType <= GLOBAL_RECO_SHOW_QRCODE)
|
||
{
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(state);
|
||
}
|
||
}
|
||
|
||
void mainUi::notifyFaceInfo(const bool faceAvailable)
|
||
{
|
||
//qDebug()<<"void mainUi::notifyFaceInfo():" << faceAvailable;
|
||
if(!faceAvailable){ //不绘制扫描线,只处理人脸离开复位情况
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalDrawScanner(GLOBAL_RECO_IN_SCANNER, faceAvailable);
|
||
}
|
||
}
|
||
|
||
void mainUi::showRecoSuccess(const char* name)
|
||
{
|
||
//qDebug()<<"void mainUi::showRecoSuccess()";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
if (name){
|
||
emit signalSuccessPage(GLOBAL_RECO_END_OK, QString(name));
|
||
}
|
||
}
|
||
|
||
void mainUi::showRecoMsgIDFail()
|
||
{
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_ID_FAILED);
|
||
}
|
||
|
||
void mainUi::showUnauthorizedPage()
|
||
{
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_BEGIN_AUTH);
|
||
}
|
||
|
||
void mainUi::showScreenSaverPage()
|
||
{
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_SCREENSAVER);
|
||
}
|
||
|
||
int mainUi::showFaceImg(const unsigned char *imgData, const int imgLen)
|
||
{
|
||
//qDebug()<<"void mainUi::showFaceImg()";
|
||
if(imgData == nullptr)
|
||
return -1;
|
||
emit signalShowAddFaceImg(imgData, imgLen);
|
||
return 0;
|
||
}
|
||
|
||
void mainUi::updatePlatformConnectionStatus(const PLATFORM_CONNECTION_STATUS_E status)
|
||
{
|
||
emit signalUpdatePlatformConnectionStatus(static_cast<int>(status));
|
||
}
|
||
|
||
void mainUi::showRecoMsgMoveForehead()
|
||
{
|
||
//qDebug() << "showRecoMsgMoveForehead()";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_TEMP_REQ);
|
||
}
|
||
|
||
void mainUi::showRecoMsgForeheadNormalTemp(const float temp, const bool isC) //显示正常温度
|
||
{
|
||
//qDebug() << "showRecoMsg Normal Temp";
|
||
emit signalShowForeheadNormalTemp(temp, isC);
|
||
}
|
||
|
||
void mainUi::showRecoMsgForeheadAbnormalTemp(const float temp, const bool isHigh, const bool isC) //显示异常温度
|
||
{
|
||
//qDebug() << "showRecoMsg Abnormal Temp:" << isHigh;
|
||
emit signalShowForeheadAbnormalTemp(temp, isHigh, isC);
|
||
}
|
||
|
||
void mainUi::showRecoMsgReadTempFailed() //体温检测失败
|
||
{
|
||
//qDebug() << "showRecoMsgRead Temp Failed";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_READ_TEMP_FAILED);
|
||
}
|
||
|
||
void mainUi::showRecoMsgNoMaskWarn() //请戴口罩
|
||
{
|
||
//qDebug() << "showRecoMsgNoMaskWarn";
|
||
//emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_MASK_REQ);
|
||
}
|
||
|
||
void mainUi::showRecoMsgMaskOk()
|
||
{
|
||
//qDebug() << "showRecoMsgMaskOk";
|
||
//emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_MASK_OK);
|
||
}
|
||
|
||
void mainUi::showRecoMsgMaskWarn()
|
||
{
|
||
emit signalNoSuccessPage(GLOBAL_RECO_TAKE_OFF_MASK);
|
||
}
|
||
|
||
void mainUi::showRecoMsgNoEntry(const bool noEntry)
|
||
{
|
||
//qDebug() << "showRecoMsgNoEntry";
|
||
//emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
if(noEntry)
|
||
emit signalNoSuccessPage(GLOBAL_RECO_NO_ENTRY);
|
||
else {
|
||
emit signalNoSuccessPage(GLOBAL_RECO_CLEAR_NO_ENTRY);
|
||
}
|
||
//测试QRcode
|
||
/*
|
||
static int i = 0;
|
||
emit signalShowQRCodeMsg(i);
|
||
i++;
|
||
if(i > 5) i = 0;
|
||
*/
|
||
}
|
||
|
||
void mainUi::turnOffScanLine()
|
||
{
|
||
//qDebug() << "turnOffScanLine";
|
||
//emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_CLOSE_SCANLINE);
|
||
}
|
||
|
||
void mainUi::clearLocalFacePage()
|
||
{
|
||
emit signalClearLocalFacePage();
|
||
}
|
||
|
||
void mainUi::updateLogo(const enLogo option)
|
||
{
|
||
emit signalUpdateLogo(static_cast<int>(option));//切换ui时logo没有显示,没有信号更新---------------------------------------------------------------------------------------------------------------
|
||
}
|
||
|
||
void mainUi::showQRCodeMsg(const QRCode_Msg_E msg)
|
||
{
|
||
emit signalShowQRCodeMsg(static_cast<int>(msg));
|
||
}
|
||
|
||
void mainUi::showQRCodeReco()
|
||
{
|
||
//qDebug() << "showQRCodeReco";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_SHOW_QRCODE_RECO);
|
||
}
|
||
|
||
void mainUi::showFaceReco()
|
||
{
|
||
//qDebug() << "showFaceReco";
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_RECOGNIZE);
|
||
emit signalNoSuccessPage(GLOBAL_RECO_SHOW_FACE_RECO);
|
||
}
|
||
|
||
void mainUi::updateRecoUiIp()
|
||
{
|
||
m_recoUi->update_IpBar();
|
||
}
|
||
|
||
void mainUi::showFeatureUpdateProgress(const unsigned current, const unsigned all)
|
||
{
|
||
emit signalShowFeatureUpdateProgress(current, all);
|
||
}
|
||
|
||
void mainUi::closeFeatureUpdateProgress()
|
||
{
|
||
emit signalCloseFeatureUpdateProgress();
|
||
}
|
||
|
||
void mainUi::showRecoUiMask(int maskType)
|
||
{
|
||
int type = 0;
|
||
if(0 == maskType){ //normal
|
||
//if(UiConfig::GetInstance()->isFaceFrameShowByTempExist()){
|
||
type = 1; // bg
|
||
//}
|
||
}else if(1 == maskType){ //TempCalibra
|
||
type = 2; //TempCalibra
|
||
}else if(2 == maskType){ //day mode
|
||
//if(UiConfig::GetInstance()->isFaceFrameShowByTempExist()){
|
||
type = 1; //bg
|
||
//}
|
||
}else if(3 == maskType){ //night mode
|
||
type = 3; //night mode
|
||
}
|
||
emit signalShowRecoUiMask(type);
|
||
}
|
||
|
||
void mainUi::showNotiMsg(const char *msg, int color)
|
||
{
|
||
//qDebug()<<"void mainUi::showRecoSuccess()";
|
||
if (msg)
|
||
{
|
||
emit signalNotiMsg(GLOBAL_RECO_SHOW_NOTI_MSG, QString(msg), color);
|
||
}
|
||
}
|
||
|
||
void mainUi::updateScreenSaver()
|
||
{
|
||
m_stackWidget_mainUi->setCurrentIndex(MAIN_UI_PAGE_RECOGNIZE);
|
||
QCoreApplication::processEvents();
|
||
emit signalUpdateScreenSaver();
|
||
}
|
||
|
||
int mainUi::grabScreen(const QString& picName, int rotate)
|
||
{
|
||
if(UiConfig::GetInstance()->isRkDevice()){
|
||
QMatrix matrix;
|
||
matrix.rotate(rotate);
|
||
QPixmap pixmap = grab(QRect(0, 0, UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight()));
|
||
pixmap.transformed(matrix, Qt::SmoothTransformation).save(picName, "jpg");
|
||
}
|
||
else{
|
||
GrabFullScreen(picName, rotate); //A038选择角度问题
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
int mainUi::switchToRecoUi()
|
||
{
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_WORK_MODE);
|
||
return 0;
|
||
}
|
||
|
||
int mainUi::showCenterMsg(const char* msg, int type)
|
||
{
|
||
if(msg){
|
||
emit signalCenterMsg(GLOBAL_RECO_SHOW_CENTER_MSG + type, QString(msg));
|
||
}
|
||
|
||
if(strlen(msg)){
|
||
emit signalDelayResetRecoUi();
|
||
|
||
}
|
||
QCoreApplication::processEvents();
|
||
return 0;
|
||
}
|
||
|
||
void mainUi::showDrawPage()
|
||
{
|
||
emit signalShowRecoUiPage(RECO_UI_PAGE_DRAW);
|
||
}
|
||
|
||
|
||
void mainUi::showCursorSwitch(bool sw)
|
||
{
|
||
QApplication::setOverrideCursor(sw ? Qt::ArrowCursor : Qt::BlankCursor);
|
||
}
|
||
|
||
int mainUi::showUserPwd(const char* name)
|
||
{
|
||
emit signalShowUserPwd(QString(name));
|
||
return 0;
|
||
}
|
||
|
||
void mainUi::setPwdButton(bool visible)
|
||
{
|
||
emit signalSetUserPwdButton(visible);
|
||
}
|
||
|
||
void mainUi::showPwdUiPersonName(const char* name)
|
||
{
|
||
emit signalShowPwdUiPersonName(name);
|
||
}
|
||
|
||
void mainUi::showUserPwdError(int type, int color)
|
||
{
|
||
emit signalShowUserPwdError(type, color);
|
||
}
|
||
|
||
void mainUi::showUserCandidate(const char* title, const char** opns, int opnsNum)
|
||
{
|
||
if(nullptr == title || nullptr == opns || opnsNum <= 0){
|
||
return;
|
||
}
|
||
QStringList options;
|
||
for(int i=0; i<opnsNum; i++){
|
||
options << opns[i];
|
||
}
|
||
emit signalShowUserCandidate(title, options);
|
||
}
|
||
|
||
void mainUi::showDevTestPage(const char* devCfgMsg)
|
||
{
|
||
emit signalCreateAndShowDevTestPage(devCfgMsg ? QString(devCfgMsg) : QString());
|
||
}
|
||
|
||
void mainUi::setDevTestMesAddrAndProdNoText(const char* text)
|
||
{
|
||
emit signalDevTestMesAddrAndProdNoText(QString(text));
|
||
}
|
||
|
||
void mainUi::setDevTestPcbSeqText(const char* text)
|
||
{
|
||
emit signalDevTestPcbSeqText(QString(text));
|
||
}
|
||
|
||
void mainUi::setDevTestConfigInfo(const char* text)
|
||
{
|
||
emit signalDevTestConfigInfo(QString(text));
|
||
}
|
||
|
||
|
||
void mainUi::showPassResult(bool pass)
|
||
{
|
||
emit signalShowFinalResult(pass);
|
||
}
|
||
|
||
void mainUi::showRecoUiColorFaceSnapshot(const char* path)
|
||
{
|
||
emit signalShowRecoUiColorFaceSnapshot(QString(path));
|
||
}
|
||
|
||
void mainUi::showRecoUiColorFaceSnapshot(const unsigned char* jpgDate, int len)
|
||
{
|
||
emit signalShowRecoUiColorFaceSnapshot(jpgDate, len);
|
||
}
|
||
|
||
void mainUi::showOrHideFaceFrame(bool show)
|
||
{
|
||
emit signalShowOrHideFaceFrame(show);
|
||
}
|
||
|
||
void mainUi::slotShowUserCandidate(const QString& title, const QStringList& opns)
|
||
{
|
||
m_backstageIf->pauseDataFlow();
|
||
|
||
StyleItemChooseDialog dlg(title, opns, m_backstageIf);
|
||
int ret = dlg.exec();
|
||
if(QDialog::Accepted == ret){
|
||
m_backstageIf->resetDecisionCenterTimer();
|
||
const int userChoose = dlg.getChoosedIndex();
|
||
//qDebug() << "user choose:" << userChoose;
|
||
m_backstageIf->candidateChoosedInPopupWindow(userChoose);
|
||
}
|
||
else if(QDialog::Rejected == ret){
|
||
m_backstageIf->candidateChoosedInPopupWindow(-1);
|
||
}
|
||
|
||
//m_backstageIf->resumeDataFlow();
|
||
}
|
||
|
||
void mainUi::slotShowSettingUi()
|
||
{
|
||
m_stackWidget_mainUi->setCurrentIndex(MAIN_UI_PAGE_SETTING);
|
||
}
|
||
|
||
void mainUi::slotSetupDone()
|
||
{
|
||
m_stackWidget_mainUi->removeWidget(m_setupUi);
|
||
delete m_setupUi;
|
||
m_setupUi = nullptr;
|
||
m_backstageIf->startIdentyState();
|
||
}
|
||
|
||
void mainUi::slotScreenTouch()
|
||
{
|
||
createSettingUi();
|
||
}
|
||
|
||
void mainUi::slotCreateAndShowDevTestPage(const QString& devCfgMsg)
|
||
{
|
||
MsgDialog msgdlg(tr("正在加载测试页面,请稍候..."));
|
||
msgdlg.show();
|
||
QCoreApplication::processEvents();
|
||
createSettingUi();
|
||
emit signalShowDevTestPage();
|
||
emit signalDevTestConfigInfo(devCfgMsg);
|
||
}
|
||
|
||
|
||
void mainUi::slotDelayResetRecoUi()
|
||
{
|
||
QTimer::singleShot(200, this, [this]{notifyFaceInfo(false);});
|
||
}
|
||
|
||
void mainUi::slotShowAntiDismantleDetect(bool upload)
|
||
{
|
||
qDebug() << "slotShowAntiDismantleDetect";
|
||
m_backstageIf->setAntiDemolitionAvail(true, upload);
|
||
if(0 == settingPageAuthentication(tr("检测到强拆设备"), tr("解除锁定"), "", false)){
|
||
m_backstageIf->startIdentyState();
|
||
m_backstageIf->setAntiDemolitionAvail(false, false);
|
||
}
|
||
}
|
||
|
||
void mainUi::recoUiswitchToType(int type)
|
||
{
|
||
emit signalRecoUiswitchToType(type);
|
||
}
|
||
|
||
void mainUi::qrcodeFastCfgResult(bool isSuccessed)
|
||
{
|
||
emit signalQrcodeFastCfgResult(isSuccessed);
|
||
}
|
||
|
||
void mainUi::icCardResult(const char *icCardNum)
|
||
{
|
||
emit signalIcCardResult(QString(icCardNum));
|
||
}
|
||
|
||
bool mainUi::isInSettingUi()
|
||
{
|
||
return (m_stackWidget_mainUi->currentIndex() == MAIN_UI_PAGE_SETTING);
|
||
}
|
||
|
||
void mainUi::updateAdScreen()
|
||
{
|
||
emit signalUpdateAdWidget();
|
||
}
|
||
|
||
void mainUi::showHealthMsg(int type, float temp, const char * msg, bool pass,
|
||
const unsigned char* jpgDate, int jpgLen, const char* tripCity, const char* failReason, int bgColor, int displayTime)
|
||
{
|
||
emit signalShowHealthMsg(type, temp, msg, pass, jpgDate, jpgLen, tripCity, failReason, bgColor, displayTime);
|
||
if(type > 0){
|
||
emit signalDelayResetRecoUi();
|
||
}
|
||
QCoreApplication::processEvents();
|
||
}
|
||
|
||
void mainUi::showHealthCodeAuthStatus(int status)
|
||
{
|
||
emit signalShowHealthCodeAuthStatus(status);
|
||
}
|
||
|
||
void mainUi::showAntiDismantleDetect(bool upload)
|
||
{
|
||
if(m_backstageIf->getAntiDemolitionSw()){
|
||
emit signalShowAntiDismantleDetect(upload);
|
||
}
|
||
}
|
||
|
||
void mainUi::showSceneResult(int result, const char* resultText, const char* businessInfo, int displayTime)
|
||
{
|
||
if(!UiConfig::GetInstance()->isRecoUiStyleScene()){
|
||
return;
|
||
}
|
||
emit signalShowSceneResult(result, resultText, businessInfo, displayTime);
|
||
QCoreApplication::processEvents();
|
||
}
|
||
|
||
void mainUi::updatePersonNumAccessed(int personAccess, int personAll)
|
||
{
|
||
emit signalUpdatePersonNumAccessed(personAccess, personAll);
|
||
}
|
||
|
||
bool mainUi::isScenePassing()
|
||
{
|
||
return m_recoUi->isScenePassing();
|
||
}
|
||
|
||
void mainUi::setSceneUiPersonCountType(int type)
|
||
{
|
||
emit signalSetSceneUiPersonCountType(type);
|
||
}
|
||
|
||
void mainUi::updateSceneUiPersonCount(int count)
|
||
{
|
||
emit signalUpdateSceneUiPersonCount(count);
|
||
}
|
||
|
||
void mainUi::showCallDialPage()
|
||
{
|
||
emit signalShowCallDialPage();
|
||
}
|
||
|
||
void mainUi::setCallConsoleStatus(int status, const char* tip)
|
||
{
|
||
emit signalSetCallConsoleStatus(status, tip);
|
||
}
|
||
|
||
void mainUi::setDndMode(bool enabled, const std::chrono::system_clock::time_point &time) {
|
||
m_recoUi->setDndMode(enabled,time);
|
||
}
|
||
|
||
void mainUi::showRecoUiDevIdAndVer(bool show)
|
||
{
|
||
emit signalShowRecoUiDevIdAndVer(show);
|
||
}
|
||
|
||
void mainUi::showUserItemChoose(const std::vector<std::string>& items)
|
||
{
|
||
QStringList options;
|
||
for(const auto& i : items){
|
||
options << QString(i.c_str());
|
||
}
|
||
emit signalShowUserItemChoose(options);
|
||
}
|
||
|
||
void mainUi::slotShowUserItemChoose(const QStringList& opns)
|
||
{
|
||
m_backstageIf->stopIdentyState();
|
||
|
||
StyleItemChooseDialog dlg("请选择", opns, m_backstageIf);
|
||
int ret = dlg.exec();
|
||
if(QDialog::Accepted == ret){
|
||
m_backstageIf->resetDecisionCenterTimer();
|
||
const int userChoose = dlg.getChoosedIndex();
|
||
//qDebug() << "user choose:" << userChoose;
|
||
m_backstageIf->startIdentyState();
|
||
m_backstageIf->userItemChoose(userChoose);
|
||
}else if(QDialog::Rejected == ret){
|
||
m_backstageIf->startIdentyState();
|
||
m_backstageIf->userItemChoose(-1);
|
||
}
|
||
}
|
||
|
||
|