#include "PrintSetting.h" #include "ui_printsetting.h" #include "SysPara.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "DevOp.h" #include "Public.h" #include "LogInfo.h" #include #include #include #include #include #include "myinclude.h" #include #include #include"scene/picscene.h" #include"scene/pictextitem.h" #include #include PrintSetting::PrintSetting(QWidget *parent) : QWidget(parent), ui(new Ui::PrintSetting) { ui->setupUi(this); ui->comboBoxPrintMode->setView(new QListView()); dialogAuthorization = new DialogAuthorization(parent); dialogAuthVarSet = new DialogAuthorization(parent); last_area_end = 0; area_end = 0; lockpulse = false; dialogShowCounter = new DialogShowCounter(parent); dialogShowCounter->setLCDframe(); dialogShowCounter->hide(); connect(dialogShowCounter,SIGNAL(rejected()),this,SLOT(ondialogShowCounterAccepted())); connect(dialogShowCounter,SIGNAL(accepted()),this,SLOT(ondialogShowCounterAccepted())); refresh_timer = new QTimer(); connect(refresh_timer, SIGNAL(timeout()), this, SLOT(refreshtimerHandler())); // refresh_timer->start(100); #ifdef ENCRYPT_VOL dialogModPasswd = new Dialogmodifypasswd(parent); dialogModPasswd->hide(); modify_vol = false; keepVolVal = ui->spinBoxHighVoltageValue->value(); ui->spinBoxHighVoltageValue->setEnabled(false); ui->spinBoxStartVoltage->setEnabled(false); connect(dialogModPasswd,SIGNAL(accepted()),this,SLOT(on_dialogModPasswdAccepted())); #else ui->volButton->hide(); #endif // ui->radioButtonFUllColFIxVal->setEnabled(false); dlgInputAddr = new DlgInputAddr(parent); dlgInputAddr->GetAddr(); dlgInputAddr->vpnConnect(); dlgInputAddr->hide(); dlgvarLen = new DlgVarLength(parent); dlgvarLen->hide(); connect(dialogAuthorization,SIGNAL(accepted()),this,SLOT(ondialogAuthorizationAccepted())); connect(dialogAuthVarSet,SIGNAL(accepted()),this,SLOT(ondialogAuthVarSetAccepted())); //connect(this,SIGNAL(authChanged(int )),this,SLOT(showVolDacEdit(int ))); connect(dlgInputAddr,SIGNAL(changeMac(QString)),ui->labMac,SLOT(setText(QString))); #ifdef __NETWORKMANAGER__ connect(dlgInputAddr,SIGNAL(changeMac(QString)),this,SLOT(showMachInfo(QString))); #endif connect(ui->pushButtonVAR,SIGNAL(pressed()),this,SLOT(on_checkVarLenChg())); connect(dlgvarLen,SIGNAL(on_set()),this,SLOT(on_VarLenSet())); if(Public::ReadLanguageName()=="Chinese"){ ui->labelZFGD->setPixmap(QPixmap(QString::fromUtf8(":/image/AH12.png"))); }else { ui->labelZFGD->setPixmap(QPixmap(QString::fromUtf8(":/image/AH13.png"))); } //ui->labelZFGD->setPixmap(QPixmap(QString::fromUtf8(":/image/AH12.png"))); dialogAuthorization->hide(); auth = AUTH_NONE; //showVolDacEdit(auth); // // QFont f =font(); // f.setFamily("wenquanyi"); // f.setPixelSize(13); // setFont(f); // ui->pushTestSysSet->hide(); //ui->spinBoxFullColFixVal->hide(); ui->tabWidget_2->removeTab(1);//去掉高级设置标签 ui->tabWidget_2->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0); // ui->tabWidget->removeTab(2); //ui->tabWidget->widget(1)->setBackgroundRole(QPalette::BrightText); //ui->tabWidget->widget(1)->palette().setColor(QColor(0,0,0,255)); ui->tabWidget->widget(1)->setStyleSheet("color:blue"); //ui->tabWidget->widget(1)->setWindowIcon(QIcon(":/icon/Estartprint2.png")); //ui->tabWidget->widget(1)->setBac #ifndef CABLEUSER ui->tabWidget->hide(); ui->checkSynCntEn->hide(); ui->checkVol1of8En->hide(); #endif #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QStringList headerLabels = QStringList()<tableWidget->setHorizontalHeaderLabels(headerLabels); ui->tableWidget->setFocusPolicy(Qt::NoFocus); ui->tableWidget->horizontalHeader()->setHighlightSections(false); ui->tableWidget->setColumnHidden(3,true);//第3列用来标志是否保存当前行 QHeaderView* vertivalHeader = ui->tableWidget->verticalHeader(); vertivalHeader->setFixedWidth(60); ui->tableWidget->setColumnWidth(2,120); //高级设置隐藏选项 flagOfSpecailSettng = 0; SpecailSettingsDisplay(); //工程模式隐藏选项 flagOfEngineeringMode = 0; EngineeringModeDisplay(); flagOfModuleDecimal = 0; ModuleDecimalDisplay(); flagOfAuthEnter = false; flagOfModuleHide = 0; ModuleHideDisplay(); specailMachineSetting(0); #else delete ui->tableWidget; delete ui->checkBoxGroupCnt1; delete ui->Cnt3AddRowBtn; delete ui->Cnt3InsertRowBtn; delete ui->Cnt3RemoveRowBtn; delete ui->cnt3RemoveAllRowsBtn; #endif #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ QStringList headerLabels2 = QStringList()<tableWidget_2->setHorizontalHeaderLabels(headerLabels2); ui->tableWidget_2->setFocusPolicy(Qt::NoFocus); ui->tableWidget_2->horizontalHeader()->setHighlightSections(false); ui->tableWidget_2->setColumnHidden(3,true);//第3列用来标志是否保存当前行 QHeaderView* vertivalHeader2 = ui->tableWidget_2->verticalHeader(); vertivalHeader2->setFixedWidth(60); ui->tableWidget_2->setColumnWidth(2,120); #endif #ifdef SPACEFLAG #else #endif current_print_col_num=0; //int h1=ui->tabWidget_3->tabBar()->tab const QString style_main2="QTabBar::tab {height:35px;border-top-left-radius: 6px;border-top-right-radius: 6px;padding-left: 11px;padding-right: 11px;border: 2px solid #C4C4C3;} \ QTabBar::tab:selected {background-color: rgb(255, 170, 127);height:37px;}\ QTabBar::tab:!selected {margin-top: 2px;}\ QTabBar::scroller{ width:40px;} \ QCheckBox::indicator { width: 18px; height: 18px; } "; ui->tabWidget_3->setStyleSheet(style_main2); connect(ui->tabWidget_2,SIGNAL(currentChanged(int)),this,SLOT(currentChanged(int))); // 删除所有标签页-分段计米 int tabsCount = ui->tabWidget_3->count(); for (int i = tabsCount - 1; i >= 0; --i) { ui->tabWidget_3->removeTab(i); } qwstatus[0]=ui->label_35->isVisible(); qwstatus[1]=ui->spinBoxdecimalpointnum->isVisible(); qwstatus[2]=ui->pushButtonVAR->isVisible(); qwstatus[3]=ui->checkVARLEN->isVisible(); qwstatus[4]=ui->label_2->isVisible(); ui->tabWidget_2->addTab(ui->tab_12,tr("分段计米")); } PrintSetting::~PrintSetting() { delete ui; delete dialogAuthorization; #ifdef ENCRYPT_VOL delete dialogModPasswd; #endif } void PrintSetting::on_checkVarLenChg() { //DlgVarLength dlg; //bool en = ui->checkVARLEN->isChecked(); if(sysPara) { dialogAuthVarSet->clearAuth(); dialogAuthVarSet->show(); } } void PrintSetting::on_VarLenSet() { //qDebug()<<"on_set"; if(sysPara){ sysPara->para.headLen=dlgvarLen->headLen; sysPara->para.endLen=dlgvarLen->endLen; sysPara->para.varLen=dlgvarLen->varLen; sysPara->para.varLen1=dlgvarLen->varLen1; sysPara->para.varLenEn = dlgvarLen->varEn; ui->checkVARLEN->setChecked(dlgvarLen->varEn); if( sysPara->para.synTriggerPrintLenMm < dlgvarLen->varLen || sysPara->para.synTriggerPrintLenMm < dlgvarLen->varLen1) { QMessageBox::information(this,tr("提示:可变长度参数不正确"),tr("要求:调整长度小于喷印间隔")); } } } void PrintSetting::ondialogAuthVarSetAccepted(){ QString authString = dialogAuthVarSet->getAuth(); if(authString == "07710665") { dlgvarLen->headLen = sysPara->para.headLen; dlgvarLen->endLen = sysPara->para.endLen; dlgvarLen->varLen = sysPara->para.varLen; dlgvarLen->varLen1 = sysPara->para.varLen1; dlgvarLen->varEn=sysPara->para.varLenEn; dlgvarLen->applyUI(sysPara->para.cnt1EndValue - sysPara->para.cnt1StartValue+1);//sysPara->para.synTriggerPrintLenMm //dlgvarLen->lab_4->setText("ddd"); dlgvarLen->show(); dlgvarLen->setFocus(); //sysPara->para.varLenEn = en; } } void PrintSetting::bindSysPara(SysPara *sysPara){ this->sysPara =sysPara; //ui->volDacEdit //ui->volDacEdit->bindSysPara(sysPara); } void PrintSetting::PrintupdateSysParaToUI() { qDebug()<<"PrintupdateSysParaToUI"; updateSysParaToUI(); } void PrintSetting::updateSysParaToUI(){ if(sysPara){ //ui->checkSpace->setChecked(sysPara->para.checkSpace); 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); 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->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); #if(0) ui->checkBoxAlterPrintEnable->setChecked (sysPara->para.alterPrint.enable );// 原来的 #else 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); } #endif 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:"<para.mode0211; qDebug()<<"checkVol1of8En:"<para.Vol1of8En; qDebug()<<"radioButtonFUllColFIxVal:"<para.FullColFixVal; qDebug()<<"checkBoxCharWidthSet:"<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->checkBoxGearPumpEnable->setChecked(sysPara->para.gearPumpEnable); ui->checkBox_ReclaimPumpEnable->setChecked(sysPara->para.flagOfReclaimPumEnable); 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(); // sysPara->para.bcOption.var3Num=ui->spinBoxCnt2EndValue_2->text().length(); //ui->volDacEdit->updateSysParaToUI(); //高速模式 ui->checkBox_FastMode->setChecked(sysPara->para.flagOfFastMode); #ifdef MIMA ui->labMac->setText(QString(" Mac:%1").arg(dlgInputAddr->jd.addr)); showMachInfo(QString::number(dlgInputAddr->jd.addr)); #else ui->labMac->setText(QString("")); #endif 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(); LoadCnt1GroupSettingsToUI();LoadCnt2GroupSettingsToUI(); sysPara->devOp->writeCnt1GroupSetting(1); //发送分段计米相关参数 sysPara->devOp->writeCnt2GroupSetting(1); sysPara->devOp->writeFpgaCalandar(0); sysPara->devOp->writeFpgaPrintPara(); 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("跳米设置")); } { const int indexTab=ui->tabWidget_2->indexOf(ui->tab_12); if(-1==indexTab) { if(sysPara->para.flagOfSecMi) ui->tabWidget_2->addTab(ui->tab_12,tr("分段计米")); } else { if(!sysPara->para.flagOfSecMi) ui->tabWidget_2->removeTab(indexTab); } } } } #include "VerBVersion.h" void PrintSetting::showMachInfo(QString Mac) { #ifdef __NETWORKMANAGER__ QString VernonBach; VernonBach.sprintf("%d.%d.%02d.", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER); VernonBach = VernonBach + (QString) Public::DateToString(__DATE__)+"_"+UP_PRINTER_STAGE_VER; QString FpgaVer = "No:"+QString::number(sysPara->status.build_dat.builTime); LogInfo::showMachineInformation(Mac,"QString SerialNum", VernonBach, FpgaVer); #endif } void PrintSetting::showRemoteControl(QString SuperNodeIP,QString EdgeIP) { #ifdef __NETWORKMANAGER__ QString VernonBach; VernonBach.sprintf("%d.%d.%02d.", UP_PRINTER_MAJOR_VER, UP_PRINTER_MINOR_VER,UP_PRINTER_RIVISION_VER); VernonBach = VernonBach + (QString) Public::DateToString(__DATE__)+"_"+UP_PRINTER_STAGE_VER; QString FpgaVer = "No:"+QString::number(sysPara->status.build_dat.builTime); //LogInfo::showMachineInformation(Mac,"QString SerialNum", VernonBach, FpgaVer); #endif } void PrintSetting::applyUIPara(){ if(sysPara){ unsigned char rExtScreenType =sysPara->para.ExtScreenType; sysPara->para.ExtScreenType = ui->comBoxExtSrceen->currentIndex(); sysPara->para.ExtMeterType = ui->comBoxExtMeterType->currentIndex(); sysPara->para.gearPumpSpeedAlarm = ui->spinBox_gearPumpSpeedAlarm->value(); if(//rExtScreenType==0 && sysPara->para.ExtScreenType) sysPara->devOp->uart2Init(); if(sysPara->para.ExtScreenType==0) { sysPara->status.ExtScreenEn =0; } ui->spinBoxColDelay->setEnabled(1); checkCnt1EndValueOnUI(); sysPara->para.varLenEn = ui->checkVARLEN->isChecked(); sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked(); sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked(); sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked(); sysPara->para.scanInverse = ui->checkBoxScanInverse->isChecked(); sysPara->para.currPrintMode = ui->comboBoxPrintMode->currentIndex(); 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.printColDelay = ui->spinBoxColDelay->value(); 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(); sysPara->status.cnt1CurrentValueInitDoneFlag = !ui->checkBoxResetCnt1CurrValue->isChecked(); sysPara->status.cnt2CurrentValueInitDoneFlag = !ui->checkBoxResetCnt2CurrValue->isChecked(); sysPara->status.cnt3CurrentValueInitDoneFlag = !ui->checkBoxResetCnt3CurrValue->isChecked(); ApplyCnt1GroupSetting();ApplyCnt2GroupSetting(); // sysPara->devOp->writeFpgaCalandar(0); sysPara->para.flagOfFastMode = ui->checkBox_FastMode->isChecked(); if(sysPara->para.flagOfFastMode || sysPara->status.FPGAVersionType == 1){ 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 //ui->radCNT1ResetEn->isChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?1:0); //ui->radCNT2ResetEn->isChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x80)?1:0); // #if(0) sysPara->para.alterPrint.enable =ui->checkBoxAlterPrintEnable->isChecked (); // 原来的 #else sysPara->para.alterPrint.enable =ui->comboBoxAlterPrintEnable->currentIndex();// 修改后的 if(sysPara->para.alterPrint.enable) sysPara->para.textEditLineSpace = 0; #endif 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.gearPumpEnable = ui->checkBoxGearPumpEnable->isChecked(); sysPara->para.flagOfReclaimPumEnable = ui->checkBox_ReclaimPumpEnable->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"<para.bcOption.var1Num<para.bcOption.var2Num; sysPara->para.ExpiryDay = ui->spinBoxExpiryDate->value(); sysPara->para.ExpirySplitMode = ui->CBDateFormat1->currentIndex(); ui->resetToCnt1InitValueCheckBox->isChecked(); //qDebug()<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); // if(sysPara->para.EditMode==SCENE) // { // QList items = pGetPicScene->selectedItems(); // if(items.size() > 0) // { // PicTextItem* picText = qgraphicsitem_cast(items.at(0)); // picText->CatchCnt1StartValue = ui->lineEditStartValue->text().toInt(); // picText->CatchCnt1CurrValue = ui->lineEditCountValue->text().toInt(); // picText->SpecialConditions = ui->radioButtonSpecialCondition->isChecked(); // pGetPicScene->clearSelection(); // //emit SwitchTimerShowItem(true); // } // } } } void PrintSetting::updateSysStatusToUI(){ if(sysPara){ ui->labelCnt1CurrValue->setText(QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16)); ui->labelCnt2CurrValue->setText(QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16)); ui->labelCnt3CurrValue->setText(QString::number(sysPara->status.Status_Counter3.cnt3CurrValue,16)); //ui->volDacEdit->updateSysStatusToUI(); //ui->labPulse ->setText(); //ui->labPulse ->setText(QString("%1 pps").arg((unsigned int)sysPara->status.synPulseCntPer1s)); int rDay= sysPara->para.openInkLineTime/24/3600; long tmp = sysPara->para.openInkLineTime%(24*3600); int rHour = tmp/3600; tmp =tmp%3600; int rMinute = tmp/60; int rSecond=tmp%60; QString s=""; //s.sprintf(tr("%4d天 %02d:%02d:%02d").toUtf8(), rDay,rHour,rMinute,rSecond);ui->labOpenInkLineTime->setText(s); s.sprintf(("%6d:%02d:%02d"), rDay*24+rHour,rMinute,rSecond);ui->labOpenInkLineTime->setText(s); ui->label_MaintenanceTime->setText(QString::number(dlgInputAddr->repairTimeLess,10)+tr("小时")); //ui->labOpenInkLineTime->setText(tr("%1天 %2:%3:%4").arg(rDay).arg(rHour).arg(rMinute).arg(rSecond)); ui->labTrunOnPowerCnt->setText(QString::number(sysPara->para.TrunOnPowerCnt,10)); } } void PrintSetting::on_pushButtonClearRunTime_pressed(){ sysPara->para.openInkLineTime=0; sysPara->para.TrunOnPowerCnt=0; sysPara->saveParaToFile(); } void PrintSetting::on_pushButtonApply_pressed() { applyUIPara(); emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked()); autoUpdateFontWidth(sysPara->status.textEditTotalCol); PrintSettingLog(); } void PrintSetting::PrintSettingLog(){ //qDebug()<comboBoxPrintMode->currentIndex()); qDebug()<spinBoxColDelay->value()); qDebug()<spinBoxColRepeatCnt->value()); qDebug()<spinBoxStartVoltage->value()); qDebug()<spinBoxEndVoltage->value()); qDebug()<spinBoxHighVoltageValue->value()); qDebug()<checkBoxRecycleWarnAction->isChecked()); qDebug()<checkBoxPowerOffAfterPhaseFault->isChecked()); qDebug()<checkSynCntEn->isChecked()); qDebug()<checkHVFaultCloseEn->isChecked()); qDebug()<checkBoxSpeedOver->isChecked()); qDebug()<checkBoxSuspendAfterPhaseFault->isChecked()); qDebug()<checkmode0211->isChecked()); qDebug()<checkVol1of8En->isChecked()); qDebug()<checkBoxCnt1NatureValue->isChecked()); qDebug()<checkBoxStopCounterMeterAfterFault->isChecked()); qDebug()<checkBoxEleEyeRetrigDis->isChecked()); qDebug()<radioButtonFUllColFIxVal->isChecked()); qDebug()<checkBoxUpDownInverse->isChecked()); qDebug()<checkBoxLeftRightInverse->isChecked()); qDebug()<comboBoxIndustry->currentIndex()); qDebug()<comboBoxRecommendedPrintSpeed->currentIndex()); qDebug()<checkBoxMagnet->isChecked()); qDebug()<checkBoxCharWidthSet->isChecked()); qDebug()<checkBoxGearPumpEnable->isChecked()); qDebug()<checkBoxResetSendData->isChecked()); qDebug()<spinBoxCnt1StartValue->value()); qDebug()<spinBoxCnt1EndValue->value()); qDebug()<spinBoxCnt1RepeateCnt->value()); qDebug()<spinBoxCnt1StepValue->value()); qDebug()<spinBoxCnt1CurrValue->value()); qDebug()<checkBoxResetCnt1CurrValue->isChecked()); //qDebug()<checkBoxNumPoint->isChecked()); qDebug()<checkVARLEN->isChecked()); qDebug()<resetToCnt1InitValueCheckBox->isChecked()); qDebug()<CBDateFormat1->currentIndex()); qDebug()<checkBoxSaveCNTStateValue->isChecked()); qDebug()<spinBoxExpiryDate->value()); qDebug()<checkBoxCircleProductCnt->isChecked()); qDebug()<spinBoxCnt2StartValue->value()); qDebug()<spinBoxCnt2EndValue->value()); qDebug()<spinBoxCnt2RepeateCnt->value()); qDebug()<spinBoxCnt2StepValue->value()); qDebug()<spinBoxCnt2CurrValue->value()); qDebug()<checkBoxResetCnt2CurrValue->isChecked()); qDebug()<spinBoxXStartValue->value()); qDebug()<spinBoxXGapValue->value()); qDebug()<spinBoxXRepeatTimeValue->value()); qDebug()<comboBoxAlterPrintEnable->currentIndex()); qDebug()<para.HiddenFuncEnable); if(ui->radioButtonSpecialCondition->isChecked()){ qDebug()<spinBoxHiddenValue->value()); qDebug()<spinBoxConditionValue->value()); qDebug()<spinBoxMeterEnable->value()); } qDebug()<para.flagOfSecMi); } void PrintSetting::on_checkBoxResetCnt1CurrValue_released() { bool checked = ui->checkBoxResetCnt1CurrValue->isChecked(); ui->spinBoxCnt1CurrValue->setEnabled(checked); } void PrintSetting::on_checkBoxResetCnt2CurrValue_released() { bool checked = ui->checkBoxResetCnt2CurrValue->isChecked(); ui->spinBoxCnt2CurrValue->setEnabled(checked); } void PrintSetting::on_checkBoxResetCnt3CurrValue_released() { bool checked = ui->checkBoxResetCnt3CurrValue->isChecked(); ui->spinBoxCnt3CurrValue->setEnabled(checked); } void PrintSetting::on_checkBoxSaveCNTStateValue_released() { bool checked = ui->checkBoxSaveCNTStateValue->isChecked(); sysPara->para.isCntSaveStateValue = checked; } void PrintSetting::on_checkBoxCircleProductCnt_released() { bool checked = ui->checkBoxCircleProductCnt->isChecked(); sysPara->status.circleProductCnt = checked; } void PrintSetting::on_dialogModPasswdAccepted() { QString authString = dialogModPasswd->getModPasswd(); if(authString == "987456123") { qDebug()<< "right choice"; modify_vol = true; ui->volButton->setText("取消授权"); ui->spinBoxHighVoltageValue->setEnabled(true); ui->spinBoxStartVoltage->setEnabled(true); } else { QMessageBox::critical(this,tr("错误"),tr("授权码:") + authString + tr(" 错误")); } } void PrintSetting::ondialogAuthorizationAccepted(){ QFile file("/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/libQtssl.o"); QString authString = dialogAuthorization->getAuth(); // sysPara->devOp->checkAuthorization(authString); if(authString == "nnyp"){ //if(authString == "axmk"){ auth = AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE | AUTH_SUPER_USER1\ //edit@11-28 |AUTH_SUPER_USER2|AUTH_DISPLAY_OTHER_INFO; SpecailSettingsDisplay(); EngineeringModeDisplay(); ModuleDecimalDisplay(); ModuleHideDisplay(); } else if(authString == "biyang"){ auth = AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE | AUTH_DISPLAY_LOG_INFO | AUTH_SUPER_USER1 ; } else if(authString == "by2016"){ //edit@11-28 auth = \ AUTH_DISPLAY_LOG_INFO //AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE //| AUTH_DISPLAY_OTHER_INFO | AUTH_SUPER_USER1 |AUTH_SUPER_USER2 ; SpecailSettingsDisplay(); EngineeringModeDisplay(); ModuleDecimalDisplay(); ModuleHideDisplay(); } else if(authString == "07710665"){ // ui->checkBoxReciclar->setEnabled(1); flagOfSpecailSettng = !flagOfSpecailSettng; SpecailSettingsDisplay(); } else if(authString == "nnyp0998"){ flagOfEngineeringMode =true; //edit@11-28 flagOfSpecailSettng =true;// !flagOfSpecailSettng; auth = AUTH_DISPLAY_SYSTEM_SETTING | AUTH_DISPLAY_SYSTEM_MANAGE | AUTH_DISPLAY_LOG_INFO | AUTH_DISPLAY_OTHER_INFO| AUTH_SUPER_USER1 |AUTH_SUPER_USER2; SpecailSettingsDisplay(); EngineeringModeDisplay(); //edit@11-30 ModuleDecimalHideDisplay(sysPara->para.HiddenFuncEnable); specailMachineSetting(1); } else if(authString == "07710221"){ flagOfModuleDecimal = !flagOfModuleDecimal; sysPara->para.flagOfModuleDecimal = flagOfModuleDecimal; ModuleDecimalDisplay(); ModuleHideDisplay(); sysPara->para.flagOfModuleHide = flagOfModuleHide; }else if(authString == "07710331"){ flagOfModuleHide = !flagOfModuleHide; sysPara->para.flagOfModuleHide = flagOfModuleHide; ModuleHideDisplay(); ModuleDecimalDisplay(); sysPara->para.flagOfModuleDecimal = flagOfModuleDecimal; } //edit@11-29 输入密码显示,再次输入隐藏 else if(authString == "07710441"){ //edit@12-03 const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9); if(sysPara->para.flagOfCnt1GroupDisp) ui->tabWidget_2->removeTab(indexTab); else ui->tabWidget_2->addTab(ui->tab_9,tr("米标显示"));//其他设置 sysPara->para.flagOfCnt1GroupDisp=!sysPara->para.flagOfCnt1GroupDisp; } //edit@11-29 输入密码显示,再次输入隐藏 else if(authString == "07710551"){ //edit@12-03 const int indexTab=ui->tabWidget->indexOf(ui->tab_6); if(sysPara->para.flagOfstepPrint) ui->tabWidget->removeTab(indexTab); else ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); sysPara->para.flagOfstepPrint=!sysPara->para.flagOfstepPrint; } //分段计米 else if(authString == "07710661"){ //edit@12-03 const int indexTab=ui->tabWidget_2->indexOf(ui->tab_12); if(sysPara->para.flagOfSecMi){ on_checkBoxGroupCnt1_clicked(false); on_checkBoxGroupCnt_2_clicked(false); ui->tabWidget_2->removeTab(indexTab); } else ui->tabWidget_2->addTab(ui->tab_12,tr("分段计米")); sysPara->para.flagOfSecMi=!sysPara->para.flagOfSecMi; } #ifdef MIMA //MIMA #ifndef TEMPMIMA else if(authString.left(7) == "3239305" && authString.right(4)=="1407") #else else if( dlgInputAddr->checkSupperInit(authString) ) #endif { QDir dirlib("/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/"); if(!dirlib.exists()) { system("mkdir -p /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/"); system("touch /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/libQtssl.o"); } if(!file.open(QIODevice::WriteOnly)){//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看 } else { sysPara->status.WorkTimeOut=0; dlgInputAddr->SetNewJm(1); sysPara->para.varLen=0; sysPara->para.varLen1=0; file.close(); // QMessageBox::warning(0,"提示",QString("软件初始化完成.") ); #ifdef __RFID_CARD sysPara->devOp->setICReaderModeFlag = true; MySleep(300); QMessageBox::warning(0,tr("提示"),tr("软件初始化完成.") ); sysPara->devOp->setRFIDReaderWorkMode(); sysPara->devOp->setRFIDReaderKey(); sysPara->devOp->setICReaderModeFlag = false; #endif } } else if((authString.left(4) == "nnyp") && ( dlgInputAddr->checkSupperJm(authString.mid(4)))) { #ifdef __RFID_CARD memset(&sysPara->RFIDPara,0,sizeof(sysPara->RFIDPara)); sysPara->saveRFIDPara(); QMessageBox::warning(0,tr("提示"),tr("RFID卡清零!") ); #endif } else if( dlgInputAddr->checkSupperJm(authString)) { sysPara->status.WorkTimeOut=0; dlgInputAddr->ReadJm(); dlgInputAddr->show(); ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr)); } else if(dlgInputAddr->checWhJm(authString)) // 0xa001 { sysPara->status.WorkTimeOut=0; QMessageBox::warning(this,tr("提示"),tr("喷码机维护设置成功!"),QMessageBox::Ok); specailMachineSetting(1); } else if(dlgInputAddr->checkSysJm(authString)) { dlgInputAddr->SaveJm(); dlgInputAddr->show(); ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr)); sysPara->status.WorkTimeOut=0; QMessageBox::warning(this,tr( "提示"),tr("系统维护设置成功!") ,QMessageBox::Ok); } #endif else if(authString == "vbip") { dlgInputAddr->setNodeIpAndPrivateIp(false); dlgInputAddr->show(); } else { auth = AUTH_NONE; QMessageBox::critical(this,tr("错误"),tr("密码:") + authString + tr(" 不存在")); } emit authChanged(auth); if(auth == AUTH_NONE ) {sysPara->status.adjHightVolInitEN=0;sysPara->status.updateSoftEN=0;} ui->pushButtonAuth->setText((auth == AUTH_NONE)?tr("输入密码"):tr("取消授权")); } void PrintSetting::SpecailSettingsDisplay() { if(flagOfSpecailSettng) { ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); ui->comboBoxIndustry->setVisible(1); ui->checkBoxNewAmplifyPlate->setVisible(1); // ui->labelRecommendedPrintSpeed->setVisible(1); ui->comboBoxRecommendedPrintSpeed->setVisible(1); ui->checkBoxPrintOnce->setVisible(1); ui->checkBoxReciclar->setVisible(1); ui->lockoulsepushButton->setVisible(1); ui->pushButtonRecommendedSetting->setVisible(1); ui->checkBox_FastMode->setVisible(1); } else { // if(flagOfEngineeringMode){ // const int indexTab=ui->tabWidget_2->indexOf(ui->tab_11); // if(indexTab>=0) // ui->tabWidget_2->removeTab(indexTab); // } // else{ // const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9); // if(indexTab>=0) // ui->tabWidget_2->removeTab(indexTab); // } const int indexTab=ui->tabWidget_2->indexOf(ui->tab_11); if(indexTab>=0) ui->tabWidget_2->removeTab(indexTab); ui->comboBoxIndustry->hide(); ui->checkBoxNewAmplifyPlate->hide(); // ui->labelRecommendedPrintSpeed->hide(); ui->comboBoxRecommendedPrintSpeed->hide(); ui->checkBoxPrintOnce->hide(); ui->checkBoxReciclar->hide(); ui->lockoulsepushButton->hide(); ui->pushButtonRecommendedSetting->hide(); ui->checkBox_FastMode->hide(); } } void PrintSetting::EngineeringModeDisplay() { if(flagOfEngineeringMode) { ui->tabWidget_2->addTab(ui->tab_9,tr("米标显示"));//其他设置 if(flagOfSpecailSettng) ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); ui->tabWidget->addTab(ui->tab_8,tr("计数器3设置")); ui->tabWidget->addTab(ui->tab_6,tr("跳米设置")); ui->checkBoxSpeedOver->setVisible(1); ui->checkBoxSuspendAfterPhaseFault->setVisible(1); ui->checkmode0211->setVisible(1); ui->checkVol1of8En->setVisible(1); ui->checkBoxStopCounterMeterAfterFault->setVisible(1); ui->checkBoxEleEyeRetrigDis->setVisible(1); ui->radioButtonFUllColFIxVal->setVisible(1); ui->checkBoxCharWidthSet->setVisible(1); ui->radioCNT3->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->label_7->setVisible(1); ui->label_6->setVisible(1); ui->label_34->setVisible(1); ui->label_35->setVisible(1); ui->spinBoxdecimalpointnum->setVisible(1); ui->spinBoxHiddenValue->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->spinBoxConditionValue->setVisible(1); ui->spinBoxMeterEnable->setVisible(1); } else { // if(flagOfSpecailSettng) // { // ui->tabWidget_2->removeTab(5); // ui->tabWidget_2->removeTab(4); // ui->tabWidget_2->addTab(ui->tab_11,tr("打印电压缩放")); // } // else{ // ui->tabWidget_2->removeTab(4); // } const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9); if(indexTab>0) ui->tabWidget_2->removeTab(indexTab); ui->tabWidget->removeTab(3); ui->tabWidget->removeTab(2); ui->checkBoxSpeedOver->hide(); ui->checkBoxSuspendAfterPhaseFault->hide(); ui->checkmode0211->hide(); ui->checkVol1of8En->hide(); ui->checkBoxStopCounterMeterAfterFault->hide(); ui->checkBoxEleEyeRetrigDis->hide(); ui->radioButtonFUllColFIxVal->hide(); ui->checkBoxCharWidthSet->hide(); ui->radioCNT3->hide(); ui->radioButtonSpecialCondition->hide(); ui->label_7->hide(); ui->label_6->hide(); ui->label_34->hide(); ui->label_35->hide(); ui->spinBoxdecimalpointnum->hide(); ui->spinBoxHiddenValue->hide(); ui->radioButtonSpecialCondition->hide(); ui->spinBoxConditionValue->hide(); ui->spinBoxMeterEnable->hide(); } ModuleDecimalDisplay(); ModuleHideDisplay(); } void PrintSetting::ModuleDecimalDisplay() { if(flagOfModuleDecimal){ ui->label_35->setVisible(1); ui->spinBoxdecimalpointnum->setVisible(1); flagOfModuleHide = 0; ui->radioButtonSpecialCondition->setChecked(0); }else{ ui->spinBoxdecimalpointnum->setValue(0); ui->spinBoxdecimalpointnum->setEnabled(0); ui->radioButtonSpecialCondition->setEnabled(1); ui->label_35->hide(); ui->spinBoxdecimalpointnum->hide(); } } void PrintSetting::ModuleHideDisplay() { if(flagOfModuleHide){ ui->label_7->setVisible(1); ui->label_6->setVisible(1); ui->label_34->setVisible(1); ui->spinBoxHiddenValue->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->spinBoxConditionValue->setVisible(1); ui->spinBoxMeterEnable->setVisible(1); flagOfModuleDecimal = 0; ui->spinBoxdecimalpointnum->setValue(0); sysPara->para.rrr_nc = 0; sysPara->para.printNumPoint = 0; }else{ ui->radioButtonSpecialCondition->setChecked(0); ui->spinBoxdecimalpointnum->setEnabled(1); ui->label_7->hide(); ui->label_6->hide(); ui->label_34->hide(); ui->spinBoxHiddenValue->hide(); ui->radioButtonSpecialCondition->hide(); ui->spinBoxConditionValue->hide(); ui->spinBoxMeterEnable->hide(); } } void PrintSetting::on_checkBoxSuspendAfterPhaseFault_clicked() { ui->checkBoxStopCounterMeterAfterFault->setEnabled(ui->checkBoxSuspendAfterPhaseFault->isChecked()); } void PrintSetting::on_checkBoxPowerOffAfterPhaseFault_clicked() { ui->checkBoxStopCounterMeterAfterFault->setEnabled(!ui->checkBoxPowerOffAfterPhaseFault->isChecked() && ui->checkBoxSuspendAfterPhaseFault->isChecked()); ui->checkBoxSuspendAfterPhaseFault->setEnabled(!ui->checkBoxPowerOffAfterPhaseFault->isChecked()); } #include #include void PrintSetting::on_pushButtonAuth_pressed() { flagOfAuthEnter = true; if(auth == AUTH_NONE){ dialogAuthorization->clearAuth(); dialogAuthorization->show(); } else { emit authChanged(AUTH_NONE); auth = AUTH_NONE; sysPara->status.adjHightVolInitEN=0;sysPara->status.updateSoftEN=0; ui->pushButtonAuth->setText(tr("输入密码")); //edit@11-28 flagOfEngineeringMode = false; flagOfSpecailSettng = false; //qDebug()<updateSysParaToUI(); specailMachineSetting(0); } MySleep(5000); flagOfAuthEnter = false; } void PrintSetting::updateAuthorization(int auth){ //ui->dacScaledSpinBox->setEnabled(auth & AUTH_SUPER_USER1); ui->checkBoxScanInverse->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelVoltageAdjustPos->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxPointVoltageAdjustPos->setEnabled(auth & AUTH_SUPER_USER1); ui->labelReducedPixelNum->setEnabled(auth & AUTH_SUPER_USER1); ui->spinBoxReducedPixelNum->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelVoltageAdjustValue->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxVoltageAdjustValue->setEnabled(auth & AUTH_SUPER_USER1); ui->labelRowSequenceMode->setEnabled(auth & AUTH_SUPER_USER1); ui->spinBoxRowSequenceMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelReducedPixMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->comboBoxReducedPixMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelLineEndAdjustPointCnt->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxLineEndAdjustPointCnt->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelLineEndAdjustPointMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->comboBoxLineEndAdjustPointMode->setEnabled(auth & AUTH_SUPER_USER1); // ui->spinBoxLastLineEndPointFixedValue->setEnabled(auth & AUTH_SUPER_USER1); // ui->labelLastLineEndPointFixedValue->setEnabled(auth & AUTH_SUPER_USER1); ui->pushButtonClearRunTime->setEnabled(auth & AUTH_SUPER_USER1); // 透明按钮 //ui->volDacEdit->updateAuthorization (auth); } void PrintSetting::on_spinBoxLastLineEndPointFixedValue_valueChanged(int arg1) { if(sysPara){ sysPara->devOp->setLastLineEndPointFixedValue(arg1); } } void PrintSetting::on_pushButtonRecommendedSetting_clicked() { QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认使用推荐设置?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ /*----------------------------设置参数,然后更新到界面-----------------------------*/ int industry = ui->comboBoxIndustry->currentIndex(); int speed = ui->comboBoxRecommendedPrintSpeed->currentIndex(); ui->comboBoxPrintMode->setCurrentIndex((industry?1:0) + speed + 1); ui->spinBoxVoltageAdjustValue->setValue(0); ui->comboBoxReducedPixMode->setCurrentIndex(0); ui->spinBoxReducedPixelNum->setValue((speed == 0)?55:((speed == 1)?30:0)); ui->spinBoxRowSequenceMode->setValue(1); ui->checkBoxScanInverse->setChecked(false); ui->spinBoxLineEndAdjustPointCnt->setValue(2); ui->comboBoxLineEndAdjustPointMode->setCurrentIndex((industry?3:1) + speed + 1); ui->spinBoxLastLineEndPointFixedValue->setValue((speed < 2)?-20:0); on_pushButtonApply_pressed(); } } void PrintSetting::showVolDacEdit(int auth){ /* if((auth&AUTH_SUPER_USER2)) { if(ui->tabWidget_2->indexOf (ui->tab_8)==-1) ui->tabWidget_2->addTab (ui->tab_8,tr("点距电压微调")); } else { if(ui->tabWidget_2->indexOf (ui->tab_8)!=-1) ui->tabWidget_2->removeTab (ui->tabWidget_2->indexOf (ui->tab_8));//ui->tabWidget_2->indexOf (ui->tab_8) } */ } void PrintSetting::on_pushOnlyCNT1Clear_pressed(){ sysPara->devOp->clearProductCnt(1<<2); // 计数器1单独清零 //sysPara->para.totalProductCnt += sysPara->status.productCnt; //qDebug()<<"only1"; } void PrintSetting::on_pushOnlyCNT2Clear_pressed(){ sysPara->devOp->clearProductCnt(1<<3);// 计数器2单独清零 //qDebug()<<"only2"; } void PrintSetting::on_pushButtonRanddomBackUP_pressed(){ QMessageBox::StandardButton ret; QFile f1("/home/plg/Xrand2.txt"); QString str; //f1.open(QFile::ReadWrite); int len = f1.size(); if(f1.size()<100 ) { ret = QMessageBox::warning(this, tr("提示"), tr("随机码文件为空,不需要导出"), QMessageBox::Ok ); //f1.close(); return; } //f1.close(); ret = QMessageBox::warning(this, tr("提示"), tr("随机码文本将展出到U盘,请插入U盘"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ LogInfo::setRunStatusText("正在导出随机码文件到U盘......"); sysPara->devOp->RandTxtBakup(1); LogInfo::setRunStatusText("随机码文件导出完成."); } } void PrintSetting::on_spinBoxExpiryDate_valueChanged(int arg1) { QDate curDate= QDate::currentDate().addDays(arg1); //ui->CBDateFormat1->clear(); QString DateTime;QString format; // str.sprintf("%04d-%02d-%02d",curDate.year(),curDate.month(),curDate.day()); // ui->CBDateFormat1->setItemText(0,str);//ui->CBDateFormat1->addItem(str); // str.sprintf("%04d/%02d/%02d",curDate.year(),curDate.month(),curDate.day()); // ui->CBDateFormat1->setItemText(1,str);//ui->CBDateFormat1->addItem(str); // str.sprintf("%04d%02d%02d",curDate.year(),curDate.month(),curDate.day()); // ui->CBDateFormat1->setItemText(2,str);//ui->CBDateFormat1->addItem(str); ui->CBDateFormat1->count(); for(int i=0;i < ui->CBDateFormat1->count();++i) { format = ui->CBDateFormat1->itemText(i); DateTime = QDateTime::currentDateTime().toString(format); ui->CBDateFormat1->setItemText(i,DateTime); //qDebug()<CBDateFormat1->addItem(str.toLocal8Bit()); //ui->CBDateFormat1->setCurrentIndex(sysPara->para.ExpirySplitMode);//p_var->splitMode //sysPara->para.ExpiryDay = arg1; } void PrintSetting::on_CBDateFormat1_currentIndexChanged(int index) { sysPara->para.ExpirySplitMode = index; } void PrintSetting::updateCnt1GroupsTblWgt() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QPalette Palette; QLineEdit *pLineEdit; int rowCnt=ui->tableWidget->rowCount(); //int rowCnt=sysPara->para.Cnt1ByGroup.cnt1GroupCnt; //qDebug()<<"updateCnt1GroupsTblWgt count"<status.cnt1GroupRunningIndex; for(int i=0;itableWidget->cellWidget(i,j); Palette = pLineEdit->palette(); if(sysPara->para.cnt1ByGroupEnalbe && (i == sysPara->status.cnt1GroupRunningIndex)) { Palette.setColor(QPalette::Normal,QPalette::Base, Qt::green); } else { Palette.setColor(QPalette::Normal,QPalette::Base, Qt::lightGray); } pLineEdit->setPalette(Palette); } } #endif } void PrintSetting::updateCnt2GroupsTblWgt() { #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ QPalette Palette; QLineEdit *pLineEdit; int rowCnt=ui->tableWidget_2->rowCount(); for(int i=0;itableWidget_2->cellWidget(i,j); Palette = pLineEdit->palette(); if(sysPara->para.cnt2ByGroupEnalbe && (i == sysPara->status.cnt2GroupRunningIndex)) { Palette.setColor(QPalette::Normal,QPalette::Base, Qt::green); } else { Palette.setColor(QPalette::Normal,QPalette::Base, Qt::lightGray); } pLineEdit->setPalette(Palette); } } #endif } void PrintSetting::onUpdateCnt1GroupDisp(bool bChangeToNext) { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ if(bChangeToNext)//循环数走完 { //改变当前执行的分段的背景颜色 updateCnt1GroupsTblWgt(); } #endif } void PrintSetting::LoadCnt1GroupSettingsToUI() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QLineEdit *pLineEdit; ui->checkBoxGroupCnt1->setChecked(sysPara->para.cnt1ByGroupEnalbe); on_checkBoxGroupCnt1_clicked(sysPara->para.cnt1ByGroupEnalbe); //qDebug()<<"LoadCnt1GroupSettingsToUI:cnt1GroupCnt "<para.Cnt1ByGroup.cnt1GroupCnt; ui->tableWidget->setRowCount(sysPara->para.Cnt1ByGroup.cnt1GroupCnt); QRegExp regx("[0-9]+$"); QValidator *validator = new QRegExpValidator(regx, this); QRegExp regxLoop("[1-9][0-9]+$"); QValidator *validatorLoop = new QRegExpValidator(regxLoop, this); for(int i=0; ipara.Cnt1ByGroup.cnt1GroupCnt; i++) { pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].StartValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(i,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].EndValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(i,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget->setCellWidget(i,2,pLineEdit); } #if 0 /* 只是打开一个文件,还没有点击开始打印,该文件的变量1的起始和结束设定就起作用了,所以去掉。如果想要分段计米生效只能点击应用了 */ sysPara->devOp->writeFpgaCalandar(1); sysPara->devOp->writeCnt1GroupSetting(1); #endif updateCnt1GroupsTblWgt(); #endif } void PrintSetting::checkCnt1EndValueOnUI() { #if 0 int cnt1Start,cnt1End,cnt1Step; int remain; int cnt1GroupRow=ui->tableWidget->rowCount(); bool cnt1GroupEn=ui->checkBoxGroupCnt1->isChecked(); if(cnt1GroupEn && cnt1GroupRow !=0) { QLineEdit *pLineEdit0 = (QLineEdit *)ui->tableWidget->cellWidget(0,0); cnt1Start = pLineEdit0->text().toInt(); QLineEdit *pLineEdit1 = (QLineEdit *)ui->tableWidget->cellWidget(0,1); cnt1End = pLineEdit1->text().toInt(); cnt1Step = ui->spinBoxCnt1StepValue->value(); remain =(cnt1End-cnt1Start)%cnt1Step; if(remain != 0) { pLineEdit1->setText(QString::number(cnt1End-remain)); QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("计数器1(结束值-开始值)不能被增量整除,结束值将被设为%1").arg(cnt1End-remain), QMessageBox::Ok); } } else { cnt1Start = ui->spinBoxCnt1StartValue->value(); cnt1End = ui->spinBoxCnt1EndValue->value(); cnt1Step = ui->spinBoxCnt1StepValue->value(); remain =(cnt1End-cnt1Start)%cnt1Step; if(remain !=0 ) { ui->spinBoxCnt1EndValue->setValue(cnt1End-remain); QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("计数器1(结束-开始)不能被增量整除,结束值将被设为%1").arg(cnt1End-remain), QMessageBox::Ok); } } #endif } void PrintSetting::ApplyCnt1GroupSetting() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QLineEdit *pLineEdit; sysPara->para.cnt1ByGroupEnalbe = ui->checkBoxGroupCnt1->isChecked(); sysPara->para.Cnt1ByGroup.cnt1GroupCnt=ui->tableWidget->rowCount(); if(sysPara->para.cnt1ByGroupEnalbe && sysPara->para.Cnt1ByGroup.cnt1GroupCnt==0) { sysPara->para.cnt1ByGroupEnalbe=false; ui->checkBoxGroupCnt1->setChecked(false); on_checkBoxGroupCnt1_clicked(false); } qDebug()<<"ApplyCnt1GroupSetting:cnt1ByGroupEnalbe: "<para.cnt1ByGroupEnalbe; qDebug()<<"ApplyCnt1GroupSetting:cnt1GroupCnt: "<para.Cnt1ByGroup.cnt1GroupCnt; for(int i=0; ipara.Cnt1ByGroup.cnt1GroupCnt; i++) { pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(i,0); sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].StartValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(i,1); sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].EndValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(i,2); sysPara->para.Cnt1ByGroup.cnt1GroupSettings[i].LoopTimes = pLineEdit->text().toInt(); qDebug()<<"i: "<para.Cnt1ByGroup.cnt1GroupSettings[i].StartValue <<"end1: "<para.Cnt1ByGroup.cnt1GroupSettings[i].EndValue <<"Loop1: "<para.Cnt1ByGroup.cnt1GroupSettings[i].LoopTimes; } sysPara->devOp->writeCnt1GroupSetting(1); sysPara->saveParaToFile(); //改变当前执行的分段的背景颜色 updateCnt1GroupsTblWgt(); #endif } void PrintSetting::rowWidgetCreate(int rowIndex) { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QLineEdit* pLineEdit; QRegExp regx("[0-9]+$"); QValidator *validator = new QRegExpValidator(regx, this); QRegExp regxLoop("[1-9][0-9]+$"); QValidator *validatorLoop = new QRegExpValidator(regxLoop, this); for(int i=0;i<3;i++) { if(i==3) { //ui->tableWidget->item(rowIndex,i)->setCheckState(Qt::Unchecked); } else { if(i<2) { pLineEdit = new QLineEdit(tr("0")); pLineEdit->setValidator(validator); } else if(i==2) { pLineEdit = new QLineEdit(tr("1")); pLineEdit->setValidator(validatorLoop); } ui->tableWidget->setCellWidget(rowIndex,i,pLineEdit); } } #endif } void PrintSetting::on_checkBoxGroupCnt1_clicked(bool checked) { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ if(checked) { ui->spinBoxCnt1StartValue->setEnabled(false); ui->spinBoxCnt1EndValue->setEnabled(false); // ui->checkBoxResetCnt1CurrValue->setEnabled(false); ui->checkBoxGroupCnt_2->setChecked(1); ui->spinBoxCnt2StartValue->setEnabled(false); ui->spinBoxCnt2EndValue->setEnabled(false); } else { ui->spinBoxCnt1StartValue->setEnabled(true); ui->spinBoxCnt1EndValue->setEnabled(true); ui->checkBoxResetCnt1CurrValue->setEnabled(true); ui->checkBoxGroupCnt_2->setChecked(0); ui->spinBoxCnt2StartValue->setEnabled(true); ui->spinBoxCnt2EndValue->setEnabled(true); } #endif } void PrintSetting::on_Cnt3AddRowBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ int rowCnt=ui->tableWidget->rowCount(); if(rowCnt>=MAX_CNT1_GROUPS_NUM) { return; } //sysPara->para.cnt1GroupCnt++; ui->tableWidget->setRowCount(rowCnt+1); rowWidgetCreate(rowCnt); #endif } void PrintSetting::on_Cnt3InsertRowBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ int rowIndex=ui->tableWidget->currentRow(); int rowCnt=ui->tableWidget->rowCount(); if(rowIndex<0||rowCnt>=MAX_CNT1_GROUPS_NUM) { //qDebug()<<"max counter1 groups num is "<tableWidget->insertRow(rowIndex+1); rowWidgetCreate(rowIndex+1); #endif } void PrintSetting::on_Cnt3RemoveRowBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ int rowIndex=ui->tableWidget->currentRow(); if(rowIndex<0) { return; } QMessageBox::StandardButton ret; if(rowIndex==sysPara->status.cnt1GroupRunningIndex) { QMessageBox::warning(this, tr("错误"), tr("正在打印第%1组设置,不可删除").arg(rowIndex+1), QMessageBox::Ok); return; } ret = QMessageBox::warning(this, tr("警告"), tr("是否确认删除第%1组设置?").arg(rowIndex+1), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ ui->tableWidget->removeRow(rowIndex); } #endif } void PrintSetting::on_cnt3RemoveAllRowsBtn_pressed() { #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认删除全部设置?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ int rowCnt=ui->tableWidget->rowCount(); for(int i=rowCnt-1;i>=0;i--) { ui->tableWidget->removeRow(i); } } #endif } void PrintSetting::on_comboBoxAlterPrintEnable_currentIndexChanged(int index) { if(index==0) { ui->spinBoxXStartValue->setEnabled(false); ui->spinBoxXRepeatTimeValue->setEnabled(false); ui->spinBoxXGapValue->setEnabled(false); } else { ui->spinBoxXStartValue->setEnabled(true); ui->spinBoxXRepeatTimeValue->setEnabled(true); ui->spinBoxXGapValue->setEnabled(true); } if(index==3) { ui->spinBoxDistanceTail->setEnabled(true); } else { ui->spinBoxDistanceTail->setEnabled(false); } } void PrintSetting::on_checkVol1of8En_clicked(bool checked) { if(checked && ui->checkmode0211->checkState()) { ui->checkmode0211->setChecked(false); } } void PrintSetting::on_checkmode0211_clicked(bool checked) { if(checked && ui->checkVol1of8En->checkState()) { ui->checkVol1of8En->setChecked(false); } if(checked && ui->radioButtonFUllColFIxVal->checkState()) { ui->radioButtonFUllColFIxVal->setChecked(false); } //sysPara->para.Vol1of8En = !checked;//打印优化 if(!checked && ui->radioButtonFUllColFIxVal->checkState() == false) { ui->spinBoxStartVoltage->setEnabled(true); ui->spinBoxEndVoltage->setEnabled(true); } else { ui->spinBoxStartVoltage->setEnabled(false); ui->spinBoxEndVoltage->setEnabled(false); } } void PrintSetting::on_volButton_clicked() { if(!modify_vol) { dialogModPasswd->clearAuth(); dialogModPasswd->show(); }else { modify_vol = false; ui->volButton->setText("修改授权"); ui->spinBoxHighVoltageValue->setEnabled(false); ui->spinBoxStartVoltage->setEnabled(false); } } void PrintSetting::on_spinBoxColDelay_valueChanged(int arg1) { if(!sysPara->para.charWidthSetEnable) { if(arg1 == 0) { QMessageBox::warning(this, tr("警告"), tr("字体宽度不能为0"), QMessageBox::Ok | QMessageBox::Cancel); ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); } } else { sysPara->para.printColDelay = arg1; } } void PrintSetting::on_radioButtonFUllColFIxVal_clicked(bool checked) { #if 0 if(checked) //使用调整电压时,打印模式默认快速,且没有字形优化 { ui->checkVol1of8En->setChecked(false); sysPara->para.Vol1of8En = !checked;//打印优化 ui->checkVol1of8En->setEnabled(false); ui->comboBoxPrintMode->setCurrentIndex(0); sysPara->para.currPrintMode = ui->comboBoxPrintMode->currentIndex(); ui->comboBoxPrintMode->setEnabled(!checked); }else { ui->checkVol1of8En->setEnabled(true); ui->comboBoxPrintMode->setEnabled(true); } #endif if(!checked && ui->checkmode0211->checkState() == false) { ui->spinBoxStartVoltage->setEnabled(true); ui->spinBoxEndVoltage->setEnabled(true); } else { ui->spinBoxStartVoltage->setEnabled(false); ui->spinBoxEndVoltage->setEnabled(false); } if(checked && ui->checkmode0211->checkState()) { ui->checkmode0211->setChecked(false); } } void PrintSetting::on_metreCountButton_clicked() { // sysPara->status.calandar_and_dat.cnt1CurrValue = 123; dialogShowCounter->show(); dialogShowCounter->init_arg(); refresh_timer->start(500); // qDebug()<<"asdasd"; // sysPara->status.calandar_and_dat.cnt2CurrValue; } void PrintSetting::ondialogShowCounterAccepted(void) { refresh_timer->stop(); // qDebug()<<"refresh_timer stop"; } void PrintSetting::updateUIForSpecialCondition() { if(sysPara->para.EditMode == TXTFILE) { ui->radioButtonSpecialCondition->setEnabled(true); } } void PrintSetting::on_radioButtonSpecialCondition_clicked(bool checked) { if(sysPara->para.EditMode==TXTFILE) { ui->spinBoxHiddenValue->setEnabled(checked); ui->spinBoxMeterEnable->setEnabled(checked); ui->spinBoxConditionValue->setEnabled(checked); ui->spinBoxdecimalpointnum->setValue(0); ui->spinBoxdecimalpointnum->setEnabled(!checked); } } void PrintSetting::refreshtimerHandler(void) { int bcdTodec = 0; int resetmetre = 0; // int cn1StartValue = ui->spinBoxCnt1StartValue->value(); // int cn1EndValue = ui->spinBoxCnt1EndValue->value(); resetmetre = dialogShowCounter->getResetMetreState(area_end); if(last_area_end != area_end){ //qDebug() << "set spinBoxCnt1StartValue"; last_area_end = area_end; ui->spinBoxCnt1StartValue->setValue(0); ui->spinBoxCnt1EndValue->setValue(area_end); sysPara->para.cnt1EndValue = area_end; } if(true == resetmetre){ if(sysPara){ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否立即重新计米?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ sysPara->devOp->clearProductCnt(3 | 0x10);// [3]总产品计数器清零FPGA sysPara->para.totalProductCnt = 0; } } resetmetre = false; } //bcdTodec = sysPara->status.calandar_and_dat.cnt1CurrValue - (sysPara->status.calandar_and_dat.cnt1CurrValue>>4)*6; //dialogShowCounter->refreshdate(sysPara->status.productCnt,cn1StartValue,cn1EndValue,bcdTodec); int currValue1 = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(); int currCnt1GroupIndex = sysPara->status.cnt1GroupRunningIndex; int currCnt1GroupLoop = sysPara->status.cnt1GroupCurrentLoop; int cnt1StartValue = sysPara->para.Cnt1ByGroup.cnt1GroupSettings[currCnt1GroupIndex].StartValue; int cnt1EndValue = sysPara->para.Cnt1ByGroup.cnt1GroupSettings[currCnt1GroupIndex].EndValue; dialogShowCounter->refreshdate(currValue1, cnt1StartValue, cnt1EndValue, currCnt1GroupIndex, currCnt1GroupLoop); } void PrintSetting::on_lockoulsepushButton_clicked() { if(lockpulse){ ui->lockoulsepushButton->setText(tr("锁定脉冲计数")); lockpulse = false; }else{ ui->lockoulsepushButton->setText(tr("解锁脉冲计数")); lockpulse = true; } } void PrintSetting::on_spinBoxCnt1EndValue_valueChanged(int arg1) { if(lockpulse){ sysPara->para.productCntPerOutputPulse = arg1; // qDebug()<< "emit change_OutputPulse()"; emit change_OutputPulse(); } } void PrintSetting::moveRow( int nFrom, int nTo) { int StartValue,EndValue,LoopTimes; int To_StartValue,To_EndValue,To_LoopTimes; QLineEdit *pLineEdit; if( nFrom == nTo ) { return; } if( nFrom < 0 || nTo < 0 ) { return; } int nRowCount = ui->tableWidget->rowCount(); if( nFrom >= nRowCount || nTo >= nRowCount ) return; pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(nFrom,0); StartValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(nFrom,1); EndValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget->cellWidget(nFrom,2); LoopTimes = pLineEdit->text().toInt(); // qDebug()<<"StartValue="<setText(QString::number(StartValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nTo,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(EndValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nTo,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget->setCellWidget(nTo,2,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_StartValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nFrom,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_EndValue)); pLineEdit->setValidator(validator); ui->tableWidget->setCellWidget(nFrom,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget->setCellWidget(nFrom,2,pLineEdit); ui->tableWidget->selectRow(nTo); // ui->tableWidget->clearFocus(); // ui->tabWidget->focusPolicy(); } //调用 void PrintSetting::on_moveUp_clicked() { moveRow(ui->tableWidget->currentRow(),ui->tableWidget->currentRow() - 1); } void PrintSetting::on_moveDown_clicked() { moveRow(ui->tableWidget->currentRow(),ui->tableWidget->currentRow() + 1); } void PrintSetting::on_pushButtonUpRow_clicked() { on_moveUp_clicked(); } void PrintSetting::on_pushButtonDownRow_clicked() { on_moveDown_clicked(); } void PrintSetting::on_pushOnlyCNT3Clear_pressed() { sysPara->devOp->clearProductCnt(1<<4);// 计数器3单独清零 } void PrintSetting::setCNT1BackColor(bool flag) { if(flag) { ui->radioCNT1->setCheckable(true); ui->radioCNT1->setChecked(true); } else { ui->radioCNT1->setChecked(false); ui->radioCNT1->setCheckable(false); } // if(flag) // { // //ui->tabWidget->widget(0)->setStyleSheet("QTabBar::tab{background-color:rgb(255, 0, 0);}"); //设置选中背景色 // ui->radioCNT1->setChecked(flag); // } // else // { // //ui->tabWidget->widget(0)->setStyleSheet("QTabBar::tab{background-color:rgb(239, 239, 239);}"); //设置选中背景色 // ui->radioCNT1->setChecked(flag); // } } void PrintSetting::setCNT2BackColor(bool flag) { if(flag) { ui->radioCNT2->setCheckable(true); ui->radioCNT2->setChecked(true); } else { ui->radioCNT2->setChecked(false); ui->radioCNT2->setCheckable(false); } } void PrintSetting::setCNT3BackColor(bool flag) { if(flag) { ui->radioCNT3->setCheckable(true); ui->radioCNT3->setChecked(true); } else { ui->radioCNT3->setChecked(false); ui->radioCNT3->setCheckable(false); } } void PrintSetting::getFpgaVersionSetDisable(){ qDebug()<<"getFpgaVersionSetDisable"; sysPara->devOp->readbuilDat(); sysPara->devOp->readFpgaVersionNum(); int FPGAVersion =sysPara->status.build_dat.builTime; unsigned int type = sysPara->status.fpgaVersionNum >> 12; QString FPGAChip = "Null"; if(sysPara->status.FPGAChipType == 1) FPGAChip = "E15"; else if(sysPara->status.FPGAChipType == 2) FPGAChip = "E22"; LogInfo::setRunStatusText(tr("builTime:%1").arg(FPGAVersion)); LogInfo::setRunStatusText(tr("fpgaVersionNum: %1").arg(sysPara->status.fpgaVersionNum)); LogInfo::setRunStatusText(tr("FPGAType: %1").arg(type)); LogInfo::setRunStatusText(tr("FPGAChip: %1").arg(FPGAChip)); if(66 == FPGAVersion) sysPara->status.FPGAVersionType = 1; else if(67 == FPGAVersion && type != 1) sysPara->status.FPGAVersionType = 2; else if(72 == FPGAVersion && type != 5) sysPara->status.FPGAVersionType = 3; else if(73 ==FPGAVersion && type != 4) sysPara->status.FPGAVersionType = 4; LogInfo::setRunStatusText(tr("FPGAVersion: %1").arg(FPGAVersion)); LogInfo::setRunStatusText(tr("FPGAType: %1").arg(sysPara->status.FPGAVersionType)); if (FPGAVersion == 67){ sysPara->status.flagOfNo67FPGA = 1; ui->checkBox_FastMode->setEnabled(true); } if(FPGAVersion== 67 && sysPara->status.FPGAVersionType == 0) { if(!sysPara->para.flagOfFastMode) uiSettingForNo67(); else uiSettingForNo66(); } else if(sysPara->status.FPGAVersionType == 1) uiSettingForNo66(); else if(sysPara->status.FPGAVersionType == 2) uiSettingForNo67(); else if(FPGAVersion == 72) uiSettingForNo72(); else if(FPGAVersion == 73) uiSettingForNo73(); qDebug()<<"checkmode0211:"<checkmode0211->isChecked(); qDebug()<<"charWidthSetEnable:"<checkBoxCharWidthSet->isChecked(); qDebug()<<"Vol1of8En:"<checkVol1of8En->isChecked(); qDebug()<<"FullColFixVal:"<radioButtonFUllColFIxVal->isChecked(); sysPara->para.mode0211 = ui->checkmode0211->isChecked();//添加0211模式 sysPara->para.charWidthSetEnable = ui->checkBoxCharWidthSet->isChecked(); sysPara->para.Vol1of8En = ui->checkVol1of8En->isChecked();//打印优化 sysPara->para.FullColFixVal = ui->radioButtonFUllColFIxVal->isChecked();//2020/3/2 } void PrintSetting::uiSettingForNo66(){ ui->checkBox_FastMode->setChecked(true); if(sysPara->para.currPrintMode>1) ui->comboBoxPrintMode->setCurrentIndex(0); ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode); ui->checkBoxCharWidthSet->setChecked(true); ui->checkVol1of8En->setChecked(true); ui->radioButtonFUllColFIxVal->setChecked(true); ui->checkmode0211->setChecked(false); ui->comboBoxPrintMode->setItemText(0,tr("超高速")); ui->comboBoxPrintMode->setItemText(1,tr("高速")); if(ui->comboBoxPrintMode->count()>2) ui->comboBoxPrintMode->removeItem(2); } void PrintSetting::uiSettingForNo67(){ ui->checkBox_FastMode->setEnabled(true); if(!sysPara->para.flagOfFastMode){ ui->checkBox_FastMode->setChecked(false); if(sysPara->para.currPrintMode>2) ui->comboBoxPrintMode->setCurrentIndex(0); ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode); ui->checkBoxCharWidthSet->setChecked(true); ui->checkVol1of8En->setChecked(true); ui->radioButtonFUllColFIxVal->setChecked(true); ui->checkmode0211->setChecked(false); if(ui->comboBoxPrintMode->count()<=2){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } } void PrintSetting::uiSettingForNo72(){ sysPara->status.flagOfNo67FPGA = 0; sysPara->para.flagOfFastMode=false; ui->checkBox_FastMode->setChecked(false); ui->checkBox_FastMode->setEnabled(false); ui->comboBoxPrintMode->setCurrentIndex(1); ui->comboBoxPrintMode->setEnabled(true); ui->checkBoxCharWidthSet->setChecked(false); ui->checkVol1of8En->setChecked(false); ui->radioButtonFUllColFIxVal->setChecked(false); ui->checkmode0211->setChecked(true); if(ui->comboBoxPrintMode->count()<=2){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } void PrintSetting::uiSettingForNo73() { sysPara->status.flagOfNo67FPGA = 0; sysPara->para.flagOfFastMode=false; ui->checkBox_FastMode->setChecked(false); ui->checkBox_FastMode->setEnabled(false); ui->checkBoxCharWidthSet->setChecked(false); ui->checkVol1of8En->setChecked(false); ui->radioButtonFUllColFIxVal->setChecked(false); ui->checkmode0211->setChecked(false); if(ui->comboBoxPrintMode->count()<=2){ ui->comboBoxPrintMode->setItemText(0,tr("快速")); ui->comboBoxPrintMode->setItemText(1,tr("标准")); ui->comboBoxPrintMode->addItem(tr("慢速")); } } //67 触发-同步器触发-字符宽度 void PrintSetting::setDisableFontWidth(bool flag){ if(sysPara->para.charWidthSetEnable && flag){ ui->spinBoxColDelay->setValue(0); ui->spinBoxColDelay->setEnabled(true); }else { ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); ui->spinBoxColDelay->setEnabled(true); } } //72 打印设置->常用设置->字体宽度 void PrintSetting::autoUpdateFontWidth(const unsigned int totalCol) { return; if(totalCol == 0) return; if(!sysPara->status.selfCheckDone && !TEST_MODE) return;//自检完成之前不检查 if(sysPara->para.printTriggerMode == PRINT_TRIGGER_TIME) return;//延迟触发模式不检查 if(((sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL ||sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) && !sysPara->para.eleEyeTriggerSynPrintEn)) return;//电眼触发非同步打印模式不检查 #define MIN_CHAR_WIDTH 0.1 //0.1mm/列 #define MAX_CHAR_WIDTH 4.0 //4.0mm/列 float printInterval; int currPrintCol; float Cur_Col_Width; float MAX_COL_DELAY; int MIN_COL_DELAY; float Cur_Max_ColDelay; int Cur_Col_Delay; if((sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER)) { printInterval = (int )sysPara->para.synTriggerPrintLenMm; } else if(((sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL ||sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE) && sysPara->para.eleEyeTriggerSynPrintEn)) { printInterval = sysPara->para.elecEyeTriggerInterval; } currPrintCol = totalCol + BLANK_COL_NUM; qDebug()<<"printInterval: "<para.printColDelay; #define MIN_COL_WIDTH 0.11 #define MAX_COL_WIDTH 0.81 Cur_Col_Width = printInterval/currPrintCol; Cur_Col_Delay = sysPara->para.printColDelay; if(sysPara->status.build_dat.builTime == 67){ float Col_Width = (MIN_CHAR_WIDTH +Cur_Col_Delay*(MAX_CHAR_WIDTH - MIN_CHAR_WIDTH) /100)*currPrintCol; MIN_COL_DELAY = 1; MAX_COL_DELAY = (MAX_COL_WIDTH - MIN_COL_WIDTH)/0.039;//(MAX_CHAR_WIDTH - MIN_CHAR_WIDTH) /100=0.039 Cur_Max_ColDelay = (Cur_Col_Width - MIN_CHAR_WIDTH)/0.039; } else{ MIN_COL_DELAY = (int)(sysPara->para.synPulseNumPerMm*MIN_COL_WIDTH); MAX_COL_DELAY = sysPara->para.synPulseNumPerMm*MAX_COL_WIDTH; Cur_Max_ColDelay = sysPara->para.synPulseNumPerMm*Cur_Col_Width; } if(Cur_Max_ColDelay < 1){ QMessageBox::information(this,tr("提示"),tr("喷印间隔太小,无法正常打印!!!")); return; } if(Cur_Col_Delay == 0){ QMessageBox::information(this,tr("提示"),tr("字体宽度为0!!!")); return; } if(Cur_Max_ColDelay > MAX_COL_DELAY) Cur_Max_ColDelay = MAX_COL_DELAY; if(sysPara->status.build_dat.builTime == 67 && Cur_Col_Delay > (int)Cur_Max_ColDelay + 1 ||sysPara->status.build_dat.builTime == 72 && Cur_Col_Delay > (int)Cur_Max_ColDelay) { int oldColDelay = sysPara->para.printColDelay; if(sysPara->status.build_dat.builTime == 67) sysPara->para.printColDelay = (int)Cur_Max_ColDelay + 1; else sysPara->para.printColDelay = (int)Cur_Max_ColDelay; ui->spinBoxColDelay->setValue(sysPara->para.printColDelay); if(sysPara)sysPara->saveParaToFile (); QMessageBox::information(this,tr("提示"),tr("原字体宽度(%1mm)已不适用于新设置的喷印间隔,已自动调整到最大允许值(%2mm)!") .arg(oldColDelay).arg(Cur_Max_ColDelay)); } if(sysPara->para.printColDelay < MIN_COL_DELAY){ QMessageBox::information(this,tr("提示"),tr("字体宽度太小,打印字体将会被严重压缩!\n建议最小字体宽度为:%1\n建议最小喷印间隔为:%2") .arg(MIN_COL_DELAY).arg(currPrintCol*MIN_COL_WIDTH)); } } void PrintSetting::on_checkBox_FastMode_clicked() { bool flag = ui->checkBox_FastMode->isChecked(); if(flag){ ui->spinBoxReducedPixelNum->setValue(60); }else{ ui->spinBoxReducedPixelNum->setValue(0); } } //edit@11-30 小数点和隐藏值模块都显示,仅做展示。 void PrintSetting::ModuleDecimalHideDisplay(const bool bEnabled) { //工程模式下,隐藏值界面控件-全部显示 ui->label_7->setVisible(1); ui->label_6->setVisible(1); ui->label_34->setVisible(1); ui->radioButtonSpecialCondition->setVisible(1); ui->spinBoxHiddenValue->setVisible(1); ui->spinBoxMeterEnable->setVisible(1); ui->spinBoxConditionValue->setVisible(1); ui->spinBoxHiddenValue->setEnabled(bEnabled); ui->spinBoxMeterEnable->setEnabled(bEnabled); ui->spinBoxConditionValue->setEnabled(bEnabled); ui->radioButtonSpecialCondition->setChecked(bEnabled); //工程模式下,小数点界面控件--全部显示 ui->label_35->setVisible(1); ui->spinBoxdecimalpointnum->setVisible(1); ui->spinBoxdecimalpointnum->setEnabled(!bEnabled); } void PrintSetting::specailMachineSetting(bool enable){ ui->checkBox_ReclaimPumpEnable->setEnabled(enable); ui->spinBox_gearPumpSpeedAlarm->setEnabled(enable); } void PrintSetting::onUpdateCnt2GroupDisp(bool bChangeToNext) { #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ if(bChangeToNext)//循环数走完 { //改变当前执行的分段的背景颜色 updateCnt2GroupsTblWgt(); } #endif } void PrintSetting::LoadCnt2GroupSettingsToUI() { #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ QLineEdit *pLineEdit; ui->checkBoxGroupCnt_2->setChecked(sysPara->para.cnt2ByGroupEnalbe); on_checkBoxGroupCnt_2_clicked(sysPara->para.cnt2ByGroupEnalbe); //qDebug()<<"LoadCnt1GroupSettingsToUI:cnt1GroupCnt "<para.Cnt1ByGroup.cnt1GroupCnt; ui->tableWidget_2->setRowCount(sysPara->para.Cnt2ByGroup.cnt2GroupCnt); QRegExp regx("[0-9]+$"); QValidator *validator = new QRegExpValidator(regx, this); QRegExp regxLoop("[1-9][0-9]+$"); QValidator *validatorLoop = new QRegExpValidator(regxLoop, this); for(int i=0; ipara.Cnt2ByGroup.cnt2GroupCnt; i++) { pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt2ByGroup.cnt2GroupSettings[i].StartValue)); pLineEdit->setValidator(validator); ui->tableWidget_2->setCellWidget(i,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt2ByGroup.cnt2GroupSettings[i].EndValue)); pLineEdit->setValidator(validator); ui->tableWidget_2->setCellWidget(i,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(sysPara->para.Cnt2ByGroup.cnt2GroupSettings[i].LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget_2->setCellWidget(i,2,pLineEdit); } #if 0 /* 只是打开一个文件,还没有点击开始打印,该文件的变量1的起始和结束设定就起作用了,所以去掉。如果想要分段计米生效只能点击应用了 */ sysPara->devOp->writeFpgaCalandar(1); sysPara->devOp->writeCnt1GroupSetting(1); #endif updateCnt2GroupsTblWgt(); #endif } void PrintSetting::on_checkBoxGroupCnt_2_clicked(bool checked) { #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ if(checked) { ui->spinBoxCnt2StartValue->setEnabled(false); ui->spinBoxCnt2EndValue->setEnabled(false); // ui->checkBoxResetCnt1CurrValue->setEnabled(false); ui->checkBoxGroupCnt1->setChecked(1); ui->spinBoxCnt1StartValue->setEnabled(false); ui->spinBoxCnt1EndValue->setEnabled(false); } else { ui->spinBoxCnt2StartValue->setEnabled(true); ui->spinBoxCnt2EndValue->setEnabled(true); ui->checkBoxResetCnt2CurrValue->setEnabled(true); ui->checkBoxGroupCnt1->setChecked(0); ui->spinBoxCnt1StartValue->setEnabled(true); ui->spinBoxCnt1EndValue->setEnabled(true); } #endif } void PrintSetting::ApplyCnt2GroupSetting() { #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ QLineEdit *pLineEdit; sysPara->para.cnt2ByGroupEnalbe = ui->checkBoxGroupCnt_2->isChecked(); sysPara->para.Cnt2ByGroup.cnt2GroupCnt=ui->tableWidget_2->rowCount(); if(sysPara->para.cnt2ByGroupEnalbe && sysPara->para.Cnt2ByGroup.cnt2GroupCnt==0) { sysPara->para.cnt2ByGroupEnalbe=false; ui->checkBoxGroupCnt_2->setChecked(false); on_checkBoxGroupCnt_2_clicked(false); } qDebug()<<"ApplyCnt2GroupSetting:cnt2ByGroupEnalbe: "<para.cnt2ByGroupEnalbe; qDebug()<<"ApplyCnt2GroupSetting:cnt2GroupCnt: "<para.Cnt2ByGroup.cnt2GroupCnt; for(int i=0; ipara.Cnt2ByGroup.cnt2GroupCnt; i++) { pLineEdit = (QLineEdit *)ui->tableWidget_2->cellWidget(i,0); sysPara->para.Cnt2ByGroup.cnt2GroupSettings[i].StartValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget_2->cellWidget(i,1); sysPara->para.Cnt2ByGroup.cnt2GroupSettings[i].EndValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget_2->cellWidget(i,2); sysPara->para.Cnt2ByGroup.cnt2GroupSettings[i].LoopTimes = pLineEdit->text().toInt(); qDebug()<<"i: "<para.Cnt2ByGroup.cnt2GroupSettings[i].StartValue <<"end2: "<para.Cnt2ByGroup.cnt2GroupSettings[i].EndValue <<"Loop2: "<para.Cnt2ByGroup.cnt2GroupSettings[i].LoopTimes; } sysPara->devOp->writeCnt2GroupSetting(1); sysPara->saveParaToFile(); //改变当前执行的分段的背景颜色 updateCnt2GroupsTblWgt(); #endif } void PrintSetting::rowWidgetCreate2(int rowIndex) { #ifdef COUNTER2_BY_GROUP /* 分段计米2 */ QLineEdit* pLineEdit; QRegExp regx("[0-9]+$"); QValidator *validator = new QRegExpValidator(regx, this); QRegExp regxLoop("[1-9][0-9]+$"); QValidator *validatorLoop = new QRegExpValidator(regxLoop, this); for(int i=0;i<3;i++) { if(i==3) { //ui->tableWidget->item(rowIndex,i)->setCheckState(Qt::Unchecked); } else { if(i<2) { pLineEdit = new QLineEdit(tr("0")); pLineEdit->setValidator(validator); } else if(i==2) { pLineEdit = new QLineEdit(tr("1")); pLineEdit->setValidator(validatorLoop); } ui->tableWidget_2->setCellWidget(rowIndex,i,pLineEdit); } } #endif } void PrintSetting::moveRow_2( int nFrom, int nTo) { int StartValue,EndValue,LoopTimes; int To_StartValue,To_EndValue,To_LoopTimes; QLineEdit *pLineEdit; if( nFrom == nTo ) { return; } if( nFrom < 0 || nTo < 0 ) { return; } int nRowCount = ui->tableWidget_2->rowCount(); if( nFrom >= nRowCount || nTo >= nRowCount ) return; pLineEdit = (QLineEdit *)ui->tableWidget_2->cellWidget(nFrom,0); StartValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget_2->cellWidget(nFrom,1); EndValue = pLineEdit->text().toInt(); pLineEdit = (QLineEdit *)ui->tableWidget_2->cellWidget(nFrom,2); LoopTimes = pLineEdit->text().toInt(); // qDebug()<<"StartValue="<setText(QString::number(StartValue)); pLineEdit->setValidator(validator); ui->tableWidget_2->setCellWidget(nTo,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(EndValue)); pLineEdit->setValidator(validator); ui->tableWidget_2->setCellWidget(nTo,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget_2->setCellWidget(nTo,2,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_StartValue)); pLineEdit->setValidator(validator); ui->tableWidget_2->setCellWidget(nFrom,0,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_EndValue)); pLineEdit->setValidator(validator); ui->tableWidget_2->setCellWidget(nFrom,1,pLineEdit); pLineEdit = new QLineEdit; pLineEdit->setText(QString::number(To_LoopTimes)); pLineEdit->setValidator(validatorLoop); ui->tableWidget_2->setCellWidget(nFrom,2,pLineEdit); ui->tableWidget_2->selectRow(nTo); // ui->tableWidget->clearFocus(); // ui->tabWidget->focusPolicy(); } void PrintSetting::on_moveUp_2_clicked() { moveRow_2(ui->tableWidget_2->currentRow(),ui->tableWidget_2->currentRow() - 1); } void PrintSetting::on_moveDown_2_clicked() { moveRow_2(ui->tableWidget_2->currentRow(),ui->tableWidget_2->currentRow() + 1); } void PrintSetting::on_pushButtonUpRow_2_clicked() { on_moveUp_2_clicked(); } void PrintSetting::on_pushButtonDownRow_2_clicked() { on_moveDown_2_clicked(); } void PrintSetting::on_Cnt3AddRowBtn_2_pressed() { #ifdef COUNTER2_BY_GROUP /* 分段计米 */ int rowCnt=ui->tableWidget_2->rowCount(); if(rowCnt>=MAX_CNT1_GROUPS_NUM) { return; } //sysPara->para.cnt1GroupCnt++; ui->tableWidget_2->setRowCount(rowCnt+1); rowWidgetCreate2(rowCnt); #endif } void PrintSetting::on_Cnt3InsertRowBtn_2_pressed() { #ifdef COUNTER2_BY_GROUP /* 分段计米 */ int rowIndex=ui->tableWidget_2->currentRow(); int rowCnt=ui->tableWidget_2->rowCount(); if(rowIndex<0||rowCnt>=MAX_CNT1_GROUPS_NUM) { //qDebug()<<"max counter1 groups num is "<tableWidget_2->insertRow(rowIndex+1); rowWidgetCreate2(rowIndex+1); #endif } void PrintSetting::on_cnt3RemoveAllRowsBtn_2_pressed() { #ifdef COUNTER2_BY_GROUP /* 分段计米 */ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认删除全部设置?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ int rowCnt=ui->tableWidget_2->rowCount(); for(int i=rowCnt-1;i>=0;i--) { ui->tableWidget_2->removeRow(i); } } #endif } void PrintSetting::on_Cnt3RemoveRowBtn_2_pressed() { #ifdef COUNTER2_BY_GROUP /* 分段计米 */ int rowIndex=ui->tableWidget_2->currentRow(); if(rowIndex<0) { return; } QMessageBox::StandardButton ret; if(rowIndex==sysPara->status.cnt2GroupRunningIndex) { QMessageBox::warning(this, tr("错误"), tr("正在打印第%1组设置,不可删除").arg(rowIndex+1), QMessageBox::Ok); return; } ret = QMessageBox::warning(this, tr("警告"), tr("是否确认删除第%1组设置?").arg(rowIndex+1), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ ui->tableWidget_2->removeRow(rowIndex); } #endif } void PrintSetting::on_cnt3RemoveAllRowsBtn_4_pressed() {unsigned char temp = 2; #ifdef COUNTER2_BY_GROUP /* 分段计米 */ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认清零计数器2的循环值已经打印次数?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ sysPara->devOp->fpgaWr(0xb12c,(unsigned char *)&temp,1); temp = 0; sysPara->devOp->fpgaWr(0xb12c,(unsigned char *)&temp,1); } #endif } void PrintSetting::on_cnt3RemoveAllRowsBtn_3_pressed() {unsigned char temp = 1; #ifdef COUNTER1_BY_GROUP /* 分段计米 */ QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("警告"), tr("是否确认清零计数器1的循环值已经打印次数?"), QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok){ sysPara->devOp->fpgaWr(0xb12c,(unsigned char *)&temp,1); temp = 0; sysPara->devOp->fpgaWr(0xb12c,(unsigned char *)&temp,1); } #endif } void PrintSetting::currentChanged(int sel) { QString text=ui->tabWidget_2->tabText(sel); // qDebug()<tabWidget_3->count()==0) { //edit@01-11 QWidget *q=ui->tabWidget->widget(0); ui->tabWidget_3->insertTab(0,q,tr("计数器1设置")); q=ui->tabWidget->widget(0); ui->tabWidget_3->insertTab(1,q,tr("计数器2设置")); qwstatus[0]=ui->label_35->isVisible(); qwstatus[1]=ui->spinBoxdecimalpointnum->isVisible(); qwstatus[2]=ui->pushButtonVAR->isVisible(); qwstatus[3]=ui->checkVARLEN->isVisible(); qwstatus[4]=ui->label_2->isVisible(); ui->label_35->setVisible(false); ui->spinBoxdecimalpointnum->setVisible(false); ui->pushButtonVAR->setVisible(false); ui->checkVARLEN->setVisible(false); ui->label_2->setVisible(false); } } else if(text==tr("计数器设置")) { if(ui->tabWidget->tabText(0)!=tr("计数器1设置")) { //edit@01-11 QWidget *q=ui->tabWidget_3->widget(0); ui->tabWidget->insertTab(0,q,tr("计数器1设置")); q=ui->tabWidget_3->widget(0); ui->tabWidget->insertTab(1,q,tr("计数器2设置")); ui->label_35->setVisible(qwstatus[0]); ui->spinBoxdecimalpointnum->setVisible(qwstatus[1]); ui->pushButtonVAR->setVisible(qwstatus[2]); ui->checkVARLEN->setVisible(qwstatus[3]); ui->label_2->setVisible(qwstatus[4]); } } } bool PrintSetting::getCurrentTabWidget(){ const int indexTab=ui->tabWidget_2->indexOf(ui->tab_12); const int indexTab2 = ui->tabWidget_2->currentIndex(); if(indexTab == indexTab2 && flagOfAuthEnter == false){ return true; } else{ return false; } }