V6.7.4 追加更新
This commit is contained in:
+3
-1
@@ -8,7 +8,7 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) :
|
DigitalInput::DigitalInput(MyInputMethod *myInputMethod,QWidget *parent) :
|
||||||
QWidget(parent,(Qt::FramelessWindowHint )),
|
QWidget(parent,(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool | Qt::BypassWindowManagerHint)),
|
||||||
ui(new Ui::DigitalInput)
|
ui(new Ui::DigitalInput)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@@ -143,6 +143,8 @@ void DigitalInput::onClrPressed()
|
|||||||
void DigitalInput::showEvent(QShowEvent *event)
|
void DigitalInput::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::showEvent(event);
|
QWidget::showEvent(event);
|
||||||
|
raise();
|
||||||
|
|
||||||
auto focusWidget = qApp->focusWidget();
|
auto focusWidget = qApp->focusWidget();
|
||||||
QSpinBox* box = dynamic_cast<QSpinBox*>(focusWidget);
|
QSpinBox* box = dynamic_cast<QSpinBox*>(focusWidget);
|
||||||
if(!box) {
|
if(!box) {
|
||||||
|
|||||||
+5
-1
@@ -1650,6 +1650,7 @@ void InkJetPrinter::getMainInstructWidgetButtonClickedSlot(int index)
|
|||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
|
m_SystemSetting->updateSysParaToUI();
|
||||||
m_StackedWidget->setCurrentWidget(m_SystemSetting);
|
m_StackedWidget->setCurrentWidget(m_SystemSetting);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1939,12 +1940,14 @@ void InkJetPrinter::stopSendSTM32Data(bool flag){
|
|||||||
/*************************STM32通过串口读取状态赋值给status-start******************************************/
|
/*************************STM32通过串口读取状态赋值给status-start******************************************/
|
||||||
void InkJetPrinter::saveSTM32Status(unsigned char *data){
|
void InkJetPrinter::saveSTM32Status(unsigned char *data){
|
||||||
unsigned char *target= ((unsigned char *)&sysPara->status)+0x44;
|
unsigned char *target= ((unsigned char *)&sysPara->status)+0x44;
|
||||||
|
int len = data[3];
|
||||||
for(int i=0;i<data[3];i++){
|
for(int i=0;i<data[3];i++){
|
||||||
if(i==16){
|
if(i==16){
|
||||||
target[i]=statWarnTempData | (data[4+i] & 0x7c);
|
target[i]=statWarnTempData | (data[4+i] & 0x7c);
|
||||||
}
|
}
|
||||||
else target[i]=data[4+i];
|
else target[i]=data[4+i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// emit showReclaimTankstatus(sysPara->status.reclaimTankstatus);
|
// emit showReclaimTankstatus(sysPara->status.reclaimTankstatus);
|
||||||
// emit showMotorIsen(sysPara->status.MOTOR_ISEN,sysPara->status.AD_FIXED);
|
// emit showMotorIsen(sysPara->status.MOTOR_ISEN,sysPara->status.AD_FIXED);
|
||||||
}
|
}
|
||||||
@@ -2585,7 +2588,7 @@ void InkJetPrinter::viscosity_timerHandler()
|
|||||||
{
|
{
|
||||||
if(!firstTime)
|
if(!firstTime)
|
||||||
qDebug()<<"错误!粘度计故障:检测不到上位灯";
|
qDebug()<<"错误!粘度计故障:检测不到上位灯";
|
||||||
LogInfo::setRunStatusText(tr("错误!粘度计故障:检测不到上位灯"));
|
// LogInfo::setRunStatusText(tr("错误!粘度计故障:检测不到上位灯"));
|
||||||
viscosity_timer->stop();
|
viscosity_timer->stop();
|
||||||
firstTime = 0;
|
firstTime = 0;
|
||||||
}
|
}
|
||||||
@@ -2919,6 +2922,7 @@ int InkJetPrinter::updateWarningTime(int type){
|
|||||||
// 关闭文件
|
// 关闭文件
|
||||||
file.close();
|
file.close();
|
||||||
inkWarnTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss");
|
inkWarnTime = QDateTime::fromString(starTime,"yyyy-MM-dd HH::mm::ss");
|
||||||
|
qDebug() << inkWarnTime;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Failed to open file for reading:";
|
qDebug() << "Failed to open file for reading:";
|
||||||
LogInfo::setRunStatusText("Failed to open file for reading");
|
LogInfo::setRunStatusText("Failed to open file for reading");
|
||||||
|
|||||||
+22
-3
@@ -2,6 +2,8 @@
|
|||||||
#include "ui_MainInstruction.h"
|
#include "ui_MainInstruction.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <cerrno>
|
||||||
|
#include <cstring>
|
||||||
#include "DlgRFIDConfig.h"
|
#include "DlgRFIDConfig.h"
|
||||||
#include "runtimectrl.h"
|
#include "runtimectrl.h"
|
||||||
#include "DlgCanvasHeightEditor.h"
|
#include "DlgCanvasHeightEditor.h"
|
||||||
@@ -210,7 +212,7 @@ void MainInstruction::on_btn_time_clicked()
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
void m_adjustdate(int year, int mon, int mday, int hour, int min, int sec) {
|
void m_adjustdate(int year, int mon, int mday, int hour, int min, int sec) {
|
||||||
time_t t;
|
time_t t;
|
||||||
struct tm nowtime;
|
struct tm nowtime = {};
|
||||||
nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second)
|
nowtime.tm_sec = sec; // Seconds.[0-60] (1 leap second)
|
||||||
nowtime.tm_min = min; // Minutes.[0-59]
|
nowtime.tm_min = min; // Minutes.[0-59]
|
||||||
nowtime.tm_hour = hour; // Hours. [0-23]
|
nowtime.tm_hour = hour; // Hours. [0-23]
|
||||||
@@ -220,11 +222,28 @@ void m_adjustdate(int year, int mon, int mday, int hour, int min, int sec) {
|
|||||||
nowtime.tm_isdst = -1; // DST.[-1/0/1]
|
nowtime.tm_isdst = -1; // DST.[-1/0/1]
|
||||||
t = mktime(&nowtime);
|
t = mktime(&nowtime);
|
||||||
|
|
||||||
#if __GLIBC_MINOR__ >= 31
|
// GLibc 版本 大于等于 2.31时使用新API
|
||||||
|
#if (__GLIBC_MINOR__ >= 31 && __GLIBC__ == 2) || (__GLIBC__ > 2)
|
||||||
|
if (t == static_cast<time_t>(-1)) {
|
||||||
|
qWarning() << "mktime failed, errno:" << errno << QString::fromLocal8Bit(std::strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct timespec res;
|
struct timespec res;
|
||||||
|
res.tv_nsec = 0;
|
||||||
res.tv_sec = t;
|
res.tv_sec = t;
|
||||||
clock_settime(CLOCK_REALTIME, &res);
|
auto r = clock_settime(CLOCK_REALTIME, &res);
|
||||||
|
if (r != 0) {
|
||||||
|
qWarning() << "clock_settime failed, errno:" << errno << QString::fromLocal8Bit(std::strerror(errno));
|
||||||
|
} else {
|
||||||
|
qInfo() << "clock_settime success";
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
if (t == static_cast<time_t>(-1)) {
|
||||||
|
qWarning() << "mktime failed, errno:" << errno << QString::fromLocal8Bit(std::strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
stime(&t);
|
stime(&t);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -98,7 +98,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabBasic">
|
<widget class="QWidget" name="tabBasic">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include<string>
|
#include<string>
|
||||||
#include<QLineEdit>
|
#include<QLineEdit>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QWindow>
|
||||||
#include "InkJetPrinter.h"
|
#include "InkJetPrinter.h"
|
||||||
|
|
||||||
extern InkJetPrinter *pInkJectPrinter;
|
extern InkJetPrinter *pInkJectPrinter;
|
||||||
@@ -125,6 +126,7 @@ void MyInputMethod::updateHandler ( int type ){
|
|||||||
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();
|
||||||
QRect rec = QApplication::desktop()->screenGeometry();
|
QRect rec = QApplication::desktop()->screenGeometry();
|
||||||
QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标
|
QPoint point = widget->mapToGlobal (QPoint(0,0)); //全局坐标
|
||||||
QRect myRec = digitalInput->geometry();
|
QRect myRec = digitalInput->geometry();
|
||||||
@@ -132,6 +134,10 @@ void MyInputMethod::updateHandler ( int type ){
|
|||||||
(point.y() > rec.height()/2)?(point.y() - myRec.height() - 20):(point.y() + 20),
|
(point.y() > rec.height()/2)?(point.y() - myRec.height() - 20):(point.y() + 20),
|
||||||
myRec.width(),myRec.height());
|
myRec.width(),myRec.height());
|
||||||
digitalInput->show();
|
digitalInput->show();
|
||||||
|
if(hostWindow && digitalInput->windowHandle() && hostWindow->windowHandle()) {
|
||||||
|
digitalInput->windowHandle()->setTransientParent(hostWindow->windowHandle());
|
||||||
|
}
|
||||||
|
digitalInput->raise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+67
-65
@@ -144,71 +144,73 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<widget class="QWidget" name="pumpControlPanel" native="true">
|
||||||
<item row="1" column="0">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<widget class="QPushButton" name="pushButtonGearPumpOff">
|
<item row="1" column="0">
|
||||||
<property name="minimumSize">
|
<widget class="QPushButton" name="pushButtonGearPumpOff">
|
||||||
<size>
|
<property name="minimumSize">
|
||||||
<width>0</width>
|
<size>
|
||||||
<height>40</height>
|
<width>0</width>
|
||||||
</size>
|
<height>40</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="maximumSize">
|
</property>
|
||||||
<size>
|
<property name="maximumSize">
|
||||||
<width>120</width>
|
<size>
|
||||||
<height>16777215</height>
|
<width>120</width>
|
||||||
</size>
|
<height>16777215</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>齿轮泵关</string>
|
<property name="text">
|
||||||
</property>
|
<string>齿轮泵关</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item row="0" column="0">
|
</item>
|
||||||
<widget class="QPushButton" name="pushButtonGearPump">
|
<item row="0" column="0">
|
||||||
<property name="minimumSize">
|
<widget class="QPushButton" name="pushButtonGearPump">
|
||||||
<size>
|
<property name="minimumSize">
|
||||||
<width>0</width>
|
<size>
|
||||||
<height>40</height>
|
<width>120</width>
|
||||||
</size>
|
<height>40</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="maximumSize">
|
</property>
|
||||||
<size>
|
<property name="maximumSize">
|
||||||
<width>120</width>
|
<size>
|
||||||
<height>16777215</height>
|
<width>120</width>
|
||||||
</size>
|
<height>16777215</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="focusPolicy">
|
</property>
|
||||||
<enum>Qt::NoFocus</enum>
|
<property name="focusPolicy">
|
||||||
</property>
|
<enum>Qt::NoFocus</enum>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>齿轮泵开 </string>
|
<property name="text">
|
||||||
</property>
|
<string>齿轮泵开 </string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item row="0" column="1">
|
</item>
|
||||||
<widget class="QSpinBox" name="spinBoxGearPumpValue">
|
<item row="0" column="1">
|
||||||
<property name="minimumSize">
|
<widget class="QSpinBox" name="spinBoxGearPumpValue">
|
||||||
<size>
|
<property name="minimumSize">
|
||||||
<width>70</width>
|
<size>
|
||||||
<height>37</height>
|
<width>70</width>
|
||||||
</size>
|
<height>37</height>
|
||||||
</property>
|
</size>
|
||||||
<property name="minimum">
|
</property>
|
||||||
<number>0</number>
|
<property name="minimum">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="maximum">
|
</property>
|
||||||
<number>400</number>
|
<property name="maximum">
|
||||||
</property>
|
<number>400</number>
|
||||||
<property name="singleStep">
|
</property>
|
||||||
<number>10</number>
|
<property name="singleStep">
|
||||||
</property>
|
<number>10</number>
|
||||||
<property name="value">
|
</property>
|
||||||
<number>100</number>
|
<property name="value">
|
||||||
</property>
|
<number>100</number>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
|||||||
+31
-8
@@ -8,6 +8,8 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QScroller>
|
||||||
|
#include <QScrollArea>
|
||||||
//#include "LogInfo.h"
|
//#include "LogInfo.h"
|
||||||
#include "myinclude.h"
|
#include "myinclude.h"
|
||||||
#include "QInputDialog"
|
#include "QInputDialog"
|
||||||
@@ -69,6 +71,22 @@ void SystemSetting::init()
|
|||||||
// 应用样式表
|
// 应用样式表
|
||||||
applyStyleSheet();
|
applyStyleSheet();
|
||||||
|
|
||||||
|
QScrollArea *scrollArea = this->findChild<QScrollArea *>("systemSettingScrollArea");
|
||||||
|
if (scrollArea) {
|
||||||
|
QWidget *viewport = scrollArea->viewport();
|
||||||
|
QScroller::grabGesture(viewport, QScroller::LeftMouseButtonGesture);
|
||||||
|
QScroller::grabGesture(viewport, QScroller::TouchGesture);
|
||||||
|
|
||||||
|
QScroller *scroller = QScroller::scroller(viewport);
|
||||||
|
QScrollerProperties properties = scroller->scrollerProperties();
|
||||||
|
// 关闭惯性:限制 flick 速度并加快减速,达到松手即停的效果
|
||||||
|
properties.setScrollMetric(QScrollerProperties::DecelerationFactor, 1.0);
|
||||||
|
properties.setScrollMetric(QScrollerProperties::MaximumVelocity, 0.0);
|
||||||
|
properties.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 0.0);
|
||||||
|
properties.setScrollMetric(QScrollerProperties::DragStartDistance, 0.002);
|
||||||
|
scroller->setScrollerProperties(properties);
|
||||||
|
}
|
||||||
|
|
||||||
// 连接信号槽
|
// 连接信号槽
|
||||||
connect(ui->closeBtn, &QPushButton::clicked, this, &SystemSetting::buttonClickedSlot);
|
connect(ui->closeBtn, &QPushButton::clicked, this, &SystemSetting::buttonClickedSlot);
|
||||||
|
|
||||||
@@ -160,14 +178,16 @@ void SystemSetting::updateSysParaToUI(){
|
|||||||
ui->comboBoxDiameter->setCurrentIndex(sysPara->para.diameter);
|
ui->comboBoxDiameter->setCurrentIndex(sysPara->para.diameter);
|
||||||
ui->comboBoxDiaphramOffset->setCurrentIndex(sysPara->para.diaphramOffset/5-1);
|
ui->comboBoxDiaphramOffset->setCurrentIndex(sysPara->para.diaphramOffset/5-1);
|
||||||
ui->enableReclaimAlgorithm->setChecked(sysPara->para.flagOfReclaimPumEnable);
|
ui->enableReclaimAlgorithm->setChecked(sysPara->para.flagOfReclaimPumEnable);
|
||||||
|
ui->checkBoxReciclar->setChecked(sysPara->para.Reciclar);
|
||||||
|
ui->checkBoxMagnet->setChecked(sysPara->para.isCheckMagnet);
|
||||||
|
ui->checkBoxSuspendAfterPhaseFault->setChecked(sysPara->para.suspendAfterPhaseFault);
|
||||||
|
ui->checkHVFaultCloseEn->setChecked(sysPara->para.HVFaultCloseEn);
|
||||||
|
|
||||||
if(sysPara->para.EditMode>SCENE)
|
if(sysPara->para.EditMode>SCENE)
|
||||||
sysPara->para.EditMode=TXTFILE;
|
sysPara->para.EditMode=TXTFILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern bool gearPumpRunNormalFlag;
|
extern bool gearPumpRunNormalFlag;
|
||||||
void SystemSetting::applyUIPara(){
|
void SystemSetting::applyUIPara(){
|
||||||
if(sysPara){
|
if(sysPara){
|
||||||
@@ -193,7 +213,13 @@ void SystemSetting::applyUIPara(){
|
|||||||
else {
|
else {
|
||||||
QMessageBox::critical(this,tr("错误"),tr("实际频率不能为%1").arg(freq));
|
QMessageBox::critical(this,tr("错误"),tr("实际频率不能为%1").arg(freq));
|
||||||
}
|
}
|
||||||
|
|
||||||
sysPara->para.flagOfReclaimPumEnable = ui->enableReclaimAlgorithm->isChecked();
|
sysPara->para.flagOfReclaimPumEnable = ui->enableReclaimAlgorithm->isChecked();
|
||||||
|
sysPara->para.Reciclar = ui->checkBoxReciclar->isChecked();
|
||||||
|
sysPara->para.isCheckMagnet = ui->checkBoxMagnet->isChecked();
|
||||||
|
sysPara->para.suspendAfterPhaseFault = ui->checkBoxSuspendAfterPhaseFault->isChecked();
|
||||||
|
sysPara->para.HVFaultCloseEn = ui->checkHVFaultCloseEn->isChecked();
|
||||||
|
|
||||||
sysPara->para.FanTemperature = ui->spinBoxFanTemperature->value();
|
sysPara->para.FanTemperature = ui->spinBoxFanTemperature->value();
|
||||||
sysPara->para.septalPostion = ui->spinBoxSeptalPostion->value();
|
sysPara->para.septalPostion = ui->spinBoxSeptalPostion->value();
|
||||||
quint16 diaphramOffset = 5*(ui->comboBoxDiaphramOffset->currentIndex()+1);
|
quint16 diaphramOffset = 5*(ui->comboBoxDiaphramOffset->currentIndex()+1);
|
||||||
@@ -723,13 +749,10 @@ void SystemSetting::on_spinBoxOscillatorVoltage_valueChanged(int arg1)
|
|||||||
{
|
{
|
||||||
static int vol=0; //
|
static int vol=0; //
|
||||||
if(sysPara){
|
if(sysPara){
|
||||||
if(vol-1==arg1 || vol+1==arg1)
|
|
||||||
{
|
|
||||||
//qDebug()<<"OSCVOL:"<<arg1;
|
|
||||||
sysPara->devOp->setOscillatorVoltage(ui->spinBoxOscillatorVoltage->value());
|
|
||||||
|
|
||||||
}
|
|
||||||
vol = arg1;
|
vol = arg1;
|
||||||
|
|
||||||
|
if(arg1 >= 10)
|
||||||
|
sysPara->devOp->setOscillatorVoltage(ui->spinBoxOscillatorVoltage->value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#include "Public.h"
|
#include "Public.h"
|
||||||
|
|||||||
+221
-203
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+221
-203
File diff suppressed because it is too large
Load Diff
+8
-2
@@ -372,7 +372,13 @@ void MainWidget::powerOffConfirmed(){
|
|||||||
qApp->exit(0);
|
qApp->exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::setRunStatus(QString str){
|
void MainWidget::setRunStatus(QString str)
|
||||||
|
{
|
||||||
|
// 自检完成后,timerHandler中会发送停止打印的命令,导致“停止打印,自动关闭高压.”顶替掉“自检完成!!!”的情况
|
||||||
|
if(ui.lb_nozzleState->text() == qApp->translate("InkJetPrinter", "自检完成!!!") &&
|
||||||
|
str == qApp->translate("InkJetPrinter", "停止打印,自动关闭高压.")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ui.lb_nozzleState->setText(str);
|
ui.lb_nozzleState->setText(str);
|
||||||
}
|
}
|
||||||
@@ -2340,7 +2346,7 @@ void MainWidget::onPreviewScene()
|
|||||||
LogInfo::setRunStatusText("currPrintRow: " + QString::number(sysPara->status.currPrintRow));
|
LogInfo::setRunStatusText("currPrintRow: " + QString::number(sysPara->status.currPrintRow));
|
||||||
LogInfo::setRunStatusText(QString("Items bounding rect: {%1, %2}").arg(sceneRect.width()).arg(sceneRect.height()));
|
LogInfo::setRunStatusText(QString("Items bounding rect: {%1, %2}").arg(sceneRect.width()).arg(sceneRect.height()));
|
||||||
|
|
||||||
sysPara->status.currPrintRow = sceneRect.height();
|
// sysPara->status.currPrintRow = sceneRect.height();
|
||||||
sysPara->status.currPrintCol = sceneRect.width();
|
sysPara->status.currPrintCol = sceneRect.width();
|
||||||
|
|
||||||
auto rows = sysPara->para.AlterMode?sysPara->status.currAlterPrintRow : sysPara->status.currPrintRow;
|
auto rows = sysPara->para.AlterMode?sysPara->status.currAlterPrintRow : sysPara->status.currPrintRow;
|
||||||
|
|||||||
+23
-18
@@ -238,8 +238,6 @@ QByteArray RFIDManager::buildMarkCardCommand(int block, int cardType, const QStr
|
|||||||
QList<QString> list = str.split(":");
|
QList<QString> list = str.split(":");
|
||||||
for(int i = 0;i < list.size();i++){
|
for(int i = 0;i < list.size();i++){
|
||||||
Cmd[i+6] = list.at(i).toInt();
|
Cmd[i+6] = list.at(i).toInt();
|
||||||
LogInfo::setRunStatusText(tr("Cmd[%1]: %2").arg(i+6).arg(Cmd[i+6]));
|
|
||||||
qDebug()<<"Cmd["<<i+6<<"]: "<<Cmd[i+6];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ARCH_X86
|
#ifdef ARCH_X86
|
||||||
@@ -287,7 +285,7 @@ bool RFIDManager::verifyWriteResponse(const QByteArray &recResponse, QString not
|
|||||||
{
|
{
|
||||||
//写数据块成功
|
//写数据块成功
|
||||||
qDebug() << notice << "成功!" << endl << endl;
|
qDebug() << notice << "成功!" << endl << endl;
|
||||||
LogInfo::setRunStatusText(notice+"成功!");
|
// LogInfo::setRunStatusText(notice+"成功!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -520,7 +518,7 @@ void RFIDManager::initRFIDMoudle(unsigned int addr, SysPara *sysPara)
|
|||||||
//报警定时器一定要在初始化之后启动,不然就崩
|
//报警定时器一定要在初始化之后启动,不然就崩
|
||||||
#ifdef __RFID_CARD
|
#ifdef __RFID_CARD
|
||||||
if (warningTimer)
|
if (warningTimer)
|
||||||
warningTimer->start(1000);
|
warningTimer->start(3000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,7 +561,8 @@ void RFIDManager::handleCheck(unsigned int addr)
|
|||||||
else {
|
else {
|
||||||
auto ret = RFIDmarkCardUsedAsync(0, strRevdata);
|
auto ret = RFIDmarkCardUsedAsync(0, strRevdata);
|
||||||
if(ret >= 0 || ret == -11){
|
if(ret >= 0 || ret == -11){
|
||||||
emit sig_showMsg(tr("刷墨水卡成功!"));
|
const QString msg = sysPara->RFIDPara.addedInk ? tr("刷墨水卡成功!") : tr("刷墨水卡成功, 请及时将该墨水卡对应的墨水添加到机器中");
|
||||||
|
emit sig_showMsg(msg);
|
||||||
sysPara->RFIDPara.cardInk = true;
|
sysPara->RFIDPara.cardInk = true;
|
||||||
sysPara->saveRFIDPara();
|
sysPara->saveRFIDPara();
|
||||||
}
|
}
|
||||||
@@ -595,7 +594,8 @@ void RFIDManager::handleCheck(unsigned int addr)
|
|||||||
else {
|
else {
|
||||||
auto ret = RFIDmarkCardUsedAsync(1, strRevdata);
|
auto ret = RFIDmarkCardUsedAsync(1, strRevdata);
|
||||||
if(ret >= 0 || ret == -11) {
|
if(ret >= 0 || ret == -11) {
|
||||||
emit sig_showMsg(tr("刷溶剂卡成功!"));
|
const QString msg = sysPara->RFIDPara.addedSolvent ? tr("刷溶剂卡成功!") : tr("刷溶剂卡成功, 请及时将该溶剂卡对应的溶剂添加到机器中");
|
||||||
|
emit sig_showMsg(msg);
|
||||||
sysPara->RFIDPara.cardSolvent = true;
|
sysPara->RFIDPara.cardSolvent = true;
|
||||||
sysPara->saveRFIDPara();
|
sysPara->saveRFIDPara();
|
||||||
}
|
}
|
||||||
@@ -1127,10 +1127,10 @@ void RFIDManager::updateStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RFIDManager::waitStatus()
|
int RFIDManager::waitStatus()
|
||||||
{
|
{
|
||||||
// updateStatus();
|
// updateStatus();
|
||||||
bool res = false;
|
int res = 0;
|
||||||
bool inkFlag = !(sysPara->status.statWarn & WARN_STATUS_INK_WARN);
|
bool inkFlag = !(sysPara->status.statWarn & WARN_STATUS_INK_WARN);
|
||||||
bool solventFlag = !(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN);
|
bool solventFlag = !(sysPara->status.statWarn & WARN_STATUS_SOLV_WARN);
|
||||||
if (status.addedInk && status.cardInk) {
|
if (status.addedInk && status.cardInk) {
|
||||||
@@ -1148,7 +1148,7 @@ bool RFIDManager::waitStatus()
|
|||||||
QDir dir("/home/plg");
|
QDir dir("/home/plg");
|
||||||
dir.remove("inkRFIDTime.txt");
|
dir.remove("inkRFIDTime.txt");
|
||||||
|
|
||||||
res = true;
|
res = 1;
|
||||||
}
|
}
|
||||||
} else if (status.addedSolvent && status.cardSolvent) {
|
} else if (status.addedSolvent && status.cardSolvent) {
|
||||||
if (sysPara && solventFlag) {
|
if (sysPara && solventFlag) {
|
||||||
@@ -1164,8 +1164,8 @@ bool RFIDManager::waitStatus()
|
|||||||
|
|
||||||
QDir dir("/home/plg");
|
QDir dir("/home/plg");
|
||||||
dir.remove("solventRFIDTime.txt");
|
dir.remove("solventRFIDTime.txt");
|
||||||
|
res = 2;
|
||||||
}
|
}
|
||||||
res = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -1240,19 +1240,24 @@ void RFIDManager::slt_timerHandle()
|
|||||||
void RFIDManager::slt_intervalTimerHandle()
|
void RFIDManager::slt_intervalTimerHandle()
|
||||||
{
|
{
|
||||||
updateStatus();
|
updateStatus();
|
||||||
if (status.addedInk && !status.cardInk && status.firstPromptInkCard) { // 提醒频率定为5s一次,后续可能加界面显示
|
if(status.addedInk && !status.cardInk && status.firstPromptInkCard){
|
||||||
emit sig_showMsg(tr("请及时刷墨水卡"));
|
emit sig_showMsg(tr("请及时使用墨水盒附带的IC卡激活墨水盒"));
|
||||||
status.firstPromptInkCard = false;
|
status.firstPromptInkCard = false;
|
||||||
}
|
}
|
||||||
else if(status.addedSolvent && !status.cardSolvent && status.firstPromptSolventCard) {
|
|
||||||
emit sig_showMsg(tr("请及时刷溶剂卡"));
|
if(status.addedSolvent && !status.cardSolvent && status.firstPromptSolventCard){
|
||||||
|
emit sig_showMsg(tr("请及时使用溶剂盒附带的IC卡激活溶剂盒"));
|
||||||
status.firstPromptSolventCard = false;
|
status.firstPromptSolventCard = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//不需要通知先后,成功即可
|
//不需要通知先后,成功即可
|
||||||
if (waitStatus()) {
|
auto res = waitStatus();
|
||||||
LogInfo::setRunStatusText(tr("sucess"));
|
if (res == 1) {
|
||||||
// totalTime = 0;
|
LogInfo::setRunStatusText("Ink progress finished, and the ink card has been used.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (res == 2) {
|
||||||
|
LogInfo::setRunStatusText("Solvent progress finished, and the solvent card has been used.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ private:
|
|||||||
StatuStruct status;
|
StatuStruct status;
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
QTimer* warningTimer = nullptr;
|
QTimer* warningTimer = nullptr;
|
||||||
bool waitStatus();
|
int waitStatus();
|
||||||
bool waitCard();
|
bool waitCard();
|
||||||
signals:
|
signals:
|
||||||
void sig_showMsg(QString msg);
|
void sig_showMsg(QString msg);
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ BarcodeEditor::BarcodeEditor(QWidget *parent) :
|
|||||||
|
|
||||||
connect(ui->cbBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BarcodeEditor::onTypeChanged);
|
connect(ui->cbBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BarcodeEditor::onTypeChanged);
|
||||||
|
|
||||||
connect(&m_barcodeFormatEditor, &DlgBarcodeFormat::accepted, this, &BarcodeEditor::onBarcodeFormatConfirmed);
|
m_barcodeFormatEditor.setParent(this, m_barcodeFormatEditor.windowFlags());
|
||||||
connect(&m_qrcodeFormatEditor, &DlgQrcodeFormat::accepted, this, &BarcodeEditor::onQrcodeFormatConfirmed);
|
m_qrcodeFormatEditor.setParent(this, m_qrcodeFormatEditor.windowFlags());
|
||||||
|
|
||||||
m_barcodeFormatEditor.setWindowModality(Qt::WindowModality::WindowModal);
|
m_barcodeFormatEditor.setWindowModality(Qt::WindowModality::WindowModal);
|
||||||
m_qrcodeFormatEditor.setWindowModality(Qt::WindowModality::WindowModal);
|
m_qrcodeFormatEditor.setWindowModality(Qt::WindowModality::WindowModal);
|
||||||
m_barcodeFormatEditor.setWindowTitle(tr("BarCode Format"));
|
m_barcodeFormatEditor.setWindowTitle(tr("BarCode Format"));
|
||||||
@@ -294,11 +293,15 @@ void BarcodeEditor::onBtnFormatClicked()
|
|||||||
{
|
{
|
||||||
if(m_vm.type == BARCODE_TYPE_BARCODE) {
|
if(m_vm.type == BARCODE_TYPE_BARCODE) {
|
||||||
m_barcodeFormatEditor.setViewModel(m_vm.format.value<DlgBarcodeFormatVM>());
|
m_barcodeFormatEditor.setViewModel(m_vm.format.value<DlgBarcodeFormatVM>());
|
||||||
m_barcodeFormatEditor.show();
|
if (m_barcodeFormatEditor.exec() == QDialog::Accepted) {
|
||||||
|
onBarcodeFormatConfirmed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_qrcodeFormatEditor.setViewModel(m_vm.format.value<DlgQrcodeFormatVM>());
|
m_qrcodeFormatEditor.setViewModel(m_vm.format.value<DlgQrcodeFormatVM>());
|
||||||
m_qrcodeFormatEditor.show();
|
if (m_qrcodeFormatEditor.exec() == QDialog::Accepted) {
|
||||||
|
onQrcodeFormatConfirmed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,6 +359,15 @@ QSpinBox::down-arrow {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>BarCodeType</tabstop>
|
||||||
|
<tabstop>comboBoxInkColor</tabstop>
|
||||||
|
<tabstop>BarCodeHeigh</tabstop>
|
||||||
|
<tabstop>BarCodeScale</tabstop>
|
||||||
|
<tabstop>BarCodeDot</tabstop>
|
||||||
|
<tabstop>checkBoxAddText</tabstop>
|
||||||
|
<tabstop>checkBtn</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ QImage PicTextItem::strToImage(const QString &str)
|
|||||||
QPointF PicTextItem::clampItemPos(const QPointF &p)
|
QPointF PicTextItem::clampItemPos(const QPointF &p)
|
||||||
{
|
{
|
||||||
return QPointF (std::min(qreal(scene()->width() - boundingRect().width()), std::max(0.0, p.x())),
|
return QPointF (std::min(qreal(scene()->width() - boundingRect().width()), std::max(0.0, p.x())),
|
||||||
std::min(qreal(scene()->height() - boundingRect().height()), std::max(0.0, p.y())));
|
std::min((qreal(scene()->height() + 1) - boundingRect().height()), std::max(0.0, p.y())));
|
||||||
}
|
}
|
||||||
|
|
||||||
TextItemModel TextItemModel::fromItem(PicTextItem *item)
|
TextItemModel TextItemModel::fromItem(PicTextItem *item)
|
||||||
|
|||||||
+221
-203
File diff suppressed because it is too large
Load Diff
+817
-727
File diff suppressed because it is too large
Load Diff
+47
-311
@@ -452,320 +452,56 @@ void TestPrintWidget::onSaveASFile(QString filename,bool Flag){// use for dialog
|
|||||||
* */
|
* */
|
||||||
void TestPrintWidget::onFileOpen(QString filePath,bool reviewFlag){
|
void TestPrintWidget::onFileOpen(QString filePath,bool reviewFlag){
|
||||||
|
|
||||||
if(editMode==SCENE) {
|
if(editMode != SCENE || !filePath.endsWith(".xml")) {
|
||||||
if(filePath.endsWith(".xml"))
|
return;
|
||||||
{
|
|
||||||
QFile file(filePath);
|
|
||||||
|
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // 以只写模式打开文件
|
|
||||||
|
|
||||||
if(reviewFlag)
|
|
||||||
xmlfileName=filePath;
|
|
||||||
|
|
||||||
QXmlStreamReader reader(&file);
|
|
||||||
if(!m_CreateImageFlag)
|
|
||||||
{
|
|
||||||
pPicScene->clear();
|
|
||||||
pViewer->viewport()->update();
|
|
||||||
unsigned char SpecialVarEnable = 0;
|
|
||||||
if (sysPara) sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&SpecialVarEnable,1);
|
|
||||||
}
|
|
||||||
// 解析 XML,直到结束
|
|
||||||
while (!reader.atEnd()) {
|
|
||||||
|
|
||||||
// 读取下一个元素
|
|
||||||
QXmlStreamReader::TokenType nType = reader.readNext();
|
|
||||||
|
|
||||||
switch (nType) {
|
|
||||||
case QXmlStreamReader::StartDocument: { // 开始文档
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 开始文档(XML 声明) ********** ");
|
|
||||||
// XML 声明
|
|
||||||
QString strVersion = reader.documentVersion().toString();
|
|
||||||
QString strEncoding = reader.documentEncoding().toString();
|
|
||||||
bool bAlone = reader.isStandaloneDocument();
|
|
||||||
//qDebug() << QString::fromLocal8Bit("版本:%1 编码:%2 Standalone:%3")
|
|
||||||
// .arg(strVersion).arg(strEncoding).arg(bAlone) << "\r\n";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QXmlStreamReader::Comment: { // 注释
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 注释 ********** ");
|
|
||||||
QString strComment = reader.text().toString();
|
|
||||||
//qDebug() << strComment << "\r\n";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QXmlStreamReader::ProcessingInstruction: { // 处理指令
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 处理指令 ********** ");
|
|
||||||
QString strProcInstr = reader.processingInstructionData().toString();
|
|
||||||
//qDebug() << strProcInstr << "\r\n";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QXmlStreamReader::DTD: { // DTD
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** DTD ********** ");
|
|
||||||
QString strDTD = reader.text().toString();
|
|
||||||
QXmlStreamNotationDeclarations notationDeclarations = reader.notationDeclarations(); // 符号声明
|
|
||||||
QXmlStreamEntityDeclarations entityDeclarations = reader.entityDeclarations(); // 实体声明
|
|
||||||
// DTD 声明
|
|
||||||
QString strDTDName = reader.dtdName().toString();
|
|
||||||
QString strDTDPublicId = reader.dtdPublicId().toString(); // DTD 公开标识符
|
|
||||||
QString strDTDSystemId = reader.dtdSystemId().toString(); // DTD 系统标识符
|
|
||||||
//qDebug() << QString::fromLocal8Bit("DTD : %1").arg(strDTD);
|
|
||||||
//qDebug() << QString::fromLocal8Bit("DTD 名称 : %1").arg(strDTDName);
|
|
||||||
//qDebug() << QString::fromLocal8Bit("DTD 公开标识符 : %1").arg(strDTDPublicId);
|
|
||||||
//qDebug() << QString::fromLocal8Bit("DTD 系统标识符 : %1").arg(strDTDSystemId);
|
|
||||||
//qDebug() << "\r\n";
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QXmlStreamReader::StartElement: { // 开始元素
|
|
||||||
QString strElementName = reader.name().toString();
|
|
||||||
if (QString::compare(strElementName, "VBfiles") == 0) { // 根元素
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 开始元素<VBfiles> ********** ");
|
|
||||||
QXmlStreamAttributes attributes = reader.attributes();
|
|
||||||
if (attributes.hasAttribute("Version")) {
|
|
||||||
QString strVersion = attributes.value("Version").toString();
|
|
||||||
//qDebug() << QString::fromLocal8Bit("属性:Version(%1)").arg(strVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
parseVbfile(reader, reviewFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case QXmlStreamReader::EndDocument: { //*/*/ 结束文档
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 结束文档 ********** ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reader.hasError()) { // 解析出错
|
|
||||||
qDebug() << QString::fromLocal8Bit("错误信息:%1 行号:%2 列号:%3 字符位移:%4").arg(reader.errorString()).arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.characterOffset());
|
|
||||||
}
|
|
||||||
//qDebug()<<"open done";
|
|
||||||
file.close(); // 关闭文件
|
|
||||||
//snprintf(sysPara->para.lastOpenedFileName,sizeof(sysPara->para.lastOpenedFileName),"%s",filePath.toLatin1().constData());
|
|
||||||
if(!m_CreateImageFlag)//生成图片显示
|
|
||||||
{
|
|
||||||
if(sysPara)
|
|
||||||
{
|
|
||||||
sysPara->sysFile =filePath;
|
|
||||||
sysPara->loadParaFromFile();
|
|
||||||
//qDebug()<<"textedit txt mode onFileOpen" << sysPara->sysFile;
|
|
||||||
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); //打开文件完成跳转到主窗口
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
extern QStringList stringListRecive;
|
if(reviewFlag) {
|
||||||
|
xmlfileName = filePath;
|
||||||
void TestPrintWidget::parseVbfile(QXmlStreamReader &reader, bool loadPrintSetting) {
|
|
||||||
// int textItemPosX;
|
|
||||||
// int textItemPosY;
|
|
||||||
// textItemPosX = picText->pos().x() - pPicScene->itemsBoundingRect().x();
|
|
||||||
// textItemPosY = picText->pos().y() - pPicScene->itemsBoundingRect().y();
|
|
||||||
float pos_x,pos_y;
|
|
||||||
bool Condition= false ;
|
|
||||||
int CatchStartValue = -1;
|
|
||||||
int CatchValue = -1;
|
|
||||||
|
|
||||||
QXmlStreamAttributes itemAttrs;
|
|
||||||
|
|
||||||
while (!reader.atEnd()) {
|
|
||||||
reader.readNext();
|
|
||||||
if (reader.isStartElement()) { // 开始元素
|
|
||||||
QString strElementName = reader.name().toString();
|
|
||||||
if (QString::compare(strElementName, "VBfile") == 0) {
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 开始元素<VBfile> ********** ");
|
|
||||||
} else if (QString::compare(strElementName, QString("pointer_x")) == 0) { // 方式一
|
|
||||||
reader.readNext();
|
|
||||||
if (reader.isCharacters()) {
|
|
||||||
pos_x = reader.text().toString().toDouble();
|
|
||||||
//qDebug() << QString("pointer_x:%1").arg(reader.text().toString());
|
|
||||||
}
|
|
||||||
} else if (QString::compare(strElementName, QString("pointer_y")) == 0) { // 方式二
|
|
||||||
pos_y = reader.readElementText().toDouble();
|
|
||||||
//qDebug() << QString("pointer_y:%1").arg(reader.readElementText());
|
|
||||||
}
|
|
||||||
else if (QString::compare(strElementName, QString("Condition")) == 0) {
|
|
||||||
Condition = reader.readElementText().toInt() ? true : false;
|
|
||||||
}
|
|
||||||
else if (QString::compare(strElementName, QString("CatchStartValue")) == 0) {
|
|
||||||
CatchStartValue = reader.readElementText().toInt();
|
|
||||||
}
|
|
||||||
else if (QString::compare(strElementName, QString("CatchValue")) == 0) {
|
|
||||||
CatchValue = reader.readElementText().toInt();
|
|
||||||
}
|
|
||||||
else if (QString::compare(strElementName, QString("html_src")) == 0) {
|
|
||||||
//qDebug() << QString("html_src:%1").arg(reader.readElementText());
|
|
||||||
}
|
|
||||||
else if(strElementName == "itemAttrs") {
|
|
||||||
itemAttrs = reader.attributes();
|
|
||||||
} else if(strElementName == "PrintSettings" && loadPrintSetting) {
|
|
||||||
|
|
||||||
// 加载打印设置
|
|
||||||
QXmlStreamAttributes attrs = reader.attributes();
|
|
||||||
PrintSettingModel model;
|
|
||||||
PrintSettingModel::loadFromXml(model, attrs);
|
|
||||||
if(m_printSetting) {
|
|
||||||
m_printSetting->setModel(model);
|
|
||||||
m_printSetting->applyPrintSettingsToSysPara(false);
|
|
||||||
}
|
|
||||||
reader.skipCurrentElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (reader.isEntityReference()) { // 实体引用
|
|
||||||
QString strName = reader.name().toString();
|
|
||||||
QString strText = reader.text().toString();
|
|
||||||
//qDebug() << QString("EntityReference : %1(%2)").arg(strName).arg(strText);
|
|
||||||
} else if (reader.isCDATA()) { // CDATA
|
|
||||||
QString strCDATA = reader.text().toString();
|
|
||||||
//qDebug() << QString("CDATA : %1").arg(strCDATA);
|
|
||||||
PicTextItem *pPictText = nullptr;
|
|
||||||
SourceType sourceType = SourceType::UNKNOWN;
|
|
||||||
bool ok = false;
|
|
||||||
sourceType = SourceType(itemAttrs.value("sourceType").toInt(&ok));
|
|
||||||
switch(sourceType) {
|
|
||||||
case IMAGE:
|
|
||||||
pPictText = new PicImageItem(0, 0);
|
|
||||||
break;
|
|
||||||
case DATETIME:
|
|
||||||
pPictText = new PicDateItem();
|
|
||||||
break;
|
|
||||||
case SCHEDULE_SHIFT:
|
|
||||||
pPictText = new PicScheduleShiftItem();
|
|
||||||
break;
|
|
||||||
case CODE:
|
|
||||||
pPictText = new PicCodeItem();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COUNTER:
|
|
||||||
pPictText = new PicCounterItem();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TEXT:
|
|
||||||
default:
|
|
||||||
pPictText = new PicTextItem(0, 0, sourceType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPictText->setAttrs(itemAttrs);
|
|
||||||
|
|
||||||
if(m_CreateImageFlag)
|
|
||||||
{
|
|
||||||
m_pSavePicScene->addItem(pPictText);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pPicScene->addItem(pPictText);
|
|
||||||
}
|
|
||||||
QFont font = pPictText->font();
|
|
||||||
// font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace);
|
|
||||||
pPictText->setPos(pos_x,pos_y);
|
|
||||||
pPictText->SpecialConditions = Condition;
|
|
||||||
pPictText->CatchCnt1StartValue = CatchStartValue;
|
|
||||||
pPictText->CatchCnt1CurrValue = CatchValue;
|
|
||||||
|
|
||||||
itemAttrs.clear();
|
|
||||||
|
|
||||||
// Condition= false ;
|
|
||||||
// CatchValue = -1;
|
|
||||||
//LogInfo::setRunStatusText(tr("接收文件解析::2"));
|
|
||||||
if(sysPara!=nullptr && !sysPara->status.forTemplateUse || m_CreateImageFlag)
|
|
||||||
{
|
|
||||||
pPictText->setHtml(strCDATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//qDebug() << tr("接收文件解析:");
|
|
||||||
//LogInfo::setRunStatusText(tr("接收文件解析::3"));
|
|
||||||
//stringListRecive << "aaaa" << "bbbb" << "cccc";
|
|
||||||
if(strCDATA.contains("#1111") || strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#01.bmp\" />"))
|
|
||||||
{
|
|
||||||
if(stringListRecive.size() > 0)
|
|
||||||
{
|
|
||||||
if(strCDATA.contains("#1111"))
|
|
||||||
{
|
|
||||||
strCDATA.replace("#1111",stringListRecive.at(0).toStdString().c_str());
|
|
||||||
}
|
|
||||||
else if(strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#01.bmp\" />"))
|
|
||||||
{
|
|
||||||
// emit generateQRCode(stringListRecive.at(0));
|
|
||||||
strCDATA.replace("modbusQR#01.bmp","modbusQR.bmp");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if(strCDATA.contains("#2222") || strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#02.bmp\" />"))
|
|
||||||
{
|
|
||||||
if(stringListRecive.size() > 1)
|
|
||||||
{
|
|
||||||
if(strCDATA.contains("#2222"))
|
|
||||||
{
|
|
||||||
strCDATA.replace("#2222",stringListRecive.at(1).toStdString().c_str());
|
|
||||||
}
|
|
||||||
else if(strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#02.bmp\" />"))
|
|
||||||
{
|
|
||||||
// emit generateQRCode(stringListRecive.at(1));
|
|
||||||
strCDATA.replace("modbusQR#02.bmp","modbusQR.bmp");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(strCDATA.contains("#3333") || strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#03.bmp\" />"))
|
|
||||||
{
|
|
||||||
if(stringListRecive.size() > 2)
|
|
||||||
{
|
|
||||||
if(strCDATA.contains("#3333"))
|
|
||||||
{
|
|
||||||
strCDATA.replace("#3333",stringListRecive.at(2).toStdString().c_str());
|
|
||||||
}
|
|
||||||
else if(strCDATA.contains("<img src=\"/home/plg/doc/modbusQR#03.bmp\" />"))
|
|
||||||
{
|
|
||||||
// emit generateQRCode(stringListRecive.at(2));
|
|
||||||
strCDATA.replace("modbusQR#03.bmp","modbusQR.bmp");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pPictText->setHtml(strCDATA);
|
|
||||||
}
|
|
||||||
Condition= false ;
|
|
||||||
CatchValue = -1;
|
|
||||||
CatchStartValue = -1;
|
|
||||||
|
|
||||||
reader.readNext();
|
|
||||||
if (reader.isCharacters()) {
|
|
||||||
QString strCharacters = reader.text().toString();
|
|
||||||
//qDebug() << QString("Characters : %1").arg(strCharacters);
|
|
||||||
}
|
|
||||||
} else if (reader.isEndElement()) { // 结束元素
|
|
||||||
QString strElementName = reader.name().toString();
|
|
||||||
if (QString::compare(strElementName, "Blogs") == 0) {
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 结束元素<Blogs> ********** ");
|
|
||||||
break; // 跳出循环(解析 QXmlStreamReader::EndDocument)
|
|
||||||
} else if (QString::compare(strElementName, "Blog") == 0) {
|
|
||||||
//qDebug() << QString::fromLocal8Bit("********** 结束元素<Blog> ********** ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
if(!ok) {
|
||||||
|
qWarning() << "Failed to load file:" << filePath;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(reviewFlag && m_printSetting) {
|
||||||
|
m_printSetting->setModel(loadedPrintSetting);
|
||||||
|
m_printSetting->applyPrintSettingsToSysPara(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
void TestPrintWidget::addCodeItem(QString str)
|
||||||
|
|||||||
@@ -142,8 +142,6 @@ private:
|
|||||||
QTextEdit* m_TextEdit = nullptr;
|
QTextEdit* m_TextEdit = nullptr;
|
||||||
QLineEdit* m_LineEdit;
|
QLineEdit* m_LineEdit;
|
||||||
|
|
||||||
void parseVbfile(QXmlStreamReader &reader, bool loadPrintSetting = false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 对 on_KeyUp_clicked 等按键事件的简便包装
|
* @brief 对 on_KeyUp_clicked 等按键事件的简便包装
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user