代码拉取完成,页面将自动刷新
#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);}");
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。