改进计数器编辑、预览状态和行为;修复移除source属性的影响、修改自检期间粘度计每次工作时间、更新翻译

This commit is contained in:
2026-09-10 19:17:34 +08:00
parent e9d601a3e8
commit 5a187c359b
27 changed files with 2184 additions and 2226 deletions
+39
View File
@@ -4,6 +4,7 @@
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
#include "scene/PicCounterItem.h" #include "scene/PicCounterItem.h"
#include <qmath.h>
CounterVarSet::CounterVarSet(QWidget *parent) : CounterVarSet::CounterVarSet(QWidget *parent) :
QWidget(parent), QWidget(parent),
@@ -25,6 +26,30 @@ void CounterVarSet::init()
// 连接信号槽 // 连接信号槽
connect(ui->checkBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot); connect(ui->checkBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot);
connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot); connect(ui->closeBtn, &QPushButton::clicked, this, &CounterVarSet::buttonClickedSlot);
connect(ui->tabWidget, &QTabWidget::currentChanged, this, [this](int i){
if(ui->cb_digits->currentIndex() == -1) {
return;
}
QSpinBox *endValueBox = nullptr;
if(ui->tabWidget->widget(i) == ui->cnt1Tab && ui->radioButtonVar1->isChecked()) {
endValueBox = ui->spinBoxCnt1EndValue;
}
else if(ui->tabWidget->widget(i) == ui->cnt2Tab && ui->radioButtonVar2->isChecked()) {
endValueBox = ui->spinBoxCnt2EndValue;
}
if(!endValueBox) {
return;
}
int digits = ui->cb_digits->itemText(ui->cb_digits->currentIndex()).toInt();
int maxValue = qPow(10, digits) - 1;
endValueBox->setMaximum(maxValue);
endValueBox->setValue(maxValue);
});
} }
void CounterVarSet::buttonClickedSlot() void CounterVarSet::buttonClickedSlot()
@@ -52,6 +77,20 @@ CounterViewModel CounterVarSet::getCounterConfig()
return viewModel; return viewModel;
} }
void CounterVarSet::onDigitsChanged(int digits)
{
int maxValue = qPow(10, digits) - 1;
QSpinBox* endValueBox = nullptr;
if(ui->radioButtonVar1->isChecked())
endValueBox = ui->spinBoxCnt1EndValue;
else
endValueBox = ui->spinBoxCnt2EndValue;
endValueBox->setMaximum(maxValue);
endValueBox->setValue(maxValue);
}
void CounterVarSet::setCounterConfig(CounterViewModel viewModel) void CounterVarSet::setCounterConfig(CounterViewModel viewModel)
{ {
m_vm = viewModel; m_vm = viewModel;
+1
View File
@@ -41,6 +41,7 @@ signals:
private slots: private slots:
void buttonClickedSlot(); void buttonClickedSlot();
void onDigitsChanged(int digits);
private: private:
Ui::CounterVarSet *ui; Ui::CounterVarSet *ui;
+1
View File
@@ -25,6 +25,7 @@ DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) :
connect(ui->Key_8,SIGNAL(pressed()),this,SLOT(onCharPressed())); connect(ui->Key_8,SIGNAL(pressed()),this,SLOT(onCharPressed()));
connect(ui->Key_9,SIGNAL(pressed()),this,SLOT(onCharPressed())); connect(ui->Key_9,SIGNAL(pressed()),this,SLOT(onCharPressed()));
connect(ui->Key_pluse,SIGNAL(pressed()),this,SLOT(onCharPressed())); connect(ui->Key_pluse,SIGNAL(pressed()),this,SLOT(onCharPressed()));
connect(ui->Key_dot, SIGNAL(pressed()),this,SLOT(onCharPressed()));
connect(ui->Key_backspace,SIGNAL(pressed()),this,SLOT(onKeyBackspacePressed())); connect(ui->Key_backspace,SIGNAL(pressed()),this,SLOT(onKeyBackspacePressed()));
// connect(ui->Key_selectAll,SIGNAL(pressed()),this,SLOT(onKeySelectAllPressed())); // connect(ui->Key_selectAll,SIGNAL(pressed()),this,SLOT(onKeySelectAllPressed()));
// connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed())); // connect(ui->Key_up,SIGNAL(pressed()),this,SLOT(onKeyUpPressed()));
+30 -23
View File
@@ -928,16 +928,16 @@ void InkJetPrinter::timerHandler(void){
static bool oneTimeFlag = false; static bool oneTimeFlag = false;
if(sysPara->status.productCnt== 0 && (oneTimeFlag==false))//计米复位发送打印数据 if(sysPara->status.productCnt== 0 && (oneTimeFlag==false))//计米复位发送打印数据
{ {
oneTimeFlag = true; oneTimeFlag = true;
m_MainWidget->on_m_StartBtn_clicked(); m_MainWidget->on_m_StartBtn_clicked();
//复位重设起始值 //复位重设起始值
if(sysPara->para.cnt1ResetToInitValue) if(sysPara->para.cnt1ResetToInitValue)
{ {
sysPara->para.cnt1CurrValue = sysPara->para.cnt1StartValue; sysPara->para.cnt1CurrValue = sysPara->para.cnt1StartValue;
sysPara->status.cnt1CurrentValueInitDoneFlag = false; sysPara->status.cnt1CurrentValueInitDoneFlag = false;
sysPara->devOp->writeFpgaCalandar(0); sysPara->devOp->writeFpgaCalandar(0);
}
} }
}
if(sysPara->status.productCnt != 0) if(sysPara->status.productCnt != 0)
{ {
oneTimeFlag = false; oneTimeFlag = false;
@@ -1027,7 +1027,7 @@ void InkJetPrinter::timerHandler(void){
arg((MAX_SELF_CHECK_CNT - sysPara->status.selfCheckCnt)/100)); arg((MAX_SELF_CHECK_CNT - sysPara->status.selfCheckCnt)/100));
} }
#ifdef BNS_DEBUG #ifdef BNS_DEBUG
if(sysPara->status.selfCheckCnt >= MAX_SELF_CHECK_CNT) // 测试自检改为15s if(sysPara->status.selfCheckCnt >= 500) // 测试自检改为5s
#else #else
if(sysPara->status.selfCheckCnt >= MAX_SELF_CHECK_CNT) if(sysPara->status.selfCheckCnt >= MAX_SELF_CHECK_CNT)
#endif #endif
@@ -1227,7 +1227,7 @@ void InkJetPrinter::timerHandler(void){
} }
if(pulse_100ms && sysPara->status.selfCheckDone){ if(pulse_100ms && sysPara->status.selfCheckDone){
detectAndcontrolReclaimTank(); //控制回收槽 detectAndcontrolReclaimTank(); //控制回收槽
} }
/*---------------------------------处理警告--------------------------------------------*/ /*---------------------------------处理警告--------------------------------------------*/
@@ -1558,6 +1558,11 @@ void InkJetPrinter::getMainWidgetButtonClickedSlot(int index)
m_TestPrintWidget->openWorkFile(currWorkFile); m_TestPrintWidget->openWorkFile(currWorkFile);
ui.label_currEditFile->setText(QString("E: %1").arg(fileInfo.baseName())); ui.label_currEditFile->setText(QString("E: %1").arg(fileInfo.baseName()));
m_StackedWidget->setCurrentWidget(m_TestPrintWidget); m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
QVector<int> counterValues{QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(),
QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt()};
m_TestPrintWidget->updateCountersCurrVal(counterValues);
break; break;
} }
case 2: // 调入文件喷印 case 2: // 调入文件喷印
@@ -2628,17 +2633,19 @@ void InkJetPrinter::autoControlViscosityPumpForSelfCheck(int selfCheckCnt)
int stageCnt = selfCheckCnt % 1000; int stageCnt = selfCheckCnt % 1000;
if(stageCnt >= 0 && stageCnt < 150) { if(stageCnt >= 0 && stageCnt < 300) {
if(!sysPara->devOp->isViscosityPumpOpen()) { if(!sysPara->devOp->isViscosityPumpOpen()) {
sysPara->devOp->controlViscosityPump(true); sysPara->devOp->controlViscosityPump(true);
qDebug() << "Start test viscosity pump."; qDebug() << "Start test viscosity pump.";
LogInfo::setRunStatusText("Start test viscosity pump.");
} }
} }
if(stageCnt >= 150) { if(stageCnt >= 300) {
if(sysPara->devOp->isViscosityPumpOpen()) { if(sysPara->devOp->isViscosityPumpOpen()) {
sysPara->devOp->controlViscosityPump(false); sysPara->devOp->controlViscosityPump(false);
qDebug() << "Stop test viscosity pump."; qDebug() << "Stop test viscosity pump.";
LogInfo::setRunStatusText("Stop test viscosity pump.");
} }
} }
} }
@@ -2761,22 +2768,22 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
if(sysPara->devOp->isReclaimTankOpenEnable()) if(sysPara->devOp->isReclaimTankOpenEnable())
sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭 sysPara->devOp->controlReclaimTankOpen(false); //到头,关闭
sysPara->status.reclainTankReachEnd = true; sysPara->status.reclainTankReachEnd = true;
m_MainWidget->setRunStatus(tr("回收槽到头")); m_MainWidget->setRunStatus(tr("回收槽到头"));
m_MainWidget->setReclaimStatus(true, 100); m_MainWidget->setReclaimStatus(true, 100);
m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮 m_MainWidget->enablePrintButton(true); //仅仅在此时能使能打印按钮
sysPara->devOp->highVoltageCtrl(0); sysPara->devOp->highVoltageCtrl(0);
m_MainWidget->stopFlashReclaimOpenBtn(); m_MainWidget->stopFlashReclaimOpenBtn();
// emit reclaimTankOpenDone(); // emit reclaimTankOpenDone();
/*回收槽开关时间校正*/ /*回收槽开关时间校正*/
sysPara->para.reclaimTankTime =( sysPara->status.currReclaimTankPos>120 )? sysPara->status.currReclaimTankPos/10-1:12; sysPara->para.reclaimTankTime =( sysPara->status.currReclaimTankPos>120 )? sysPara->status.currReclaimTankPos/10-1:12;
m_SystemSetting->updateReclaimTime( sysPara->para.reclaimTankTime ); m_SystemSetting->updateReclaimTime( sysPara->para.reclaimTankTime );
qDebug()<<"reclaimTankOpenDone currReclaimTankPos:"<<sysPara->status.currReclaimTankPos; qDebug()<<"reclaimTankOpenDone currReclaimTankPos:"<<sysPara->status.currReclaimTankPos;
qDebug()<<"reclaimTankOpenDone curr_reclaimTankTime:"<<sysPara->status.curr_reclaimTankTime; qDebug()<<"reclaimTankOpenDone curr_reclaimTankTime:"<<sysPara->status.curr_reclaimTankTime;
LogInfo::setRunStatusText("reclaimTankOpenDone currReclaimTankPos:"+QString::number(sysPara->status.currReclaimTankPos)); LogInfo::setRunStatusText("reclaimTankOpenDone currReclaimTankPos:"+QString::number(sysPara->status.currReclaimTankPos));
} }
else if(sysPara->status.reclaimTankstatus == 0x11 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作 else if(sysPara->status.reclaimTankstatus == 0x11 )//7 故障,6 关完成,5开完成,4 保持, 3 停止, 2 关, 1 开,0-无操作
{ {
@@ -2826,7 +2833,7 @@ void InkJetPrinter::detectAndcontrolReclaimTank(){
LogInfo::setRunStatusText(tr("回收槽卡住或者回收槽开关时间设置错误")); LogInfo::setRunStatusText(tr("回收槽卡住或者回收槽开关时间设置错误"));
m_MainWidget->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误")); m_MainWidget->setRunStatus(tr("回收槽卡住或者回收槽开关时间设置错误"));
} }
else if(sysPara->status.reclaimTankstatus == 4 ) else if(sysPara->status.reclaimTankstatus == 4 )
{ {
m_MainWidget->setReclaimOpenBtnStatus(true); m_MainWidget->setReclaimOpenBtnStatus(true);
m_MainWidget->setReclaimCloseBtnStatus(true); m_MainWidget->setReclaimCloseBtnStatus(true);
+1 -1
View File
@@ -124,7 +124,7 @@ void MyInputMethod::updateHandler ( int type ){
switch(type){ switch(type){
case 0:break; case 0:break;
case 1: case 1:
if(widget && dynamic_cast<QSpinBox *>(widget)){ if(widget && (dynamic_cast<QSpinBox *>(widget))){
if(digitalInput->isHidden()){ if(digitalInput->isHidden()){
QWidget *hostWindow = widget->window(); QWidget *hostWindow = widget->window();
QRect rec = QApplication::desktop()->screenGeometry(); QRect rec = QApplication::desktop()->screenGeometry();
+1 -1
View File
@@ -26,7 +26,7 @@
<enum>Qt::StrongFocus</enum> <enum>Qt::StrongFocus</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
+2 -2
View File
@@ -5,8 +5,8 @@
Major.Minor.Rivison.yyyy-MM-DD_Beta Major.Minor.Rivison.yyyy-MM-DD_Beta
*/ */
#define UP_PRINTER_MAJOR_VER 6 #define UP_PRINTER_MAJOR_VER 6
#define UP_PRINTER_MINOR_VER 8 #define UP_PRINTER_MINOR_VER 9
#define UP_PRINTER_RIVISION_VER 7 #define UP_PRINTER_RIVISION_VER 1
#define SUB_VERSION "_KOR" #define SUB_VERSION "_KOR"
#ifdef __RFID_OLD #ifdef __RFID_OLD
#define SUB_RFID "_RO" #define SUB_RFID "_RO"
+225 -246
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -35,7 +35,7 @@
<enum>Qt::StrongFocus</enum> <enum>Qt::StrongFocus</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@@ -265,7 +265,7 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="cnt1Tab">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
@@ -647,7 +647,7 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="cnt2Tab">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
+226 -211
View File
@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>231</width> <width>231</width>
<height>260</height> <height>270</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@@ -89,6 +89,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<property name="styleSheet">
<string notr="true">font-size: 16px;</string>
</property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
@@ -105,60 +108,8 @@
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLineEdit" name="traceEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Key_backspace">
<property name="minimumSize">
<size>
<width>70</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>DEL</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/icon/keybackspace.png</normaloff>:/icon/keybackspace.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0">
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
@@ -191,6 +142,63 @@
<property name="spacing"> <property name="spacing">
<number>1</number> <number>1</number>
</property> </property>
<item row="0" column="0">
<widget class="QPushButton" name="Key_7">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>7</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="Key_5">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="Key_6">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QPushButton" name="Key_1"> <widget class="QPushButton" name="Key_1">
<property name="minimumSize"> <property name="minimumSize">
@@ -229,82 +237,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QPushButton" name="Key_5">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="Key_9">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>9</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="Key_6">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="Key_7">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>7</string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QPushButton" name="Key_2"> <widget class="QPushButton" name="Key_2">
<property name="minimumSize"> <property name="minimumSize">
@@ -324,25 +256,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QPushButton" name="Key_4">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QPushButton" name="Key_8"> <widget class="QPushButton" name="Key_8">
<property name="minimumSize"> <property name="minimumSize">
@@ -362,8 +275,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="0" column="2">
<widget class="QPushButton" name="Key_pluse"> <widget class="QPushButton" name="Key_9">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>50</width> <width>50</width>
@@ -377,7 +290,26 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>-</string> <string>9</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="Key_4">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>4</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -400,69 +332,152 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3" rowspan="2">
<widget class="QPushButton" name="enterBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>Enter</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="clrBtn">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="iconSize">
<size>
<width>12</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="Key_pluse">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="Key_dot">
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>.</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item alignment="Qt::AlignBottom">
<widget class="QWidget" name="rightPanel" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="QPushButton" name="clrBtn">
<property name="minimumSize">
<size>
<width>50</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Clear</string>
</property>
<property name="iconSize">
<size>
<width>12</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="enterBtn">
<property name="minimumSize">
<size>
<width>50</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>100</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>Enter</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="0" column="0">
<widget class="QWidget" name="topPanel" native="true">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="1">
<widget class="QLineEdit" name="traceEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="Key_backspace">
<property name="minimumSize">
<size>
<width>70</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>DEL</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/icon/keybackspace.png</normaloff>:/icon/keybackspace.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>
+225 -246
View File
File diff suppressed because it is too large Load Diff
+225 -246
View File
File diff suppressed because it is too large Load Diff
+233 -234
View File
File diff suppressed because it is too large Load Diff
+9 -8
View File
@@ -33,6 +33,7 @@
#include "scene/piccodeitem.h" #include "scene/piccodeitem.h"
#include "scene/PicCounterItem.h" #include "scene/PicCounterItem.h"
#include <QElapsedTimer> #include <QElapsedTimer>
#include <QStringList>
#include <QScroller> #include <QScroller>
#include <QFontMetrics> #include <QFontMetrics>
#include <QPainter> #include <QPainter>
@@ -946,12 +947,12 @@ void MainWidget::updateTotalCnt(int en)
void MainWidget::on_m_StartBtn_clicked() void MainWidget::on_m_StartBtn_clicked()
{ {
if(sysPara){ if(sysPara){
test_flag = 0; test_flag = 0;
if (!checkTriggerMode()) return; if (!checkTriggerMode()) return;
// 打印状态交给状态机修改 // 打印状态交给状态机修改
sysPara->status.isPrinting=false; sysPara->status.isPrinting=false;
// auto mgr = PrinterStateManager::instance(); // auto mgr = PrinterStateManager::instance();
#if !defined(FPGA_TEST) && !defined(QT_DEBUG) #if !defined(FPGA_TEST) && !defined(QT_DEBUG)
// if (mgr && mgr->canStopPrint()) { // if (mgr && mgr->canStopPrint()) {
@@ -991,7 +992,7 @@ void MainWidget::on_m_StartBtn_clicked()
// 高亮切换 // 高亮切换
changeHighLight(true); changeHighLight(true);
} }
} }
void MainWidget::on_m_StopBtn_clicked() void MainWidget::on_m_StopBtn_clicked()
@@ -2358,7 +2359,7 @@ bool MainWidget::updatePhaseIndicatorLight(){
sysPara->status.phaseErrorCnt = 0; sysPara->status.phaseErrorCnt = 0;
} }
else { else {
if(sysPara->status.phaseErrorCnt < 10) if(sysPara->status.phaseErrorCnt < 200)
sysPara->status.phaseErrorCnt ++ ; sysPara->status.phaseErrorCnt ++ ;
else { else {
if(!sysPara->status.lastPhaseFault){ if(!sysPara->status.lastPhaseFault){
@@ -2524,15 +2525,15 @@ bool MainWidget::checkTriggerMode()
#ifndef QT_DEBUG #ifndef QT_DEBUG
if(!SIMULATE_PRINTING_MODE){ if(!SIMULATE_PRINTING_MODE){
if (!sysPara->status.reclainTankReachEnd) { if (!sysPara->status.reclainTankReachEnd) {
return; return false;
} }
if((sysPara->status.statWarn & WARN_STATUS_HDINT)){ if((sysPara->status.statWarn & WARN_STATUS_HDINT)){
QMessageBox::information(this,tr("错误"),tr("喷头盖未关,请先关喷头盖!")); QMessageBox::information(this,tr("错误"),tr("喷头盖未关,请先关喷头盖!"));
return ; return false;
} }
if((sysPara->status.statWarn & WARN_STATUS_INK_SWINT)){ if((sysPara->status.statWarn & WARN_STATUS_INK_SWINT)){
QMessageBox::information(this,tr("错误"),tr("墨线未开,请先开墨线开关!")); QMessageBox::information(this,tr("错误"),tr("墨线未开,请先开墨线开关!"));
return ; return false;
} }
} }
#endif #endif
+1
View File
@@ -18,6 +18,7 @@
#include <QToolButton> #include <QToolButton>
#include <QTextEdit> #include <QTextEdit>
#include <QTime> #include <QTime>
#include <QElapsedTimer>
#include <QMessageBox> #include <QMessageBox>
#include "scene/picscene.h" #include "scene/picscene.h"
#include "LogInfo.h" #include "LogInfo.h"
+2
View File
@@ -22,6 +22,8 @@
#define TEST_MODE 0 //测试模式 #define TEST_MODE 0 //测试模式
#define SIMULATE_PRINTING_MODE 1 //模拟打印模式 #define SIMULATE_PRINTING_MODE 1 //模拟打印模式
#define DISABLE_PRINT_START_CHECK
#ifdef __CONVERTERWIFI__ #ifdef __CONVERTERWIFI__
#define LANINTERFACE_NAME "eth0" #define LANINTERFACE_NAME "eth0"
#endif #endif
+5
View File
@@ -181,6 +181,11 @@ QImage PicDateItem::itemImage()
return img; return img;
} }
void PicDateItem::letterSpaceChanged()
{
setModel(m_model);
}
QRectF PicDateItem::boundingRect() const QRectF PicDateItem::boundingRect() const
{ {
return PicTextItem::boundingRect(); return PicTextItem::boundingRect();
+2
View File
@@ -28,6 +28,8 @@ protected:
virtual QImage itemImage() override; virtual QImage itemImage() override;
virtual void letterSpaceChanged() override;
private: private:
QTimer m_timer; QTimer m_timer;
+5
View File
@@ -102,6 +102,11 @@ QImage PicScheduleShiftItem::itemImage()
return backgroundImg; return backgroundImg;
} }
void PicScheduleShiftItem::letterSpaceChanged()
{
setSchedules(schedules());
}
QSize PicScheduleShiftItem::calcMaxSize() QSize PicScheduleShiftItem::calcMaxSize()
{ {
if (m_schedules.isEmpty()) if (m_schedules.isEmpty())
+3 -1
View File
@@ -25,7 +25,7 @@ public:
PicScheduleShiftItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0, const SourceType type = SourceType::SCHEDULE_SHIFT); PicScheduleShiftItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0, const SourceType type = SourceType::SCHEDULE_SHIFT);
const QVector<ScheduleModel>& schedules() const; const QVector<ScheduleModel>& schedules() const;
void setSchedules(QVector<ScheduleModel> schedules); void setSchedules(QVector<ScheduleModel> schedules);
bool updateScheduleName(); bool updateScheduleName();
@@ -39,6 +39,8 @@ protected:
virtual QImage itemImage(); virtual QImage itemImage();
virtual void letterSpaceChanged() override;
private: private:
QString findScheduleName(const QTime& time); QString findScheduleName(const QTime& time);
+1 -2
View File
@@ -117,8 +117,7 @@ void PicTextItem::setCustomFont(QString name)
newFont.setStyleStrategy(QFont::NoAntialias); newFont.setStyleStrategy(QFont::NoAntialias);
setFont(newFont); setFont(newFont);
m_untransImage = strToImage(m_source.toString()); letterSpaceChanged();
applyModify();
} }
int PicTextItem::letterSpace() int PicTextItem::letterSpace()
+225 -246
View File
File diff suppressed because it is too large Load Diff
+41 -18
View File
@@ -138,15 +138,12 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
connect(ui.btnNum,&QPushButton::clicked,[this](){ connect(ui.btnNum,&QPushButton::clicked,[this](){
pPicScene->clearSelection(); pPicScene->clearSelection();
QFont font("WenQuanYi7");
int ls = (int)(font.letterSpacing());
CounterViewModel vm; CounterViewModel vm;
vm.charWidth = 0; vm.charWidth = 0;
vm.enbCustomCharWidth = false; vm.enbCustomCharWidth = false;
vm.counterType = COUNTER_TYPE_1; vm.counterType = COUNTER_TYPE_1;
vm.digitalNum = 2; vm.digitalNum = 2;
vm.letterSpace = ls; vm.letterSpace = 1;
vm.cnt1Settings = m_printSettingModel.cnt1Settings; vm.cnt1Settings = m_printSettingModel.cnt1Settings;
vm.cnt2Settings = m_printSettingModel.cnt2Settings; vm.cnt2Settings = m_printSettingModel.cnt2Settings;
emit sig_showEditCounter(vm); emit sig_showEditCounter(vm);
@@ -689,10 +686,9 @@ void TestPrintWidget::onImageLoaderAccepted()
item->setImagePath(imgPath); item->setImagePath(imgPath);
auto boundingRect = pPicScene->itemsBoundingRect(); auto boundingRect = pPicScene->itemsBoundingRect();
int y = sysPara->para.canvasHeight - item->boundingRect().height(); int y = sysPara->para.canvasHeight - item->boundingRect().height();
item->setPos(x_item, y); item->setPos(boundingRect.right() + 1, y);
x_item = x_item + boundingRect.right() + 5; x_item = x_item + boundingRect.right() + 1;
item->setSelected(true); item->setSelected(true);
} }
void TestPrintWidget::onBtnItemConfigClicked() void TestPrintWidget::onBtnItemConfigClicked()
@@ -831,8 +827,8 @@ void TestPrintWidget::slt_BarCodeItemDone()
auto boundingRect = pPicScene->itemsBoundingRect(); auto boundingRect = pPicScene->itemsBoundingRect();
pPicScene->addItem(codeItem); pPicScene->addItem(codeItem);
int y = sysPara->para.canvasHeight - codeItem->boundingRect().height(); int y = sysPara->para.canvasHeight - codeItem->boundingRect().height();
codeItem->setPos(x_item, y); codeItem->setPos(boundingRect.right() + 1, y);
x_item = x_item + boundingRect.right() + 5; x_item = x_item + boundingRect.right() + 1;
} else { } else {
codeItem->setBarcodeViewModel(vm); codeItem->setBarcodeViewModel(vm);
} }
@@ -993,16 +989,22 @@ void TestPrintWidget::addDateTimeItem(const DateItemModel &model, const TextItem
PicDateItem* item = new PicDateItem(); PicDateItem* item = new PicDateItem();
item->setHtml(htmlStr); item->setHtml(htmlStr);
pPicScene->addItem(item); pPicScene->addItem(item);
item->setTextItemModel(textModel);
item->setModel(model);
auto boundingRect = pPicScene->itemsBoundingRect(); auto boundingRect = pPicScene->itemsBoundingRect();
int y = sysPara->para.canvasHeight - item->boundingRect().height(); int y = sysPara->para.canvasHeight - item->boundingRect().height();
item->setPos(x_item, y); item->setPos(boundingRect.right() + 1, y);
x_item = x_item + boundingRect.right() + 5; x_item = x_item + boundingRect.right() + 1;
item->setSelected(true); item->setSelected(true);
item->setModel(model);
} }
void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules, TextItemModel txtModel) void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules, TextItemModel txtModel)
{ {
if(schedules.size() == 0) {
qWarning() << "The schedules is empty, will be nothing";
return;
}
// 如果当前选中了一个日期时间item,则直接设置模型 // 如果当前选中了一个日期时间item,则直接设置模型
auto selectItems = pPicScene->selectedItems(); auto selectItems = pPicScene->selectedItems();
if(selectItems.size() == 1) { if(selectItems.size() == 1) {
@@ -1022,13 +1024,12 @@ void TestPrintWidget::addScheduleShiftsItem(QVector<ScheduleModel> schedules, Te
item->setHtml(htmlStr); item->setHtml(htmlStr);
pPicScene->addItem(item); pPicScene->addItem(item);
item->setTextItemModel(txtModel); item->setTextItemModel(txtModel);
item->setSchedules(std::move(schedules));
auto boundingRect = pPicScene->itemsBoundingRect(); auto boundingRect = pPicScene->itemsBoundingRect();
int y = sysPara->para.canvasHeight - item->boundingRect().height(); int y = sysPara->para.canvasHeight - item->boundingRect().height();
item->setPos(x_item, y+3); item->setPos(boundingRect.right() + 1, y+3);
x_item = x_item + boundingRect.right() + 5; x_item = x_item + boundingRect.right() + 1;
item->setSelected(true); item->setSelected(true);
item->setSchedules(std::move(schedules));
} }
void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont> f) void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont> f)
@@ -1047,6 +1048,8 @@ void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont>
} }
} }
QVector<int> currVals{vm.cnt1Settings.currValue, vm.cnt2Settings.currValue};
QFont font; QFont font;
if(flag) { if(flag) {
@@ -1066,6 +1069,7 @@ void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont>
m_printSettingModel.cnt1Settings = vm.cnt1Settings; m_printSettingModel.cnt1Settings = vm.cnt1Settings;
m_printSettingModel.cnt2Settings = vm.cnt2Settings; m_printSettingModel.cnt2Settings = vm.cnt2Settings;
updateCountersCurrVal(currVals);
} }
return; return;
} }
@@ -1085,12 +1089,13 @@ void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont>
auto boundingRect = pPicScene->itemsBoundingRect(); auto boundingRect = pPicScene->itemsBoundingRect();
int y = sysPara->para.canvasHeight - item->boundingRect().height(); int y = sysPara->para.canvasHeight - item->boundingRect().height();
item->setPos(x_item, y); item->setPos(boundingRect.right() + 1, y);
x_item = x_item + boundingRect.right() + 5; x_item = x_item + boundingRect.right() + 1;
item->setSelected(true); item->setSelected(true);
m_printSettingModel.cnt1Settings = vm.cnt1Settings; m_printSettingModel.cnt1Settings = vm.cnt1Settings;
m_printSettingModel.cnt2Settings = vm.cnt2Settings; m_printSettingModel.cnt2Settings = vm.cnt2Settings;
updateCountersCurrVal(currVals);
} }
QString TestPrintWidget::currentFile() QString TestPrintWidget::currentFile()
@@ -1098,6 +1103,24 @@ QString TestPrintWidget::currentFile()
return xmlfileName; return xmlfileName;
} }
void TestPrintWidget::updateCountersCurrVal(const QVector<int> values)
{
if(values.size() < 2) {
qDebug() << "Invalied values";
return;
}
auto items = pPicScene->items();
for(auto item : items) {
auto counterItem = dynamic_cast<PicCounterItem*>(item);
if(!counterItem)
continue;
int displayNum = counterItem->counterType() == COUNTER_TYPE_1 ? values[0] : values[1];
counterItem->setCounter(counterItem->counterType(), counterItem->digitalNum(), displayNum);
}
}
void TestPrintWidget::showBarcodeEditor(const BarcodeViewModel& vm) void TestPrintWidget::showBarcodeEditor(const BarcodeViewModel& vm)
{ {
#if defined(ARCH_AARCH64) #if defined(ARCH_AARCH64)
+3
View File
@@ -60,6 +60,9 @@ public:
QString currentFile(); QString currentFile();
// 更新编辑界面内所有计数器的当前值
void updateCountersCurrVal(const QVector<int> values);
public slots: public slots:
void on_enlargeButton_pressed(); void on_enlargeButton_pressed();
void on_addButton_pressed(const SourceType type = SourceType::UNKNOWN); void on_addButton_pressed(const SourceType type = SourceType::UNKNOWN);
+225 -246
View File
File diff suppressed because it is too large Load Diff
+225 -246
View File
File diff suppressed because it is too large Load Diff
+225 -246
View File
File diff suppressed because it is too large Load Diff