1 Star 0 Fork 0

qinxude/rk3568ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
exportprogress.cpp 3.53 KB
一键复制 编辑 原始数据 按行查看 历史
qinxude 提交于 2024-09-03 09:38 . 3568ui base
#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));
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/qinxude/rk3568ui.git
[email protected]:qinxude/rk3568ui.git
qinxude
rk3568ui
rk3568ui
master

搜索帮助