Files
VX5_KRO_GearPump/Printsetting.cpp
T
2026-04-29 14:10:10 +08:00

1189 lines
56 KiB
C++

#include "Printsetting.h"
#include "ui_Printsetting.h"
#include <QMessageBox>
#include <QDebug>
PrintSetting::PrintSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::PrintSetting)
{
ui->setupUi(this);
m_checkBtn = ui->checkBtn;
m_closeBtn = ui->closeBtn;
pulseNumFix = new PulseNumFix(parent);
pulseNumFix->hide();
ui->lineEditTriggerPulsePerMm->setValidator(new QDoubleValidator(0));
connect(pulseNumFix,SIGNAL(pulseNuxFixDone(float)),this,SLOT(onPulseNumFixDone(float)));
ui->checkBoxEleEyeMakeClean->setHidden(1);
ui->spinBoxOuputPulseCol->setHidden(1);
ui->labelSynTriggerPrintLenRatio->setHidden(1);
ui->spinBoxSynTriggerPrintLenRatio->setHidden(1);
//隐藏这部分控件暂时用不到
ui->radioButtonSynTrigger->hide();
ui->labelDelayTriggerValue->hide();
ui->spinBoxDelayTriggerValue->hide();
ui->groupBox_3->hide();
ui->labelTimeTriggerMode->setEnabled(false);
ui->comboBoxTimeTriggerMode->setEnabled(false);
init();
}
PrintSetting::~PrintSetting()
{
delete ui;
}
void PrintSetting::init()
{
// 应用样式表
applyStyleSheet();
// 连接信号槽
connect(m_closeBtn, &QPushButton::clicked, this, &PrintSetting::buttonClickedSlot);
connect(m_checkBtn,&QPushButton::clicked, this, &PrintSetting::buttonClickedSlot);
}
extern void MySleep(unsigned int msec);
void PrintSetting::buttonClickedSlot()
{
QPushButton* btn = qobject_cast<QPushButton*>(sender());
if (btn == m_closeBtn)
{
emit sendButtonClickedSignal(1);
}else if(btn == m_checkBtn){
emit sendButtonClickedSignal(2);
on_pushButtonApply_pressed();
}
}
void PrintSetting::bindSysPara(SysPara *sysPara){
this->sysPara =sysPara;
}
void PrintSetting::on_pushButtonApply_pressed(){
applyUIPara();
applyUITriggerPara();
if(sysPara->devOp->writeFpgaPrintPara() != -1)
QMessageBox::information(this,tr("提示"),tr("应用成功"));
if(sysPara)sysPara->saveParaToFile ();
}
void PrintSetting::applyUIPara(){
if(sysPara){
/*
LogInfo::setRunStatusText(tr("addr: %1").arg(addr));
LogInfo::setRunStatusText(tr("data: %1").arg(data));
LogInfo::setRunStatusText(tr("len: %1").arg(len));
sysPara->para.ExtScreenType = ui->comBoxExtSrceen->currentIndex();
sysPara->para.ExtMeterType = ui->comBoxExtMeterType->currentIndex();
sysPara->para.gearPumpSpeedAlarm = ui->spinBox_gearPumpSpeedAlarm->value();
if(sysPara->para.ExtScreenType==0)
{
sysPara->status.ExtScreenEn =0;
}
*/
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; //延时触发
sysPara->para.printDelayMs = 200; //重复间隔
sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked();
ui->spinBoxColDelay->setEnabled(1);
sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked();
sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked();
sysPara->para.currSelectVolPara = ui->comboBox_selcetVolPara->currentIndex();
sysPara->para.printColDelay = ui->spinBoxColDelay->value();
/*
sysPara->para.scanInverse = ui->checkBoxScanInverse->isChecked();
sysPara->para.currPrintMode = ui->comboBoxPrintMode->currentIndex();
sysPara->para.varLenEn = ui->checkVARLEN->isChecked();
sysPara->para.suspendAfterPhaseFault = ui->checkBoxSuspendAfterPhaseFault->isChecked();
sysPara->para.powerOffAfterPhaseFault = ui->checkBoxPowerOffAfterPhaseFault->isChecked();
sysPara->para.RecycleWarnAction = ui->checkBoxRecycleWarnAction->isChecked();
sysPara->para.stopCounterMeterAfterFault = ui->checkBoxStopCounterMeterAfterFault->isChecked();
sysPara->para.cnt1EndValue = ui->spinBoxCnt1EndValue->value();
sysPara->para.cnt1RepeateValue = ui->spinBoxCnt1RepeateCnt->value();
sysPara->para.cnt1StartValue = ui->spinBoxCnt1StartValue->value();
sysPara->para.cnt1StepValue = ui->spinBoxCnt1StepValue->value();
sysPara->para.cnt1CurrValue = ui->spinBoxCnt1CurrValue->value(); //这个值设置没关系,在关机前还会再此被设置
sysPara->para.cnt2EndValue = ui->spinBoxCnt2EndValue->value();
sysPara->para.cnt2RepeateValue = ui->spinBoxCnt2RepeateCnt->value();
sysPara->para.cnt2StartValue = ui->spinBoxCnt2StartValue->value();
sysPara->para.cnt2StepValue = ui->spinBoxCnt2StepValue->value();
sysPara->para.cnt2CurrValue = ui->spinBoxCnt2CurrValue->value();
sysPara->para.newAmplifyPlate = ui->checkBoxNewAmplifyPlate->isChecked();
sysPara->para.cnt3EndValue = ui->spinBoxCnt3EndValue->value();
sysPara->para.cnt3RepeateValue = ui->spinBoxCnt3RepeateCnt->value();
sysPara->para.cnt3StartValue = ui->spinBoxCnt3StartValue->value();
sysPara->para.cnt3StepValue = ui->spinBoxCnt3StepValue->value();
sysPara->para.cnt3CurrValue = ui->spinBoxCnt3CurrValue->value();
sysPara->para.startVoltage = ui->spinBoxStartVoltage->value();
sysPara->para.endVoltage = ui->spinBoxEndVoltage->value();
sysPara->para.charBold = ui->spinBoxColRepeatCnt->value();
*/
sysPara->para.HighVoltageAmplitude = ui->spinBoxHighVoltageValue->value();
// 回收泵的控制转至系统设置界面 byons@2026年4月22日
// sysPara->para.gearPumpEnable = ui->checkBoxGearPumpEnable->isChecked();
// sysPara->para.flagOfReclaimPumEnable = ui->checkBox_ReclaimPumpEnable->isChecked();
sysPara->devOp->setHighVoltageAmplitudetoSTM32();
/*
sysPara->status.cnt1CurrentValueInitDoneFlag = !ui->checkBoxResetCnt1CurrValue->isChecked();
sysPara->status.cnt2CurrentValueInitDoneFlag = !ui->checkBoxResetCnt2CurrValue->isChecked();
sysPara->status.cnt3CurrentValueInitDoneFlag = !ui->checkBoxResetCnt3CurrValue->isChecked();
if(sysPara->para.cnt1ByGroupEnalbe)
ApplyCnt1GroupSetting();
sysPara->para.flagOfFastMode = ui->checkBox_FastMode->isChecked();
if(sysPara->para.flagOfFastMode){
if(ui->comboBoxPrintMode->count()>=3){
ui->comboBoxPrintMode->setItemText(0,tr("超高速"));
ui->comboBoxPrintMode->setItemText(1,tr("高速"));
ui->comboBoxPrintMode->removeItem(2);
}
}else{
if(ui->comboBoxPrintMode->count()<3){
ui->comboBoxPrintMode->setItemText(0,tr("快速"));
ui->comboBoxPrintMode->setItemText(1,tr("标准"));
ui->comboBoxPrintMode->addItem(tr("慢速"));
}
}
if(sysPara->para.EditMode==TXTFILE)
{
sysPara->status.specialVarPrint.SpecialVarEnable = ui->radioButtonSpecialCondition->isChecked();
sysPara->status.cnt4CurrValue = ui->spinBoxHiddenValue->value();
sysPara->status.specialVarPrint.MeterEnable = ui ->spinBoxMeterEnable->value();
sysPara ->status.specialVarPrint.SpecialConditionValue = ui->spinBoxConditionValue->value();
if(sysPara->status.specialVarPrint.SpecialVarEnable)
sysPara->status.specialVarPrint.SpecialVarEnable = 0xFF;
if(sysPara->status.specialVarPrint.MeterEnable)
sysPara->status.specialVarPrint.MeterEnable = 0xFF;
sysPara->para.cnt4CurrValue = sysPara->status.cnt4CurrValue;
sysPara->para.HiddenConditionValue = sysPara->status.specialVarPrint.SpecialConditionValue;
sysPara->para.HiddenFuncEnable = sysPara->status.specialVarPrint.SpecialVarEnable;
sysPara->para.HiddenMeterEnable = sysPara->status.specialVarPrint.MeterEnable;
}
*/
sysPara->devOp->writeFpgaCalandar(0);
/*
sysPara->para.reducedPixelNumRatio = ui->spinBoxReducedPixelNum->value();
sysPara->para.reducedPixelMode = ui->comboBoxReducedPixMode->currentIndex();
sysPara->para.rowSequenceMode = ui->spinBoxRowSequenceMode->value();
sysPara->para.pointVoltageAdjustPos = ui->spinBoxPointVoltageAdjustPos->value();
sysPara->para.PointVoltageAdjustValue = ui->spinBoxVoltageAdjustValue->value();
sysPara->para.lineEndAdjustPointCnt = ui->spinBoxLineEndAdjustPointCnt->value();
sysPara->para.lineEndAdjustPointDelay = ui->comboBoxLineEndAdjustPointMode->currentIndex();
sysPara->para.lastLineEndPointFixedValue = ui->spinBoxLastLineEndPointFixedValue->value();
sysPara->para.FullColFixVal = ui->radioButtonFUllColFIxVal->isChecked();//2020/3/2
sysPara->para.dacScale = ui->dacScaledSpinBox->value();
sysPara->para.industryIndex = ui->comboBoxIndustry->currentIndex();
sysPara->para.recommendedPrintSpeed = ui->comboBoxRecommendedPrintSpeed->currentIndex();
if(ui->eleCNT1IncEn->isChecked())
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1
else
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xef); // CNT1 = current
if(ui->eleCNT2IncEn->isChecked())
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1
else
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xdf); // CNT2 = current
if(ui->eleCNT3IncEn->isChecked())
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x40); // CNT3 +1
else
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xbf); // CNT3 = current
sysPara->para.alterPrint.enable =ui->comboBoxAlterPrintEnable->currentIndex();// 修改后的
if(sysPara->para.alterPrint.enable)
sysPara->para.textEditLineSpace = 0;
sysPara->para.alterPrint.lineSpace = sysPara->para.textEditLineSpace;
sysPara->para.alterPrint.startValue = ui->spinBoxXStartValue->value ();
sysPara->para.alterPrint.repeatValue = ui->spinBoxXGapValue->value ();
sysPara->para.alterPrint.repeatPrintTimes =ui->spinBoxXRepeatTimeValue->value ();
sysPara->para.alterPrint.DistanceTail =ui->spinBoxDistanceTail->value ();
if( sysPara->para.alterPrint.startValue>= sysPara->para.alterPrint.repeatValue )
{
sysPara->para.alterPrint.startValue =sysPara->para.alterPrint.repeatValue -1;
ui->spinBoxXStartValue->setValue (sysPara->para.alterPrint.startValue);
QMessageBox::information(this,tr("提示:交替参数不正确"),tr("要求:起始位置<交替间隔"));
}
if( sysPara->para.alterPrint.repeatPrintTimes+sysPara->para.alterPrint.startValue
> sysPara->para.alterPrint.repeatValue )
{
sysPara->para.alterPrint.repeatPrintTimes =sysPara->para.alterPrint.repeatValue -sysPara->para.alterPrint.startValue-1;
ui->spinBoxXRepeatTimeValue->setValue (sysPara->para.alterPrint.repeatPrintTimes);
QMessageBox::information(this,tr("提示:交替参数不正确"),tr("要求:(重复次数+起始位置)<交替间隔"));
}
sysPara->para.Cnt1NatureValue = ui->checkBoxCnt1NatureValue->isChecked (); //
sysPara->para.speedoverPaushPrint = ui->checkBoxSpeedOver->isChecked();
sysPara->para.SynCntEn = ui->checkSynCntEn->isChecked();
sysPara->para.Vol1of8En = ui->checkVol1of8En->isChecked();//打印优化
sysPara->para.mode0211 = ui->checkmode0211->isChecked();//添加0211模式
sysPara->para.cnt1ResetToInitValue = ui->resetToCnt1InitValueCheckBox->isChecked();// 电眼复位时,复位起始值或当前值
//sysPara->para.printOnce = ui->checkBoxPrintOnce->isChecked();// 每条信息只喷一次
// sysPara->para.printOnce = 0;// 每条信息只喷一次
//sysPara->para.printNumPoint = ui->checkBoxNumPoint->isChecked();// 每条信息只喷一次
sysPara->para.Reciclar = ui->checkBoxReciclar->isChecked();//sysPara->para.Reciclar = 0; //
switch(ui->spinBoxdecimalpointnum->value())
//20240625修改小数点位数可选0-3位,FPGA原参数a44d 地址第6号位为 是否打印小数使能信号,1为打印小数,0为不打印小数。
//更改为:
// a44d 地址第6号位和第7号位为 打印显示小数位数;
// 第7,6变量为 11 打印3位小数,
// 第7,6变量为 10 打印2位小数,
// 第7,6变量为 01 打印1位小数,
// 第7,6变量为 00 打印0位小数,
{
case 0:
ui->radioButtonSpecialCondition->setEnabled(true);
sysPara->para.printNumPoint = 0;
sysPara->para.rrr_nc = 0;
break;
case 1:
ui->radioButtonSpecialCondition->setEnabled(false);
ui->spinBoxMeterEnable->setValue(0);
sysPara->para.printNumPoint = 1;
sysPara->para.rrr_nc = 0;
break;
case 2:
ui->radioButtonSpecialCondition->setEnabled(false);
ui->spinBoxMeterEnable->setValue(0);
sysPara->para.printNumPoint = 0;
sysPara->para.rrr_nc = 1;
break;
case 3:
ui->radioButtonSpecialCondition->setEnabled(false);
ui->spinBoxMeterEnable->setValue(0);
sysPara->para.printNumPoint = 1;
sysPara->para.rrr_nc = 1;
break;
default:
sysPara->para.printNumPoint = 0;
sysPara->para.rrr_nc = 0;
break;
}
sysPara->para.stepPrint.startValue = ui->spinBoxJumpStartValue->value();
sysPara->para.stepPrint.endValue = ui->spinBoxJumpEndValue->value();
sysPara->para.stepPrint.enbale = ui->checkBoxStepPrintEn->isChecked();
sysPara->para.stepPrint.StepValue = ui->spinBoxJumpStepValue->value();
sysPara->para.ResetSendData = ui->checkBoxResetSendData->isChecked();
sysPara->para.eleEyeReTrigDisable = ui->checkBoxEleEyeRetrigDis->isChecked();
sysPara->para.ResetAllProductCntEn = ui->checkAllProductResetEn->isChecked();
sysPara->para.ResetProductCntEn = ui->checkProductResetEn->isChecked();
sysPara->para.HVFaultCloseEn = ui->checkHVFaultCloseEn->isChecked();
sysPara->para.phaseHighCnt = ui->phaseHighCntSpinBox->value();
sysPara->para.charWidthSetEnable = ui->checkBoxCharWidthSet->isChecked();
sysPara->para.isCheckMagnet = ui->checkBoxMagnet->isChecked();
sysPara->para.isCheckPrintLight = ui->printfLightCheckBox->isChecked();
sysPara->para.bcOption.var1Num=ui->spinBoxCnt1EndValue->text().length();
sysPara->para.bcOption.var2Num=ui->spinBoxCnt2EndValue->text().length();
// sysPara->para.bcOption.var3Num=ui->spinBoxCnt2EndValue_2->text().length();
//qDebug()<<"sysPara->para.bcOption.varNum"<<sysPara->para.bcOption.var1Num<<sysPara->para.bcOption.var2Num;
sysPara->para.ExpiryDay = ui->spinBoxExpiryDate->value();
sysPara->para.ExpirySplitMode = ui->CBDateFormat1->currentIndex();
ui->resetToCnt1InitValueCheckBox->isChecked();
//qDebug()<<sysPara->print.ExpiryDay;
*/
// if(sysPara->devOp->writeFpgaPrintPara() != -1) // save para to disk file.
// QMessageBox::information(this,tr("提示"),tr("应用成功"));
/*
//ui->labelCnt1CurrValueTxt->setEnabled(false);
// ui->labelCnt2CurrValueTxt->setEnabled(false);
ui->spinBoxCnt1CurrValue->setEnabled(false);
ui->spinBoxCnt2CurrValue->setEnabled(false);
ui->spinBoxCnt3CurrValue->setEnabled(false);
ui->checkBoxResetCnt1CurrValue->setChecked(false);
ui->checkBoxResetCnt2CurrValue->setChecked(false);
ui->checkBoxResetCnt3CurrValue->setChecked(false);
*/
}
}
void PrintSetting::updateSysParaToUI(){
if(sysPara){
/*
ui->checkVARLEN->setChecked(sysPara->para.varLenEn?1:0);
ui->checkBoxNewAmplifyPlate->setChecked(sysPara->para.newAmplifyPlate);
ui->comBoxExtSrceen->setCurrentIndex(sysPara->para.ExtScreenType);
ui->comBoxExtMeterType->setCurrentIndex(sysPara->para.ExtMeterType);
*/
ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse);
ui->checkBoxUpDownInverse->setChecked(sysPara->para.upDownInverse);
sysPara->para.mode0211 = 1;
/*
ui->checkBoxScanInverse->setChecked(sysPara->para.scanInverse);
ui->checkBoxRecycleWarnAction->setChecked(sysPara->para.RecycleWarnAction);
ui->checkBoxPowerOffAfterPhaseFault->setChecked(sysPara->para.powerOffAfterPhaseFault);
ui->checkBoxSuspendAfterPhaseFault->setChecked(!sysPara->para.powerOffAfterPhaseFault);
ui->checkBoxSuspendAfterPhaseFault->setChecked(sysPara->para.suspendAfterPhaseFault);
ui->checkBoxStopCounterMeterAfterFault->setEnabled(sysPara->para.suspendAfterPhaseFault);
ui->checkBoxStopCounterMeterAfterFault->setChecked(sysPara->para.stopCounterMeterAfterFault);
ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode);
ui->spinBox_gearPumpSpeedAlarm->setValue(sysPara->para.gearPumpSpeedAlarm);
*/
/*----------------------------------------*/
ui->spinBoxColDelay->setValue(sysPara->para.printColDelay);
/*
ui->spinBoxColRepeatCnt->setValue(sysPara->para.charBold);
ui->spinBoxCnt1EndValue->setValue(sysPara->para.cnt1EndValue);
ui->spinBoxCnt1RepeateCnt->setValue(sysPara->para.cnt1RepeateValue);
ui->spinBoxCnt1StartValue->setValue(sysPara->para.cnt1StartValue);
ui->spinBoxCnt1StepValue->setValue(sysPara->para.cnt1StepValue);
ui->spinBoxCnt1CurrValue->setValue(sysPara->para.cnt1CurrValue);
ui->spinBoxCnt2EndValue->setValue(sysPara->para.cnt2EndValue);
ui->spinBoxCnt2RepeateCnt->setValue(sysPara->para.cnt2RepeateValue);
ui->spinBoxCnt2StartValue->setValue(sysPara->para.cnt2StartValue);
ui->spinBoxCnt2StepValue->setValue(sysPara->para.cnt2StepValue);
ui->spinBoxCnt2CurrValue->setValue(sysPara->para.cnt2CurrValue);
ui->spinBoxCnt3EndValue->setValue(sysPara->para.cnt3EndValue);
ui->spinBoxCnt3RepeateCnt->setValue(sysPara->para.cnt3RepeateValue);
ui->spinBoxCnt3StartValue->setValue(sysPara->para.cnt3StartValue);
ui->spinBoxCnt3StepValue->setValue(sysPara->para.cnt3StepValue);
ui->spinBoxCnt3CurrValue->setValue(sysPara->para.cnt3CurrValue);
ui->spinBoxStartVoltage->setValue(sysPara->para.startVoltage);
ui->spinBoxEndVoltage->setValue(sysPara->para.endVoltage);
*/
ui->spinBoxHighVoltageValue->setValue(sysPara->para.HighVoltageAmplitude);
/*
ui->spinBoxReducedPixelNum->setValue(sysPara->para.reducedPixelNumRatio);
ui->comboBoxReducedPixMode->setCurrentIndex(sysPara->para.reducedPixelMode);
ui->spinBoxRowSequenceMode->setValue(sysPara->para.rowSequenceMode);
ui->spinBoxPointVoltageAdjustPos->setValue(sysPara->para.pointVoltageAdjustPos);
ui->spinBoxVoltageAdjustValue->setValue(sysPara->para.PointVoltageAdjustValue);
ui->spinBoxLineEndAdjustPointCnt->setValue(sysPara->para.lineEndAdjustPointCnt);
ui->comboBoxLineEndAdjustPointMode->setCurrentIndex(sysPara->para.lineEndAdjustPointDelay);
ui->spinBoxLastLineEndPointFixedValue->setValue(sysPara->para.lastLineEndPointFixedValue);
// ui->spinBoxFullColFixVal->setValue(sysPara->para.FullColFixVal);
ui->radioButtonFUllColFIxVal->setChecked(sysPara->para.FullColFixVal);
*/
ui->comboBox_selcetVolPara->setCurrentIndex(sysPara->para.currSelectVolPara);
// 齿轮泵和回收泵的控制转至系统设置 byons@2026年4月22日
// ui->checkBoxGearPumpEnable->setChecked(sysPara->para.gearPumpEnable);
// ui->checkBox_ReclaimPumpEnable->setChecked(sysPara->para.flagOfReclaimPumEnable);
//隐藏功能
/*
ui->radioButtonSpecialCondition->setChecked(sysPara->para.HiddenFuncEnable);
ui->spinBoxHiddenValue->setValue(sysPara->para.cnt4CurrValue);
ui->spinBoxConditionValue->setValue(sysPara->para.HiddenConditionValue);
ui->spinBoxMeterEnable->setValue(sysPara->para.HiddenMeterEnable);
// sysPara->status.cnt4CurrValue = sysPara->para.cnt4CurrValue;
sysPara->status.specialVarPrint.SpecialConditionValue = sysPara->para.HiddenConditionValue ;
sysPara->status.specialVarPrint.SpecialVarEnable =sysPara->para.HiddenFuncEnable ;
sysPara->status.specialVarPrint.MeterEnable = sysPara->para.HiddenMeterEnable;
if(sysPara->status.specialVarPrint.SpecialVarEnable)
sysPara->status.specialVarPrint.SpecialVarEnable = 0xFF;
if(sysPara->status.specialVarPrint.MeterEnable)
sysPara->status.specialVarPrint.MeterEnable = 0xFF;
emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked());
if(sysPara->para.HiddenFuncEnable)
{
// emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked());
ui->spinBoxdecimalpointnum->setValue(0);
ui->spinBoxdecimalpointnum->setEnabled(false);
ui->radioButtonSpecialCondition->setEnabled(true);
ui->spinBoxHiddenValue->setEnabled(true);
ui->spinBoxConditionValue->setEnabled(true);
ui->spinBoxMeterEnable->setEnabled(true);
}
if(!sysPara->para.rrr_nc)
{
if(!sysPara->para.printNumPoint)
ui->spinBoxdecimalpointnum->setValue(0);
else
ui->spinBoxdecimalpointnum->setValue(1);
}
else
{
if(!sysPara->para.printNumPoint)
ui->spinBoxdecimalpointnum->setValue(2);
else
ui->spinBoxdecimalpointnum->setValue(3);
}
ui->comboBoxIndustry->setCurrentIndex(sysPara->para.industryIndex);
ui->comboBoxRecommendedPrintSpeed->setCurrentIndex(sysPara->para.recommendedPrintSpeed);
ui->comboBoxAlterPrintEnable->setCurrentIndex (sysPara->para.alterPrint.enable );// 修改后的
if(sysPara->para.alterPrint.enable == 0)
{
ui->spinBoxXStartValue->setEnabled(false);
ui->spinBoxXRepeatTimeValue->setEnabled(false);
ui->spinBoxXGapValue->setEnabled(false);
}
ui->spinBoxXStartValue->setValue (sysPara->para.alterPrint.startValue );
ui->spinBoxXGapValue->setValue (sysPara->para.alterPrint.repeatValue);
ui->spinBoxXRepeatTimeValue->setValue (sysPara->para.alterPrint.repeatPrintTimes);
ui->spinBoxDistanceTail->setValue(sysPara->para.alterPrint.DistanceTail );
ui->checkBoxCnt1NatureValue->setChecked ( sysPara->para.Cnt1NatureValue); //
ui->checkBoxSpeedOver->setChecked(sysPara->para.speedoverPaushPrint);
ui->checkSynCntEn->setChecked(sysPara->para.SynCntEn);
ui->checkVol1of8En->setChecked(sysPara->para.Vol1of8En);
ui->checkBoxEleEyeRetrigDis->setChecked( sysPara->para.eleEyeReTrigDisable );
ui->checkmode0211->setChecked(sysPara->para.mode0211);
ui->resetToCnt1InitValueCheckBox->setChecked(sysPara->para.cnt1ResetToInitValue);
qDebug()<<"checkmode0211:"<<sysPara->para.mode0211;
qDebug()<<"checkVol1of8En:"<<sysPara->para.Vol1of8En;
qDebug()<<"radioButtonFUllColFIxVal:"<<sysPara->para.FullColFixVal;
qDebug()<<"checkBoxCharWidthSet:"<<sysPara->para.charWidthSetEnable;
//ui->checkBoxPrintOnce->setChecked(sysPara->para.printOnce);
//ui->checkBoxNumPoint->setChecked(sysPara->para.printNumPoint);
ui->checkBoxReciclar->setChecked(sysPara->para.Reciclar);
ui->dacScaledSpinBox->setValue(sysPara->para.dacScale);
ui->checkBoxResetSendData->setChecked(sysPara->para.ResetSendData);
ui->spinBoxJumpStartValue->setValue( sysPara->para.stepPrint.startValue );
ui->spinBoxJumpEndValue->setValue( sysPara->para.stepPrint.endValue );
//ui->checkBoxStepPrintEn->setEnabled( sysPara->para.stepPrint.enbale );
ui->checkBoxStepPrintEn->setChecked( sysPara->para.stepPrint.enbale );
ui->spinBoxJumpStepValue->setValue(sysPara->para.stepPrint.StepValue);
ui->checkProductResetEn->setChecked(sysPara->para.ResetProductCntEn);
ui->checkAllProductResetEn->setChecked(sysPara->para.ResetAllProductCntEn);
ui->checkHVFaultCloseEn->setChecked(sysPara->para.HVFaultCloseEn);
// 电眼触发计数器动作 选择
ui->eleCNT1IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?1:0);
ui->radCNT1ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?0:1);
ui->eleCNT2IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?1:0);
ui->radCNT2ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?0:1);
ui->eleCNT3IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?1:0);
ui->radCNT3ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?0:1);
ui->checkBoxCharWidthSet->setChecked(sysPara->para.charWidthSetEnable);
ui->checkBoxMagnet->setChecked(sysPara->para.isCheckMagnet);
ui->printfLightCheckBox->setChecked(sysPara->para.isCheckPrintLight);
ui->phaseHighCntSpinBox->setValue( sysPara->para.phaseHighCnt);
sysPara->para.bcOption.var1Num=ui->spinBoxCnt1EndValue->text().length();
sysPara->para.bcOption.var2Num=ui->spinBoxCnt2EndValue->text().length();
ui->checkBox_FastMode->setChecked(sysPara->para.flagOfFastMode);
ui->labMac->setText(QString(" Mac:%1").arg(dlgInputAddr->jd.addr));
sysPara->status.machineMac = dlgInputAddr->jd.addr;
showMachInfo(QString::number(dlgInputAddr->jd.addr));
ui->CBDateFormat1->setCurrentIndex(sysPara->para.ExpirySplitMode);//p_var->splitMode
ui->spinBoxExpiryDate->setValue(sysPara->para.ExpiryDay);
//on_spinBoxExpiryDate_valueChanged(sysPara->print.ExpiryVar.);
ui->checkBoxSaveCNTStateValue->setCheckState(sysPara->para.isCntSaveStateValue ? Qt::Checked : Qt::Unchecked);
flagOfModuleDecimal = sysPara->para.flagOfModuleDecimal;
ModuleDecimalDisplay();
flagOfModuleHide = sysPara->para.flagOfModuleHide;
ModuleHideDisplay();
displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage);
LoadCnt1GroupSettingsToUI();
if(sysPara->para.mode0211 || sysPara->para.FullColFixVal)
{
ui->spinBoxStartVoltage->setEnabled(false);
ui->spinBoxEndVoltage->setEnabled(false);
}
if(sysPara->para.flagOfCnt1GroupDisp)
{
//edit@12-03
const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9);
if(-1==indexTab)
ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置"));
}
if(sysPara->para.flagOfstepPrint)
{
//edit@12-03
const int indexTab=ui->tabWidget->indexOf(ui->tab_6);
if(-1==indexTab)
ui->tabWidget->addTab(ui->tab_6,tr("跳米设置"));
}
*/
TriggerupdateSysParaToUI();
}
}
void PrintSetting::TriggerupdateSysParaToUI(){
if(sysPara)
{
/*----------------------------------------*/
setTriggerUI(sysPara->para.printTriggerMode);
ui->eleEyeEdgetTriggerInner->setChecked(sysPara->para.eleEyeEdgetTriggerInner);
ui->eleEyeEdgetTriggerExternal->setChecked(sysPara->para.eleEyeEdgetTriggerExternal);
ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner);
ui->radioButtonSynTriggerExternal->setChecked(sysPara->para.synTriggerExternal);
ui->spinBoxDelayTriggerValue->setValue(sysPara->para.printDelayMs);
#ifndef NON_CABLE
ui->comboBoxTimeTriggerMode->setCurrentIndex(sysPara->para.timeTriggerPrintMode);
#endif
ui->spinBoxEleEyeTriggerIntervalMs->setValue(sysPara->para.elecEyeTriggerInterval);
ui->spinBoxOutputPulseDelayMs->setValue(sysPara->para.outputPulseDelayMs);
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(sysPara->para.photoElectricityRepeateNum);
//ui->spinBoxSynTriggerPrintLen->setValue(sysPara->para.synTriggerPrintLenMm);
ui->spinBoxSynTriggerPrintLen->setText(QString::number(sysPara->para.synTriggerPrintLenMm));
ui->lineEditTriggerPulsePerMm->setText(QString::number(sysPara->para.synPulseNumPerMm));
if(sysPara->para.sysTriggerPrintMode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)
//edit@11-19
;//ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synCharWidthRatio);
else
ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio);
/*----------------------------------------*/
ui->spinBoxEleEyeTriggerPrintDelay->setValue(sysPara->para.eleEyeTriggerPrintDelay);
ui->checkBoxSynMakeClean->setChecked(sysPara->para.synClearCntInEleEyeMode);
//ui->checkBoxEleEyeMakeClean->setChecked(sysPara->para.eleEyeClearCntInSynMode);
ui->comboBoxEleEyeMakeClean->setCurrentIndex( sysPara->para.eleEyeClearCntInSynMode & 0x0f);
ui->checkBoxPulseOutputEnable->setChecked(sysPara->para.pulseOutputEnable);
ui->labelProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable);
ui->spinBoxProductCntPerOutputPulse->setEnabled(sysPara->para.pulseOutputEnable);
ui->spinBoxProductCntPerOutputPulse->setValue(sysPara->para.productCntPerOutputPulse);
ui->labelOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable);
//ui->spinBoxOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable);
ui->spinBoxOutputPulseDelayMs->setEnabled(true /*sysPara->para.outputPulseDelayMs*/);
ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol);
ui->checkEyeTriggerSynPrintEn->setChecked (sysPara->para.eleEyeTriggerSynPrintEn);
ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType);
//ui->checkBoxAutoSpeedEN->setChecked (sysPara->para.autoSynSpeedEn );
ui->spinBoxEleMaskTime->setValue(sysPara->para.eleMaskTime);
ui->spinBoxAltMirrorGap->setValue( sysPara->para.AltMirrorGap & 0x0fff );
ui->comboBoxAltMirrType->setCurrentIndex( (sysPara->para.AltMirrorGap>>12) & 0x000F);
ui->spinBoxpluseSinal->setValue(sysPara->para.pulse_sinal_value);
if(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)
ui->radioButtonEleEyeEdgetTrigger->setChecked(true);
if( sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL){
ui->radioButtonEleEyeLevelTrigger->setChecked(true);
}
}
}
void PrintSetting::updateSysStatusToUI(){
}
void PrintSetting::on_pushButtonApplyPulseFix_clicked()
{
pulseNumFix->bindSysPara(sysPara);
pulseNumFix->hide();
pulseNumFix->show();
// qDebug()<<"pushButtonApplyPulseFix";
}
void PrintSetting::onPulseNumFixDone(float value){
ui->lineEditTriggerPulsePerMm->setText(QString::number(value));
}
void PrintSetting::on_lineEditTriggerPulsePerMm_textChanged(const QString &arg1)
{
Q_UNUSED(arg1);
sysPara->para.synPulseNumPerMm = ui->lineEditTriggerPulsePerMm->text().toFloat();
}
void PrintSetting::applyUITriggerPara(){
if(sysPara){
GetTriggerUIPara();
if(sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER)
{
if( sysPara->para.synTriggerPrintLenMm < sysPara->para.eleEyeTriggerPrintDelay )
{
QMessageBox::information(this,tr("提示:参数不正确"),tr("要求:触发长度小于喷印间隔"));
}
}
sysPara->para.eleEyeEdgetTriggerInner = ui->eleEyeEdgetTriggerInner->isChecked();
sysPara->para.eleEyeEdgetTriggerExternal = ui->eleEyeEdgetTriggerExternal->isChecked();
sysPara->para.synTriggerInner = ui->radioButtonSynTriggerInner->isChecked();
sysPara->para.synTriggerExternal = ui->radioButtonSynTriggerExternal->isChecked();
sysPara->para.pulseOutputEnable = ui->checkBoxPulseOutputEnable->isChecked();
sysPara->para.productCntPerOutputPulse = ui->spinBoxProductCntPerOutputPulse->value();
sysPara->para.outputPulseDelayMs = ui->spinBoxOutputPulseDelayMs->value();
sysPara->para.OuputPulseCol = ui->spinBoxOuputPulseCol->value();
if(((ui->checkEyeTriggerSynPrintEn->checkState()==1 )
&&(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
|| sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER )
{
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
}
else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):"));
// if(sysPara->devOp->writeFpgaPrintPara() != -1)
// QMessageBox::information(this,tr("提示"),tr("应用成功"));
}
}
void PrintSetting::GetTriggerUIPara(){
if(sysPara){
sysPara->para.printDelayMs = ui->spinBoxDelayTriggerValue->value();
sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex();
sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔
sysPara->para.photoElectricityRepeateNum = ui->spinBoxEleEyeTriggerRepeatCnt->value();
sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->text().toFloat();
//sysPara->para.synTriggerPrintLenMm = ui->spinBoxSynTriggerPrintLen->value();
sysPara->para.synPulseNumPerMm = ui->lineEditTriggerPulsePerMm->text().toFloat();
sysPara->para.sysTriggerPrintMode = ui->comboBoxSynPrintMode->currentIndex();
if(sysPara->para.sysTriggerPrintMode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)
//edit@11-19
;//sysPara->para.synCharWidthRatio = ui->spinBoxSynTriggerPrintLenRatio->value();
else
sysPara->para.synTriggerPrintLenRatio = ui->spinBoxSynTriggerPrintLenRatio->value();
// 原代码:
//sysPara->para.AltMirrorGap =(unsigned int) ( ((unsigned int)ui->spinBoxAltMirrorGap->value()) & 0x7fff) | ( ui->comboBoxAltMirrType->currentIndex()==1?0x8000:0x0000);
// 20160303:
sysPara->para.AltMirrorGap =(unsigned int) ( ((unsigned int)ui->spinBoxAltMirrorGap->value()) & 0x0fff) |( ( ui->comboBoxAltMirrType->currentIndex())<<12 );
//qDebug()<< (sysPara->para.AltMirrorGap & 0x0fff) << (sysPara->para.AltMirrorGap & 0xf000);
// if(ui->radioButtonDelayTrigger->isChecked())
if(ui->eleEyeEdgetTriggerInner->isChecked() && ui->radioButtonSynTriggerInner->isChecked()){ //都选外部--延时触发
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
sysPara->para.printDelayMs = ui->spinBoxEleEyeTriggerIntervalMs->value(); //延时触发的重复间隔
}
else if(ui->radioButtonEleEyeLevelTrigger->isChecked() && ui->eleEyeEdgetTriggerExternal->isChecked()) //光电边沿触发
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL;
else if(ui->radioButtonEleEyeEdgetTrigger->isChecked() && ui->eleEyeEdgetTriggerExternal->isChecked()) //光电电平触发
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE;
else if(ui->radioButtonSynTriggerExternal->isChecked())
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
else
sysPara->para.printTriggerMode = PRINT_TRIGGER_NONE;
// sysPara->para.eleEyeTriggerSynPrintEn = ui->checkEyeTriggerSynPrintEn->isChecked ();
if(ui->eleEyeEdgetTriggerExternal->isChecked() && ui->radioButtonSynTriggerExternal->isChecked()) //都选外部--电眼+同步触发
sysPara->para.eleEyeTriggerSynPrintEn=true;
else
sysPara->para.eleEyeTriggerSynPrintEn=false;
sysPara->para.eleEyeTriggerPrintDelay = ui->spinBoxEleEyeTriggerPrintDelay->value();
sysPara->para.synClearCntInEleEyeMode = ui->checkBoxSynMakeClean->isChecked();
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xf0) + ui->comboBoxEleEyeMakeClean->currentIndex(); //ui->checkBoxEleEyeMakeClean->isChecked();
//sysPara->para.autoSynSpeedEn = ui->checkBoxAutoSpeedEN->isChecked ();
sysPara->para.autoSynSpeedEn = 0;
//sysPara->para.synPulsePerMmX8 = (unsigned short)(sysPara->para.synPulseNumPerMm *256);
sysPara->para.synPulsePerMmX8 = (unsigned short)((unsigned int)sysPara->para.synPulseNumPerMm <<8);
sysPara->para.eleMaskTime = ui->spinBoxEleMaskTime->value();
sysPara->para.synchronizorActType = ui->comboBoxSyncActType->currentIndex();
sysPara->para.pulse_sinal_value = ui->spinBoxpluseSinal->value();
}
}
void PrintSetting::on_radioButtonDelayTrigger_pressed()
{
setTriggerUI(PRINT_TRIGGER_TIME);
// emit synDisableFontWidth(false);
}
void PrintSetting::on_radioButtonEleEyeEdgetTrigger_pressed()
{
setTriggerUI(PRINT_TRIGGER_ELEC_EYE_EDGE);
if(ui->radioButtonSynTriggerExternal->isChecked())
setEnableSynTriggerSetting(true);
else
setEnableSynTriggerSetting(false);
// emit synDisableFontWidth(false);
}
void PrintSetting::on_radioButtonEleEyeLevelTrigger_pressed()
{
setTriggerUI(PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL);
if(ui->radioButtonSynTriggerExternal->isChecked())
setEnableSynTriggerSetting(true);
else
setEnableSynTriggerSetting(false);
// emit synDisableFontWidth(false);
}
void PrintSetting::on_radioButtonSynTrigger_pressed()
{
//edit@11-19
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
// setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER);
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
// //72版本禁用字符宽度
// if(72 == FpgaVer){
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(0);
// }else if (67 == FpgaVer)
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
// emit synDisableFontWidth(true);
}
void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
{
qDebug()<<"checked:"<<checked;
int triggerMode = sysPara->para.printTriggerMode;
if(sysPara)
{
//if( !sysPara->para.eleEyeTriggerSynPrintEn )
if( checked)
{
//ui->radioButtonSynTrigger->setChecked(1);
#ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(1);
#endif
ui->labelSynTriggerPrintLen->setEnabled(1);
ui->lineEditTriggerPulsePerMm->setEnabled(1);
ui->labelTriggerPulsePerMm->setEnabled(1);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
ui->labelSynTriggerPrintLenRatio->setEnabled(1);
ui->checkBoxEleEyeMakeClean->setEnabled(1);
ui->pushButtonApplyPulseFix->setEnabled(1);
ui->comboBoxSynPrintMode->setEnabled(1);
ui->labelSynPrintMode->setEnabled(1);
//ui->checkBoxAutoSpeedEN->setEnabled (1);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)"));
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
if(ui->comboBoxSyncActType->currentIndex() || 0b11) //如果不是在正反转打印的模式下,就切换到正反转模式
{
ui->comboBoxSyncActType->setCurrentIndex(0);
}
}
else
{
// ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#endif
ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
// ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
//ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
ui->labelEleMaskTime->setText(tr("封锁间隔(毫秒)"));
ui->labelOutputPulseDelayMs->setText( ui->radioButtonSynTrigger->isChecked()?tr("延时(毫米):"):tr("延时(毫秒):"));
}
}
}
void PrintSetting::setTriggerUI(int triggerMode){
ui->radioButtonDelayTrigger->setChecked(triggerMode == PRINT_TRIGGER_TIME);
ui->spinBoxDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->labelDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
// ui->comboBoxTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
// ui->labelTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || triggerMode == PRINT_TRIGGER_TIME);
ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
ui->checkBoxSynMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->checkEyeTriggerSynPrintEn->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->labelEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
ui->spinBoxEleMaskTime->setEnabled (triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
if(sysPara->para.eleEyeTriggerSynPrintEn &&
(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)
)
{
//ui->radioButtonSynTrigger->setChecked(1);
// ui->spinBoxSynTriggerPrintLen->setEnabled(0);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
ui->labelSynTriggerPrintLen->setEnabled(1);
ui->lineEditTriggerPulsePerMm->setEnabled(1);
ui->labelTriggerPulsePerMm->setEnabled(1);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
ui->labelSynTriggerPrintLenRatio->setEnabled(1);
ui->checkBoxEleEyeMakeClean->setEnabled(1);
ui->pushButtonApplyPulseFix->setEnabled(1);
ui->comboBoxSynPrintMode->setEnabled(1);
ui->labelSynPrintMode->setEnabled(1);
//ui->checkBoxAutoSpeedEN->setEnabled (1);
ui->labelEleMaskTime->setEnabled(1);
ui->spinBoxEleMaskTime->setEnabled(1);
//ui->spinBoxEleMaskTime->setEnabled(1);
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)"));
}
else
{
ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#ifndef NON_CABLE
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
#endif
ui->labelSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->lineEditTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelTriggerPulsePerMm->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->spinBoxSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynTriggerPrintLenRatio->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->checkBoxEleEyeMakeClean->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
//ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
//ui->labelEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
//ui->spinBoxEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER)
{
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
}
else
{
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
}
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
ui->labelEleMaskTime->setText(tr("封锁时间(毫秒)"));
}
if(( ( //sysPara->para.eleEyeTriggerSynPrintEn ||
ui->checkEyeTriggerSynPrintEn->isChecked())
&&(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
|| triggerMode == PRINT_TRIGGER_SYNCHRONIZER )
{
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
}
else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):"));
setSynPrintMode(sysPara->para.sysTriggerPrintMode);
//72版本禁用该输入框
//67打开
// if(triggerMode== PRINT_TRIGGER_SYNCHRONIZER){
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
// if(72==FpgaVer)
// {
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
// }
// else if(67==FpgaVer)
// {
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(true);
// }
// }
// else{
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
// }
}
void PrintSetting::setSynPrintMode(int mode){
ui->labelSynTriggerPrintLenRatio->setText((mode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)?tr("字符宽度"):tr("喷印比例(%)"));
ui->comboBoxSynPrintMode->setCurrentIndex(mode);
//ui->spinBoxSynTriggerPrintLenRatio->setValue((mode == SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH)?sysPara->para.synCharWidthRatio:sysPara->para.synTriggerPrintLenRatio);
//edit@11-18
if(SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode)
{
ui->spinBoxSynTriggerPrintLenRatio->setValue(sysPara->para.synTriggerPrintLenRatio);
}
const bool bShow=SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH!=mode;
//隐藏文本框
ui->labelSynTriggerPrintLenRatio->setVisible(bShow);
//隐藏输入框
ui->spinBoxSynTriggerPrintLenRatio->setVisible(bShow);
}
void PrintSetting::applyStyleSheet()
{
QString styleSheet = R"(
QTabWidget {
border: none;
background-color: #7B838E;
}
QTabWidget::tab-bar {
background-color: #7B838E;
alignment: left;
height: 80px;
margin: 0;
}
QTabBar {
background-color: #7B838E;
border: none;
width: 100%;
min-width: 100%;
height: 80px;
padding: 0;
}
QTabBar::tab {
width: 140px;
height: 80px;
font-size: 16px;
font-weight: bold;
color: #000000;
border: none;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
alignment: center bottom;
padding-top: 0;
}
QTabBar::tab {
margin-left: 10px;
margin-top: 10px;
}
QTabBar::tab:!selected {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #6E757F, stop:1 #96A0A9);
border: 2px solid #63535D;
border-bottom: none;
position: relative;
bottom: 0px;
}
QTabBar::tab:selected {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #95B2D4, stop:1 #F0F0F0);
border: none;
position: relative;
bottom: 0px;
}
QTabWidget::pane {
border: none;
background-color: #f0f0f0;
top: -12px;
}
QWidget#buttonWidget {
background-color: #95989D;
}
QPushButton#closeBtn {
background-color: #E6F7FF;
border: 1px solid #87CEEB;
border-radius: 4px;
font-size: 24px;
color: #228B22;
}
QPushButton#closeBtn:hover {
background-color: #D1E9FF;
}
QPushButton#closeBtn:pressed {
background-color: #BAE7FF;
}
QLabel {
font-size: 18px;
color: #000000;
font-weight: 500;
}
QCheckBox {
font-size: 18px;
color: #000000;
font-weight:500;
}
QCheckBox::indicator {
width: 18px;
height: 18px;
border: 1px solid #96A0A9;
border-radius: 10px;
background-color: #ffffff;
}
QCheckBox::indicator:checked {
background-color: #95B2D4;
border-color: #95B2D4;
image: url(:/Demo/image/select.png);
}
QPushButton {
background-color: #5396C1;
color: #ffffff;
border: 1px solid #000000;
border-radius: 3px;
font-size: 18px;
font-weight:500;
}
QPushButton:hover {
background-color: #5396C1;
}
QPushButton:disabled {
background-color: #7C828E;
color: #606060;
border-color: #808080;
}
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
background-color: #E3E7EC;
}
)";
// closeBtn->setObjectName("closeBtn");
// buttonWidget->setObjectName("buttonWidget");
this->setStyleSheet(styleSheet);
}
void PrintSetting::on_eleEyeEdgetTriggerInner_clicked()
{
if(ui->radioButtonSynTriggerInner->isChecked()){
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
}else
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
setTriggerUI(sysPara->para.printTriggerMode);
ui->checkEyeTriggerSynPrintEn->setChecked(false);
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
setEnableEleEyeSetting(false);
}
void PrintSetting::setEnableEleEyeSetting(bool flag){
ui->labelEleEyeTriggerIntervalMs->setEnabled(flag);
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(flag || sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME);
ui->labelEleMaskTime->setEnabled(flag);
ui->spinBoxEleMaskTime->setEnabled(flag);
ui->labelEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
ui->checkBoxSynMakeClean->setEnabled(flag);
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
}
void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
{
if(ui->radioButtonSynTrigger->isChecked())
ui->checkEyeTriggerSynPrintEn->setChecked(true);
else
ui->checkEyeTriggerSynPrintEn->setChecked(false);
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
setEnableEleEyeSetting(true);
}
void PrintSetting::setEnableSynTriggerSetting(bool flag){
ui->labelTriggerPulsePerMm->setEnabled(flag);
ui->lineEditTriggerPulsePerMm->setEnabled(flag);
ui->pushButtonApplyPulseFix->setEnabled(flag);
ui->labelSynTriggerPrintLen->setEnabled(flag);
ui->spinBoxSynTriggerPrintLen->setEnabled(flag);
ui->comboBoxSyncActType->setEnabled(flag);
ui->labelSynPrintMode->setEnabled(flag);
ui->comboBoxSynPrintMode->setEnabled(flag);
}
void PrintSetting::on_radioButtonSynTriggerInner_clicked()
{
if(ui->eleEyeEdgetTriggerInner->isChecked()){
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
setTriggerUI(sysPara->para.printTriggerMode);
}
ui->checkEyeTriggerSynPrintEn->setChecked(false);
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
setEnableSynTriggerSetting(false);
}
void PrintSetting::on_radioButtonSynTriggerExternal_clicked()
{
if(ui->eleEyeEdgetTriggerExternal->isChecked())
ui->checkEyeTriggerSynPrintEn->setChecked(true);
else{
ui->checkEyeTriggerSynPrintEn->setChecked(false);
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
}
on_checkEyeTriggerSynPrintEn_clicked(ui->checkEyeTriggerSynPrintEn->isChecked());
setEnableSynTriggerSetting(true);
}
void PrintSetting::on_radioButtonEleEyeEdgetTrigger_clicked()
{
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE;
}
void PrintSetting::on_radioButtonEleEyeLevelTrigger_clicked()
{
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL;
}