608 lines
24 KiB
C++
608 lines
24 KiB
C++
|
#include "recoUi.h"
|
||
|
#include <QDebug>
|
||
|
#include <QVBoxLayout>
|
||
|
#include <QPainter>
|
||
|
#include "UiTools.h"
|
||
|
#include "UiInterfaceForBackstage.h"
|
||
|
#include "mainUi.h"
|
||
|
|
||
|
statusbarUi::statusbarUi(QWidget *parent) : MyWidgetWithMainStyleColor(parent)
|
||
|
{
|
||
|
qDebug() << "statusbarUi()";
|
||
|
|
||
|
QPalette palette(this->palette());
|
||
|
palette.setColor(QPalette::WindowText,Qt::white);
|
||
|
|
||
|
m_label_ip = new QLabel(this);
|
||
|
//m_label_ip->setText("192.168.10.106");
|
||
|
m_label_ip->setPalette(palette);
|
||
|
m_label_ip->installEventFilter(this);
|
||
|
|
||
|
m_label_platform = new QLabel(this);
|
||
|
QPixmap pm(":/res/image/disconnect.png");
|
||
|
pm = pm.scaled(20, 20, Qt::KeepAspectRatio);
|
||
|
m_label_platform->setPixmap(pm);
|
||
|
|
||
|
// m_label_wifi = new QLabel(this);
|
||
|
// pm.load(":/res/image/Wifi.png");
|
||
|
// pm = pm.scaled(20, 20, Qt::KeepAspectRatio);
|
||
|
// m_label_wifi->setPixmap(pm);
|
||
|
|
||
|
// m_label_4g = new QLabel(this);
|
||
|
// pm.load(":/res/image/4G.png");
|
||
|
// pm = pm.scaled(20, 20, Qt::KeepAspectRatio);
|
||
|
// m_label_4g->setPixmap(pm);
|
||
|
|
||
|
m_label_time = new QLabel(this);
|
||
|
// m_label_time->setText("12:34");
|
||
|
m_label_time->setPalette(palette);
|
||
|
qDebug()<<"recoUi _labelTime = "<<m_label_time;
|
||
|
_timerUpdate = new TimerUpdate(m_label_time, this);
|
||
|
m_label_time->installEventFilter(this);
|
||
|
|
||
|
QHBoxLayout* hbLayout = new QHBoxLayout();
|
||
|
hbLayout->addWidget(m_label_ip, 20, Qt::AlignLeft);
|
||
|
hbLayout->addWidget(m_label_platform, 1, Qt::AlignRight);
|
||
|
// hbLayout->addWidget(m_label_wifi, 1, Qt::AlignRight);
|
||
|
// hbLayout->addWidget(m_label_4g, 1, Qt::AlignRight);
|
||
|
hbLayout->addWidget(m_label_time, 1, Qt::AlignRight);
|
||
|
setLayout(hbLayout);
|
||
|
}
|
||
|
|
||
|
statusbarUi:: ~statusbarUi()
|
||
|
{
|
||
|
if(nullptr != _timerUpdate)
|
||
|
{
|
||
|
delete _timerUpdate;
|
||
|
}
|
||
|
|
||
|
qDebug() << "~statusbarUi()";
|
||
|
}
|
||
|
|
||
|
void statusbarUi::updatePlatformConnectionStatus(const int status)
|
||
|
{
|
||
|
QPixmap pm;
|
||
|
switch(status)
|
||
|
{
|
||
|
case UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_DISCONNECTED:
|
||
|
pm.load(":/res/image/disconnect.png");
|
||
|
break;
|
||
|
case UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_CONNECTED:
|
||
|
pm.load(":/res/image/display.png");
|
||
|
break;
|
||
|
case UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_LOGGED:
|
||
|
pm.load(":/res/image/display.png");
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
m_label_platform->setPixmap(pm.scaled(20, 20, Qt::KeepAspectRatio));
|
||
|
}
|
||
|
|
||
|
void statusbarUi::updateIpLabel(QString &ipStr)
|
||
|
{
|
||
|
if(m_label_ip)
|
||
|
{
|
||
|
m_label_ip->setText(ipStr);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//bool statusbarUi::eventFilter(QObject *watched, QEvent *event)
|
||
|
//{
|
||
|
// if( ( m_label_ip == watched ) && (event->type() == QEvent::MouseButtonPress) )
|
||
|
// {
|
||
|
// emit signalChangeRecoPage();
|
||
|
// }
|
||
|
// if( ( m_label_time == watched ) && (event->type() == QEvent::MouseButtonPress) )
|
||
|
// {
|
||
|
// emit signalTestChangePage();
|
||
|
// }
|
||
|
//}
|
||
|
|
||
|
recoUi::recoUi(QWidget *parent) : WidgetWithBackstageInterface(parent)
|
||
|
{
|
||
|
qDebug() << "recoUi()";
|
||
|
|
||
|
m_stack_recoPage = new QStackedWidget(this);
|
||
|
// m_statusbar = new statusbarUi(this);
|
||
|
|
||
|
if(UiConfig::GetInstance()->isRecoUiStyleColor()){
|
||
|
m_recoPageColor = new recoUiRecognizeTypeColor(false, false, false, this);
|
||
|
m_stack_recoPage->addWidget(m_recoPageColor);
|
||
|
}else if (UiConfig::GetInstance()->isRecoUiStyleAd()){
|
||
|
m_recoPageAd = new recoUiRecognizeTypeAd(false, false, false, this);
|
||
|
m_stack_recoPage->addWidget(m_recoPageAd);
|
||
|
}
|
||
|
#if 0
|
||
|
else if(UiConfig::GetInstance()->isRecoUiStyleScene()){
|
||
|
m_recoPageScene = new recoUiRecognizeScene(false, false, this);
|
||
|
m_stack_recoPage->addWidget(m_recoPageScene);
|
||
|
}
|
||
|
#endif
|
||
|
else {
|
||
|
m_recoPage = new recoUiRecognize(false, false, false, this);
|
||
|
m_stack_recoPage->addWidget(m_recoPage);
|
||
|
}
|
||
|
|
||
|
m_ssPage = new recoUiScreensaver(0, this);
|
||
|
m_stack_recoPage->addWidget(m_ssPage);
|
||
|
|
||
|
m_pwdPage = new recoUiPassword(this);
|
||
|
m_stack_recoPage->addWidget(m_pwdPage);
|
||
|
|
||
|
m_healthMsgPage = new recoUiHealthCode(this);
|
||
|
m_stack_recoPage->addWidget(m_healthMsgPage);
|
||
|
|
||
|
m_sceneResult = new recoUiSceneResult(this);
|
||
|
m_stack_recoPage->addWidget(m_sceneResult);
|
||
|
|
||
|
m_callDialPage = new recoUiCallDial(this);
|
||
|
m_stack_recoPage->addWidget(m_callDialPage);
|
||
|
|
||
|
m_callConsolePage = new recoUiCallConsole(this);
|
||
|
m_stack_recoPage->addWidget(m_callConsolePage);
|
||
|
|
||
|
if(UiConfig::GetInstance()->isRkDevice()){
|
||
|
DrawPage* draw = new DrawPage(UiConfig::GetInstance()->getUiWidth(), UiConfig::GetInstance()->getUiHeight(), this);
|
||
|
m_stack_recoPage->addWidget(draw);
|
||
|
}
|
||
|
|
||
|
m_timer = new QTimer(this);
|
||
|
connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimer()));
|
||
|
|
||
|
QVBoxLayout* vbLayout = new QVBoxLayout();
|
||
|
vbLayout->addWidget(m_stack_recoPage, 90);
|
||
|
//vbLayout->addWidget(m_statusbar, 1);
|
||
|
vbLayout->setMargin(0);
|
||
|
vbLayout->setSpacing(0);
|
||
|
setLayout(vbLayout);
|
||
|
|
||
|
connect(parent, SIGNAL(signalUpdateScreenSaver()), m_ssPage, SLOT(slotUpdateScreenSaver()));
|
||
|
connect(parent, SIGNAL(signalShowUserPwd(const QString&)), this, SLOT(slotShowPasswordPage(const QString&)));
|
||
|
connect(m_pwdPage, SIGNAL(signalShowRecognizePage()), this, SLOT(slotShowRecognizePage()));
|
||
|
connect(parent, SIGNAL(signalShowPwdUiPersonName(const QString&)), m_pwdPage, SLOT(slotShowPwdUiPersonName(const QString&)));
|
||
|
connect(parent, SIGNAL(signalShowUserPwdError(int, int)), m_pwdPage, SLOT(slotShowUserPwdError(int, int)));
|
||
|
connect(parent, SIGNAL(signalSetUserPwdButton(bool)), this, SLOT(slotSaveRecoUiPwdBtnStatus(bool)));
|
||
|
connect(parent, SIGNAL(signalShowRecoUiMask(int)), this, SLOT(slotSaveRecoUiNightModeStatus(int)));
|
||
|
connect(parent, SIGNAL(signalUpdateAdWidget()), this, SLOT(slotUpdateAdScreen()));
|
||
|
connect(parent, SIGNAL(signalShowHealthMsg(int, float, const QString&, bool, const unsigned char*, int, const QString&, const QString&, int, int)),
|
||
|
this, SLOT(slotShowHealthMsg(int, float, const QString&, bool, const unsigned char*, int, const QString&, const QString&, int, int)));
|
||
|
connect(parent, SIGNAL(signalShowSceneResult(int, const QString&, const QString&, int)),
|
||
|
this, SLOT(slotShowSceneResult(int, const QString&, const QString&, int)));
|
||
|
connect(parent, SIGNAL(signalUpdatePersonNumAccessed(int, int)), this, SLOT(slotUpdatePersonNumAccessed(int, int)));
|
||
|
connect(parent, SIGNAL(signalSetSceneUiPersonCountType(int)), this, SLOT(slotSetSceneUiPersonCountType(int)));
|
||
|
connect(parent, SIGNAL(signalUpdateSceneUiPersonCount(int)), this, SLOT(slotUpdateSceneUiPersonCount(int)));
|
||
|
connect(m_callDialPage, SIGNAL(signalShowRecognizePage()), this, SLOT(slotShowRecognizePage()));
|
||
|
connect(m_callConsolePage, SIGNAL(signalShowRecognizePage()), this, SLOT(slotShowRecognizePage()));
|
||
|
connect(m_callDialPage, SIGNAL(signalCallBtnPressed(const QString&)), this, SLOT(slotShowCallConsolePage(const QString&)));
|
||
|
connect(m_callConsolePage, SIGNAL(signalCallAgain()), m_callDialPage, SLOT(slotCall()));
|
||
|
|
||
|
auto p = dynamic_cast<mainUi *>(parent);
|
||
|
if (p != nullptr) {
|
||
|
connect(p, &mainUi::signalShowCallBtn, this, &recoUi::slotShowCallBtn);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
recoUi::~recoUi()
|
||
|
{
|
||
|
qDebug() << "~recoUi()";
|
||
|
}
|
||
|
|
||
|
void recoUi::setBackstageUiinterface(BackstageInterfaceForUi* interface)
|
||
|
{
|
||
|
m_backstageIf = interface;
|
||
|
if(m_recoPage){
|
||
|
m_recoPage->setBackstageUiinterface(m_backstageIf);
|
||
|
connectRecoPage(m_recoPage);
|
||
|
m_recoPage->setStyle(UiConfig::GetInstance()->isRecoUiStyleScene() ? 4 : 0);
|
||
|
}else if(m_recoPageColor){
|
||
|
m_recoPageColor->setBackstageUiinterface(m_backstageIf);
|
||
|
connectRecoPage(m_recoPageColor);
|
||
|
}else if(m_recoPageAd){
|
||
|
m_recoPageAd->setBackstageUiinterface(m_backstageIf);
|
||
|
connectRecoPage(m_recoPageAd);
|
||
|
QTimer::singleShot(1000, this, [this]{m_recoPageAd->setCamVideoWind();});
|
||
|
}
|
||
|
if (m_sceneResult != nullptr && m_backstageIf != nullptr) { // 初始化检票人数
|
||
|
m_sceneResult->setPersonCountType(m_backstageIf->getTicketModePeopleCountType());
|
||
|
m_sceneResult->setTicketCheckCount(-1, m_backstageIf->getTicketCheckCountToday());
|
||
|
}
|
||
|
#if 0
|
||
|
else if(m_recoPageScene){
|
||
|
connectRecoPage(m_recoPageScene);
|
||
|
m_recoPageScene->setBackstageUiinterface(m_backstageIf);
|
||
|
}
|
||
|
#endif
|
||
|
m_ssPage->setBackstageUiinterface(m_backstageIf);
|
||
|
m_pwdPage->setBackstageUiinterface(m_backstageIf);
|
||
|
m_healthMsgPage->setBackstageUiinterface(m_backstageIf);
|
||
|
m_callDialPage->setBackstageUiinterface(m_backstageIf);
|
||
|
m_callConsolePage->setBackstageUiinterface(m_backstageIf);
|
||
|
update_IpBar();
|
||
|
}
|
||
|
|
||
|
//statusbarUi *recoUi::getStatusInstance()
|
||
|
//{
|
||
|
// return m_statusbar;
|
||
|
//}
|
||
|
|
||
|
void recoUi::slotShowSettingPage()
|
||
|
{
|
||
|
emit signalShowSettingPage();
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowRecoUiPage(const int nPage)
|
||
|
{
|
||
|
int index = m_stack_recoPage->currentIndex();
|
||
|
if(nPage == RECO_UI_PAGE_WORK_MODE){
|
||
|
if(index == RECO_UI_PAGE_SCREENSAVER){
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_RECOGNIZE);
|
||
|
}
|
||
|
return;
|
||
|
}else if(index == RECO_UI_PAGE_HEALTHCODE || index == RECO_UI_PAGE_SCENERESULT || index == RECO_UI_PAGE_CALL_DIAL || index == RECO_UI_PAGE_CALL_CONSOLE){
|
||
|
return;
|
||
|
}
|
||
|
m_stack_recoPage->setCurrentIndex(nPage);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotUpdatePlatformConnectionStatus(int status) {
|
||
|
m_isPlatformConnected = (status == UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_LOGGED);
|
||
|
if (m_callDialPage != nullptr) {
|
||
|
m_callDialPage->setPlatformConnected(status == UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_LOGGED);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowPasswordPage(const QString& name)
|
||
|
{
|
||
|
m_pwdPage->reset(name);
|
||
|
slotShowRecoUiPage(RECO_UI_PAGE_PASSWORD);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowRecognizePage()
|
||
|
{
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_RECOGNIZE);
|
||
|
m_backstageIf->startIdentyState();
|
||
|
}
|
||
|
|
||
|
void recoUi::update_IpBar()
|
||
|
{
|
||
|
if(nullptr == m_backstageIf)
|
||
|
{
|
||
|
return ;
|
||
|
}
|
||
|
|
||
|
#if 0
|
||
|
const int nSize = 128;
|
||
|
char buf[nSize] = "";
|
||
|
m_backstageIf->getIP(buf, nSize);
|
||
|
QString ipStr = buf;
|
||
|
m_statusbar->updateIpLabel(ipStr);
|
||
|
#endif
|
||
|
if(m_backstageIf){
|
||
|
emit signalUpdateRecoUiIpDisplay(m_backstageIf->getIpShowSw());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::updateVideoWind()
|
||
|
{
|
||
|
QWidget *curWidget = m_stack_recoPage->currentWidget();
|
||
|
|
||
|
if(curWidget == m_recoPage){
|
||
|
m_recoPage->setCamVideoWind();
|
||
|
}else if(curWidget == m_recoPageColor){
|
||
|
m_recoPageColor->setCamVideoWind();
|
||
|
}else if(curWidget == m_recoPageAd){
|
||
|
m_recoPageAd->setCamVideoWind();
|
||
|
}
|
||
|
#if 0
|
||
|
else if(curWidget == m_recoPageScene){
|
||
|
m_recoPageScene->setCamVideoWind();
|
||
|
}
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
bool recoUi::isScenePassing()
|
||
|
{
|
||
|
return m_stack_recoPage->currentIndex() == RECO_UI_PAGE_SCENERESULT;//m_sceneResult->isPassing();
|
||
|
}
|
||
|
|
||
|
|
||
|
void recoUi::connectRecoPage(const QObject* recoPage)
|
||
|
{
|
||
|
connect(recoPage, SIGNAL(signalChangePage()), this, SLOT(slotShowSettingPage()));
|
||
|
|
||
|
connect(this, SIGNAL(signalNoSuccessPage(const int)), recoPage, SLOT(slotsNoSuccessPage(const int)));
|
||
|
connect(this, SIGNAL(signalSuccessPage(const int, const QString&)), recoPage, SLOT(slotsSuccessPage(const int, const QString&)));
|
||
|
connect(parent()->parent(), SIGNAL(signalDrawScanner(const int, const bool)), recoPage, SLOT(slotsDrawScanner(const int, const bool)));
|
||
|
connect(parent()->parent(), SIGNAL(signalInteraction(const INTERACION_OPTION& , int )),
|
||
|
recoPage, SLOT(slotsInteractionChange(const INTERACION_OPTION& , int )));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowForeheadNormalTemp(const float, const bool)), recoPage, SLOT(slotShowNormalTemp(const float, const bool)));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowForeheadAbnormalTemp(const float, const bool, const bool)), recoPage, SLOT(slotShowAbnormalTemp(const float, const bool, const bool)));
|
||
|
connect(parent()->parent(), SIGNAL(signalUpdateLogo(const int)), recoPage, SLOT(slotUpdateLogo(const int)));
|
||
|
connect(parent()->parent(), SIGNAL(signalUpdatePlatformConnectionStatus(const int)), recoPage, SLOT(slotUpdatePlatformConnectionStatus(const int)));
|
||
|
connect(parent()->parent(), SIGNAL(signalResetRecoUi()), recoPage, SLOT(slotsResetRecoUi()));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowQRCodeMsg(int)), recoPage, SLOT(slotShowQRCodeMsg(int)));
|
||
|
connect(this, SIGNAL(signalChangeRecoUiMode()), recoPage, SLOT(slotChangeRecoUiMode()));
|
||
|
connect(this, SIGNAL(signalUpdateRecoUiIpDisplay(bool)), recoPage, SLOT(slotUpdateRecoUiIpDisplay(bool)));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowFeatureUpdateProgress(const unsigned, const unsigned)), recoPage, SLOT(slotShowFeatureUpdateProgress(const unsigned, const unsigned)));
|
||
|
connect(parent()->parent(), SIGNAL(signalCloseFeatureUpdateProgress()), recoPage, SLOT(slotCloseFeatureUpdateProgress()));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowRecoUiMask(int)), recoPage, SLOT(slotShowRecoUiMask(int)));
|
||
|
connect(parent()->parent(), SIGNAL(signalNotiMsg(const int, const QString&, int)), recoPage, SLOT(slotNotiMsg(const int, const QString&, int)));
|
||
|
connect(parent()->parent(), SIGNAL(signalCenterMsg(const int, const QString&)), recoPage, SLOT(slotCenterMsg(const int, const QString&)));
|
||
|
connect(recoPage, SIGNAL(signalShowPwdPage(const QString&)), this, SLOT(slotShowPasswordPage(const QString&)));
|
||
|
connect(parent()->parent(), SIGNAL(signalSetUserPwdButton(bool)), recoPage, SLOT(slotSetUserPwdButton(bool)));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowOrHideFaceFrame(bool)), recoPage, SLOT(slotShowOrHideFaceFrame(bool)));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowFinalResult(bool)), recoPage, SLOT(slotShowFinalResult(bool)));
|
||
|
|
||
|
connect(parent()->parent(), SIGNAL(signalShowRecoUiColorFaceSnapshot(const QString&)), recoPage, SLOT(slotShowRecoUiColorFaceSnapshot(const QString&)));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowRecoUiColorFaceSnapshot(const unsigned char*, int)), recoPage, SLOT(slotShowRecoUiColorFaceSnapshot(const unsigned char*, int)));
|
||
|
connect(parent()->parent(), SIGNAL(signalUpdateScreenSaver()), recoPage, SIGNAL(signalUpdateScreenSaver()));
|
||
|
connect(recoPage, SIGNAL(signalScreenTouch()), parent()->parent(), SLOT(slotScreenTouch()));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowHealthCodeAuthStatus(int)), recoPage, SLOT(slotShowHealthCodeAuthStatus(int)));
|
||
|
connect(parent()->parent(), SIGNAL(signalShowRecoUiDevIdAndVer(bool)), recoPage, SLOT(slotShowRecoUiDevIdAndVer(bool)));
|
||
|
if ((m_recoPage != nullptr) && (dynamic_cast<const recoUiRecognize *>(recoPage) == m_recoPage)) {
|
||
|
connect(m_recoPage, &recoUiRecognize::callDialButtonClicked, this, &recoUi::slotShowCallDialPage);
|
||
|
connect(m_recoPage, &recoUiRecognize::callPlatformButtonClicked, this, &recoUi::slotShowCallConsolePage);
|
||
|
} else if ((m_recoPageColor != nullptr) && (dynamic_cast<const recoUiRecognizeTypeColor *>(recoPage) == m_recoPageColor)) {
|
||
|
connect(m_recoPageColor, &recoUiRecognizeTypeColor::callDialButtonClicked, this, &recoUi::slotShowCallDialPage);
|
||
|
connect(m_recoPageColor, &recoUiRecognizeTypeColor::callPlatformButtonClicked, this, &recoUi::slotShowCallConsolePage);
|
||
|
} else if ((m_recoPageAd != nullptr) && (dynamic_cast<const recoUiRecognizeTypeAd *>(recoPage) == m_recoPageAd)) {
|
||
|
connect(m_recoPageAd, &recoUiRecognizeTypeAd::callDialButtonClicked, this, &recoUi::slotShowCallDialPage);
|
||
|
connect(m_recoPageAd, &recoUiRecognizeTypeAd::callPlatformButtonClicked, this, &recoUi::slotShowCallConsolePage);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotRecoUiswitchToType(int type)
|
||
|
{
|
||
|
if( (0 == type && UiConfig::GetInstance()->isRecoUiStyleClassical()) ||
|
||
|
(1 == type && UiConfig::GetInstance()->isRecoUiStyleStandard()) ||
|
||
|
(2 == type && UiConfig::GetInstance()->isRecoUiStyleColor()) ||
|
||
|
(3 == type && UiConfig::GetInstance()->isRecoUiStyleAd()) ||
|
||
|
(4 == type && UiConfig::GetInstance()->isRecoUiStyleScene()) ){
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if( ( (0 == type || 4 == type) && !UiConfig::GetInstance()->isRecoUiStyleStandard()) ||
|
||
|
( (1 == type || 4 == type) && !UiConfig::GetInstance()->isRecoUiStyleClassical()) ||
|
||
|
( (0 == type || 1 == type) && !UiConfig::GetInstance()->isRecoUiStyleScene()) ){
|
||
|
if(!m_recoPage){
|
||
|
m_recoPage = new recoUiRecognize(m_isNightMode, m_showPwdBtn, m_showCallBtn, this);
|
||
|
connectRecoPage(m_recoPage);
|
||
|
m_recoPage->setBackstageUiinterface(m_backstageIf);
|
||
|
}
|
||
|
m_stack_recoPage->insertWidget(0, m_recoPage);
|
||
|
m_recoPage->setCamVideoWind();
|
||
|
}else if(2 == type){
|
||
|
if(!m_recoPageColor){
|
||
|
m_recoPageColor = new recoUiRecognizeTypeColor(m_isNightMode, m_showPwdBtn, m_showCallBtn, this);
|
||
|
connectRecoPage(m_recoPageColor);
|
||
|
m_recoPageColor->setBackstageUiinterface(m_backstageIf);
|
||
|
}
|
||
|
m_stack_recoPage->insertWidget(0, m_recoPageColor);
|
||
|
m_recoPageColor->setCamVideoWind();
|
||
|
}else if(3 == type){
|
||
|
if(!m_recoPageAd){
|
||
|
m_recoPageAd = new recoUiRecognizeTypeAd(m_isNightMode, m_showPwdBtn, m_showCallBtn, this);
|
||
|
connectRecoPage(m_recoPageAd);
|
||
|
m_recoPageAd->setBackstageUiinterface(m_backstageIf);
|
||
|
}
|
||
|
m_stack_recoPage->insertWidget(0, m_recoPageAd);
|
||
|
m_recoPageAd->setCamVideoWind();
|
||
|
}
|
||
|
#if 0
|
||
|
else if(4 == type){
|
||
|
if(!m_recoPageScene){
|
||
|
m_recoPageScene = new recoUiRecognizeScene(m_isNightMode, m_showPwdBtn, m_showCallBtn, this);
|
||
|
connectRecoPage(m_recoPageScene);
|
||
|
m_recoPageScene->setBackstageUiinterface(m_backstageIf);
|
||
|
}
|
||
|
m_stack_recoPage->insertWidget(0, m_recoPageScene);
|
||
|
m_recoPageScene->setCamVideoWind();
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
if( (1 != type && 4 != type && UiConfig::GetInstance()->isRecoUiStyleClassical()) ||
|
||
|
(0 != type && 4 != type && UiConfig::GetInstance()->isRecoUiStyleStandard()) ||
|
||
|
(0 != type && 1 != type && UiConfig::GetInstance()->isRecoUiStyleScene()) ){
|
||
|
m_stack_recoPage->removeWidget(m_recoPage);
|
||
|
}else if(2 != type && UiConfig::GetInstance()->isRecoUiStyleColor()){
|
||
|
m_stack_recoPage->removeWidget(m_recoPageColor);
|
||
|
}else if(3 != type && UiConfig::GetInstance()->isRecoUiStyleAd()){
|
||
|
m_stack_recoPage->removeWidget(m_recoPageAd);
|
||
|
}
|
||
|
#if 0
|
||
|
else if(4 != type && UiConfig::GetInstance()->isRecoUiStyleScene()){
|
||
|
m_stack_recoPage->removeWidget(m_recoPageScene);
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
m_stack_recoPage->setCurrentIndex(0);
|
||
|
UiConfig::GetInstance()->setRecoUiStyle(type);
|
||
|
if( m_recoPage && (0 == type || 1 == type || 4 == type) ){
|
||
|
m_recoPage->setStyle(type);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotSaveRecoUiPwdBtnStatus(bool status)
|
||
|
{
|
||
|
qDebug() << "slotSaveRecoUiPwdBtnStatus:" << status;
|
||
|
m_showPwdBtn = status;
|
||
|
}
|
||
|
|
||
|
void recoUi::slotSaveRecoUiNightModeStatus(int type)
|
||
|
{
|
||
|
//qDebug() << "slotSaveRecoUiNightModeStatus:" << type;
|
||
|
m_isNightMode = (3 == type);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotUpdateAdScreen()
|
||
|
{
|
||
|
if(m_recoPageAd){
|
||
|
m_recoPageAd->updateAdWidget();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotTimer()
|
||
|
{
|
||
|
m_timer->stop();
|
||
|
m_recoPage->slotsResetRecoUi(); // 这里直接调用 reset, 否则RECO_UI_PAGE_RECOGNIZE可能会出现中间态
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_RECOGNIZE);
|
||
|
if(UiConfig::GetInstance()->isRecoUiStyleScene()){
|
||
|
m_sceneResult->resetPersonCount();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowHealthMsg(int type, float temp, const QString& msg, bool pass, const unsigned char* jpgDate,
|
||
|
int jpgLen, const QString& tripCity, const QString& failReason, int bgColor, int displayTime)
|
||
|
{
|
||
|
if(type < 0){
|
||
|
m_timer->stop();
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_RECOGNIZE);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
m_healthMsgPage->showHealthMsg(type, temp, msg, pass, jpgDate, jpgLen, tripCity, failReason, bgColor);
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_HEALTHCODE);
|
||
|
m_timer->start(displayTime * 1000);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowSceneResult(int result, const QString& resultText, const QString& businessInfo, int displayTime)
|
||
|
{
|
||
|
if(result < 0){
|
||
|
if(-1 == result){ //超时
|
||
|
m_sceneResult->resetPersonCount();
|
||
|
m_recoPage->setSceneUiReco(false);
|
||
|
}else{
|
||
|
m_recoPage->setSceneUiReco(true);
|
||
|
}
|
||
|
m_timer->stop();
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_RECOGNIZE);
|
||
|
return;
|
||
|
}
|
||
|
if(result > 0){//通过才更新
|
||
|
int count = m_backstageIf->getTicketCheckCountToday();
|
||
|
m_sceneResult->setTicketCheckCount(0, count);
|
||
|
m_recoPage->setTicketCheckCount(0, count);
|
||
|
|
||
|
#if 0
|
||
|
m_recoPageScene->setTicketCheckCount(count);
|
||
|
#endif
|
||
|
}
|
||
|
m_sceneResult->showResult(result, resultText, businessInfo);
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_SCENERESULT);
|
||
|
m_timer->start(displayTime);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotUpdatePersonNumAccessed(int personAccess, int personAll)
|
||
|
{
|
||
|
if(m_stack_recoPage->currentIndex() != RECO_UI_PAGE_SCENERESULT){
|
||
|
return;
|
||
|
}
|
||
|
if(m_sceneResult->updatePersonNumAccessed(personAccess, personAll)){
|
||
|
m_timer->start(1000);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotNoSuccessPage(int result)
|
||
|
{
|
||
|
if(UiConfig::GetInstance()->isRecoUiStyleScene()){
|
||
|
if(m_stack_recoPage->currentIndex() == RECO_UI_PAGE_SCENERESULT){
|
||
|
if(GLOBAL_RECO_FACE_CAMERA == result){
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_RECOGNIZE);//请正视镜头可以打断场景结果,需要切换页面
|
||
|
}else{
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if(result != GLOBAL_RECO_NO_ENTRY && result != GLOBAL_RECO_CLEAR_NO_ENTRY){
|
||
|
m_recoPage->setSceneUiReco(true);
|
||
|
}
|
||
|
}
|
||
|
emit signalNoSuccessPage(result);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotSetSceneUiPersonCountType(int type)
|
||
|
{
|
||
|
m_sceneResult->setPersonCountType(type);
|
||
|
m_recoPage->setScenePersonCountType(type);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotUpdateSceneUiPersonCount(int count)
|
||
|
{
|
||
|
m_sceneResult->setTicketCheckCount(1, count);
|
||
|
m_recoPage->setTicketCheckCount(1, count);
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowCallDialPage() {
|
||
|
if (m_isPlatformConnected) {
|
||
|
m_callDialPage->reset();
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_CALL_DIAL);
|
||
|
m_backstageIf->getCallDevList();
|
||
|
} else {
|
||
|
if (m_recoPage != nullptr) {
|
||
|
emit m_recoPage->slotCenterMsg(64, "当前设备离线,请稍后重试");
|
||
|
QTimer::singleShot(1500, this, [this]() { emit m_recoPage->slotCenterMsg(64, ""); });
|
||
|
}
|
||
|
if (m_recoPageColor != nullptr) {
|
||
|
emit m_recoPageColor->slotCenterMsg(64, "当前设备离线,请稍后重试");
|
||
|
QTimer::singleShot(1500, this, [this]() { emit m_recoPageColor->slotCenterMsg(64, ""); });
|
||
|
}
|
||
|
if (m_recoPageAd != nullptr) {
|
||
|
emit m_recoPageAd->slotCenterMsg(64, "当前设备离线,请稍后重试");
|
||
|
QTimer::singleShot(1500, this, [this]() { emit m_recoPageAd->slotCenterMsg(64, ""); });
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowCallConsolePage(const QString &contactName) {
|
||
|
if (m_isPlatformConnected) {
|
||
|
m_callConsolePage->reset(contactName);
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_CALL_CONSOLE);
|
||
|
if (contactName == "管理处") {
|
||
|
m_backstageIf->callDev("", 2);
|
||
|
}
|
||
|
} else {
|
||
|
if (m_recoPage != nullptr) {
|
||
|
emit m_recoPage->slotCenterMsg(64, "当前设备离线,请稍后重试");
|
||
|
QTimer::singleShot(1500, this, [this]() { emit m_recoPage->slotCenterMsg(64, ""); });
|
||
|
}
|
||
|
if (m_recoPageColor != nullptr) {
|
||
|
emit m_recoPageColor->slotCenterMsg(64, "当前设备离线,请稍后重试");
|
||
|
QTimer::singleShot(1500, this, [this]() { emit m_recoPageColor->slotCenterMsg(64, ""); });
|
||
|
}
|
||
|
if (m_recoPageAd != nullptr) {
|
||
|
emit m_recoPageAd->slotCenterMsg(64, "当前设备离线,请稍后重试");
|
||
|
QTimer::singleShot(1500, this, [this]() { emit m_recoPageAd->slotCenterMsg(64, ""); });
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotSetCallConsoleStatus(int status, const QString& text)
|
||
|
{
|
||
|
m_callConsolePage->setStatus(status, text);
|
||
|
if(status < 100){
|
||
|
m_stack_recoPage->setCurrentIndex(RECO_UI_PAGE_CALL_CONSOLE);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::slotShowCallBtn(bool callButton, bool videoButton) {
|
||
|
m_showCallBtn = callButton;
|
||
|
if (m_recoPage != nullptr) {
|
||
|
m_recoPage->slotShowCallBtn(m_showCallBtn);
|
||
|
}
|
||
|
if (m_recoPageColor != nullptr) {
|
||
|
m_recoPageColor->slotShowCallBtn(m_showCallBtn);
|
||
|
}
|
||
|
if (m_recoPageAd != nullptr) {
|
||
|
m_recoPageAd->slotShowCallBtn(m_showCallBtn);
|
||
|
}
|
||
|
if (m_callConsolePage != nullptr) {
|
||
|
m_callConsolePage->setVideoButtonVisible(videoButton);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void recoUi::setDndMode(bool enabled, const std::chrono::system_clock::time_point &time) {
|
||
|
if (m_recoPageAd) {
|
||
|
m_recoPageAd->setDndMode(enabled, time);
|
||
|
}
|
||
|
}
|