1 Star 0 Fork 0

qinxude/rk3568ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
functionaltestsetting.cpp 14.16 KB
一键复制 编辑 原始数据 按行查看 历史
qinxude 提交于 2024-09-03 09:38 . 3568ui base
#include "functionaltestsetting.h"
#include "ui_functionaltestsetting.h"
FunctionalTestSetting::FunctionalTestSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::FunctionalTestSetting)
{
ui->setupUi(this);
this->hide();
m_DataDictionary = DataDictionary::GetInstance();
SetQRadioButtonStyleSheet();
}
FunctionalTestSetting::~FunctionalTestSetting()
{
delete ui;
}
void FunctionalTestSetting::on_QuiteButton_clicked()
{
this->hide();
}
void FunctionalTestSetting::SetQRadioButtonStyleSheet(QRadioButton *button,bool s)
{
if(s)
{
button->setStyleSheet("QRadioButton\
{\
color: rgb(15, 188, 18);\
image-position:left;\
padding-left:20px;\
font: 24px 'Ubuntu';\
font: bold;\
border:0px solid;\
border-color: rgb(53,65,139);\
padding-left: 0px; \
}\
QRadioButton::indicator\
{\
width:30px;\
height:30px;\
}");
}
else {
button->setStyleSheet("QRadioButton\
{\
color: rgb(204, 0, 0);\
image-position:left;\
padding-left:20px;\
font: 24px 'Ubuntu';\
font: bold;\
border:0px solid;\
border-color: rgb(53,65,139);\
padding-left: 0px; \
}\
QRadioButton::indicator\
{\
width:30px;\
height:30px;\
}");
}
}
void FunctionalTestSetting::SetQRadioButtonStyleSheet()
{
SetQRadioButtonStyleSheet(ui->CarUpStart,true);
SetQRadioButtonStyleSheet(ui->CarDownStart,true);
SetQRadioButtonStyleSheet(ui->CarFontStart,true);
SetQRadioButtonStyleSheet(ui->CarBackStart,true);
SetQRadioButtonStyleSheet(ui->CarLeftStart,true);
SetQRadioButtonStyleSheet(ui->CarRightStart,true);
SetQRadioButtonStyleSheet(ui->CarUpStop,false);
SetQRadioButtonStyleSheet(ui->CarDownStop,false);
SetQRadioButtonStyleSheet(ui->CarFontStop,false);
SetQRadioButtonStyleSheet(ui->CarBackStop,false);
SetQRadioButtonStyleSheet(ui->CarLeftStop,false);
SetQRadioButtonStyleSheet(ui->CarRightStop,false);
}
void FunctionalTestSetting::showEvent(QShowEvent *event)
{
Display();
connect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),
this,SLOT(DevParamDataChangeProcess(DevParamDataIndex_t)));
}
void FunctionalTestSetting::hideEvent(QHideEvent *event)
{
disconnect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),
this,SLOT(DevParamDataChangeProcess(DevParamDataIndex_t)));
}
void FunctionalTestSetting::Display()
{
uint32_t Sta = 0;
Sta = m_DataDictionary->GetDevParamData(D_TOWER_CAR_FRONT).toUInt();
if(Sta == DEV_SET_UNABLE){
ui->CarFontStart->setChecked(false);
ui->CarFontStop->setChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
ui->CarFontStart->setChecked(true);
ui->CarFontStop->setChecked(false);
}
Sta = m_DataDictionary->GetDevParamData(D_TOWER_CAR_BACK).toUInt();
if(Sta == DEV_SET_UNABLE){
ui->CarBackStart->setChecked(false);
ui->CarBackStop->setChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
ui->CarBackStart->setChecked(true);
ui->CarBackStop->setChecked(false);
}
Sta = m_DataDictionary->GetDevParamData(D_TOWER_CAR_UP).toUInt();
if(Sta == DEV_SET_UNABLE){
ui->CarUpStart->setChecked(false);
ui->CarUpStop->setChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
ui->CarUpStart->setChecked(true);
ui->CarUpStop->setChecked(false);
}
Sta = m_DataDictionary->GetDevParamData(D_TOWER_CAR_DOWN).toUInt();
if(Sta == DEV_SET_UNABLE){
ui->CarDownStart->setChecked(false);
ui->CarDownStop->setChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
ui->CarDownStart->setChecked(true);
ui->CarDownStop->setChecked(false);
}
Sta = m_DataDictionary->GetDevParamData(D_TOWER_CAR_LEFT).toUInt();
if(Sta == DEV_SET_UNABLE){
ui->CarLeftStart->setChecked(false);
ui->CarLeftStop->setChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
ui->CarLeftStart->setChecked(true);
ui->CarLeftStop->setChecked(false);
}
Sta = m_DataDictionary->GetDevParamData(D_TOWER_CAR_RIGHT).toUInt();
if(Sta == DEV_SET_UNABLE){
ui->CarRightStart->setChecked(false);
ui->CarRightStop->setChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
ui->CarRightStart->setChecked(true);
ui->CarRightStop->setChecked(false);
}
Sta = m_DataDictionary->GetDevParamData(D_TOWER_SYS_DEBUG).toUInt();
if(Sta == DEV_SET_UNABLE){
DebugEntryChecked(false);
DebugExitChecked(true);
}else if (Sta == DEV_SET_ENABLE) {
DebugEntryChecked(true);
DebugExitChecked(false);
}
}
void FunctionalTestSetting::DebugEntryChecked(bool Sta)
{
if(Sta == true){
ui->DebugEntry->setStyleSheet("QPushButton{\
background-color: rgb(251, 160, 57);\
border:2px solid rgb(251, 160, 57);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);}");
ui->DebugEntry->setChecked(true);
}else {
ui->DebugEntry->setStyleSheet("QPushButton{\
border:2px solid rgb(255,255,255);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);}");
ui->DebugEntry->setChecked(false);
}
}
void FunctionalTestSetting::DebugExitChecked(bool Sta)
{
if(Sta == true){
ui->DebugExit->setStyleSheet("QPushButton{\
background-color: rgb(251, 160, 57);\
border:2px solid rgb(251, 160, 57);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);}");
ui->DebugExit->setChecked(true);
}else {
ui->DebugExit->setStyleSheet("QPushButton{\
border:2px solid rgb(255,255,255);\
font: 24px'Ubuntu';\
font:bold;\
color: rgb(255, 255, 255);}");
ui->DebugExit->setChecked(false);
}
}
template< class T>
void FunctionalTestSetting::SetDevParamData(DevParamDataIndex_t Index,T Data)
{
disconnect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),
this,SLOT(DevParamDataChangeProcess(DevParamDataIndex_t)));
m_DataDictionary->SetDevParamData(Index,Data);
connect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),
this,SLOT(DevParamDataChangeProcess(DevParamDataIndex_t)));
}
void FunctionalTestSetting::DevParamDataChangeProcess(DevParamDataIndex_t Index)
{
switch (Index) {
case D_TOWER_CAR_FRONT:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
CarFontStartEnable(true);
}
else
{
CarFontStartEnable(false);
}
break;
case D_TOWER_CAR_BACK:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
CarBackStartEnable(true);
}
else
{
CarBackStartEnable(false);
}
break;
case D_TOWER_CAR_UP:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
CarUpStartEnable(true);
}
else
{
CarUpStartEnable(false);
}
break;
case D_TOWER_CAR_DOWN:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
CarDownStartEnable(true);
}
else
{
CarDownStartEnable(false);
}
break;
case D_TOWER_CAR_LEFT:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
CarLeftStartEnable(true);
}
else
{
CarLeftStartEnable(false);
}
break;
case D_TOWER_CAR_RIGHT:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
CarRightStartEnable(true);
}
else
{
CarRightStartEnable(false);
}
break;
case D_TOWER_SYS_DEBUG:
if(m_DataDictionary->GetDevParamData(Index).toUInt() == DEV_SET_ENABLE)
{
DebugEntryChecked(true);
DebugExitChecked(false);
}
else
{
DebugEntryChecked(false);
DebugExitChecked(true);
}
break;
default:
break;
}
}
void FunctionalTestSetting::MisDataChangeProcess(MisDataIndex_t Index)
{
switch (Index) {
default:
break;
}
}
void FunctionalTestSetting::CarFontStartEnable(bool f)
{
if(f){
ui->CarFontStop->setChecked(false);
ui->CarFontStart->setChecked(true);
}else {
ui->CarFontStart->setChecked(false);
ui->CarFontStop->setChecked(true);
}
}
void FunctionalTestSetting::on_CarFontStart_clicked()
{
//if(!ui->CarFontStart->isChecked())
{
CarFontStartEnable(true);
SetDevParamData(D_TOWER_CAR_FRONT,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_CarFontStop_clicked()
{
//if(!ui->CarFontStop->isChecked())
{
CarFontStartEnable(false);
SetDevParamData(D_TOWER_CAR_FRONT,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::CarBackStartEnable(bool f)
{
if(f){
ui->CarBackStop->setChecked(false);
ui->CarBackStart->setChecked(true);
}else {
ui->CarBackStart->setChecked(false);
ui->CarBackStop->setChecked(true);
}
}
void FunctionalTestSetting::on_CarBackStart_clicked()
{
//if(!ui->CarBackStart->isChecked())
{
CarBackStartEnable(true);
SetDevParamData(D_TOWER_CAR_BACK,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_CarBackStop_clicked()
{
//if(!ui->CarBackStop->isChecked())
{
CarBackStartEnable(false);
SetDevParamData(D_TOWER_CAR_BACK,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::CarUpStartEnable(bool f)
{
if(f){
ui->CarUpStop->setChecked(false);
ui->CarUpStart->setChecked(true);
}else {
ui->CarUpStart->setChecked(false);
ui->CarUpStop->setChecked(true);
}
}
void FunctionalTestSetting::on_CarUpStart_clicked()
{
//if(!ui->CarUpStart->isChecked())
{
CarUpStartEnable(true);
SetDevParamData(D_TOWER_CAR_UP,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_CarUpStop_clicked()
{
//if(!ui->CarUpStop->isChecked())
{
CarUpStartEnable(false);
SetDevParamData(D_TOWER_CAR_UP,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::CarDownStartEnable(bool f)
{
if(f){
ui->CarDownStop->setChecked(false);
ui->CarDownStart->setChecked(true);
}else {
ui->CarDownStart->setChecked(false);
ui->CarDownStop->setChecked(true);
}
}
void FunctionalTestSetting::on_CarDownStart_clicked()
{
//if(!ui->CarDownStart->isChecked())
{
CarDownStartEnable(true);
SetDevParamData(D_TOWER_CAR_DOWN,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_CarDownStop_clicked()
{
//if(!ui->CarDownStop->isChecked())
{
CarDownStartEnable(false);
SetDevParamData(D_TOWER_CAR_DOWN,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::CarLeftStartEnable(bool f)
{
if(f){
ui->CarLeftStop->setChecked(false);
ui->CarLeftStart->setChecked(true);
}else {
ui->CarLeftStart->setChecked(false);
ui->CarLeftStop->setChecked(true);
}
}
void FunctionalTestSetting::on_CarLeftStart_clicked()
{
//if(!ui->CarLeftStart->isChecked())
{
CarLeftStartEnable(true);
SetDevParamData(D_TOWER_CAR_LEFT,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_CarLeftStop_clicked()
{
//if(!ui->CarLeftStop->isChecked())
{
CarLeftStartEnable(false);
SetDevParamData(D_TOWER_CAR_LEFT,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::CarRightStartEnable(bool f)
{
if(f){
ui->CarRightStop->setChecked(false);
ui->CarRightStart->setChecked(true);
}else {
ui->CarRightStart->setChecked(false);
ui->CarRightStop->setChecked(true);
}
}
void FunctionalTestSetting::on_CarRightStart_clicked()
{
//if(!ui->CarRightStart->isChecked())
{
CarRightStartEnable(true);
SetDevParamData(D_TOWER_CAR_RIGHT,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_CarRightStop_clicked()
{
//if(!ui->CarRightStop->isChecked())
{
CarRightStartEnable(false);
SetDevParamData(D_TOWER_CAR_RIGHT,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::on_DebugEntry_clicked()
{
//if(!ui->DebugEntry->isChecked())
{
DebugEntryChecked(true);
DebugExitChecked(false);
SetDevParamData(D_TOWER_SYS_DEBUG,DEV_SET_ENABLE);
}
}
void FunctionalTestSetting::on_DebugExit_clicked()
{
//if(!ui->DebugExit->isChecked())
{
DebugEntryChecked(false);
DebugExitChecked(true);
SetDevParamData(D_TOWER_SYS_DEBUG,DEV_SET_UNABLE);
}
}
void FunctionalTestSetting::on_pushButton_3_clicked()
{
VolumeControl::GetInstance()->SetMedia("qrc:/Sng/MomentAlarm.wav");
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/qinxude/rk3568ui.git
[email protected]:qinxude/rk3568ui.git
qinxude
rk3568ui
rk3568ui
master

搜索帮助