代码拉取完成,页面将自动刷新
#include "exportprogress.h"
#include "ui_exportprogress.h"
ExportProgress::ExportProgress(QWidget *parent) :
QWidget(parent),
ui(new Ui::ExportProgress)
{
ui->setupUi(this);
this->hide();
m_DataDictionary = DataDictionary::GetInstance();
ui->progressBar->setRange(0,100);
m_Timer = new QTimer;
m_Timer->setInterval(1000);
ui->progressBar->setStyleSheet("QProgressBar { \
border: 0px solid grey; \
background-color: rgba(255, 255, 255,0);\
color: rgb(255, 255, 255);\
}\
QProgressBar::chunk {\
background-color: rgb(115, 210, 22);\
}");
connect(m_Timer,SIGNAL(timeout()),\
this,SLOT(QuiteTimeout()));
}
ExportProgress::~ExportProgress()
{
delete ui;
}
void ExportProgress::showEvent(QShowEvent *event)
{
ui->progressBar->setValue(0);
on_Exporting_Show();
connect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),\
this,SLOT(DevParamDataChange(DevParamDataIndex_t)));
}
void ExportProgress::hideEvent(QHideEvent *event)
{
m_Timer->stop();
disconnect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),\
this,SLOT(DevParamDataChange(DevParamDataIndex_t)));
}
void ExportProgress::DevParamDataChange(DevParamDataIndex_t Index)
{
switch (Index) {
case D_EXPORT_PROGRESS:
{
QString V = m_DataDictionary->GetDevParamData(Index);
int P = V.toUInt();
if(P > 0 && P < 100)
{
ui->progressBar->setValue(P);
}
else if(P == 100)
{
ui->progressBar->setValue(P);
on_ExportError_Success();
}
else if(P == 999)
{
on_ExportError_Show();
}
}
break;
default:
break;
}
}
void ExportProgress::on_RetryButton_clicked()
{
on_Exporting_Show();
m_DataDictionary->SetMisData(MIS_BB_CMD,1);
}
void ExportProgress::on_Quite_clicked()
{
hide();
}
void ExportProgress::on_Stop_clicked()
{
on_ExportError_Show();
m_DataDictionary->SetMisData(MIS_BB_CMD,2);
}
void ExportProgress::QuiteTimeout()
{
m_Timer->start();
m_TimerCnt--;
ui->Pic->setText(QString().number(m_TimerCnt));
if(m_TimerCnt == 0)
on_Quite_clicked();
}
void ExportProgress::on_Exporting_Show()
{
m_TimerCnt = 3;
ui->Pic->setText("");
ui->Stop->show();
ui->Quite->hide();
ui->RetryButton->hide();
ui->Info->setText("导出中,请稍等");
ui->Info->setStyleSheet("QLabel{color: rgb(255,255,255);}");
ui->Pic->setStyleSheet("QLabel{image: url(:/image/SyncSta.png);}");
}
void ExportProgress::on_ExportError_Show()
{
ui->Stop->hide();
ui->Quite->show();
ui->RetryButton->show();
ui->Info->setText("导出失败");
ui->Info->setStyleSheet("QLabel{color: rgb(255,255,255);}");
ui->Pic->setStyleSheet("QLabel{image: url(:/image/SettingFailed.png);}");
}
void ExportProgress::on_ExportError_Success()
{
m_Timer->start();
ui->Stop->hide();
ui->Quite->hide();
ui->RetryButton->hide();
ui->Info->setText("导出成功,自动返回");
ui->Info->setStyleSheet("QLabel{color: rgb(255,255,255);}");
ui->Pic->setStyleSheet("QLabel{color: rgb(255,255,255);\
border-image: url(:/image/CountDown.png);}");
ui->Pic->setText(QString().number(m_TimerCnt));
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。