V6.7.5_beta
This commit is contained in:
+46
-200
@@ -17,8 +17,6 @@ CounterVarSet::CounterVarSet(QWidget *parent) :
|
||||
ui->checkVARLEN->hide();
|
||||
|
||||
init();
|
||||
currPage = 0;
|
||||
initReplaceValue();
|
||||
}
|
||||
|
||||
CounterVarSet::~CounterVarSet()
|
||||
@@ -34,15 +32,6 @@ void CounterVarSet::init()
|
||||
connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot);
|
||||
}
|
||||
|
||||
void CounterVarSet::bindSysPara(SysPara *sysPara)
|
||||
{
|
||||
this->sysPara = sysPara;
|
||||
}
|
||||
|
||||
void CounterVarSet::bindTxTEdit(QTextEdit* textEdit){
|
||||
m_textEdit = textEdit;
|
||||
}
|
||||
|
||||
void CounterVarSet::buttonClickedSlot()
|
||||
{
|
||||
// 编辑
|
||||
@@ -60,27 +49,30 @@ void CounterVarSet::buttonClickedSlot()
|
||||
if (btn == ui->checkBtn)
|
||||
{
|
||||
// on_buttonInsertVari_pressed();
|
||||
applyUIPara();
|
||||
emit sendButtonClickedSignal(1);
|
||||
}else if(btn == ui->closeBtn){
|
||||
emit sendButtonClickedSignal(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CounterViewModel CounterVarSet::getCounterConfig()
|
||||
{
|
||||
CounterViewModel viewModel;
|
||||
unsigned char splitMode = sysPara ? sysPara->para.ExpirySplitMode : 0;
|
||||
CounterViewModel& viewModel = m_vm;
|
||||
unsigned char splitMode = 0;
|
||||
getValue(&viewModel.counterType, &viewModel.digitalNum, &splitMode);
|
||||
viewModel.letterSpace = ui->letterSpaceSpinBox->value();
|
||||
viewModel.charWidth = ui->charWidthSpinBox->value();
|
||||
viewModel.enbCustomCharWidth = ui->enbCharWidthSpinBox->isChecked();
|
||||
|
||||
applyUIPara();
|
||||
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
void CounterVarSet::setCounterConfig(CounterViewModel viewModel)
|
||||
{
|
||||
m_vm = viewModel;
|
||||
|
||||
ui->cb_digits->setCurrentText(QString::number(viewModel.digitalNum));
|
||||
ui->radioButtonVar1->setChecked(viewModel.counterType == COUNTER_TYPE_1 ? true : false);
|
||||
ui->radioButtonVar2->setChecked(viewModel.counterType == COUNTER_TYPE_2 ? true : false);
|
||||
@@ -88,69 +80,10 @@ void CounterVarSet::setCounterConfig(CounterViewModel viewModel)
|
||||
ui->letterSpaceSpinBox->setValue(viewModel.letterSpace);
|
||||
ui->charWidthSpinBox->setValue(viewModel.charWidth);
|
||||
ui->enbCharWidthSpinBox->setChecked(viewModel.enbCustomCharWidth);
|
||||
|
||||
updateSysParaToUI();
|
||||
}
|
||||
|
||||
void CounterVarSet::on_buttonInsertVari_pressed()
|
||||
{
|
||||
if(!m_textEdit || !sysPara)
|
||||
return;
|
||||
|
||||
QString fontname = "Dinkie9";
|
||||
|
||||
// 从字体名中提取像素大小(字体名最后的数字)
|
||||
int pixelSize = 9;
|
||||
QString numStr = "";
|
||||
for(int i = fontname.length() - 1; i >= 0; --i) {
|
||||
if(fontname[i].isDigit()) {
|
||||
numStr.prepend(fontname[i]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!numStr.isEmpty()) {
|
||||
pixelSize = numStr.toInt();
|
||||
}
|
||||
|
||||
QFont font;
|
||||
font.setFamily(fontname);
|
||||
font.setPixelSize(pixelSize);
|
||||
pixelSize = font.pixelSize();
|
||||
font.setWeight(false && (pixelSize<=16) ?QFont::Bold:QFont::Normal);
|
||||
font.setLetterSpacing(QFont::AbsoluteSpacing, sysPara->para.textEditCharSpace);
|
||||
|
||||
QFontMetrics fontMetrics(font);
|
||||
|
||||
int width = (fontMetrics.horizontalAdvance("0123456789")) / 10;
|
||||
int height = font.pixelSize();
|
||||
|
||||
int digitalNum;
|
||||
int varType;
|
||||
unsigned char splitMode = sysPara->para.ExpirySplitMode;
|
||||
getValue(&varType, &digitalNum, &splitMode);
|
||||
|
||||
fmt = m_textEdit->currentCharFormat();
|
||||
|
||||
int varType1 = varType;
|
||||
|
||||
if(fontname.contains("SerifL") || fontname.contains("serifl"))
|
||||
varType1 = 20 + varType;
|
||||
else if(fontname.contains("SerifR") || fontname.contains("serifr"))
|
||||
varType1 = 20 + varType;
|
||||
else if(fontname.contains("bangla"))
|
||||
varType1 = 30 + varType;
|
||||
else if(fontname.contains("biyangF"))
|
||||
varType1 = 50 + varType;
|
||||
else if(fontname.contains("Roman"))
|
||||
varType1 = 60 + varType;
|
||||
|
||||
m_textEdit->insertHtml(QString("<img src=':/%1/%5/../image/digitalWidth%2.bmp' height='%3' width='%4' style=\"vertical-align: bottom;\" />")
|
||||
.arg(varType).arg(false && (pixelSize<=16)?(digitalNum*100 + 75):digitalNum)
|
||||
.arg(height+1).arg(width*digitalNum).arg(varType1));
|
||||
|
||||
m_textEdit->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void CounterVarSet::getValue(int *varType,int *digitalWidth,unsigned char *splitMode){
|
||||
int type = 0,width = 0;
|
||||
|
||||
@@ -171,80 +104,49 @@ void CounterVarSet::getValue(int *varType,int *digitalWidth,unsigned char *split
|
||||
}
|
||||
|
||||
|
||||
void CounterVarSet::applyUIPara(){
|
||||
if(sysPara){
|
||||
void CounterVarSet::applyUIPara()
|
||||
{
|
||||
m_vm.cnt1Settings.endValue = ui->spinBoxCnt1EndValue->value();
|
||||
m_vm.cnt1Settings.repeatValue = ui->spinBoxCnt1RepeateCnt->value();
|
||||
m_vm.cnt1Settings.startValue = ui->spinBoxCnt1StartValue->value();
|
||||
m_vm.cnt1Settings.stepValue = ui->spinBoxCnt1StepValue->value();
|
||||
m_vm.cnt1Settings.currValue = ui->spinBoxCnt1CurrValue->value();
|
||||
m_vm.cnt1Settings.editCurrValue = ui->checkBoxResetCnt1CurrValue->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->status.cnt1CurrentValueInitDoneFlag = ui->checkBoxResetCnt1CurrValue->isChecked();
|
||||
// sysPara->status.cnt1CurrentValueInitDoneFlag = false;
|
||||
m_vm.cnt2Settings.endValue = ui->spinBoxCnt2EndValue->value();
|
||||
m_vm.cnt2Settings.repeatValue = ui->spinBoxCnt2RepeateCnt->value();
|
||||
m_vm.cnt2Settings.startValue = ui->spinBoxCnt2StartValue->value();
|
||||
m_vm.cnt2Settings.stepValue = ui->spinBoxCnt2StepValue->value();
|
||||
m_vm.cnt2Settings.currValue = ui->spinBoxCnt2CurrValue->value();
|
||||
m_vm.cnt2Settings.editCurrValue = ui->checkBoxResetCnt2CurrValue->isChecked();
|
||||
|
||||
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->status.cnt2CurrentValueInitDoneFlag = ui->checkBoxResetCnt2CurrValue->isChecked();
|
||||
|
||||
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
|
||||
|
||||
ui->checkBoxResetCnt1CurrValue->setChecked(false);
|
||||
ui->checkBoxResetCnt2CurrValue->setChecked(false);
|
||||
|
||||
sysPara->devOp->writeFpgaCalandar(0);
|
||||
|
||||
// unsigned int flags = 0;
|
||||
// if(sysPara->status.cnt1CurrentValueInitDoneFlag)
|
||||
// flags = 1 << 2;
|
||||
|
||||
// if(sysPara->status.cnt2CurrentValueInitDoneFlag)
|
||||
// flags |= 1 << 3;
|
||||
|
||||
// sysPara->devOp->clearProductCnt(flags);
|
||||
}
|
||||
ui->checkBoxResetCnt1CurrValue->setChecked(false);
|
||||
ui->checkBoxResetCnt2CurrValue->setChecked(false);
|
||||
}
|
||||
|
||||
void CounterVarSet::updateSysParaToUI(){
|
||||
void CounterVarSet::updateSysParaToUI()
|
||||
{
|
||||
ui->spinBoxCnt1EndValue->setValue(m_vm.cnt1Settings.endValue);
|
||||
ui->spinBoxCnt1RepeateCnt->setValue(m_vm.cnt1Settings.repeatValue);
|
||||
ui->spinBoxCnt1StartValue->setValue(m_vm.cnt1Settings.startValue);
|
||||
ui->spinBoxCnt1StepValue->setValue(m_vm.cnt1Settings.stepValue);
|
||||
ui->spinBoxCnt1CurrValue->setValue(m_vm.cnt1Settings.currValue);
|
||||
|
||||
if(sysPara){
|
||||
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(m_vm.cnt2Settings.endValue);
|
||||
ui->spinBoxCnt2RepeateCnt->setValue(m_vm.cnt2Settings.repeatValue);
|
||||
ui->spinBoxCnt2StartValue->setValue(m_vm.cnt2Settings.startValue);
|
||||
ui->spinBoxCnt2StepValue->setValue(m_vm.cnt2Settings.stepValue);
|
||||
ui->spinBoxCnt2CurrValue->setValue(m_vm.cnt2Settings.currValue);
|
||||
|
||||
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->eleCNT1IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?1:0);
|
||||
// ui->radCNT1ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?0:1);
|
||||
|
||||
// 电眼触发计数器动作 选择
|
||||
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->eleCNT2IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?1:0);
|
||||
// ui->radCNT2ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?0:1);
|
||||
|
||||
ui->checkBoxResetCnt1CurrValue->setChecked(false);
|
||||
ui->checkBoxResetCnt2CurrValue->setChecked(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString CounterVarSet::getFamilyName(int fontsize){
|
||||
return "YaHei"+QString::number(fontsize);
|
||||
ui->checkBoxResetCnt1CurrValue->setChecked(false);
|
||||
ui->checkBoxResetCnt2CurrValue->setChecked(false);
|
||||
}
|
||||
|
||||
void CounterVarSet::applyStyleSheet()
|
||||
@@ -469,61 +371,5 @@ void CounterVarSet::on_pushOnlyCNT1Clear_pressed()
|
||||
|
||||
void CounterVarSet::on_pushOnlyCNT2Clear_pressed()
|
||||
{
|
||||
sysPara->devOp->clearProductCnt(1<<3);// 计数器2单独清零
|
||||
}
|
||||
|
||||
void CounterVarSet::initReplaceValue(){
|
||||
// dataList.clear();
|
||||
// dataList << "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7"
|
||||
// << "8" << "9" << "A" << "B" << "C" << "D" << "E" << "F";
|
||||
|
||||
// if(ui->comboBox_2->currentIndex() == 0) //index 0 --- 数据
|
||||
// loadDataShow();
|
||||
}
|
||||
|
||||
//void CounterVarSet::loadDataShow(){
|
||||
// if(currPage >3) //最大显示4页
|
||||
// currPage =3;
|
||||
// int objectIndex = 1;
|
||||
// for(int i=currPage*4;(i<(currPage+1)*4)&&(i<dataList.size());i++){
|
||||
|
||||
// QString strObject = QString("lineEditName") + QString::number(objectIndex);
|
||||
// QLineEdit *lineEdit = this->findChild<QLineEdit*>(strObject);
|
||||
// if(lineEdit)
|
||||
// lineEdit->setText(QString::number(i));
|
||||
|
||||
// QString strObject2 = QString("lineEdit_Replace") + QString::number(objectIndex);
|
||||
// QLineEdit *lineEdit2 = this->findChild<QLineEdit*>(strObject2);
|
||||
// if(lineEdit2)
|
||||
// lineEdit2->setText(dataList.at(i));
|
||||
// objectIndex++;
|
||||
// }
|
||||
//}
|
||||
|
||||
void CounterVarSet::editCounter(int index)
|
||||
{
|
||||
ui->tabWidget->setCurrentIndex(index);
|
||||
editFlag = true;
|
||||
}
|
||||
//void CounterVarSet::on_btnUP_clicked()
|
||||
//{
|
||||
// if(currPage<1)
|
||||
// return;
|
||||
// currPage = currPage-1;
|
||||
|
||||
// if(ui->comboBox_2->currentIndex() == 0){
|
||||
// loadDataShow();
|
||||
// }
|
||||
//}
|
||||
|
||||
//void CounterVarSet::on_btnDown_clicked()
|
||||
//{
|
||||
// int currentIndex = ui->comboBox_2->currentIndex();
|
||||
// if (currentIndex == 0) { // Data
|
||||
// if (currPage < 3) {
|
||||
// currPage++;
|
||||
// }
|
||||
// loadDataShow();
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
// sysPara->devOp->clearProductCnt(1<<3);// 计数器2单独清零
|
||||
}
|
||||
+1
-26
@@ -22,24 +22,10 @@ public:
|
||||
void init();
|
||||
void applyStyleSheet();
|
||||
void getValue(int *varType,int *digitalWidth,unsigned char *splitMode);
|
||||
void on_buttonInsertVari_pressed();
|
||||
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
|
||||
void bindTxTEdit(QTextEdit* textEdit);
|
||||
|
||||
QString getFamilyName(int);
|
||||
|
||||
void updateSysParaToUI(); //重载
|
||||
void applyUIPara(); //重载
|
||||
|
||||
void initReplaceValue();
|
||||
|
||||
void loadDataShow();
|
||||
|
||||
// 显示要修改计数器的界面
|
||||
void editCounter(int index);
|
||||
|
||||
// 获取当前计数器配置:varType(7或8) 和 digitalNum(位数)
|
||||
CounterViewModel getCounterConfig();
|
||||
|
||||
@@ -62,21 +48,10 @@ private slots:
|
||||
|
||||
void on_pushOnlyCNT2Clear_pressed();
|
||||
|
||||
// void on_btnUP_clicked();
|
||||
|
||||
// void on_btnDown_clicked();
|
||||
|
||||
private:
|
||||
Ui::CounterVarSet *ui;
|
||||
SysPara* sysPara = nullptr;
|
||||
|
||||
QTextEdit* m_textEdit;
|
||||
QTextCharFormat fmt;
|
||||
|
||||
QStringList dataList; //替换的内容 数据
|
||||
int currPage;
|
||||
|
||||
bool editFlag = false;
|
||||
CounterViewModel m_vm;
|
||||
};
|
||||
|
||||
#endif // COUNTERVARSET_H
|
||||
|
||||
@@ -2754,6 +2754,9 @@ int DevOp::writeFpgaPrintPara(bool ignoreWarn){
|
||||
if(sysPara->para.OuputPulseCol > 200)
|
||||
sysPara->para.OuputPulseCol = 200;
|
||||
|
||||
|
||||
writeSyncAndDelayPrintCount(sysPara->para.enbSyncAndTimeTriggerLimit, sysPara->para.syncAndTimeTriggerLimit);
|
||||
|
||||
/*---------------------------------------------------------------------------------------*/
|
||||
setOscillatorVoltage(sysPara->para.oscillatorVoltage); //因为经过调整参数,所以开机也要多发送一次
|
||||
sysPara->saveParaToFile();
|
||||
|
||||
@@ -255,7 +255,7 @@ void DialogFileOperation::on_pushButtonInsert_clicked()
|
||||
|
||||
QString filePath = dirPath + index.data().toString();
|
||||
|
||||
emit openFile(filePath,true);
|
||||
emit openFile(filePath);
|
||||
hide();
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void DialogFileOperation::on_pushButtonOpen_clicked()
|
||||
QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR;
|
||||
QString filePath = dirPath + index.data().toString();
|
||||
|
||||
emit openFile(filePath,true);
|
||||
emit openFile(filePath);
|
||||
hide();
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ void DialogFileOperation::on_radioButtonUdisk_released()
|
||||
|
||||
void DialogFileOperation::modbus_openfile(QString filename)
|
||||
{
|
||||
emit openFile(filename,true);
|
||||
emit openFile(filename);
|
||||
}
|
||||
|
||||
void DialogFileOperation::openLastWork()
|
||||
@@ -294,5 +294,5 @@ void DialogFileOperation::openLastWork()
|
||||
QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_DOC_ROOT_DIR;
|
||||
QString filePath = dirPath + "LastWork.xml";
|
||||
|
||||
emit openFile(filePath,true);
|
||||
emit openFile(filePath);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ private slots:
|
||||
void on_listViewFile_clicked(const QModelIndex &index);
|
||||
|
||||
Q_SIGNALS:
|
||||
void openFile(QString filePath,bool insertFlag);
|
||||
void openFile(QString filePath);
|
||||
void createSceneImage(QString filePath);
|
||||
|
||||
private:
|
||||
|
||||
@@ -129,6 +129,7 @@ void DialogSaveFile::on_pushButtonLast_pressed()
|
||||
void DialogSaveFile::on_pushButtonExit_pressed()
|
||||
{
|
||||
hide();
|
||||
reject();
|
||||
}
|
||||
//void DialogSaveFile::on_lostfocuse_pressed()
|
||||
//{
|
||||
@@ -142,9 +143,11 @@ void DialogSaveFile::on_pushButtonSave_clicked()
|
||||
QString filePath = dirPath + ui->lineEdit->text();// index.data().toString();
|
||||
|
||||
emit saveFile(filePath,false);
|
||||
m_filename = filePath;
|
||||
|
||||
emit returnMainWidget(20);
|
||||
hide();
|
||||
accept();
|
||||
}
|
||||
|
||||
void DialogSaveFile::on_radioButtonLocal_released()
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "DialogSaveFile.h"
|
||||
#include <QModelIndex>
|
||||
#include "myinclude.h"
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class DialogSaveFile;
|
||||
}
|
||||
@@ -23,6 +26,11 @@ public:
|
||||
|
||||
// 默认保存最后一次作业文件
|
||||
void saveLastWork();
|
||||
|
||||
QString filename() const {
|
||||
return m_filename;
|
||||
}
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
@@ -40,6 +48,7 @@ Q_SIGNALS:
|
||||
private:
|
||||
Ui::DialogSaveFile *ui;
|
||||
|
||||
QString m_filename;
|
||||
};
|
||||
|
||||
#endif // DialogSaveFile_H
|
||||
|
||||
+147
-111
@@ -5,6 +5,7 @@
|
||||
#include <QElapsedTimer>
|
||||
#include "VerBVersion.h"
|
||||
#include <QEvent>
|
||||
#include "DialogFileOperation.h"
|
||||
|
||||
#ifdef __RFID_CARD
|
||||
#define DETECT_WARNING_TIME 10 //Seconds
|
||||
@@ -92,6 +93,9 @@ void InkJetPrinter::init()
|
||||
m_scheduleShiftsEditor = new ScheduleShiftsEditor(this);
|
||||
m_DateVarSet = new DateVarSet(this);
|
||||
m_CounterVarSet = new CounterVarSet(this);
|
||||
m_dlgFileOperation = new DialogFileOperation(this);
|
||||
|
||||
connect(m_dlgFileOperation, &DialogFileOperation::openFile, this, &InkJetPrinter::onDlgFileOpen);
|
||||
|
||||
viscosity_timer = new QTimer();
|
||||
connect(viscosity_timer, SIGNAL(timeout()), this, SLOT(viscosity_timerHandler()));
|
||||
@@ -103,6 +107,10 @@ void InkJetPrinter::init()
|
||||
// 我真的不想拉,但是今天状态燃尽了,以后再改了
|
||||
m_TestPrintWidget->setPrintSettingWidget(m_PrintSetting);
|
||||
|
||||
// 初始文件名为 空
|
||||
ui.label_currWorkFile->setText("");
|
||||
ui.label_currEditFile->setText("");
|
||||
|
||||
// 信号槽连接(原逻辑完全不变)
|
||||
connect(m_MainWidget, &MainWidget::sendButtonClickedSignal, this, &InkJetPrinter::getMainWidgetButtonClickedSlot);
|
||||
connect(m_MainWidget,SIGNAL(setDisableAll()),this,SLOT(disableTabClick()));
|
||||
@@ -116,25 +124,28 @@ void InkJetPrinter::init()
|
||||
|
||||
#ifndef FPGA_TEST
|
||||
// 调入文件喷印时,主动重启打印
|
||||
connect(m_TestPrintWidget, &TestPrintWidget::sig_stopPrint, m_MainWidget, [this](){
|
||||
auto isPrinting = sysPara->status.isPrinting;
|
||||
if(isPrinting) {
|
||||
m_MainWidget->on_m_StopBtn_clicked();
|
||||
// connect(m_TestPrintWidget, &TestPrintWidget::sig_currentFileChanged, this, [this](){
|
||||
|
||||
QTimer::singleShot(500, [this](){
|
||||
// ui.label_currWorkFile->setText(m_TestPrintWidget->currentFile());
|
||||
|
||||
m_PrintSetting->applyPrintSettingsToSysPara(false);
|
||||
// auto isPrinting = sysPara->status.isPrinting;
|
||||
// if(isPrinting) {
|
||||
// m_MainWidget->on_m_StopBtn_clicked();
|
||||
|
||||
m_MainWidget->on_m_StartBtn_clicked();
|
||||
LogInfo::setRunStatusText("Restarting the print because the work file was switched.");
|
||||
});
|
||||
}
|
||||
else {
|
||||
QTimer::singleShot(300, [this](){
|
||||
m_PrintSetting->applyPrintSettingsToSysPara(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
// QTimer::singleShot(500, [this](){
|
||||
|
||||
// m_PrintSetting->applyPrintSettingsToSysPara(false);
|
||||
|
||||
// m_MainWidget->on_m_StartBtn_clicked();
|
||||
// LogInfo::setRunStatusText("Restarting the print because the work file was switched.");
|
||||
// });
|
||||
// }
|
||||
// else {
|
||||
// QTimer::singleShot(300, [this](){
|
||||
// m_PrintSetting->applyPrintSettingsToSysPara(false);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
#endif
|
||||
|
||||
// 班时元素与编辑 连接
|
||||
@@ -166,7 +177,6 @@ void InkJetPrinter::init()
|
||||
// connect(myInputMethod,&MyInputMethod::sendEnterClickedSignal,&TestPrintWidget::onEditItemDone);
|
||||
// connect(myInputMethod,SIGNAL(sendEnterClickedSignal()),m_TestPrintWidget,SLOT(onEditItemDone()));
|
||||
connect(m_DateVarSet,SIGNAL(backSpaceBtn()),myInputMethod,SLOT(backSapceButtonDel()));
|
||||
connect(m_TestPrintWidget,SIGNAL(sendUpdateFontSignl(int)),m_FontSetWidget,SLOT(updateFontSelect(int)));
|
||||
|
||||
connect (m_MainWidget,SIGNAL(repeatInitedPid()),this,SLOT(handleInitedPID()));
|
||||
connect(m_MainWidget,SIGNAL(clearPressureFault()),this,SLOT(resetPressureCnt()));
|
||||
@@ -193,7 +203,6 @@ void InkJetPrinter::init()
|
||||
m_OtherInfo->bindSysPara(para);
|
||||
m_TestPrintWidget->bindSysPara(para);
|
||||
m_DateVarSet->bindSysPara(para);
|
||||
m_CounterVarSet->bindSysPara(para);
|
||||
m_MainInstruction->bindSysPara(para);
|
||||
m_BarCodeDlg->bindSysPara(para);
|
||||
m_QRCodeDlg->bindSysPara(para);
|
||||
@@ -208,11 +217,8 @@ void InkJetPrinter::init()
|
||||
m_CounterVarSet->updateSysParaToUI();
|
||||
|
||||
m_SystemManage->loadKeyBoardType();
|
||||
|
||||
m_MainWidget->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||
m_MainWidget->bindPicScene(m_TestPrintWidget->getPicScene());
|
||||
|
||||
m_FontSetWidget->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||
m_CounterVarSet->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||
m_BarCodeDlg->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||
m_QRCodeDlg->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||
m_textEdit = m_TestPrintWidget->getQTextEdit();
|
||||
@@ -238,62 +244,16 @@ void InkJetPrinter::init()
|
||||
m_StackedWidget->addWidget(m_DateVarSet);
|
||||
m_StackedWidget->addWidget(m_CounterVarSet);
|
||||
|
||||
|
||||
// 创建 32 线程和 FPGA 线程,并初始化串口
|
||||
m_serialThreadFPGA = new QThread;
|
||||
serialFPGA = new Serial("/dev/ttyAS5");
|
||||
|
||||
connect(m_serialThreadFPGA,&QThread::started,serialFPGA,&Serial::startInitSlot);
|
||||
|
||||
serialFPGA->moveToThread(m_serialThreadFPGA);
|
||||
connect(serialFPGA,SIGNAL(sendQueueData(int,int,unsigned char*,int,int)),sysPara->devOp,SLOT(resendFPGADate(int,int,unsigned char*,int,int)));
|
||||
connect(serialFPGA,SIGNAL(resendFPGAData(int,int,unsigned char*,int,int)),sysPara->devOp,SLOT(resendFPGADate(int,int,unsigned char*,int,int)));
|
||||
connect(sysPara->devOp,SIGNAL(sendSerialDataToFPGA(int,int,unsigned char*,int,int)),serialFPGA,SLOT(sendSerialData(int,int,unsigned char*,int,int)),Qt::QueuedConnection);
|
||||
connect(serialFPGA,SIGNAL(getFPGAVersion(uint)),this,SLOT(saveFPGAVersionNum(uint)));
|
||||
|
||||
connect(serialFPGA,SIGNAL(stopSendData(bool)),this,SLOT(stopSendFPGAData(bool)));
|
||||
connect(serialFPGA,SIGNAL(getFPGAPhaseDetectHighTm(unsigned char*)),this,SLOT(saveFPGAPhaseDetectHighTm(unsigned char*)));
|
||||
connect(serialFPGA,SIGNAL(getFPGAStatus(unsigned char*)),this,SLOT(saveFPGAStatus(unsigned char*)));
|
||||
connect(serialFPGA,SIGNAL(getFPGACalandarAndDat(unsigned char*)),this,SLOT(saveFPGACalandarAndDat(unsigned char*)));
|
||||
connect(serialFPGA,SIGNAL(getFPGACnt3CurrValue(unsigned char*)),this,SLOT(saveFPGACnt3CurrValue(unsigned char*)));
|
||||
connect(serialFPGA,SIGNAL(getFPGAXXXDay(unsigned char*)),this,SLOT(saveFPGAXXXDay(unsigned char*)));
|
||||
connect(serialFPGA,SIGNAL(queueSizeFPGA(int)),this,SLOT(showFPGAqueuesize(int)));
|
||||
connect(serialFPGA,SIGNAL(queueFPGASizeSIG(int)),this,SLOT(showqueueFPGAsize(int)));
|
||||
connect(serialFPGA, &Serial::FPGABuildDat, this, [this](int buildTime){
|
||||
sysPara->status.build_dat.builTime = quint16(buildTime);
|
||||
qDebug() << "FPGA build time: " << buildTime;
|
||||
LogInfo::setRunStatusText(QString("FPGA build time: %1").arg(buildTime));
|
||||
});
|
||||
|
||||
m_serialThreadSTM32 = new QThread();
|
||||
serialSTM32 = new Serial("/dev/ttyAS2");
|
||||
|
||||
connect(m_serialThreadSTM32,&QThread::started,serialSTM32,&Serial::startInitSlot);
|
||||
|
||||
serialSTM32->moveToThread(m_serialThreadSTM32);
|
||||
connect(serialSTM32,SIGNAL(sendQueueData(int,int,unsigned char*,int,int)),sysPara->devOp,SLOT(resendSTM32Date(int,int,unsigned char*,int,int)));
|
||||
connect(sysPara->devOp,SIGNAL(sendSerialDataToSTM32(int,int,unsigned char*,int,int)),serialSTM32,SLOT(sendSerialData(int,int,unsigned char*,int,int)));
|
||||
connect(serialSTM32,SIGNAL(getSTM32Status(unsigned char*)),this,SLOT(saveSTM32Status(unsigned char*)));
|
||||
connect(serialSTM32,SIGNAL(getGearPumpVal(unsigned char*)),this,SLOT(saveGearPumpVal(unsigned char*)));
|
||||
connect(serialSTM32,SIGNAL(getPulseCnt(unsigned char*)),this,SLOT(savePulseCntVal(unsigned char*)));
|
||||
connect(serialSTM32,SIGNAL(getSTM32Version(unsigned char*)),this,SLOT(saveSTM32Version(unsigned char*)));
|
||||
connect(serialSTM32,SIGNAL(getSTM32Time(unsigned char*)),this,SLOT(saveSTM32Time(unsigned char*)));
|
||||
connect(serialSTM32,SIGNAL(stopSendData(bool)),this,SLOT(stopSendSTM32Data(bool)));
|
||||
connect(serialSTM32,SIGNAL(powerOffReady()),m_MainWidget,SLOT(powerOffConfirmed()));
|
||||
|
||||
connect(serialSTM32,SIGNAL(queueSizeSTM32(int)),this,SLOT(showSTM32queuesize(int)));
|
||||
connect(serialSTM32, &Serial::STM32Connected, this, [this](bool ok, QString errorMsg){
|
||||
if(ok){
|
||||
LogInfo::setRunStatusText("Connected to STM32 serial port");
|
||||
}
|
||||
else{
|
||||
LogInfo::setRunStatusText("STM32 serial port connection failed: " + errorMsg);
|
||||
}
|
||||
});
|
||||
initSerialPorts();
|
||||
|
||||
connect(m_SystemManage,SIGNAL(sigToCloseSerialFPGA()),this,SLOT(closeSerialFPGA()));
|
||||
connect(m_SystemManage,SIGNAL(sigToCloseSerialSTM32()),this,SLOT(closeSerialSTM32()));
|
||||
connect(m_SystemManage,SIGNAL(restartSerial()),this,SLOT(restartSerialPort()));
|
||||
connect(m_SystemManage, &SystemManage::rebootAppAcquired, this, &InkJetPrinter::rebootApp);
|
||||
flagOfSerialThreadStratEn = true;
|
||||
|
||||
connect(m_SystemManage,SIGNAL(enableClick(bool)),this,SLOT(enableInkJetTabClick(bool)));
|
||||
connect(m_SystemManage,SIGNAL(upgradeSTM32(QString)),serialSTM32,SLOT(upgradeSTM32File(QString)));
|
||||
@@ -311,9 +271,6 @@ void InkJetPrinter::init()
|
||||
sysPara->status.machineMac = m_MainInstruction->dlgInputAddr->jd.addr;
|
||||
sysPara->para.rfidCountDown = 5;
|
||||
|
||||
if (m_TestPrintWidget)
|
||||
m_TestPrintWidget->loadLastWork();
|
||||
|
||||
timer = new QTimer();
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(timerHandler()));
|
||||
timer->start(10);
|
||||
@@ -362,9 +319,7 @@ void InkJetPrinter::showEvent(QShowEvent *e)
|
||||
QWidget::showEvent(e);
|
||||
|
||||
if(firstShow) {
|
||||
if (m_TestPrintWidget)
|
||||
m_TestPrintWidget->loadLastWork();
|
||||
|
||||
loadLastWorkAndPreparePrint();
|
||||
firstShow = false;
|
||||
}
|
||||
}
|
||||
@@ -1524,19 +1479,9 @@ void InkJetPrinter::getTestPrintWidgetButtonClickedSlot(int index)
|
||||
case 20:
|
||||
{
|
||||
m_StackedWidget->setCurrentWidget(m_MainWidget);
|
||||
MySleep(200);
|
||||
m_MainWidget->onPreviewScene();
|
||||
m_MainWidget->SendPrintDataToFpga(0);
|
||||
ui.label_currEditFile->setText("");
|
||||
break;
|
||||
}
|
||||
|
||||
// 哪个天才写的? 有什么用?
|
||||
case 21:
|
||||
{
|
||||
// 没用的切换,不讲逻辑的嘛?
|
||||
// m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1553,10 +1498,9 @@ void InkJetPrinter::openDatetimeEditor(DateItemModel dateModel, TextItemModel te
|
||||
m_StackedWidget->setCurrentWidget(m_DateVarSet);
|
||||
}
|
||||
|
||||
void InkJetPrinter::slt_updatePrintContent()
|
||||
void InkJetPrinter::slt_updatePrintContent(const QString &filename)
|
||||
{
|
||||
m_MainWidget->onPreviewScene();
|
||||
m_MainWidget->SendPrintDataToFpga(0);
|
||||
loadWorkFileAndPreparePrint(filename);
|
||||
}
|
||||
|
||||
void InkJetPrinter::getFontSetWidgetButtonClickedSlot(int index)
|
||||
@@ -1577,12 +1521,17 @@ void InkJetPrinter::getMainWidgetButtonClickedSlot(int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
case 1: { // 编辑当前文件
|
||||
m_TestPrintWidget->openWorkFile(sysPara->para.lastOpenedFileName);
|
||||
QFileInfo fileInfo(sysPara->para.lastOpenedFileName);
|
||||
ui.label_currEditFile->setText(QString("E: %1").arg(fileInfo.baseName()));
|
||||
m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
|
||||
break;
|
||||
case 2:
|
||||
// m_StackedWidget->setCurrentWidget(m_MainInterfaceWidget);
|
||||
m_TestPrintWidget->on_openfileButton_pressed();
|
||||
}
|
||||
case 2: // 调入文件喷印
|
||||
m_dlgFileOperation->setWindowModality(Qt::WindowModal);
|
||||
m_dlgFileOperation->refreshListView(SCENE);
|
||||
m_dlgFileOperation->show();
|
||||
break;
|
||||
case 3:
|
||||
close();
|
||||
@@ -1888,10 +1837,10 @@ void InkJetPrinter::saveFPGACalandarAndDat(unsigned char *data){
|
||||
|
||||
QString hexStr = QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue, 16);
|
||||
bool ok;
|
||||
sysPara->para.cnt1CurrValue = hexStr.toUInt(&ok, 10);
|
||||
// sysPara->para.cnt1CurrValue = hexStr.toUInt(&ok, 10);
|
||||
|
||||
hexStr = QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue, 16);
|
||||
sysPara->para.cnt2CurrValue = hexStr.toUInt(&ok, 10);
|
||||
// sysPara->para.cnt2CurrValue = hexStr.toUInt(&ok, 10);
|
||||
}
|
||||
|
||||
void InkJetPrinter::saveFPGACnt3CurrValue(unsigned char *data){
|
||||
@@ -2070,13 +2019,18 @@ void InkJetPrinter::restartSerialPort(){
|
||||
closeSerialFPGA();
|
||||
closeSerialSTM32();
|
||||
|
||||
initSerialPorts();
|
||||
}
|
||||
|
||||
void InkJetPrinter::initSerialPorts()
|
||||
{
|
||||
serialFPGA = new Serial("/dev/ttyAS5");
|
||||
connect(m_serialThreadFPGA, &QThread::started, serialFPGA, &Serial::startInitSlot);
|
||||
serialFPGA->moveToThread(m_serialThreadFPGA);
|
||||
connect(serialFPGA,SIGNAL(sendQueueData(int,int,unsigned char*,int,int)),sysPara->devOp,SLOT(resendFPGADate(int,int,unsigned char*,int,int)));
|
||||
connect(serialFPGA,SIGNAL(resendFPGAData(int,int,unsigned char*,int,int)),sysPara->devOp,SLOT(resendFPGADate(int,int,unsigned char*,int,int)));
|
||||
connect(sysPara->devOp,SIGNAL(sendSerialDataToFPGA(int,int,unsigned char*,int,int)),serialFPGA,SLOT(sendSerialData(int,int,unsigned char*,int,int)),Qt::QueuedConnection);
|
||||
connect(serialFPGA,SIGNAL(getFPGAVersion(uint)),this,SLOT(saveFPGAVersionNum(uint)));
|
||||
connect(m_serialThreadFPGA,&QThread::started,serialFPGA,&Serial::startInitSlot);
|
||||
connect(serialFPGA,SIGNAL(stopSendData(bool)),this,SLOT(stopSendFPGAData(bool)));
|
||||
connect(serialFPGA,SIGNAL(getFPGAPhaseDetectHighTm(unsigned char*)),this,SLOT(saveFPGAPhaseDetectHighTm(unsigned char*)));
|
||||
connect(serialFPGA,SIGNAL(getFPGAStatus(unsigned char*)),this,SLOT(saveFPGAStatus(unsigned char*)));
|
||||
@@ -2092,6 +2046,7 @@ void InkJetPrinter::restartSerialPort(){
|
||||
});
|
||||
|
||||
serialSTM32 = new Serial("/dev/ttyAS2");
|
||||
connect(m_serialThreadSTM32, &QThread::started, serialSTM32, &Serial::startInitSlot);
|
||||
serialSTM32->moveToThread(m_serialThreadSTM32);
|
||||
connect(serialSTM32,SIGNAL(sendQueueData(int,int,unsigned char*,int,int)),sysPara->devOp,SLOT(resendSTM32Date(int,int,unsigned char*,int,int)));
|
||||
connect(sysPara->devOp,SIGNAL(sendSerialDataToSTM32(int,int,unsigned char*,int,int)),serialSTM32,SLOT(sendSerialData(int,int,unsigned char*,int,int)));
|
||||
@@ -2102,7 +2057,6 @@ void InkJetPrinter::restartSerialPort(){
|
||||
connect(serialSTM32,SIGNAL(getSTM32Time(unsigned char*)),this,SLOT(saveSTM32Time(unsigned char*)));
|
||||
connect(serialSTM32,SIGNAL(stopSendData(bool)),this,SLOT(stopSendSTM32Data(bool)));
|
||||
connect(serialSTM32,SIGNAL(powerOffReady()),m_MainWidget,SLOT(powerOffConfirmed()));
|
||||
connect(m_serialThreadSTM32,&QThread::started,serialSTM32,&Serial::startInitSlot);
|
||||
connect(serialSTM32,SIGNAL(queueSizeSTM32(int)),this,SLOT(showSTM32queuesize(int)));
|
||||
connect(serialSTM32, &Serial::STM32Connected, this, [this](bool ok, QString errorMsg){
|
||||
if(ok){
|
||||
@@ -2696,9 +2650,81 @@ void InkJetPrinter::handleInitedPID()
|
||||
PID_init();
|
||||
}
|
||||
|
||||
|
||||
bool InkJetPrinter::loadLastWorkAndPreparePrint()
|
||||
{
|
||||
// 打开最后一次作业文件
|
||||
qDebug() << sysPara->sysFile;
|
||||
qDebug() << sysPara->para.lastOpenedFileName;
|
||||
QString lastFilename = QString(sysPara->para.lastOpenedFileName);
|
||||
|
||||
QFileInfo fileInfo(lastFilename);
|
||||
if (!(fileInfo.exists() && fileInfo.isFile())) {
|
||||
LogInfo::setRunStatusText(QString("Last work file not found: %1").arg(lastFilename));
|
||||
return false;
|
||||
}
|
||||
|
||||
return loadWorkFileAndPreparePrint(lastFilename);
|
||||
}
|
||||
|
||||
bool InkJetPrinter::loadWorkFileAndPreparePrint(const QString &filename)
|
||||
{
|
||||
auto u8Filename = filename.toUtf8();
|
||||
if(u8Filename.size() > int(ARRAY_SIZE(sysPara->para.lastOpenedFileName) - 1)) {
|
||||
LogInfo::setRunStatusText(QString("File name is too long: %1").arg(filename));
|
||||
return false;
|
||||
}
|
||||
|
||||
PicScene* scene = new PicScene();
|
||||
PrintSettingModel model;
|
||||
auto ret = PicSceneLoader::loadSceneFromFile(filename, scene, &model);
|
||||
if(!ret) {
|
||||
LogInfo::setRunStatusText(QString("Failed to load work file: %1").arg(filename));
|
||||
delete scene;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rePrint = false;
|
||||
if(sysPara->status.isPrinting && sysPara->status.selfCheckDone) {
|
||||
m_MainWidget->on_m_StopBtn_clicked();
|
||||
rePrint = true;
|
||||
}
|
||||
|
||||
PrintSettingModel::applyToSysPara(model, sysPara);
|
||||
|
||||
// 应用完数据之后,将当前值编辑标志位清除,避免下次读取时为 true
|
||||
model.cnt1Settings.editCurrValue = false;
|
||||
model.cnt2Settings.editCurrValue = false;
|
||||
PicSceneLoader::saveSceneToXmlFile(filename, scene, &model);
|
||||
|
||||
ret = m_MainWidget->generatePrintContent(scene);
|
||||
if(!ret) {
|
||||
LogInfo::setRunStatusText(QString("Failed to generate print content from work file: %1").arg(filename));
|
||||
delete scene;
|
||||
return false;
|
||||
}
|
||||
|
||||
LogInfo::setRunStatusText(QString("Work file loaded: %1").arg(filename));
|
||||
|
||||
ui.label_currWorkFile->setText(QFileInfo(filename).baseName());
|
||||
|
||||
strncpy(sysPara->para.lastOpenedFileName, u8Filename.constData(), sizeof(sysPara->para.lastOpenedFileName) - 1);
|
||||
sysPara->para.lastOpenedFileName[sizeof(sysPara->para.lastOpenedFileName) - 1] = '\0';
|
||||
sysPara->saveParaToFile();
|
||||
|
||||
if(rePrint) {
|
||||
m_MainWidget->on_m_StartBtn_clicked();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static int highPressureCnt = 0;
|
||||
static unsigned int logCnt = 0;
|
||||
void InkJetPrinter::checkPressureControl(){ //1s
|
||||
|
||||
void InkJetPrinter::checkPressureControl()
|
||||
{ // 1s
|
||||
unsigned int alarmPressure = 0;
|
||||
if(sysPara->para.pressure <= 700)
|
||||
alarmPressure = 800;
|
||||
@@ -2879,19 +2905,9 @@ void InkJetPrinter::warningShow(int type,int num){
|
||||
*/
|
||||
void InkJetPrinter::createNewJobFile()
|
||||
{
|
||||
auto currentFile = m_TestPrintWidget->currentFile();
|
||||
if(!currentFile.isEmpty() && !currentFile.contains("LastWork.xml")) {
|
||||
QFileInfo fileInfo(currentFile);
|
||||
auto ret = QMessageBox::information(nullptr, "", tr("当前正在使用\r\n %1 \r\n确定要新建文件吗?").arg(fileInfo.baseName()),
|
||||
QMessageBox::Ok, QMessageBox::Cancel);
|
||||
if(ret == QMessageBox::Cancel) {
|
||||
LogInfo::setRunStatusText("Canceled create new job file.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo::setRunStatusText("Create new job file...");
|
||||
qInfo() << "Switch to job edit widget...";
|
||||
ui.label_currEditFile->setText(("E: (New file)"));
|
||||
m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
|
||||
m_TestPrintWidget->on_newfileButton_pressed();
|
||||
}
|
||||
@@ -3018,6 +3034,15 @@ void InkJetPrinter::initRFIDManager()
|
||||
this, &InkJetPrinter::slt_showMsg);
|
||||
connect(manager_rfid,SIGNAL(sig_maintenanceShow()),
|
||||
m_MainInstruction,SLOT(maintenanceDialogShow()));
|
||||
|
||||
auto checkReclaimOpenBtn = [this]() {
|
||||
if(sysPara->status.selfCheckDone && (sysPara->status.reclaimTankstatus == 2 || sysPara->status.reclaimTankstatus == 6)) {
|
||||
m_MainWidget->setReclaimOpenBtnStatus(true);
|
||||
}
|
||||
};
|
||||
|
||||
connect(manager_rfid, &RFIDManager::sig_inkCardProgressFinished, this, checkReclaimOpenBtn);
|
||||
connect(manager_rfid, &RFIDManager::sig_solventProgressFinished, this, checkReclaimOpenBtn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3197,3 +3222,14 @@ void InkJetPrinter::slt_showMsg(QString msg)
|
||||
|
||||
LogInfo::setRunStatusText(msg);
|
||||
}
|
||||
|
||||
void InkJetPrinter::onDlgFileOpen(const QString& filename)
|
||||
{
|
||||
QFileInfo fileInfo(filename);
|
||||
if(!fileInfo.exists() || !fileInfo.isFile()) {
|
||||
LogInfo::setRunStatusText(tr("File not found: %1").arg(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
loadWorkFileAndPreparePrint(filename);
|
||||
}
|
||||
+25
-1
@@ -35,6 +35,9 @@
|
||||
|
||||
#include "rfid/RFIDManager.h"
|
||||
#include "runtimectrl.h"
|
||||
#include "scene/PicSceneLoader.h"
|
||||
|
||||
class DialogFileOperation;
|
||||
|
||||
class InkJetPrinter : public QWidget
|
||||
{
|
||||
@@ -68,6 +71,8 @@ private:
|
||||
SystemSetting* m_SystemSetting;
|
||||
OtherInfo* m_OtherInfo;
|
||||
|
||||
DialogFileOperation* m_dlgFileOperation = nullptr;
|
||||
|
||||
FontSetWidget* m_FontSetWidget;
|
||||
|
||||
PrintSetting* m_PrintSetting;
|
||||
@@ -99,12 +104,29 @@ private:
|
||||
private:
|
||||
bool pushButtonStartFlag;
|
||||
void init();
|
||||
void initSerialPorts();
|
||||
void autoControlValvePump();
|
||||
void pressureAdj();
|
||||
void autoControlHeater();
|
||||
void cycleValveRunForSelfCheck();
|
||||
void detectAndcontrolReclaimTank();
|
||||
|
||||
/**
|
||||
* @brief 加载最后一次作业文件并准备打印
|
||||
* 包括:加载打印内容,打印设置
|
||||
* @return 加载是否成功
|
||||
*
|
||||
*/
|
||||
bool loadLastWorkAndPreparePrint();
|
||||
|
||||
/**
|
||||
* @brief 加载指定作业文件并准备打印
|
||||
*
|
||||
* @param filename 作业文件的路径
|
||||
* @return 加载是否成功
|
||||
*/
|
||||
bool loadWorkFileAndPreparePrint(const QString& filename);
|
||||
|
||||
void checkPressureControl();
|
||||
void showMessage(QString);
|
||||
|
||||
@@ -130,13 +152,15 @@ private:
|
||||
QDateTime solventWarnTime = QDateTime();
|
||||
#endif
|
||||
private slots:
|
||||
void onDlgFileOpen(const QString& filename);
|
||||
|
||||
void slt_showMsg(QString msg);
|
||||
void timerHandler();
|
||||
void getMainWidgetButtonClickedSlot(int index);
|
||||
void getTestPrintWidgetButtonClickedSlot(int index);
|
||||
void openDatetimeEditor(DateItemModel dateModel, TextItemModel textItemModel);
|
||||
// 更新打印内容
|
||||
void slt_updatePrintContent();
|
||||
void slt_updatePrintContent(const QString& filename);
|
||||
// void getErCodeSettingsWidgetButtonClickedSlot(int index);
|
||||
// void getMainInterfaceWidgetButtonClickedSlot(int index);
|
||||
void viscosity_timerHandler();
|
||||
|
||||
+40
-7
@@ -46,13 +46,6 @@
|
||||
<number>30</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hlayout_frame1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_queue">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="titleText">
|
||||
<property name="styleSheet">
|
||||
@@ -63,6 +56,39 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_currWorkFile">
|
||||
<property name="text">
|
||||
<string>LastWork.xml</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_currEditFile">
|
||||
<property name="text">
|
||||
<string>E: QQBase</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pressure">
|
||||
<property name="text">
|
||||
@@ -84,6 +110,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_queue">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
+97
-31
@@ -110,7 +110,7 @@ void PrintSetting::on_pushButtonApply_pressed(){
|
||||
PrintSettingModel::setDefPrintSettingModel(m_model);
|
||||
QMessageBox::information(nullptr, tr("提示"), tr("默认设置已保存"));
|
||||
} else {
|
||||
applyPrintSettingsToSysPara(true);
|
||||
// applyPrintSettingsToSysPara(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,21 +157,8 @@ void PrintSetting::updateModelFromUI(){
|
||||
m_model.outputPulseDelayMs = ui->spinBoxOutputPulseDelayMs->value();
|
||||
m_model.OuputPulseCol = ui->spinBoxOuputPulseCol->value();
|
||||
|
||||
unsigned int value = 0;
|
||||
if (ui->cb_unlimited->isChecked())
|
||||
value = (m_model.triggerMode == PRINT_TRIGGER_SYNCHRONIZER || m_model.triggerMode == PRINT_TRIGGER_TIME) ? UINT32_MAX : UINT16_MAX;
|
||||
else
|
||||
value = ui->spinBoxEleEyeTriggerRepeatCnt->value();
|
||||
|
||||
m_model.eleEyeRepeatCnt = value;
|
||||
|
||||
// if (m_model.triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL
|
||||
// || m_model.triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE
|
||||
// || m_model.triggerMode == PRINT_TRIGGER_SYNCHRONIZER) {
|
||||
// ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
|
||||
// } else {
|
||||
// ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):"));
|
||||
// }
|
||||
m_model.unlimitedRepeat = ui->cb_unlimited->isChecked();
|
||||
m_model.eleEyeRepeatCnt = ui->spinBoxEleEyeTriggerRepeatCnt->value();
|
||||
}
|
||||
|
||||
void PrintSetting::bindSysPara(SysPara *sysPara)
|
||||
@@ -224,12 +211,8 @@ void PrintSetting::TriggerupdateModelToUI()
|
||||
ui->spinBoxEleEyeTriggerIntervalMs->setValue(m_model.triggerInterval);
|
||||
ui->spinBoxOutputPulseDelayMs->setValue(m_model.outputPulseDelayMs);
|
||||
|
||||
if(m_model.eleEyeRepeatCnt > INT32_MAX){
|
||||
ui->cb_unlimited->setChecked(true);
|
||||
}
|
||||
else {
|
||||
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(m_model.eleEyeRepeatCnt);
|
||||
}
|
||||
ui->cb_unlimited->setChecked(m_model.unlimitedRepeat);
|
||||
ui->spinBoxEleEyeTriggerRepeatCnt->setValue(m_model.eleEyeRepeatCnt);
|
||||
|
||||
ui->spinBoxSynTriggerPrintLen->setText(QString::number(m_model.triggerInterval));
|
||||
ui->lineEditTriggerPulsePerMm->setText(QString::number((double)m_model.encoderPulsePerMm));
|
||||
@@ -592,12 +575,14 @@ void PrintSetting::setEnableEleEyeSetting(bool flag){
|
||||
ui->labelEleEyeTriggerIntervalMs->setEnabled(!(ui->radioButtonSynTriggerExternal->isChecked() && ui->eleEyeEdgetTriggerInner->isChecked()));
|
||||
// ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(!(ui->radioButtonSynTriggerExternal->isChecked() && ui->eleEyeEdgetTriggerInner->isChecked()));
|
||||
ui->spinBoxEleMaskTime->setEnabled(flag);
|
||||
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(true);
|
||||
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
|
||||
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
|
||||
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
|
||||
ui->cb_unlimited->setEnabled(true);
|
||||
|
||||
ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(flag);
|
||||
if (!flag) ui->cb_unlimited->setChecked(false);
|
||||
|
||||
ui->cb_unlimited->setEnabled(true);
|
||||
ui->cb_unlimited->setChecked(!flag);
|
||||
}
|
||||
|
||||
void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
|
||||
@@ -638,7 +623,7 @@ void PrintSetting::applyPrintSettingsToSysPara(bool showTip)
|
||||
int res = sysPara->devOp->writeFpgaPrintPara(!showTip);
|
||||
|
||||
sysPara->devOp->writeSyncAndDelayPrintCount(
|
||||
m_model.triggerMode == PRINT_TRIGGER_SYNCHRONIZER || m_model.triggerMode == PRINT_TRIGGER_TIME,
|
||||
(m_model.triggerMode == PRINT_TRIGGER_SYNCHRONIZER || m_model.triggerMode == PRINT_TRIGGER_TIME) && m_model.unlimitedRepeat,
|
||||
m_model.eleEyeRepeatCnt);
|
||||
|
||||
sysPara->devOp->setHighVoltageAmplitudetoSTM32();
|
||||
@@ -661,6 +646,7 @@ void PrintSetting::applyPrintSettingsToSysPara(bool showTip)
|
||||
|
||||
PrintSettingModel PrintSetting::model() const
|
||||
{
|
||||
updateModelFromUI();
|
||||
return m_model;
|
||||
}
|
||||
|
||||
@@ -732,9 +718,18 @@ void PrintSetting::on_cb_unlimited_clicked(bool checked)
|
||||
|
||||
void PrintSettingModel::loadFromXml(PrintSettingModel& model, const QXmlStreamAttributes& attrs)
|
||||
{
|
||||
auto readIntAttrOrDefault = [&attrs](const char* name, int defaultValue) -> int {
|
||||
return attrs.hasAttribute(name) ? attrs.value(name).toInt() : defaultValue;
|
||||
};
|
||||
|
||||
auto readBoolAttrOrDefault = [&attrs](const char* name, bool defaultValue) -> bool {
|
||||
return attrs.hasAttribute(name) ? (attrs.value(name).toInt() != 0) : defaultValue;
|
||||
};
|
||||
|
||||
model.timeTriggerPrintMode = attrs.value("timeTriggerPrintMode").toInt();
|
||||
model.triggerInterval = attrs.value("triggerInterval").toUInt();
|
||||
model.eleEyeRepeatCnt = attrs.value("eleEyeRepeatCnt").toUInt();
|
||||
model.unlimitedRepeat = attrs.value("unlimitedRepeat").toInt() != 0;
|
||||
model.triggerMode = attrs.value("triggerMode").toUInt();
|
||||
model.encoderPulsePerMm = attrs.value("encoderPulsePerMm").toFloat();
|
||||
model.printColDelay = attrs.value("printColDelay").toUInt();
|
||||
@@ -754,6 +749,22 @@ void PrintSettingModel::loadFromXml(PrintSettingModel& model, const QXmlStreamAt
|
||||
model.leftRightInverse = attrs.value("leftRightInverse").toInt() != 0;
|
||||
model.upDownInverse = attrs.value("upDownInverse").toInt() != 0;
|
||||
model.eleEyeTriggerSynPrintEn = attrs.value("eleEyeTriggerSynPrintEn").toInt() != 0;
|
||||
|
||||
model.cnt1Settings.startValue = readIntAttrOrDefault("cnt1StartValue", model.cnt1Settings.startValue);
|
||||
model.cnt1Settings.endValue = readIntAttrOrDefault("cnt1EndValue", model.cnt1Settings.endValue);
|
||||
model.cnt1Settings.repeatValue = readIntAttrOrDefault("cnt1RepeatValue", model.cnt1Settings.repeatValue);
|
||||
model.cnt1Settings.stepValue = readIntAttrOrDefault("cnt1StepValue", model.cnt1Settings.stepValue);
|
||||
model.cnt1Settings.currValue = readIntAttrOrDefault("cnt1CurrValue", model.cnt1Settings.currValue);
|
||||
model.cnt1Settings.editCurrValue = readBoolAttrOrDefault("cnt1EditCurrValue", model.cnt1Settings.editCurrValue);
|
||||
model.cnt1Settings.eleEyeIncEn = readBoolAttrOrDefault("cnt1EleEyeIncEn", model.cnt1Settings.eleEyeIncEn);
|
||||
|
||||
model.cnt2Settings.startValue = readIntAttrOrDefault("cnt2StartValue", model.cnt2Settings.startValue);
|
||||
model.cnt2Settings.endValue = readIntAttrOrDefault("cnt2EndValue", model.cnt2Settings.endValue);
|
||||
model.cnt2Settings.repeatValue = readIntAttrOrDefault("cnt2RepeatValue", model.cnt2Settings.repeatValue);
|
||||
model.cnt2Settings.stepValue = readIntAttrOrDefault("cnt2StepValue", model.cnt2Settings.stepValue);
|
||||
model.cnt2Settings.currValue = readIntAttrOrDefault("cnt2CurrValue", model.cnt2Settings.currValue);
|
||||
model.cnt2Settings.editCurrValue = readBoolAttrOrDefault("cnt2EditCurrValue", model.cnt2Settings.editCurrValue);
|
||||
model.cnt2Settings.eleEyeIncEn = readBoolAttrOrDefault("cnt2EleEyeIncEn", model.cnt2Settings.eleEyeIncEn);
|
||||
}
|
||||
|
||||
void PrintSettingModel::saveToXml(const PrintSettingModel& model, QXmlStreamWriter& writer)
|
||||
@@ -761,6 +772,7 @@ void PrintSettingModel::saveToXml(const PrintSettingModel& model, QXmlStreamWrit
|
||||
writer.writeAttribute("timeTriggerPrintMode", QString::number(model.timeTriggerPrintMode));
|
||||
writer.writeAttribute("triggerInterval", QString::number(model.triggerInterval));
|
||||
writer.writeAttribute("eleEyeRepeatCnt", QString::number(model.eleEyeRepeatCnt));
|
||||
writer.writeAttribute("unlimitedRepeat", QString::number(model.unlimitedRepeat));
|
||||
writer.writeAttribute("triggerMode", QString::number(model.triggerMode));
|
||||
writer.writeAttribute("encoderPulsePerMm", QString::number((double)model.encoderPulsePerMm));
|
||||
writer.writeAttribute("printColDelay", QString::number(model.printColDelay));
|
||||
@@ -780,6 +792,22 @@ void PrintSettingModel::saveToXml(const PrintSettingModel& model, QXmlStreamWrit
|
||||
writer.writeAttribute("leftRightInverse", QString::number(model.leftRightInverse));
|
||||
writer.writeAttribute("upDownInverse", QString::number(model.upDownInverse));
|
||||
writer.writeAttribute("eleEyeTriggerSynPrintEn", QString::number(model.eleEyeTriggerSynPrintEn));
|
||||
|
||||
writer.writeAttribute("cnt1StartValue", QString::number(model.cnt1Settings.startValue));
|
||||
writer.writeAttribute("cnt1EndValue", QString::number(model.cnt1Settings.endValue));
|
||||
writer.writeAttribute("cnt1RepeatValue", QString::number(model.cnt1Settings.repeatValue));
|
||||
writer.writeAttribute("cnt1StepValue", QString::number(model.cnt1Settings.stepValue));
|
||||
writer.writeAttribute("cnt1CurrValue", QString::number(model.cnt1Settings.currValue));
|
||||
writer.writeAttribute("cnt1EditCurrValue", QString::number(model.cnt1Settings.editCurrValue));
|
||||
writer.writeAttribute("cnt1EleEyeIncEn", QString::number(model.cnt1Settings.eleEyeIncEn));
|
||||
|
||||
writer.writeAttribute("cnt2StartValue", QString::number(model.cnt2Settings.startValue));
|
||||
writer.writeAttribute("cnt2EndValue", QString::number(model.cnt2Settings.endValue));
|
||||
writer.writeAttribute("cnt2RepeatValue", QString::number(model.cnt2Settings.repeatValue));
|
||||
writer.writeAttribute("cnt2StepValue", QString::number(model.cnt2Settings.stepValue));
|
||||
writer.writeAttribute("cnt2CurrValue", QString::number(model.cnt2Settings.currValue));
|
||||
writer.writeAttribute("cnt2EditCurrValue", QString::number(model.cnt2Settings.editCurrValue));
|
||||
writer.writeAttribute("cnt2EleEyeIncEn", QString::number(model.cnt2Settings.eleEyeIncEn));
|
||||
}
|
||||
|
||||
void PrintSettingModel::applyToSysPara(const PrintSettingModel &model, SysPara *sysPara)
|
||||
@@ -799,7 +827,11 @@ void PrintSettingModel::applyToSysPara(const PrintSettingModel &model, SysPara *
|
||||
|
||||
sysPara->para.timeTriggerPrintMode = model.timeTriggerPrintMode;
|
||||
sysPara->para.elecEyeTriggerInterval = model.triggerInterval;
|
||||
sysPara->para.photoElectricityRepeateNum = model.eleEyeRepeatCnt;
|
||||
|
||||
sysPara->para.photoElectricityRepeateNum = (model.unlimitedRepeat &&
|
||||
(model.triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || model.triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)) ?
|
||||
UINT16_MAX : model.eleEyeRepeatCnt;
|
||||
|
||||
sysPara->para.synTriggerPrintLenMm = (float)model.triggerInterval;
|
||||
sysPara->para.synPulseNumPerMm = model.encoderPulsePerMm;
|
||||
sysPara->para.sysTriggerPrintMode = SYN_PRINT_MODE_ACCORDING_CHAR_WIDTH;
|
||||
@@ -840,6 +872,25 @@ void PrintSettingModel::applyToSysPara(const PrintSettingModel &model, SysPara *
|
||||
&& !(isEyeMode && model.eleEyeTriggerSynPrintEn);
|
||||
|
||||
sysPara->para.synTriggerExternal = !sysPara->para.synTriggerInner;
|
||||
|
||||
sysPara->para.enbSyncAndTimeTriggerLimit = !model.unlimitedRepeat &&
|
||||
(model.triggerMode == PRINT_TRIGGER_TIME || model.triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
|
||||
sysPara->para.syncAndTimeTriggerLimit = sysPara->para.enbSyncAndTimeTriggerLimit ? model.eleEyeRepeatCnt : 0;
|
||||
|
||||
sysPara->para.cnt1EndValue = model.cnt1Settings.endValue;
|
||||
sysPara->para.cnt1StartValue = model.cnt1Settings.startValue;
|
||||
sysPara->para.cnt1StepValue = model.cnt1Settings.stepValue;
|
||||
sysPara->para.cnt1RepeateValue = model.cnt1Settings.repeatValue;
|
||||
sysPara->para.cnt1CurrValue = model.cnt1Settings.currValue;
|
||||
sysPara->status.cnt1CurrentValueInitDoneFlag = model.cnt1Settings.editCurrValue;
|
||||
|
||||
sysPara->para.cnt2EndValue = model.cnt2Settings.endValue;
|
||||
sysPara->para.cnt2StartValue = model.cnt2Settings.startValue;
|
||||
sysPara->para.cnt2StepValue = model.cnt2Settings.stepValue;
|
||||
sysPara->para.cnt2RepeateValue = model.cnt2Settings.repeatValue;
|
||||
sysPara->para.cnt2CurrValue = model.cnt2Settings.currValue;
|
||||
sysPara->status.cnt2CurrentValueInitDoneFlag = model.cnt2Settings.editCurrValue;
|
||||
}
|
||||
|
||||
PrintSettingModel PrintSettingModel::fromSysPara(SysPara *sysPara)
|
||||
@@ -891,6 +942,20 @@ PrintSettingModel PrintSettingModel::fromSysPara(SysPara *sysPara)
|
||||
model.OuputPulseCol = sysPara->para.OuputPulseCol;
|
||||
model.pulse_sinal_value = sysPara->para.pulse_sinal_value;
|
||||
|
||||
model.cnt1Settings.startValue = sysPara->para.cnt1StartValue;
|
||||
model.cnt1Settings.endValue = sysPara->para.cnt1EndValue;
|
||||
model.cnt1Settings.repeatValue = sysPara->para.cnt1RepeateValue;
|
||||
model.cnt1Settings.stepValue = sysPara->para.cnt1StepValue;
|
||||
model.cnt1Settings.currValue = sysPara->para.cnt1CurrValue;
|
||||
model.cnt1Settings.editCurrValue = sysPara->status.cnt1CurrentValueInitDoneFlag;
|
||||
|
||||
model.cnt2Settings.startValue = sysPara->para.cnt2StartValue;
|
||||
model.cnt2Settings.endValue = sysPara->para.cnt2EndValue;
|
||||
model.cnt2Settings.repeatValue = sysPara->para.cnt2RepeateValue;
|
||||
model.cnt2Settings.stepValue = sysPara->para.cnt2StepValue;
|
||||
model.cnt2Settings.currValue = sysPara->para.cnt2CurrValue;
|
||||
model.cnt2Settings.editCurrValue = sysPara->status.cnt2CurrentValueInitDoneFlag;
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -898,10 +963,10 @@ QString PrintSettingModel::toString(const PrintSettingModel &model)
|
||||
{
|
||||
QString str = QString::asprintf("LRInverse: %d, UpDownInverse: %d, printColDelay: %d, \r\n"
|
||||
"highVoltageAmplitude: %d, volParaIndex: %d, triggerMode: %d, eleEyeTriggerSynPrintEn: %d, \r\n"
|
||||
"eleMaskTime: %d, triggerInterval: %d, timeTriggerPrintMode: %d, eleEyeRepeatCnt: %d, \r\n"
|
||||
"eleEyeTriggerPrintDelay: %d, encoderPulsePerMm: %d, altMirrorType: %d, altMirrorGap: %d. \r\n",
|
||||
"eleMaskTime: %d, triggerInterval: %d, timeTriggerPrintMode: %d, eleEyeRepeatCnt: %d, unlimitedRepeat: %d, \r\n"
|
||||
"eleEyeTriggerPrintDelay: %d, encoderPulsePerMm: %.3f, altMirrorType: %d, altMirrorGap: %d. \r\n",
|
||||
model.leftRightInverse, model.upDownInverse, model.printColDelay, model.highVoltageAmplitude, model.volParaIndex, model.triggerMode,
|
||||
model.eleEyeTriggerSynPrintEn, model.eleMaskTime, model.triggerInterval, model.timeTriggerPrintMode, model.eleEyeRepeatCnt,
|
||||
model.eleEyeTriggerSynPrintEn, model.eleMaskTime, model.triggerInterval, model.timeTriggerPrintMode, model.eleEyeRepeatCnt, model.unlimitedRepeat,
|
||||
model.eleEyeTriggerPrintDelay, model.encoderPulsePerMm, model.altMirrorType, model.altMirrorGap);
|
||||
return str;
|
||||
}
|
||||
@@ -933,10 +998,11 @@ void PrintSettingModel::setDefPrintSettingModel(const PrintSettingModel &model)
|
||||
}
|
||||
|
||||
QXmlStreamWriter writer(&file);
|
||||
PrintSettingModel normalizedModel = model;
|
||||
writer.setAutoFormatting(true);
|
||||
writer.writeStartDocument();
|
||||
writer.writeEmptyElement("PrintSettings");
|
||||
saveToXml(model, writer);
|
||||
saveToXml(normalizedModel, writer);
|
||||
writer.writeEndDocument();
|
||||
|
||||
file.close();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QXmlStreamWriter>
|
||||
#include "PulseNumFix.h"
|
||||
#include "scene/CounterEditor.h"
|
||||
|
||||
namespace Ui {
|
||||
class PrintSetting;
|
||||
@@ -35,6 +36,8 @@ struct PrintSettingModel
|
||||
|
||||
unsigned eleEyeRepeatCnt = 1; // 电眼触发时,打印内容的次数,也就是重复数
|
||||
|
||||
bool unlimitedRepeat = false; // 无限重复打印
|
||||
|
||||
unsigned triggerMode = 0; // 触发模式
|
||||
|
||||
float encoderPulsePerMm = 40; // 编码器的每毫米脉冲数
|
||||
@@ -81,6 +84,10 @@ struct PrintSettingModel
|
||||
|
||||
bool eleEyeTriggerSynPrintEn = false;
|
||||
|
||||
CounterSettings cnt1Settings; // 计数器1 配置
|
||||
|
||||
CounterSettings cnt2Settings; // 计数器2 配置
|
||||
|
||||
static void loadFromXml(PrintSettingModel& model, const QXmlStreamAttributes& attrs);
|
||||
static void saveToXml(const PrintSettingModel& model, QXmlStreamWriter& writer);
|
||||
|
||||
@@ -130,6 +137,11 @@ public:
|
||||
void setModel(const PrintSettingModel& model);
|
||||
|
||||
void setDefaultSettingMode(bool enable);
|
||||
|
||||
bool isDefaultSettingMode() const {
|
||||
return m_isDefaultSettingMode;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void buttonClickedSlot();
|
||||
|
||||
|
||||
+3
-1
@@ -143,7 +143,9 @@ void SysPara::loadParaFromFile(){
|
||||
//loadDefaultPara();//qDebug("loadDefaultPara2");
|
||||
}
|
||||
//qDebug()<<"SYSPrar:"<<sysFile<<"LO:"<<para.lastOpenedFileName;
|
||||
loadPrintParaFromFile(sysFile);
|
||||
|
||||
// 现在已由 PrintSettingModel 管理 byons@2026年7月21日
|
||||
// loadPrintParaFromFile(sysFile);
|
||||
}
|
||||
|
||||
void SysPara::loadDefaultPara(){
|
||||
|
||||
@@ -808,6 +808,10 @@ typedef struct {
|
||||
bool flagOfSolventWarning; //报错累计次数达标,报警标志设为true
|
||||
unsigned short rfidCountDown;
|
||||
unsigned int canvasHeight; // 韩国需求中,要求可以设定打印区域的高度,默认为32。
|
||||
|
||||
bool enbSyncAndTimeTriggerLimit; // 同步和时喷打印次数限制功能使能
|
||||
unsigned int syncAndTimeTriggerLimit; // 同步和时喷打印次数限制值
|
||||
|
||||
/* */
|
||||
// 1108Bytes
|
||||
}sysPara_t;
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,217 @@
|
||||
# m_RightBtn(喷嘴开启)可用性真值表
|
||||
|
||||
## 0) 你要的重点:只整理“上层可点(E=true)”
|
||||
|
||||
这一节只看上层传给 `setReclaimOpenBtnStatus(E)` 的 E,不包含底层拦截(airPushing / RFID)。
|
||||
|
||||
关键调用位置:
|
||||
- [mainwidget.cpp](mainwidget.cpp#L863)
|
||||
- [InkJetPrinter.cpp](InkJetPrinter.cpp#L1094)
|
||||
- [InkJetPrinter.cpp](InkJetPrinter.cpp#L2555)
|
||||
- [InkJetPrinter.cpp](InkJetPrinter.cpp#L2581)
|
||||
|
||||
上层 E=true 的来源只有 4 类:
|
||||
- 停止打印后:`currReclaimTankPos == 0` 时传 true。
|
||||
- 自检完成瞬间:直接传 true。
|
||||
- 回收槽状态机:`reclaimTankstatus == 2` 时传 true。
|
||||
- 回收槽状态机:`reclaimTankstatus == 4` 时传 true。
|
||||
|
||||
## 0.1) 上层 E=true 精简真值表(不含 A/R)
|
||||
|
||||
定义四个上层布尔量:
|
||||
- S:自检完成事件(self check done edge)
|
||||
- T:停止打印事件且 `currReclaimTankPos == 0`
|
||||
- R2:`reclaimTankstatus == 2`
|
||||
- R4:`reclaimTankstatus == 4`
|
||||
|
||||
则上层可点条件:
|
||||
|
||||
E = S OR T OR R2 OR R4
|
||||
|
||||
只看 E=true 的最小真值表(命中任一来源即可):
|
||||
|
||||
| S | T | R2 | R4 | E |
|
||||
|---|---|---|---|---|
|
||||
| 1 | 0 | 0 | 0 | 1 |
|
||||
| 0 | 1 | 0 | 0 | 1 |
|
||||
| 0 | 0 | 1 | 0 | 1 |
|
||||
| 0 | 0 | 0 | 1 | 1 |
|
||||
|
||||
说明:
|
||||
- 这 4 行是“最小命中表”。多项同时为 1(例如 T=1 且 R2=1)也仍然是 E=1。
|
||||
|
||||
## 0.2) 上层 E=false 的主要覆盖路径(帮助你理解为何看起来复杂)
|
||||
|
||||
下面这些路径会频繁把 E 拉回 false:
|
||||
- 开始打印后立即置 false:[mainwidget.cpp](mainwidget.cpp#L824)
|
||||
- 打印中周期置 false:[mainwidget.cpp](mainwidget.cpp#L2594)
|
||||
- 自检启动/进行中置 false:[InkJetPrinter.cpp](InkJetPrinter.cpp#L1059)
|
||||
- 排气过程周期置 false:[mainwidget.cpp](mainwidget.cpp#L1034)
|
||||
- 齿轮泵未进入运行态时置 false:[InkJetPrinter.cpp](InkJetPrinter.cpp#L710)
|
||||
- 关机流程置 false:[mainwidget.cpp](mainwidget.cpp#L219)
|
||||
|
||||
所以“上层 E=true”通常是阶段性信号,可能很快被其他流程覆盖为 false。
|
||||
|
||||
## 0.3) 我建议的上层简化口径(先统一 E,再叠加底层拦截)
|
||||
|
||||
你可以把现有分散调用统一理解为两步:
|
||||
|
||||
1) 先算上层意图 E:
|
||||
|
||||
```cpp
|
||||
bool upperEnable = selfCheckDoneEdge
|
||||
|| (stopPrint && currReclaimTankPos == 0)
|
||||
|| (reclaimTankstatus == 2)
|
||||
|| (reclaimTankstatus == 4);
|
||||
```
|
||||
|
||||
2) 再算最终可点:
|
||||
|
||||
```cpp
|
||||
bool finalEnable = upperEnable && !airPushing && !rfidBlocked;
|
||||
```
|
||||
|
||||
这样分层后,排查会非常直接:
|
||||
- 先问“上层想不想给点”(E)
|
||||
- 再问“底层有没有拦截”(A/R)
|
||||
|
||||
## 1) 最终判定公式
|
||||
|
||||
m_RightBtn 最终是否可用,不只看调用处传入的 enable,还会在 MainWidget 内再次过滤。
|
||||
|
||||
关键实现位置:
|
||||
- [setReclaimOpenBtnStatus 定义](mainwidget.cpp#L959)
|
||||
- [RFID 条件过滤](mainwidget.cpp#L961)
|
||||
- [airPushing 条件过滤](mainwidget.cpp#L968)
|
||||
- [最终 setEnabled](mainwidget.cpp#L971)
|
||||
|
||||
可用公式:
|
||||
|
||||
FinalEnabled = E AND (NOT A) AND (NOT R)
|
||||
|
||||
变量定义:
|
||||
- E:上层调用 setReclaimOpenBtnStatus(E) 时传入的 enable
|
||||
- A:sysPara->status.airPushing(是否正在排气)
|
||||
- R:RFID 层拦截(仅在编译启用 __RFID_CARD 时有效)
|
||||
- inkCardTimeOut 或 solventCardTimeOut 或 needMaintenance 任一为真,则 R=1
|
||||
|
||||
说明:
|
||||
- 若未启用 __RFID_CARD,R 恒为 0。
|
||||
|
||||
## 2) 最终可用真值表(硬条件)
|
||||
|
||||
| E | A | R | FinalEnabled |
|
||||
|---|---|---|---|
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 0 | 1 | 1 | 0 |
|
||||
| 1 | 0 | 0 | 1 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 0 |
|
||||
| 1 | 1 | 1 | 0 |
|
||||
|
||||
结论:
|
||||
- 唯一能点的组合是 E=1、A=0、R=0。
|
||||
|
||||
## 2.1) 只看“按钮可用=true”的最小真值表
|
||||
|
||||
如果你只关心“什么时候能点”,那真值表可以压缩成 1 行:
|
||||
|
||||
| E | A | R | FinalEnabled |
|
||||
|---|---|---|---|
|
||||
| 1 | 0 | 0 | 1 |
|
||||
|
||||
反向速记(现场排查更快):
|
||||
- 只要满足以下任一条件,按钮就一定不可用:
|
||||
- E=0(上层当前不允许)
|
||||
- A=1(正在排气)
|
||||
- R=1(RFID 拦截)
|
||||
|
||||
## 2.2) 工程化简化版(建议你按这个理解)
|
||||
|
||||
把复杂条件改写成一个“守卫函数”,先算出 3 个阻塞原因,再统一决定可用性。
|
||||
|
||||
建议逻辑:
|
||||
|
||||
```cpp
|
||||
// 只表达逻辑,不改变现有业务行为
|
||||
bool blockedByRFID = hasRFIDGuard && (inkCardTimeOut || solventCardTimeOut || needMaintenance);
|
||||
bool blockedByAirPush = airPushing;
|
||||
bool blockedByUpperLayer = !upperEnable;
|
||||
|
||||
bool finalEnabled = !blockedByRFID && !blockedByAirPush && !blockedByUpperLayer;
|
||||
```
|
||||
|
||||
对应到 UI 语义:
|
||||
- 可用态:Ready
|
||||
- 不可用态:BlockedByUpperLayer / BlockedByAirPush / BlockedByRFID
|
||||
|
||||
这样简化后的好处:
|
||||
- 读代码时从“多处 setReclaimOpenBtnStatus(true/false)”切换为“先看谁在设置阻塞原因”。
|
||||
- 打日志更清晰:可直接输出第一个阻塞原因,而不是只看到按钮被置灰。
|
||||
- 后续扩展更稳:新增条件只需新增一个 blockedByX,不会到处散落 if。
|
||||
|
||||
建议落地步骤(不改行为,只提可维护性):
|
||||
- 第一步:在 MainWidget 内新增一个 `computeReclaimOpenBtnEnabled()`,所有按钮状态更新都走它。
|
||||
- 第二步:在 `setReclaimOpenBtnStatus` 里补充调试日志(仅 debug),打印 E/A/R。
|
||||
- 第三步:把状态机处的“直接 true/false”改成“设置上层意图 upperEnable”,统一在一个点算最终值。
|
||||
|
||||
## 3) E(上层 enable)常见取值来源表
|
||||
|
||||
| 场景 | 调用代码 | 传入 E |
|
||||
|---|---|---|
|
||||
| 开始打印后 | [mainwidget.cpp](mainwidget.cpp#L824) | 0 |
|
||||
| 停止打印后,按回收槽位置决定 | [mainwidget.cpp](mainwidget.cpp#L863) | currReclaimTankPos == 0 |
|
||||
| 关机流程(回收槽未关) | [mainwidget.cpp](mainwidget.cpp#L219) | 0 |
|
||||
| 排气进行中(周期) | [mainwidget.cpp](mainwidget.cpp#L1034) | 0 |
|
||||
| 打印中且自检完成(周期) | [mainwidget.cpp](mainwidget.cpp#L2594) | 0 |
|
||||
| 自检开始 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L1059) | 0 |
|
||||
| 自检完成 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L1094) | 1 |
|
||||
| 回收槽状态机:状态=1或2 时 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2555) | reclaimTankstatus == 2 |
|
||||
| 回收槽状态机:状态=4(保持) | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2581) | 1 |
|
||||
| 齿轮泵未进入运行态 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L710) | 0 |
|
||||
|
||||
## 4) 按回收槽状态机的可用性(忽略 A/R 时的 E)
|
||||
|
||||
这张表只表示状态机“想给”的 E,最终仍需经过第 2 节硬条件过滤。
|
||||
|
||||
| reclaimTankstatus | 语义 | E(状态机给值) | 代码位置 |
|
||||
|---|---|---|---|
|
||||
| 1 | 开槽中 | 0 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2555) |
|
||||
| 2 | 关槽中 | 1 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2555) |
|
||||
| 4 | 保持 | 1 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2581) |
|
||||
| 5 | 开到位 | 未在该分支直接设置 E(通常由其他逻辑接管) | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2520) |
|
||||
| 6 | 关到位 | 未在该分支直接设置 E(通常随后可再次开槽) | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2561) |
|
||||
| 0x11/0x12 | 卡滞/异常 | 不会给出稳定可用态,偏禁用与告警处理 | [InkJetPrinter.cpp](InkJetPrinter.cpp#L2546) |
|
||||
|
||||
## 5) 点击行为补充(按钮可用后点下去会发生什么)
|
||||
|
||||
入口:
|
||||
- [on_m_RightBtn_clicked](mainwidget.cpp#L1266)
|
||||
|
||||
行为分支:
|
||||
- 若 reclaimTankBlockedAppending 为真:先弹告警确认,不直接开槽。
|
||||
- [mainwidget.cpp](mainwidget.cpp#L1300)
|
||||
- 若 canRunAirPushing 为真 且 currReclaimTankPos==0:先排气,再开槽。
|
||||
- [mainwidget.cpp](mainwidget.cpp#L1270)
|
||||
- 其他情况:直接调用 reclaimTanOpen。
|
||||
- [mainwidget.cpp](mainwidget.cpp#L1298)
|
||||
|
||||
补充状态位来源:
|
||||
- canRunAirPushing 在开槽动作中会被置为 false。
|
||||
- [mainwidget.cpp](mainwidget.cpp#L1135)
|
||||
- 自检完成、关槽完成后会恢复为 true。
|
||||
- [InkJetPrinter.cpp](InkJetPrinter.cpp#L1098)
|
||||
- [InkJetPrinter.cpp](InkJetPrinter.cpp#L2571)
|
||||
|
||||
## 6) 一句话版本
|
||||
|
||||
m_RightBtn 可用的必要且充分条件是:上层当前允许开启(E=1)+ 不在排气(A=0)+ RFID 不拦截(R=0)。在实际运行中,E 主要由“自检状态、打印状态、回收槽状态机、故障流程”共同驱动。
|
||||
|
||||
## 7) 给现场同事的超短口令
|
||||
|
||||
先看 E,再看 A,再看 R:
|
||||
- E 由业务状态机决定“想不想让你点”。
|
||||
- A/R 决定“即使想让你点,也要不要强制拦截”。
|
||||
- 只有 E=1 且 A=0 且 R=0,m_RightBtn 才会真的可点。
|
||||
+30
-13
@@ -50,7 +50,6 @@ MainWidget::MainWidget(QWidget* parent)
|
||||
m_MainBtn = ui.m_MainBtn;
|
||||
m_ManageBtn = ui.m_ManageBtn;
|
||||
m_MsgBtn = ui.m_MsgBtn;
|
||||
// m_TextEdit = ui.m_TextEdit;
|
||||
m_PrintDisplay = ui.widgetPrintTextDisplay;
|
||||
m_CloseBtn = ui.m_CloseBtn;
|
||||
m_StopBtn = ui.m_StopBtn;
|
||||
@@ -170,12 +169,23 @@ void MySleep(unsigned int msec)
|
||||
|
||||
}
|
||||
|
||||
void MainWidget::bindTxTEdit(QTextEdit* textEdit){
|
||||
m_textEdit = textEdit;
|
||||
}
|
||||
bool MainWidget::generatePrintContent(PicScene *scene)
|
||||
{
|
||||
if(!scene) {
|
||||
qWarning() << "Scene is empty!";
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWidget::bindPicScene(PicScene* pPicScene){
|
||||
this->pPicScene = pPicScene;
|
||||
if(this->pPicScene) {
|
||||
pPicScene->deleteLater();
|
||||
pPicScene = nullptr;
|
||||
}
|
||||
|
||||
this->pPicScene = scene;
|
||||
onPreviewScene();
|
||||
|
||||
// SendPrintDataToFpga(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::bindSysPara(SysPara *sysPara){
|
||||
@@ -739,7 +749,7 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
/******2020/2/29*****/
|
||||
if(sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER) //同步模式下,判断喷印间隔是否设置合理
|
||||
{
|
||||
QSizeF size = m_textEdit->document()->size();
|
||||
QSizeF size = QSizeF(sysPara->status.currPrintCol, sysPara->status.currPrintRow);
|
||||
float stroke,print_len_min;
|
||||
stroke = sysPara->para.printColDelay/sysPara->para.synPulseNumPerMm;
|
||||
print_len_min = stroke * size.width();
|
||||
@@ -897,7 +907,7 @@ void MainWidget::SendPrintDataToFpga(unsigned char alterMode, int startCol, int
|
||||
Q_UNUSED(alterMode);
|
||||
|
||||
// 看清楚,最后取反,也就是说,如果不是局部更新,则写入打印设置和变量控制
|
||||
if(!(startCol >= 0 && size > 0 && size - startCol >= 1)) {
|
||||
if(!(startCol >= 0 && size > 0)) {
|
||||
sysPara->devOp->writeFpgaPrintPara(1);
|
||||
sysPara->devOp->writeFpgaVariCtrl();
|
||||
startCol = 0;
|
||||
@@ -1815,6 +1825,11 @@ int MainWidget::getMaxSpeedCalcPara(){
|
||||
void MainWidget::onPreviewScene()
|
||||
{
|
||||
sysPara->para.EditMode = SCENE;
|
||||
|
||||
if(!pPicScene) {
|
||||
return;
|
||||
}
|
||||
|
||||
pPicScene->clearSelection();
|
||||
|
||||
QRect sceneRect = pPicScene->itemsBoundingRect().toRect();
|
||||
@@ -2364,15 +2379,17 @@ void MainWidget::handleEmptySize()
|
||||
// 初始化空场景的尺寸(默认适配打印最大尺寸,避免界面空白)
|
||||
bool MaxCol4000 = sysPara->status.flagOfNo67FPGA ? true : false;
|
||||
QSize emptySize(MaxCol4000 ? MAX_PRINT_COL_NUM_Normal : MAX_PRINT_COL_NUM_Wide, MAX_PRINT_ROW_NUM);
|
||||
QImage emptyImage(emptySize, QImage::Format_ARGB32);
|
||||
emptyImage.fill(0x00ffffff); // 填充白色背景,与正常场景渲染一致
|
||||
QPainter emptyPainter(&emptyImage);
|
||||
pPicScene->render(&emptyPainter, QRectF(), QRectF(0, 0, emptySize.width(), emptySize.height()));
|
||||
|
||||
// 不是,渲染这个有什么用处吗?byons@2026年7月21日
|
||||
// QImage emptyImage(emptySize, QImage::Format_ARGB32);
|
||||
// emptyImage.fill(0x00ffffff); // 填充白色背景,与正常场景渲染一致
|
||||
// QPainter emptyPainter(&emptyImage);
|
||||
// pPicScene->render(&emptyPainter, QRectF(), QRectF(0, 0, emptySize.width(), emptySize.height()));
|
||||
|
||||
// 初始化打印参数,避免空场景导致的参数异常
|
||||
previewFlag = 1;
|
||||
sysPara->status.currPrintRow = 0;
|
||||
sysPara->status.currPrintCol = emptySize.width();
|
||||
sysPara->status.currPrintCol = 0; // emptySize.width();
|
||||
sysPara->status.variNum = 0;
|
||||
sysPara->status.QRvariNum = 0;
|
||||
sysPara->status.ExpiryVarNum = 0;
|
||||
|
||||
+14
-5
@@ -39,9 +39,20 @@ public:
|
||||
|
||||
void bindSysPara(SysPara *SysPara);
|
||||
|
||||
void bindTxTEdit(QTextEdit* textEdit);
|
||||
void bindPicScene(PicScene* pPicScene);
|
||||
/**
|
||||
* @brief 生成打印内容,并发送打印内容到 FPGA
|
||||
*
|
||||
* @param pPicScene 包含打印内容的场景
|
||||
* @return 成功返回true,否则false,查看日志
|
||||
*/
|
||||
bool generatePrintContent(PicScene* pPicScene);
|
||||
|
||||
/**
|
||||
* @brief 重新生成打印内容,所用场景是由调用 generatePrintContent 时设置的,generatePrintContent 也会调用此函数
|
||||
*
|
||||
*/
|
||||
void onPreviewScene();
|
||||
|
||||
// 260420 hlp:场景为空时,渲染空场景并刷新界面
|
||||
void handleEmptySize();
|
||||
|
||||
@@ -132,7 +143,6 @@ private:
|
||||
QPushButton* m_MainBtn;
|
||||
QPushButton* m_ManageBtn;
|
||||
QPushButton* m_MsgBtn;
|
||||
QTextEdit* m_TextEdit;
|
||||
QPushButton* m_CloseBtn;
|
||||
QPushButton* m_StopBtn;
|
||||
QPushButton* m_StartBtn;
|
||||
@@ -143,11 +153,10 @@ private:
|
||||
|
||||
|
||||
bool previewFlag;
|
||||
QTextEdit* m_textEdit;
|
||||
int r_ExpiryDay;
|
||||
QTimer *airPushTimer;
|
||||
|
||||
PicScene *pPicScene;
|
||||
PicScene *pPicScene = nullptr;
|
||||
QGraphicsView *view;
|
||||
|
||||
FileManageWidget *m_fileManageWidget = nullptr;
|
||||
|
||||
@@ -1249,15 +1249,17 @@ void RFIDManager::slt_intervalTimerHandle()
|
||||
emit sig_showMsg(tr("请及时使用溶剂盒附带的IC卡激活溶剂盒"));
|
||||
status.firstPromptSolventCard = false;
|
||||
}
|
||||
|
||||
|
||||
//不需要通知先后,成功即可
|
||||
auto res = waitStatus();
|
||||
if (res == 1) {
|
||||
LogInfo::setRunStatusText("Ink progress finished, and the ink card has been used.");
|
||||
emit sig_inkCardProgressFinished();
|
||||
return;
|
||||
}
|
||||
if (res == 2) {
|
||||
LogInfo::setRunStatusText("Solvent progress finished, and the solvent card has been used.");
|
||||
emit sig_solventProgressFinished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,13 @@ signals:
|
||||
|
||||
void sig_maintenanceShow();
|
||||
|
||||
// 墨水流程已完成,(墨水、刷卡均已完成)
|
||||
void sig_inkCardProgressFinished();
|
||||
|
||||
// 溶剂流程已完成
|
||||
void sig_solventProgressFinished();
|
||||
|
||||
|
||||
private slots:
|
||||
//接收刷卡数据槽函数
|
||||
void slt_readRFIDData();
|
||||
|
||||
+13
-87
@@ -8,34 +8,13 @@
|
||||
#include "DlgQrcodeFormat.h"
|
||||
|
||||
// 使用SysPara的相关参数构造CounterEditorVM
|
||||
CounterEditorVM makeCounterVM(SysPara* sysPara, COUNTER_TYPE type, int digitalNum)
|
||||
CounterEditorVM makeCounterVM(COUNTER_TYPE type, int digitalNum, const CounterSettings& cnt1Settings, const CounterSettings& cnt2Settings)
|
||||
{
|
||||
CounterEditorVM vm;
|
||||
if(!sysPara)
|
||||
return vm;
|
||||
|
||||
vm.counterType = type;
|
||||
vm.digitalNum = digitalNum;
|
||||
|
||||
auto& cnt1 = vm.counter1;
|
||||
cnt1.startValue = sysPara->para.cnt1StartValue;
|
||||
cnt1.endValue = sysPara->para.cnt1EndValue;
|
||||
cnt1.repeatValue = sysPara->para.cnt1RepeateValue;
|
||||
cnt1.stepValue = sysPara->para.cnt1StepValue;
|
||||
cnt1.currValue = sysPara->para.cnt1CurrValue;
|
||||
// cnt1CurrentValueInitDoneFlag 与 checkBoxResetCnt1CurrValue 的勾选互为反向
|
||||
cnt1.editCurrValue = !sysPara->status.cnt1CurrentValueInitDoneFlag;
|
||||
cnt1.eleEyeIncEn = (sysPara->para.eleEyeClearCntInSynMode & 0x10) != 0;
|
||||
|
||||
auto& cnt2 = vm.counter2;
|
||||
cnt2.startValue = sysPara->para.cnt2StartValue;
|
||||
cnt2.endValue = sysPara->para.cnt2EndValue;
|
||||
cnt2.repeatValue = sysPara->para.cnt2RepeateValue;
|
||||
cnt2.stepValue = sysPara->para.cnt2StepValue;
|
||||
cnt2.currValue = sysPara->para.cnt2CurrValue;
|
||||
cnt2.editCurrValue = !sysPara->status.cnt2CurrentValueInitDoneFlag;
|
||||
cnt2.eleEyeIncEn = (sysPara->para.eleEyeClearCntInSynMode & 0x20) != 0;
|
||||
|
||||
vm.counter1 = cnt1Settings;
|
||||
vm.counter2 = cnt2Settings;
|
||||
return vm;
|
||||
}
|
||||
|
||||
@@ -90,15 +69,6 @@ BarcodeEditor::~BarcodeEditor()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BarcodeEditor::bindSysPara(SysPara *sysPara)
|
||||
{
|
||||
if (!sysPara) {
|
||||
qWarning() << "BarcodeEditor::bindSysPara: null pointer passed, ignored";
|
||||
return;
|
||||
}
|
||||
m_sysPara = sysPara;
|
||||
}
|
||||
|
||||
void BarcodeEditor::bindViewModel(const BarcodeViewModel &vm)
|
||||
{
|
||||
m_vm = vm;
|
||||
@@ -171,9 +141,11 @@ void BarcodeEditor::bindViewModel(const BarcodeViewModel &vm)
|
||||
if(ui->tabWidget->indexOf(m_counterEditor) == -1) {
|
||||
ui->tabWidget->addTab(m_counterEditor, tr(u8"计数器"));
|
||||
}
|
||||
m_counterEditor->setViewModel(makeCounterVM(m_sysPara,
|
||||
m_counterEditor->setViewModel(makeCounterVM(
|
||||
static_cast<COUNTER_TYPE>(m_vm.counterViewModel.counterType),
|
||||
m_vm.counterViewModel.digitalNum));
|
||||
m_vm.counterViewModel.digitalNum,
|
||||
m_vm.counterViewModel.cnt1Settings,
|
||||
m_vm.counterViewModel.cnt2Settings));
|
||||
m_counterEditor->setFixedSize(ui->tabBarcode->size());
|
||||
}
|
||||
else {
|
||||
@@ -226,6 +198,8 @@ BarcodeViewModel BarcodeEditor::viewModel()
|
||||
CounterEditorVM cnt = m_counterEditor->viewModel();
|
||||
m_vm.counterViewModel.counterType = cnt.counterType;
|
||||
m_vm.counterViewModel.digitalNum = cnt.digitalNum;
|
||||
m_vm.counterViewModel.cnt1Settings = cnt.counter1;
|
||||
m_vm.counterViewModel.cnt2Settings = cnt.counter2;
|
||||
}
|
||||
|
||||
return m_vm;
|
||||
@@ -242,53 +216,6 @@ void BarcodeEditor::restoreViewModel()
|
||||
bindViewModel(m_vm);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 逻辑基本类似 CounterVarSet::applyUIPara
|
||||
*
|
||||
*/
|
||||
void BarcodeEditor::applyCounterConfigToSysPara()
|
||||
{
|
||||
if(!m_vm.contentPattern.contains("{c}"))
|
||||
return;
|
||||
|
||||
if (!m_sysPara) {
|
||||
qWarning() << "BarcodeEditor::applyCounterConfigToSysPara: m_sysPara is null, skipping";
|
||||
return;
|
||||
}
|
||||
|
||||
CounterEditorVM cnt = m_counterEditor->viewModel();
|
||||
if(cnt.counterType == COUNTER_TYPE_1) {
|
||||
m_sysPara->para.cnt1StartValue = cnt.counter1.startValue;
|
||||
m_sysPara->para.cnt1EndValue = cnt.counter1.endValue;
|
||||
m_sysPara->para.cnt1RepeateValue = cnt.counter1.repeatValue;
|
||||
m_sysPara->para.cnt1StepValue = cnt.counter1.stepValue;
|
||||
m_sysPara->para.cnt1CurrValue = cnt.counter1.currValue;
|
||||
m_sysPara->status.cnt1CurrentValueInitDoneFlag = cnt.counter1.editCurrValue;
|
||||
|
||||
if(cnt.counter1.eleEyeIncEn)
|
||||
m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1
|
||||
else
|
||||
m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode & 0xef); // CNT1 = current
|
||||
|
||||
}
|
||||
else if(cnt.counterType == COUNTER_TYPE_2) {
|
||||
m_sysPara->para.cnt2StartValue = cnt.counter2.startValue;
|
||||
m_sysPara->para.cnt2EndValue = cnt.counter2.endValue;
|
||||
m_sysPara->para.cnt2RepeateValue = cnt.counter2.repeatValue;
|
||||
m_sysPara->para.cnt2StepValue = cnt.counter2.stepValue;
|
||||
m_sysPara->para.cnt2CurrValue = cnt.counter2.currValue;
|
||||
m_sysPara->status.cnt2CurrentValueInitDoneFlag = cnt.counter2.editCurrValue;
|
||||
|
||||
if(cnt.counter2.eleEyeIncEn)
|
||||
m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1
|
||||
else
|
||||
m_sysPara->para.eleEyeClearCntInSynMode = (m_sysPara->para.eleEyeClearCntInSynMode & 0xdf); // CNT2 = current
|
||||
}
|
||||
|
||||
if(m_sysPara->devOp)
|
||||
m_sysPara->devOp->writeFpgaCalandar(0);
|
||||
}
|
||||
|
||||
void BarcodeEditor::onBtnFormatClicked()
|
||||
{
|
||||
if(m_vm.type == BARCODE_TYPE_BARCODE) {
|
||||
@@ -330,7 +257,6 @@ void BarcodeEditor::onBtnCounterClicked()
|
||||
void BarcodeEditor::onCheckBtnClicked()
|
||||
{
|
||||
m_vm = viewModel();
|
||||
applyCounterConfigToSysPara();
|
||||
emit accepted();
|
||||
hide();
|
||||
}
|
||||
@@ -466,11 +392,11 @@ void BarcodeEditor::onContentChanged(QString content)
|
||||
else {
|
||||
if(ui->tabWidget->indexOf(m_counterEditor) == -1) {
|
||||
ui->tabWidget->addTab(m_counterEditor, tr(u8"计数器"));
|
||||
if(m_sysPara) {
|
||||
m_counterEditor->setViewModel(makeCounterVM(m_sysPara,
|
||||
m_counterEditor->setViewModel(makeCounterVM(
|
||||
static_cast<COUNTER_TYPE>(m_vm.counterViewModel.counterType),
|
||||
m_vm.counterViewModel.digitalNum));
|
||||
}
|
||||
m_vm.counterViewModel.digitalNum,
|
||||
m_vm.counterViewModel.cnt1Settings,
|
||||
m_vm.counterViewModel.cnt2Settings));
|
||||
}
|
||||
m_counterEditor->setFixedSize(ui->tabBarcode->size());
|
||||
}
|
||||
|
||||
@@ -94,19 +94,6 @@ public:
|
||||
explicit BarcodeEditor(QWidget *parent = nullptr);
|
||||
~BarcodeEditor();
|
||||
|
||||
/**
|
||||
* @brief 绑定系统参数
|
||||
*
|
||||
* 计数器配置选项卡所需的各个计数器的配置通过此方式提供;
|
||||
* @note
|
||||
* BarcodeEditor 将在 @see bindViewModel 中读取 sysPara->para.cnt1*** 或 sysPara->para.cnt2*** 相关参数,并在用户点击确认按钮时修改它们。
|
||||
*
|
||||
* @remark 沿用的是旧逻辑
|
||||
*
|
||||
* @param sysPara
|
||||
*/
|
||||
void bindSysPara(SysPara* sysPara);
|
||||
|
||||
/**
|
||||
* @brief 注入条形码视图模型(纯结构体,按值拷贝)
|
||||
*
|
||||
|
||||
@@ -31,6 +31,8 @@ struct CounterEditorVM {
|
||||
CounterSlot counter1, counter2;
|
||||
};
|
||||
|
||||
using CounterSettings = CounterEditorVM::CounterSlot;
|
||||
|
||||
class CounterEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "SysPara.h"
|
||||
#include <QMap>
|
||||
#include <QXmlStreamAttributes>
|
||||
#include "CounterEditor.h"
|
||||
|
||||
enum InkType {
|
||||
INK_TYPE_BLACK,
|
||||
@@ -34,6 +35,10 @@ struct CounterViewModel {
|
||||
int charWidth = 0; // 字符宽度,仅在 enbCustomCharWidth == true 时有意义
|
||||
bool enbCustomCharWidth = false;
|
||||
|
||||
CounterSettings cnt1Settings;
|
||||
|
||||
CounterSettings cnt2Settings;
|
||||
|
||||
static void loadFromXml(CounterViewModel& vm, const QXmlStreamAttributes& attrs);
|
||||
static void saveToXml(CounterViewModel& vm, QXmlStreamAttributes& attrs);
|
||||
};
|
||||
|
||||
+99
-199
@@ -2,7 +2,6 @@
|
||||
#include <QDebug>
|
||||
#include <QIcon>
|
||||
#include <QFile>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <QMessageBox>
|
||||
@@ -45,14 +44,7 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
// m_ButtonGroup->addButton(ui.btnList, 7);
|
||||
|
||||
dialogSaveFile =new DialogSaveFile(0);
|
||||
connect(dialogSaveFile,SIGNAL(returnMainWidget(int)),this,SIGNAL(sendButtonClickedSignal(int)));
|
||||
|
||||
dialogFileOperation = new DialogFileOperation(0);
|
||||
connect(dialogFileOperation,SIGNAL(openFile(QString,bool)),this,SLOT(onFileOpen(QString,bool)));
|
||||
|
||||
m_CreateImageFlag = false;
|
||||
m_pSavePicScene = new QGraphicsScene();
|
||||
m_pSavePicScene->setSceneRect(QRectF(0, 0, 3200, MAX_PRINT_ROW_NUM)); //生成图片的场景
|
||||
// connect(dialogSaveFile,SIGNAL(returnMainWidget(int)),this,SIGNAL(sendButtonClickedSignal(int)));
|
||||
|
||||
editMode = SCENE;
|
||||
|
||||
@@ -99,8 +91,13 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
connect(ui.btnSave, &QPushButton::clicked, this, &TestPrintWidget::on_saveButton_pressed);
|
||||
|
||||
connect(ui.btnListConfig, &QPushButton::clicked, [this]() {
|
||||
|
||||
if(m_printSetting) {
|
||||
m_printSetting->setModel(m_printSettingModel);
|
||||
}
|
||||
|
||||
emit sendButtonClickedSignal(9);
|
||||
});
|
||||
});
|
||||
|
||||
connect(ui.btnItemConfig, &QPushButton::clicked, this, &TestPrintWidget::onBtnItemConfigClicked);
|
||||
|
||||
@@ -158,12 +155,23 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
vm.counterType = COUNTER_TYPE_1;
|
||||
vm.digitalNum = 2;
|
||||
vm.letterSpace = ls;
|
||||
vm.cnt1Settings = m_printSettingModel.cnt1Settings;
|
||||
vm.cnt2Settings = m_printSettingModel.cnt2Settings;
|
||||
emit sig_showEditCounter(vm);
|
||||
});
|
||||
|
||||
connect(ui.btnBarcode, &QPushButton::clicked, [this](){
|
||||
pPicScene->clearSelection();
|
||||
showBarcodeEditor();
|
||||
BarcodeViewModel vm;
|
||||
vm.generalSettingsVM = TextItemModel();
|
||||
vm.contentPattern = "";
|
||||
vm.counterViewModel = CounterViewModel();
|
||||
vm.dateViewModel = DateItemModel::createDefaultReplaceModel();
|
||||
vm.type = BARCODE_TYPE_BARCODE;
|
||||
vm.format.setValue(DlgBarcodeFormatVM());
|
||||
vm.counterViewModel.cnt1Settings = m_printSettingModel.cnt1Settings;
|
||||
vm.counterViewModel.cnt2Settings = m_printSettingModel.cnt2Settings;
|
||||
showBarcodeEditor(vm);
|
||||
});
|
||||
|
||||
// X,Y label connection
|
||||
@@ -177,13 +185,15 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
|
||||
if (ret == QMessageBox::Ok){
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
|
||||
dialogSaveFile->saveLastWork();
|
||||
emit sig_updatePrintContent();
|
||||
} else {
|
||||
dialogFileOperation->openLastWork();
|
||||
if(xmlfileName.isEmpty()) {
|
||||
on_saveButton_pressed();
|
||||
} else {
|
||||
saveFile();
|
||||
}
|
||||
|
||||
emit sig_updatePrintContent(xmlfileName);
|
||||
}
|
||||
|
||||
emit sendButtonClickedSignal(20);
|
||||
});
|
||||
|
||||
@@ -197,7 +207,6 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
connect(&m_barcodeEditor, &BarcodeEditor::accepted, this, &TestPrintWidget::slt_BarCodeItemDone);
|
||||
|
||||
m_LineEdit->setProperty("Enter replace enter", true);
|
||||
connect(m_LineEdit, &QLineEdit::returnPressed, this, &TestPrintWidget::onLineEditReturnPressed);
|
||||
|
||||
m_LineEdit->installEventFilter(this);
|
||||
|
||||
@@ -208,20 +217,12 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
void TestPrintWidget::bindSysPara(SysPara *sysPara)
|
||||
{
|
||||
this->sysPara = sysPara;
|
||||
|
||||
// 它需要这个
|
||||
m_barcodeEditor.bindSysPara(sysPara);
|
||||
}
|
||||
|
||||
TestPrintWidget::~TestPrintWidget()
|
||||
{
|
||||
m_LineEdit->removeEventFilter(this);
|
||||
|
||||
if(m_pSavePicScene)
|
||||
{
|
||||
delete m_pSavePicScene;
|
||||
m_pSavePicScene = nullptr;
|
||||
}
|
||||
if(m_TextEdit){
|
||||
delete m_TextEdit;
|
||||
m_TextEdit = nullptr;
|
||||
@@ -234,30 +235,6 @@ TestPrintWidget::~TestPrintWidget()
|
||||
|
||||
}
|
||||
|
||||
void TestPrintWidget::loadLastWork()
|
||||
{
|
||||
if (dialogFileOperation) {
|
||||
dialogFileOperation->openLastWork();
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap TestPrintWidget::loadIcon(const QString& iconName, const QSize& size)
|
||||
{
|
||||
QString iconPath = QString(":/icons/res/icons/%1.png").arg(iconName);
|
||||
QPixmap pixmap(iconPath);
|
||||
return pixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_openfileButton_pressed()
|
||||
{
|
||||
pPicScene->clearSelection();
|
||||
pPicScene->clearFocus();
|
||||
if (dialogFileOperation) {
|
||||
dialogFileOperation->refreshListView(editMode);
|
||||
dialogFileOperation->exec();
|
||||
}
|
||||
}
|
||||
|
||||
void TestPrintWidget::addDateItem()
|
||||
{
|
||||
pPicScene->clearSelection();
|
||||
@@ -289,7 +266,6 @@ void TestPrintWidget::on_enlargeButton_pressed()
|
||||
|
||||
void TestPrintWidget::on_addButton_pressed(const SourceType type)
|
||||
{
|
||||
addItemFlag = false;
|
||||
m_LineEdit->setEnabled(true);
|
||||
m_LineEdit->setText("");
|
||||
pPicScene->clearSelection();
|
||||
@@ -308,8 +284,6 @@ void TestPrintWidget::on_addButton_pressed(const SourceType type)
|
||||
// ui->saveButton->setEnabled(true);
|
||||
textItem->setPlainText("");
|
||||
textItem->setSelected(true);
|
||||
|
||||
addItemFlag = true;
|
||||
}
|
||||
|
||||
void TestPrintWidget::onEditItemDone()
|
||||
@@ -395,137 +369,71 @@ void TestPrintWidget::getShowSelectItemText()
|
||||
void TestPrintWidget::on_saveButton_pressed()
|
||||
{
|
||||
pPicScene->clearSelection();
|
||||
if(xmlfileName.isEmpty() || xmlfileName.contains("LastWork.xml"))
|
||||
if(xmlfileName.isEmpty())
|
||||
{
|
||||
qDebug()<<"xml file null";
|
||||
#ifdef MYSAVEFILEDLG
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
|
||||
dialogSaveFile->refreshListView(editMode);
|
||||
dialogSaveFile->show();
|
||||
dialogSaveFile->refreshListView(SCENE);
|
||||
dialogSaveFile->setEnterFileName("");
|
||||
auto ret = dialogSaveFile->exec();
|
||||
|
||||
if(ret == QDialog::Accepted) {
|
||||
auto filename = dialogSaveFile->filename();
|
||||
if(!filename.endsWith(".xml",Qt::CaseInsensitive))
|
||||
filename += ".xml";
|
||||
|
||||
saveFile(filename);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
pPicScene->update();
|
||||
saveFile();
|
||||
if(sysPara){
|
||||
sysPara->sysFile =xmlfileName;
|
||||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||||
}
|
||||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||||
// ui->saveButton->setEnabled(false);
|
||||
// emit fileNameChanged(QFileInfo(xmlfileName).fileName());
|
||||
}
|
||||
}
|
||||
|
||||
void TestPrintWidget::saveFile()
|
||||
void TestPrintWidget::saveFile(const QString& filename)
|
||||
{
|
||||
if (m_printSetting) {
|
||||
auto model = m_printSetting->model();
|
||||
PicSceneLoader::saveSceneToXmlFile(xmlfileName, pPicScene, &model);
|
||||
} else {
|
||||
PicSceneLoader::saveSceneToXmlFile(xmlfileName, pPicScene, nullptr);
|
||||
}
|
||||
auto fn = filename.isEmpty() ? xmlfileName : filename;
|
||||
PicSceneLoader::saveSceneToXmlFile(fn, pPicScene, &m_printSettingModel);
|
||||
}
|
||||
|
||||
void TestPrintWidget::onSaveASFile(QString filename,bool Flag){// use for dialogSaveFile class
|
||||
void TestPrintWidget::onSaveASFile(QString filename,bool Flag)
|
||||
{// use for dialogSaveFile class
|
||||
qDebug()<<filename;
|
||||
xmlfileName = filename;
|
||||
if(!filename.endsWith(".xml",Qt::CaseInsensitive))
|
||||
xmlfileName += ".xml";
|
||||
|
||||
saveFile();
|
||||
if(sysPara){
|
||||
sysPara->sysFile = xmlfileName;
|
||||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||||
}
|
||||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",xmlfileName.toLatin1().constData());
|
||||
// ui->saveButton->setEnabled(false);
|
||||
// emit fileNameChanged(QFileInfo(xmlfileName).fileName());
|
||||
}
|
||||
|
||||
/*
|
||||
* 和DialogFileOperation对接
|
||||
* */
|
||||
void TestPrintWidget::onFileOpen(QString filePath,bool reviewFlag){
|
||||
void TestPrintWidget::openWorkFile(QString filePath){
|
||||
|
||||
if(editMode != SCENE || !filePath.endsWith(".xml")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(reviewFlag) {
|
||||
xmlfileName = filePath;
|
||||
}
|
||||
|
||||
pViewer->viewport()->update();
|
||||
unsigned char SpecialVarEnable = 0;
|
||||
if (sysPara) {
|
||||
sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1);
|
||||
}
|
||||
|
||||
PrintSettingModel loadedPrintSetting;
|
||||
bool ok = PicSceneLoader::loadSceneFromFile(filePath,
|
||||
pPicScene,
|
||||
reviewFlag ? &loadedPrintSetting : nullptr);
|
||||
bool ok = PicSceneLoader::loadSceneFromFile(filePath, pPicScene, &m_printSettingModel);
|
||||
if(!ok) {
|
||||
qWarning() << "Failed to load file:" << filePath;
|
||||
return;
|
||||
}
|
||||
|
||||
if(reviewFlag && m_printSetting) {
|
||||
m_printSetting->setModel(loadedPrintSetting);
|
||||
m_printSetting->applyPrintSettingsToSysPara(false);
|
||||
xmlfileName = filePath;
|
||||
|
||||
if(m_printSetting) {
|
||||
m_printSetting->setModel(m_printSettingModel);
|
||||
}
|
||||
|
||||
if(sysPara)
|
||||
{
|
||||
sysPara->sysFile = filePath;
|
||||
sysPara->loadParaFromFile();
|
||||
snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData());
|
||||
}
|
||||
|
||||
// 主动暂停打印
|
||||
if(reviewFlag) {
|
||||
emit sig_stopPrint();
|
||||
|
||||
// xmlfileName 会被 saveLastWork 更改,因此此处暂存变量, 在执行后恢复
|
||||
qDebug() << "xmlfileName:" << xmlfileName;
|
||||
auto filename = xmlfileName;
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)), Qt::DirectConnection);
|
||||
dialogSaveFile->saveLastWork();
|
||||
xmlfileName = filename;
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
}
|
||||
|
||||
emit sendButtonClickedSignal(20); //打开文件完成跳转到主窗口
|
||||
}
|
||||
|
||||
void TestPrintWidget::addCodeItem(QString str)
|
||||
{
|
||||
addItemFlag = false;
|
||||
m_LineEdit->setEnabled(true);
|
||||
m_LineEdit->setText("");
|
||||
pPicScene->clearSelection();
|
||||
codeItem_Operation = new PicCodeItem(0, 0, SourceType::CODE);
|
||||
codeItem_Operation->setSource(str);
|
||||
pPicScene->addItem(codeItem_Operation);
|
||||
|
||||
QList<QGraphicsItem *> items = pPicScene->items();
|
||||
if(pPicScene->items().count()>1){
|
||||
QRectF itemRect= items.at(1)->boundingRect();
|
||||
codeItem_Operation->setPos( items.at(1)->scenePos().x()+itemRect.width()+20, items.at(1)->scenePos().y());
|
||||
}
|
||||
else
|
||||
codeItem_Operation->setPos(this->pViewer->mapToScene(0,0));//edit@12-07
|
||||
|
||||
codeItem_Operation->setPlainText("");
|
||||
codeItem_Operation->setSelected(true);
|
||||
|
||||
addItemFlag = true;
|
||||
|
||||
qDebug() << "xmlfileName:" << xmlfileName;
|
||||
}
|
||||
|
||||
int TestPrintWidget::checkSelectScene()
|
||||
@@ -713,26 +621,14 @@ void TestPrintWidget::setPrintSettingWidget(PrintSetting *wid)
|
||||
|
||||
m_printSetting = wid;
|
||||
connect(m_printSetting, &PrintSetting::sendButtonClickedSignal, this, [this](int i) {
|
||||
if(i == 2) {
|
||||
saveFile();
|
||||
LogInfo::setRunStatusText("Save print setting.");
|
||||
if(i == 2 && !m_printSetting->isDefaultSettingMode()) {
|
||||
m_printSettingModel = m_printSetting->model();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool TestPrintWidget::eventFilter(QObject *watched, QEvent *event) {
|
||||
// 只处理 graphicsView 的事件
|
||||
if (watched == ui.graphicsView) {
|
||||
// 处理鼠标点击事件
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
|
||||
std::cout<<"MouseButtonPress"<<std::endl;
|
||||
// 返回 true 表示事件已处理,不再传递
|
||||
// 返回 false 表示继续传递事件
|
||||
return false; // 通常让事件继续传递,以便Item也能收到事件
|
||||
}
|
||||
}
|
||||
|
||||
bool TestPrintWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == m_LineEdit) {
|
||||
if(event->type() == QEvent::FocusOut) {
|
||||
onEditItemDone();
|
||||
@@ -807,6 +703,8 @@ void TestPrintWidget::onBtnItemConfigClicked()
|
||||
vm.letterSpace = counterItem->letterSpace();
|
||||
vm.enbCustomCharWidth = false;
|
||||
vm.charWidth = counterItem->charWidth();
|
||||
vm.cnt1Settings = m_printSettingModel.cnt1Settings;
|
||||
vm.cnt2Settings = m_printSettingModel.cnt2Settings;
|
||||
emit sig_showEditCounter(vm);
|
||||
}
|
||||
return;
|
||||
@@ -843,8 +741,10 @@ void TestPrintWidget::onBtnItemConfigClicked()
|
||||
if(!codeItem)
|
||||
return;
|
||||
|
||||
m_barcodeEditor.bindViewModel(codeItem->barcodeViewModel());
|
||||
showBarcodeEditor(false);
|
||||
auto vm = codeItem->barcodeViewModel();
|
||||
vm.counterViewModel.cnt1Settings = m_printSettingModel.cnt1Settings;
|
||||
vm.counterViewModel.cnt2Settings = m_printSettingModel.cnt2Settings;
|
||||
showBarcodeEditor(vm);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -884,46 +784,51 @@ void TestPrintWidget::on_newfileButton_pressed()
|
||||
xmlfileName = "";
|
||||
|
||||
if (sysPara) {
|
||||
PrintSettingModel defModel = PrintSettingModel::defPrintSettingModel();
|
||||
PrintSettingModel::applyToSysPara(defModel, sysPara);
|
||||
m_printSettingModel = PrintSettingModel::defPrintSettingModel();
|
||||
if(m_printSetting)
|
||||
m_printSetting->setModel(defModel);
|
||||
m_printSetting->setModel(m_printSettingModel);
|
||||
}
|
||||
|
||||
sendButtonClickedSignal(21); //新建文件完成
|
||||
emit sig_currentFileChanged();
|
||||
}
|
||||
|
||||
void TestPrintWidget::slt_BarCodeItemDone()
|
||||
{
|
||||
auto vm = m_barcodeEditor.viewModel();
|
||||
|
||||
// 如果当前选中了一个条形码或二维码,则更新其内容,然后直接返回
|
||||
bool flag = false;
|
||||
auto selectedItem = pPicScene->selectedItems();
|
||||
for(auto item : selectedItem) {
|
||||
auto codeItem = dynamic_cast<PicCodeItem*>(item);
|
||||
if(codeItem) {
|
||||
codeItem->setBarcodeViewModel(vm);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag)
|
||||
return;
|
||||
|
||||
if(vm.contentPattern.isEmpty()) {
|
||||
qInfo() << "Empty content pattern, the barcode will not be generated.";
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加条形码或验证码
|
||||
pPicScene->clearSelection();
|
||||
PicCodeItem* item = new PicCodeItem(0, 0, SourceType::CODE);
|
||||
item->setBarcodeViewModel(vm);
|
||||
auto boundingRect = pPicScene->itemsBoundingRect();
|
||||
pPicScene->addItem(item);
|
||||
item->setPos(boundingRect.right(), 0.0);
|
||||
item->setSelected(true);
|
||||
PicCodeItem* codeItem = nullptr;
|
||||
|
||||
// 如果当前选中了一个条形码或二维码,则更新其内容,然后直接返回
|
||||
bool flag = false;
|
||||
auto selectedItem = pPicScene->selectedItems();
|
||||
for(auto item : selectedItem) {
|
||||
codeItem = dynamic_cast<PicCodeItem*>(item);
|
||||
if(codeItem)
|
||||
break;
|
||||
}
|
||||
|
||||
if(!codeItem) {
|
||||
// 添加条形码或二维码
|
||||
pPicScene->clearSelection();
|
||||
codeItem = new PicCodeItem(0, 0, SourceType::CODE);
|
||||
auto boundingRect = pPicScene->itemsBoundingRect();
|
||||
pPicScene->addItem(codeItem);
|
||||
codeItem->setPos(boundingRect.right(), 0.0);
|
||||
}
|
||||
|
||||
codeItem->setBarcodeViewModel(vm);
|
||||
codeItem->setSelected(true);
|
||||
|
||||
m_printSettingModel.cnt1Settings = vm.counterViewModel.cnt1Settings;
|
||||
m_printSettingModel.cnt2Settings = vm.counterViewModel.cnt2Settings;
|
||||
|
||||
if(m_printSetting)
|
||||
m_printSetting->setModel(m_printSettingModel);
|
||||
}
|
||||
|
||||
QGraphicsItem* findClosestItemToViewCenter(QGraphicsView* view)
|
||||
@@ -1017,16 +922,6 @@ void TestPrintWidget::selectPreviousItem()
|
||||
selectItemByDirection(false);
|
||||
}
|
||||
|
||||
void TestPrintWidget::onLineEditReturnPressed()
|
||||
{
|
||||
if(pPicScene->selectedItems().size() != 0) {
|
||||
qDebug() << "Change current item text";
|
||||
}
|
||||
else {
|
||||
qDebug() << "Add new item text";
|
||||
}
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_cbResolution_currentIndexChanged(int index)
|
||||
{
|
||||
constexpr char* IdxToFontFamily[] = {"WenQuanYi5",
|
||||
@@ -1147,6 +1042,9 @@ void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont>
|
||||
if(vm.enbCustomCharWidth) {
|
||||
counterItem->setCharWidth(vm.charWidth);
|
||||
}
|
||||
|
||||
m_printSettingModel.cnt1Settings = vm.cnt1Settings;
|
||||
m_printSettingModel.cnt2Settings = vm.cnt2Settings;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1167,6 +1065,9 @@ void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont>
|
||||
if(vm.enbCustomCharWidth) {
|
||||
item->setCharWidth(vm.charWidth);
|
||||
}
|
||||
|
||||
m_printSettingModel.cnt1Settings = vm.cnt1Settings;
|
||||
m_printSettingModel.cnt2Settings = vm.cnt2Settings;
|
||||
}
|
||||
|
||||
QString TestPrintWidget::currentFile()
|
||||
@@ -1174,14 +1075,13 @@ QString TestPrintWidget::currentFile()
|
||||
return xmlfileName;
|
||||
}
|
||||
|
||||
void TestPrintWidget::showBarcodeEditor(bool restoreViewModel)
|
||||
void TestPrintWidget::showBarcodeEditor(const BarcodeViewModel& vm)
|
||||
{
|
||||
#if defined(ARCH_AARCH64)
|
||||
m_barcodeEditor.setWindowState(Qt::WindowFullScreen);
|
||||
#endif
|
||||
if(restoreViewModel)
|
||||
m_barcodeEditor.restoreViewModel();
|
||||
|
||||
m_barcodeEditor.bindViewModel(vm);
|
||||
m_barcodeEditor.setWindowModality(Qt::WindowModal);
|
||||
m_barcodeEditor.show();
|
||||
}
|
||||
|
||||
+13
-43
@@ -7,7 +7,6 @@
|
||||
#include <QLineEdit>
|
||||
#include <QXmlStreamReader>
|
||||
#include "DialogSaveFile.h"
|
||||
#include "DialogFileOperation.h"
|
||||
#include <QGraphicsView>
|
||||
// 包含UI自动生成的头文件
|
||||
#include "ui_TestPrintWidget.h"
|
||||
@@ -26,6 +25,7 @@
|
||||
#include <scene/piccodeitem.h>
|
||||
#include "CounterVarSet.h"
|
||||
#include "scene/BarcodeEditor.h"
|
||||
#include "Printsetting.h"
|
||||
|
||||
typedef struct ItemReplaceInfo
|
||||
{
|
||||
@@ -39,8 +39,6 @@ typedef struct ItemReplaceInfo
|
||||
#define SOURCE_COUNTER1 "Counter1_QvQ"
|
||||
#define SOURCE_COUNTER2 "Counter2_QvQ"
|
||||
|
||||
class PrintSetting;
|
||||
|
||||
class TestPrintWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -49,21 +47,13 @@ public:
|
||||
TestPrintWidget(QWidget* parent = nullptr);
|
||||
~TestPrintWidget();
|
||||
|
||||
// 打开最后一次作业文件
|
||||
void loadLastWork();
|
||||
|
||||
void on_buttonSelectFont_pressed();
|
||||
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
|
||||
void setFontFormat(int fontsize,QString fontfamily);
|
||||
QTextEdit* getQTextEdit();
|
||||
PicScene* getPicScene();
|
||||
|
||||
void getShowSelectItemText();
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
|
||||
void on_openfileButton_pressed();
|
||||
|
||||
void saveFile();
|
||||
void saveFile(const QString& filename = nullptr);
|
||||
|
||||
void on_KeyUp_clicked();
|
||||
void on_KeyLeft_clicked();
|
||||
@@ -82,9 +72,6 @@ public:
|
||||
|
||||
QString currentFile();
|
||||
|
||||
bool addItemFlag;
|
||||
// QString getReplateAfterStr(QString);
|
||||
|
||||
public slots:
|
||||
void on_enlargeButton_pressed();
|
||||
void on_addButton_pressed(const SourceType type = SourceType::UNKNOWN);
|
||||
@@ -93,7 +80,7 @@ public slots:
|
||||
void on_saveButton_pressed();
|
||||
void onSaveASFile(QString filename,bool Flag);
|
||||
|
||||
void onFileOpen(QString filePath,bool insertFlag);
|
||||
void openWorkFile(QString filePath);
|
||||
|
||||
void on_newfileButton_pressed();
|
||||
|
||||
@@ -103,7 +90,7 @@ public slots:
|
||||
|
||||
void selectPreviousItem();
|
||||
|
||||
void onLineEditReturnPressed();
|
||||
void showBarcodeEditor(const BarcodeViewModel& vm);
|
||||
|
||||
protected:
|
||||
// 重写事件过滤器
|
||||
@@ -122,8 +109,6 @@ private slots:
|
||||
|
||||
void addDateItem();
|
||||
|
||||
void showBarcodeEditor(bool restoreVM = true);
|
||||
|
||||
void onBtnArrowClicked();
|
||||
|
||||
// 复制
|
||||
@@ -149,39 +134,23 @@ private:
|
||||
*/
|
||||
void moveSelectedItem(Qt::Key key);
|
||||
|
||||
// 加载图标(保留原功能)
|
||||
QPixmap loadIcon(const QString& iconName, const QSize& size = QSize(40, 40));
|
||||
|
||||
PicScene *pPicScene; //保存Item的Html
|
||||
PicScene *pPicScene = nullptr; //保存Item的Html
|
||||
// PicScene *pPicScene2; // 保存Item的Html对应的图片 解决场景模式文本无法放大的问题
|
||||
QGraphicsView *view;
|
||||
QGraphicsView *pViewer;
|
||||
PicTextItem *textItem;
|
||||
PicTextItem *textItem2;
|
||||
|
||||
PicCodeItem *codeItem_Operation = nullptr;
|
||||
|
||||
// 修改条形码和二维码的标志
|
||||
bool editCodeFlag = false;
|
||||
QGraphicsView *pViewer = nullptr;
|
||||
PicTextItem *textItem = nullptr;
|
||||
|
||||
PrintSetting* m_printSetting = nullptr;
|
||||
|
||||
PrintSettingModel m_printSettingModel;
|
||||
|
||||
QString xmlfileName;
|
||||
DialogSaveFile *dialogSaveFile;
|
||||
DialogFileOperation *dialogFileOperation;
|
||||
|
||||
ImageLoader *imageLoader = nullptr;
|
||||
ItemEditor * itemEditor = nullptr;
|
||||
BarcodeEditor m_barcodeEditor;
|
||||
|
||||
int editMode;
|
||||
bool m_CreateImageFlag;
|
||||
QGraphicsScene *m_pSavePicScene;
|
||||
|
||||
// 条形码和二维码的选择界面
|
||||
void initSelecteCodeDlg();
|
||||
// 在界面添加显示条形码和二维码的场景
|
||||
void addCodeItem(QString str);
|
||||
//寻找当前选中的图层,没有选中的就不继续处理
|
||||
int checkSelectScene();
|
||||
|
||||
@@ -211,9 +180,8 @@ private:
|
||||
void selectItemByDirection(bool forward);
|
||||
|
||||
signals:
|
||||
void sig_stopPrint();
|
||||
|
||||
void sendButtonClickedSignal(int index);
|
||||
void sendUpdateFontSignl(int);
|
||||
|
||||
void sig_showEditCounter(CounterViewModel viewModel);
|
||||
|
||||
@@ -223,7 +191,9 @@ signals:
|
||||
void sig_showScheduleShiftsEditor(QVector<ScheduleModel> schedules, TextItemModel txtModel);
|
||||
|
||||
// 点击确定后,更新打印内容
|
||||
void sig_updatePrintContent();
|
||||
void sig_updatePrintContent(const QString& filename);
|
||||
|
||||
void sig_currentFileChanged();
|
||||
};
|
||||
|
||||
#endif // TESTPRINTWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user