1 Star 0 Fork 0

qinxude/rk3568ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
faceidtimeout.cpp 2.84 KB
一键复制 编辑 原始数据 按行查看 历史
qinxude 提交于 2024-09-03 09:38 . 3568ui base
#include "faceidtimeout.h"
#include "ui_faceidtimeout.h"
FaceIdTimeout::FaceIdTimeout(QWidget *parent) :
QWidget(parent),
ui(new Ui::FaceIdTimeout)
{
ui->setupUi(this);
hide();
m_DelayTimer = new QTimer;
m_DelayTimer->setInterval(10 * 60 *1000);
m_DecTimer = new QTimer;
m_DecTimer->setInterval(1000);
m_SoftTimer = new QTimer;
//SetSoftwareTimer(DataDictionary::GetInstance()->GetMisData(MIS_FACEID_TIMEOUT).toInt());
m_Cnt = 300;
connect(m_DecTimer,SIGNAL(timeout()),\
this,SLOT(UpdateCnt()));
connect(m_DelayTimer,SIGNAL(timeout()),\
this,SLOT(show()));
connect(m_SoftTimer,SIGNAL(timeout()),\
this,SLOT(SoftTimeout()));
connect(DataDictionary::GetInstance(),SIGNAL(MisDataChange(MisDataIndex_t)),\
this,SLOT(MisDataChange(MisDataIndex_t)));
}
FaceIdTimeout::~FaceIdTimeout()
{
delete ui;
}
void FaceIdTimeout::showEvent(QShowEvent *event)
{
m_Cnt = 300;
ShowDecCnt();
m_DecTimer->start();
m_DelayTimer->stop();
}
void FaceIdTimeout::hideEvent(QHideEvent *event)
{
m_DecTimer->stop();
}
void FaceIdTimeout::on_StartDecButton_clicked()
{
DataDictionary::GetInstance()->SetMisData(MIS_FACEID_START,1);
DataDictionary::GetInstance()->SetMisData(MIS_FACEID_STA,0);
}
void FaceIdTimeout::UpdateCnt()
{
m_Cnt--;
if(m_Cnt == 0)
{
hide();
DataDictionary::GetInstance()->SetMisData(MIS_FACEID_QUITE,1);
}
ShowDecCnt();
}
void FaceIdTimeout::ShowDecCnt()
{
ui->Cnt->setText(QString().number(m_Cnt));
}
void FaceIdTimeout::on_DelayButton_clicked()
{
m_DelayTimer->start();
hide();
}
void FaceIdTimeout::MisDataChange(MisDataIndex_t Index)
{
switch (Index) {
case MIS_FACEID_STA:
case MIS_FACEID_TIMEOUT:
hide();
m_DelayTimer->stop();
if(DataDictionary::GetInstance()->GetMisData(MIS_FACEID_STA).toUInt() == 1)
{
SetSoftwareTimer(DataDictionary::GetInstance()->GetMisData(MIS_FACEID_TIMEOUT).toInt());
}
else if(DataDictionary::GetInstance()->GetMisData(MIS_FACEID_STA).toUInt() == 0){
SetSoftwareTimer(0);
}
break;
case MIS_BLKBOX_FACEID_INFO:
if(DataDictionary::GetInstance()->GetMisData(Index).toUInt() == 2){
m_DelayTimer->stop();
SoftTimeout();
}
break;
// SetSoftwareTimer(DataDictionary::GetInstance()->GetMisData(MIS_FACEID_TIMEOUT).toInt());
// break;
default:
break;
}
}
void FaceIdTimeout::SoftTimeout()
{
if(m_DelayTimer->isActive())
{
return ;
}
else
{
m_SoftTimer->stop();
this->show();
}
}
void FaceIdTimeout::SetSoftwareTimer(int32_t T)
{
m_SoftTimer->stop();
if(T > 0)
{
m_SoftTimer->setInterval(T * 1000);
m_SoftTimer->start();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/qinxude/rk3568ui.git
[email protected]:qinxude/rk3568ui.git
qinxude
rk3568ui
rk3568ui
master

搜索帮助