1 Star 0 Fork 0

qinxude/rk3568ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
syncdatatobb.cpp 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
qinxude 提交于 2024-09-03 09:38 . 3568ui base
#include "syncdatatobb.h"
#include "ui_syncdatatobb.h"
SyncDataToBB::SyncDataToBB(QWidget *parent) :
QWidget(parent),
ui(new Ui::SyncDataToBB)
{
ui->setupUi(this);
this->hide();
m_Timer = new QTimer;
m_Timer->setInterval(5*1000);
m_DataDictionary = DataDictionary::GetInstance();
connect(m_Timer,SIGNAL(timeout()),\
this,SLOT(syncTimeout()));
}
SyncDataToBB::~SyncDataToBB()
{
delete ui;
}
void SyncDataToBB::showEvent(QShowEvent *event)
{
ScreenSwitchButton::GetInstance()->Show(this);
m_DataDictionary->SetDevParamData(D_ALL_DATA,1);
m_Timer->start();
ui->Info->setText("同步中 ... ...");
ui->Info->setStyleSheet("QLabel{color: rgb(0,0,0);}");
ui->Pic->setStyleSheet("QLabel{image: url(:/image/SyncSta.png);}");
connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),\
this,SLOT(MisDataChange(MisDataIndex_t)));
}
void SyncDataToBB::hideEvent(QHideEvent *event)
{
m_Timer->stop();
disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),\
this,SLOT(MisDataChange(MisDataIndex_t)));
}
void SyncDataToBB::MisDataChange(MisDataIndex_t Index)
{
switch (Index) {
case MIS_BLKBOX_SYNCSTA:
{
QString V = m_DataDictionary->GetMisData(Index);
SetSta(V.toUInt());
}
break;
default:
break;
}
}
void SyncDataToBB::syncTimeout()
{
SetSta(2);
}
void SyncDataToBB::SetSta(int Sta)
{
m_Timer->stop();
if(Sta == 0)
{
ui->Info->setText("同步失败");
ui->Info->setStyleSheet("QLabel{color: rgb(238, 0, 0);}");
ui->Pic->setStyleSheet("QLabel{image: url(:/image/SettingFailed.png);}");
}
else if(Sta == 1)
{
ui->Info->setText("同步成功");
ui->Info->setStyleSheet("QLabel{color: rgb(0, 238, 0);}");
ui->Pic->setStyleSheet("QLabel{image: url(:/image/SettingSucess.png);}");
}
else {
ui->Info->setText("同步超时");
ui->Info->setStyleSheet("QLabel{color: rgb(238, 0, 0);}");
ui->Pic->setStyleSheet("QLabel{image: url(:/image/SettingFailed.png);}");
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/qinxude/rk3568ui.git
[email protected]:qinxude/rk3568ui.git
qinxude
rk3568ui
rk3568ui
master

搜索帮助