新二维码/条形码编辑逻辑
This commit is contained in:
@@ -65,3 +65,8 @@ K(bypm0718wx)
|
||||
QtUI.r666
|
||||
qt4
|
||||
QtUI.r668
|
||||
2varRam.png
|
||||
3varRam.png
|
||||
800X600_New_SystemProject-_NewInterface.zip
|
||||
bnsTest.png
|
||||
printSceneView.png
|
||||
|
||||
Binary file not shown.
+140
-106
@@ -45,14 +45,14 @@ void CounterVarSet::bindTxTEdit(QTextEdit* textEdit){
|
||||
void CounterVarSet::buttonClickedSlot()
|
||||
{
|
||||
// 编辑
|
||||
// if (editFlag) {
|
||||
// m_textEdit->clear();
|
||||
// on_buttonInsertVari_pressed();
|
||||
// applyUIPara();
|
||||
// emit sig_updateSelectedCounter();
|
||||
// editFlag = false;
|
||||
// return;
|
||||
// }
|
||||
// if (editFlag) {
|
||||
// m_textEdit->clear();
|
||||
// on_buttonInsertVari_pressed();
|
||||
// applyUIPara();
|
||||
// emit sig_updateSelectedCounter();
|
||||
// editFlag = false;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 添加
|
||||
QPushButton* btn = qobject_cast<QPushButton*>(sender());
|
||||
@@ -236,114 +236,148 @@ QString CounterVarSet::getFamilyName(int fontsize){
|
||||
|
||||
void CounterVarSet::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet = R"(
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
QString styleSheet =
|
||||
R"(
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
// 下拉框
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
|
||||
QSpinBox::down-button {
|
||||
width: 23px; /* 图标显示宽度 */
|
||||
height: 23px; /* 图标显示高度 */
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
background-color: #5396C1;
|
||||
}
|
||||
QSpinBox::down-button {
|
||||
width: 23px; /* 图标显示宽度 */
|
||||
height: 23px; /* 图标显示高度 */
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QSpinBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
QSpinBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
QSpinBox::up-button {
|
||||
width: 23px; /* 图标显示宽度 */
|
||||
height: 23px; /* 图标显示高度 */
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
background-color: #5396C1;
|
||||
}
|
||||
QSpinBox::up-button {
|
||||
width: 23px; /* 图标显示宽度 */
|
||||
height: 23px; /* 图标显示高度 */
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QSpinBox::up-arrow {
|
||||
image: url(image/up_white.png);
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
QSpinBox::up-arrow {
|
||||
image: url(image/up_white.png);
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
QSpinBox {
|
||||
border: 1px solid #333333;
|
||||
}
|
||||
QSpinBox {
|
||||
border: 1px solid #333333;
|
||||
}
|
||||
|
||||
)";
|
||||
QTabWidget {
|
||||
border: none;
|
||||
background-color: #7B838E;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
margin-top: -3px;
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QTabBar::tab:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
@@ -373,12 +407,12 @@ void CounterVarSet::on_pushOnlyCNT2Clear_pressed()
|
||||
}
|
||||
|
||||
void CounterVarSet::initReplaceValue(){
|
||||
// dataList.clear();
|
||||
// dataList << "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7"
|
||||
// << "8" << "9" << "A" << "B" << "C" << "D" << "E" << "F";
|
||||
// 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();
|
||||
// if(ui->comboBox_2->currentIndex() == 0) //index 0 --- 数据
|
||||
// loadDataShow();
|
||||
}
|
||||
|
||||
//void CounterVarSet::loadDataShow(){
|
||||
|
||||
+110
-85
@@ -16,23 +16,6 @@ DateVarSet::DateVarSet(QWidget *parent) :
|
||||
|
||||
digitWidth = 4;
|
||||
|
||||
//connect(ui->radioButtonCurDate,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
//connect(ui->radioButtonExpiry,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonVarRandom,SIGNAL(toggled(bool)),this,SLOT(onRanDomPressed(bool)));
|
||||
//connect(ui->radioButtonHour,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonMinute,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonWeek,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonMonth,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonSecond,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonDay,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// // connect(ui->radioButtonXDay,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonYear,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonVar1,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool)));
|
||||
// connect(ui->radioButtonVar2,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool)));
|
||||
// connect(ui->radioButtonCNT3,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool)));
|
||||
|
||||
//ui->radioButtonXDay->hide();
|
||||
|
||||
varTypeSet = 0;
|
||||
varHtmlStr = "";
|
||||
|
||||
@@ -45,6 +28,8 @@ DateVarSet::DateVarSet(QWidget *parent) :
|
||||
layout->addWidget(m_generalSettings);
|
||||
ui->generalTab->setLayout(layout);
|
||||
|
||||
applyStyleSheet();
|
||||
|
||||
init();
|
||||
|
||||
initReplaceValue();
|
||||
@@ -52,7 +37,6 @@ DateVarSet::DateVarSet(QWidget *parent) :
|
||||
|
||||
void DateVarSet::init()
|
||||
{
|
||||
applyStyleSheet();
|
||||
// 连接信号槽
|
||||
connect(ui->checkBtn, &QPushButton::clicked, this, &DateVarSet::buttonClickedSlot);
|
||||
connect(ui->closeBtn,&QPushButton::clicked, this, &DateVarSet::buttonClickedSlot);
|
||||
@@ -82,6 +66,17 @@ void DateVarSet::init()
|
||||
connect(ui->lineEdit_Replace4, &QLineEdit::textChanged, std::bind(&DateVarSet::onLineEditReplaceChanged, this, 3, std::placeholders::_1));
|
||||
}
|
||||
|
||||
void DateVarSet::initUI()
|
||||
{
|
||||
if (m_generalSettings)
|
||||
m_generalSettings->initUI();
|
||||
|
||||
ui->lineEdit_DateFormat->setText("");
|
||||
ui->expirationCBox->setCurrentIndex(0);
|
||||
ui->expirationNumCBox->setValue(0);
|
||||
ui->cb_replaceType->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void DateVarSet::initReplaceValue(){
|
||||
monthList.clear();
|
||||
for (int i = 1; i <= 12; ++i) {
|
||||
@@ -308,7 +303,7 @@ void DateVarSet::on_buttonInsertVari_pressed()
|
||||
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)); //插入索引后
|
||||
qDebug() << m_textEdit->toHtml();
|
||||
qDebug() << m_textEdit->toHtml();
|
||||
} // 普通变量 VarType<=8
|
||||
else if(varType ==EXPIRYDATE){ //80 :/80/image/expiryDate8.bmp qrc:/80/image/expiryDate875.bmp
|
||||
// QImage img;
|
||||
@@ -513,6 +508,8 @@ void DateVarSet::setDateModel(const DateItemModel &model)
|
||||
}
|
||||
|
||||
loadMonthShow();
|
||||
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
void DateVarSet::useReplaceInsertVar(){
|
||||
@@ -528,82 +525,110 @@ QString DateVarSet::getFamilyName(int fontsize){
|
||||
void DateVarSet::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet =
|
||||
R"(
|
||||
R"(
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
|
||||
// 下拉框
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
)";
|
||||
QTabWidget {
|
||||
border: none;
|
||||
background-color: #7B838E;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
+5
-1
@@ -27,7 +27,9 @@ public:
|
||||
|
||||
void init();
|
||||
|
||||
void applyStyleSheet();
|
||||
void initUI();
|
||||
|
||||
// void applyStyleSheet();
|
||||
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
|
||||
@@ -118,6 +120,8 @@ private:
|
||||
int currPage;
|
||||
|
||||
QXmlStreamAttributes m_backup;
|
||||
|
||||
void applyStyleSheet(); // 应用样式表
|
||||
};
|
||||
|
||||
#endif // DATEVARSET_H
|
||||
|
||||
+1
-3
@@ -160,9 +160,7 @@
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
min-width: 60px;
|
||||
min-height: 40px;
|
||||
font-size: 36px;
|
||||
font-size: 24px;
|
||||
font-family: "Ubuntu";
|
||||
color: #228B22;
|
||||
}
|
||||
|
||||
+31
-22
@@ -118,7 +118,6 @@ void InkJetPrinter::init()
|
||||
connect(m_SystemSetting,&SystemSetting::sendButtonClickedSignal,this,&InkJetPrinter::getSystemSettingWidgetButtonClickSlot);
|
||||
connect(m_OtherInfo,&OtherInfo::sendButtonClickedSignal,this,&InkJetPrinter::getOtherInfoWidgetButtonClickSlot);
|
||||
connect(m_LogInfo,&LogInfo::sendButtonClickedSignal,this,&InkJetPrinter::getLogInfoWidgetButtonClickSlot);
|
||||
connect(m_LogInfo,&LogInfo::sig_updateGeneralState,this,&InkJetPrinter::slt_updateGeneralState);
|
||||
|
||||
connect(m_DateVarSet,&DateVarSet::sendButtonClickedSignal,this,&InkJetPrinter::getDateSetWidgetButtonClickSlot);
|
||||
//添加计数器,修改计数器
|
||||
@@ -140,12 +139,20 @@ void InkJetPrinter::init()
|
||||
connect(m_TestPrintWidget, &TestPrintWidget::sig_showEditCounter,
|
||||
this, &InkJetPrinter::slt_editCounter);
|
||||
|
||||
// 状态界面
|
||||
if (ctrl_loginfo == nullptr) ctrl_loginfo = LogInfoCtrl::instance();
|
||||
connect(ctrl_loginfo, &LogInfoCtrl::sig_show, this, [=](){
|
||||
getMainWidgetButtonClickedSlot(5);
|
||||
m_LogInfo->checkState();
|
||||
});
|
||||
|
||||
SysPara *para = new SysPara();
|
||||
bindSysPara(para);
|
||||
m_MainWidget->bindSysPara(para);
|
||||
m_FontSetWidget->bindSysPara(para);
|
||||
m_PrintSetting->bindSysPara(para);
|
||||
m_SystemManage->bindSysPara(para);
|
||||
m_SystemUpdate->bindSysPara(para);
|
||||
m_SystemSetting->bindSysPara(para);
|
||||
m_OtherInfo->bindSysPara(para);
|
||||
m_TestPrintWidget->bindSysPara(para);
|
||||
@@ -153,7 +160,8 @@ void InkJetPrinter::init()
|
||||
m_CounterVarSet->bindSysPara(para);
|
||||
m_MainInstruction->bindSysPara(para);
|
||||
m_BarCodeDlg->bindSysPara(para);
|
||||
m_QRCodeDlg->setSysPara(para);
|
||||
m_QRCodeDlg->bindSysPara(para);
|
||||
m_LogInfo->bindSysPara(para);
|
||||
|
||||
if(sysPara->para.gearPumpEnable)
|
||||
pushButtonStartFlag = true;
|
||||
@@ -719,8 +727,8 @@ void InkJetPrinter::timerHandler(void){
|
||||
// byons: 改到往下一百行左右的位置了 byons@2026年4月11日
|
||||
// 用于刷新时间类型 byons@2026年4月10日
|
||||
// 现在只用于更新界面,给人看的,因此理论延迟1秒左右,实际受系统用量影响可能会更慢
|
||||
if(m_StackedWidget->currentWidget() == m_MainWidget)
|
||||
m_MainWidget->onPreviewScene();
|
||||
// if(m_StackedWidget->currentWidget() == m_MainWidget)
|
||||
// m_MainWidget->onPreviewScene();
|
||||
|
||||
// end by byons@2026年4月10日
|
||||
}
|
||||
@@ -831,20 +839,24 @@ void InkJetPrinter::timerHandler(void){
|
||||
}
|
||||
|
||||
// byons: 时间类型图元更新 @2026年4月11日
|
||||
if(sysPara->status.isPrinting) {
|
||||
if (m_MainWidget->dateTimeItemsDotUpdate()) {
|
||||
// // 统计追踪更新频率
|
||||
// static QElapsedTimer bnsTimer;
|
||||
// static int toogleCount = 0;
|
||||
// ++toogleCount;
|
||||
// if(toogleCount > 10) {
|
||||
// auto elapsed = bnsTimer.restart();
|
||||
// qDebug() << (QString("timeHandler avg elapsed: %1 s").arg(elapsed / qreal(toogleCount) / 1000.0));
|
||||
// toogleCount = 0;
|
||||
// }
|
||||
|
||||
// 统计追踪更新频率
|
||||
static QElapsedTimer bnsTimer;
|
||||
static int toogleCount = 0;
|
||||
++toogleCount;
|
||||
if(toogleCount > 10) {
|
||||
auto elapsed = bnsTimer.restart();
|
||||
qDebug() << (QString("timeHandler avg elapsed: %1 s").arg(elapsed / qreal(toogleCount) / 1000.0));
|
||||
toogleCount = 0;
|
||||
if(sysPara->status.isPrinting) {
|
||||
m_MainWidget->SendPrintDataToFpga(0);
|
||||
}
|
||||
|
||||
if (m_MainWidget->dateTimeItemsDotUpdate())
|
||||
m_MainWidget->SendPrintDataToFpga(0);
|
||||
if(m_StackedWidget->currentWidget() == m_MainWidget) {
|
||||
m_MainWidget->updatePrintDisplayLabel();
|
||||
}
|
||||
}
|
||||
|
||||
// if (modbus->getModbusStatus() == 1) {
|
||||
@@ -1130,6 +1142,7 @@ void InkJetPrinter::timerHandler(void){
|
||||
static bool read_flag = false;
|
||||
if((widget == m_MainWidget || widget == m_LogInfo) && pulse_100ms) {
|
||||
m_MainWidget->updateSysStatusToUI();
|
||||
m_MainWidget->updateGeneralState(m_MainWidget->alarmStatus);
|
||||
m_LogInfo->updateSysStatusToUI(m_MainWidget->alarmStatus);
|
||||
}
|
||||
/*
|
||||
@@ -1561,11 +1574,14 @@ void InkJetPrinter::getTestPrintWidgetButtonClickedSlot(int index)
|
||||
|
||||
void InkJetPrinter::openDatetimeEditor(PicDateItem* item)
|
||||
{
|
||||
m_DateVarSet->initUI();
|
||||
m_DateVarSet->initReplaceValue();
|
||||
|
||||
if(item) {
|
||||
m_DateVarSet->edit(item);
|
||||
}
|
||||
else
|
||||
m_DateVarSet->setDateModel(DateItemModel::createDefaultReplaceModel());
|
||||
|
||||
m_StackedWidget->setCurrentWidget(m_DateVarSet);
|
||||
}
|
||||
@@ -1758,13 +1774,6 @@ void InkJetPrinter::getLogInfoWidgetButtonClickSlot(int index){
|
||||
}
|
||||
}
|
||||
|
||||
void InkJetPrinter::slt_updateGeneralState(DevStatusLightType type, QString stateStr)
|
||||
{
|
||||
if (m_MainWidget) {
|
||||
m_MainWidget->updateGeneralState(type, stateStr);
|
||||
}
|
||||
}
|
||||
|
||||
void InkJetPrinter::getDateSetWidgetButtonClickSlot(int index){
|
||||
switch (index)
|
||||
{
|
||||
|
||||
+5
-4
@@ -57,9 +57,10 @@ private:
|
||||
MainWidget* m_MainWidget;
|
||||
TestPrintWidget* m_TestPrintWidget;
|
||||
|
||||
QBarCode* m_BarCodeDlg = nullptr;
|
||||
dlgQrCode* m_QRCodeDlg = nullptr;
|
||||
// MainInterfaceWidget* m_MainInterfaceWidget;
|
||||
QBarCode* m_BarCodeDlg __attribute__((deprecated("Use BarcodeEditor instead"))) = nullptr;
|
||||
|
||||
dlgQrCode* m_QRCodeDlg __attribute__((deprecated("Use BarcodeEditor instead"))) = nullptr;
|
||||
|
||||
SystemManage* m_SystemManage;
|
||||
SystemUpdate* m_SystemUpdate;
|
||||
SystemSetting* m_SystemSetting;
|
||||
@@ -72,6 +73,7 @@ private:
|
||||
MainInstruction* m_MainInstruction;
|
||||
|
||||
LogInfo* m_LogInfo;
|
||||
LogInfoCtrl* ctrl_loginfo = nullptr;
|
||||
|
||||
ScheduleShiftsEditor* m_scheduleShiftsEditor = nullptr;
|
||||
|
||||
@@ -123,7 +125,6 @@ private slots:
|
||||
void getSystemSettingWidgetButtonClickSlot(int index);
|
||||
void getOtherInfoWidgetButtonClickSlot(int index);
|
||||
void getLogInfoWidgetButtonClickSlot(int index);
|
||||
void slt_updateGeneralState(DevStatusLightType type, QString stateStr);
|
||||
void getDateSetWidgetButtonClickSlot(int index);
|
||||
void getCounterVarSetWidgetButtonClickSlot(int index);
|
||||
void slt_counterVarUpdate();
|
||||
|
||||
+2
-2
@@ -86,8 +86,8 @@
|
||||
<widget class="QPushButton" name="okBtn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>62</width>
|
||||
<height>42</height>
|
||||
<width>100</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
||||
+242
-300
@@ -13,7 +13,7 @@
|
||||
#include <QSettings>
|
||||
|
||||
#ifndef LOGINFOFILE_DIR
|
||||
#define LOGINFOFILE_DIR "/home/plg/loginfo/"
|
||||
#define LOGINFOFILE_DIR "/home/plg/loginfo/"
|
||||
#endif
|
||||
#define UDISK_LOGINFO_ROOT_DIR "/udisk/log/"
|
||||
|
||||
@@ -28,7 +28,7 @@ LogInfo::LogInfo(QWidget *parent) :
|
||||
textEdit->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
|
||||
textEdit2 = ui->textEditRunStatus_2;
|
||||
//textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
|
||||
textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
|
||||
textEdit2->verticalScrollBar()->setStyleSheet("QScrollBar:vertical { width: 40px; }");
|
||||
|
||||
|
||||
textEditMachInfo = ui->machinInformation;
|
||||
@@ -64,15 +64,15 @@ LogInfo::LogInfo(QWidget *parent) :
|
||||
|
||||
LogInfo::~LogInfo()
|
||||
{
|
||||
textEdit = 0;
|
||||
textEdit2 = 0;
|
||||
textEditMachInfo = 0;
|
||||
if(fileDialog)
|
||||
delete fileDialog;
|
||||
textEdit = 0;
|
||||
textEdit2 = 0;
|
||||
textEditMachInfo = 0;
|
||||
if(fileDialog)
|
||||
delete fileDialog;
|
||||
delete ui;
|
||||
|
||||
disconnect(timerLogdel, SIGNAL(timeout()), this, SLOT(deleteOldLog()));
|
||||
timerLogdel->stop();
|
||||
disconnect(timerLogdel, SIGNAL(timeout()), this, SLOT(deleteOldLog()));
|
||||
timerLogdel->stop();
|
||||
}
|
||||
|
||||
void LogInfo::init()
|
||||
@@ -91,7 +91,9 @@ void LogInfo::init()
|
||||
QTabBar::tab:selected {background-color: rgb(255, 170, 127);height:70px;}\
|
||||
QTabBar::tab:!selected {margin-top: 5px;}\
|
||||
QTabBar::scroller{ width:80px;}";
|
||||
// this->setStyleSheet(style_main2);
|
||||
// this->setStyleSheet(style_main2);
|
||||
if (ctrl_loginfo == nullptr) ctrl_loginfo = LogInfoCtrl::instance();
|
||||
connect(ctrl_loginfo, &LogInfoCtrl::sig_cleanOver, this, &LogInfo::slt_cleanOver);
|
||||
}
|
||||
|
||||
void LogInfo::buttonClickedSlot()
|
||||
@@ -119,19 +121,19 @@ void LogInfo::showMachineInformation(QString Mac,QString SerialNum, QString Vern
|
||||
{
|
||||
QString machInfo;
|
||||
machInfo = "Mac:" + Mac + "\n";
|
||||
// machInfo += "Serial Number:" + SerialNum + "\n";
|
||||
// machInfo += "Serial Number:" + SerialNum + "\n";
|
||||
machInfo += "VernonBach Ver:" + VernonBachVer + "\n";
|
||||
machInfo += "FPGA Ver:" + FpgaVer;
|
||||
// QFile kernelVer("/proc/version");
|
||||
// if (kernelVer.open(QFile::ReadOnly | QFile::Text)) {
|
||||
// QTextStream in(&kernelVer);
|
||||
// QString kernelVer=in.readLine();
|
||||
// QStringList list=kernelVer.split(" ");
|
||||
// QStringList list2=kernelVer.split("#");
|
||||
// machInfo = machInfo + "Kernel: ";
|
||||
// machInfo = machInfo + list.at(2);
|
||||
// machInfo = machInfo + "(" + list2.at(1) + ")";
|
||||
// }
|
||||
// QFile kernelVer("/proc/version");
|
||||
// if (kernelVer.open(QFile::ReadOnly | QFile::Text)) {
|
||||
// QTextStream in(&kernelVer);
|
||||
// QString kernelVer=in.readLine();
|
||||
// QStringList list=kernelVer.split(" ");
|
||||
// QStringList list2=kernelVer.split("#");
|
||||
// machInfo = machInfo + "Kernel: ";
|
||||
// machInfo = machInfo + list.at(2);
|
||||
// machInfo = machInfo + "(" + list2.at(1) + ")";
|
||||
// }
|
||||
|
||||
textEditMachInfo->setText(machInfo);
|
||||
}
|
||||
@@ -141,10 +143,10 @@ void LogInfo::showVerionInformation(QString Mac,QString VernonBachVer, QString F
|
||||
static bool flag = false;
|
||||
if(!flag){
|
||||
QString machInfo;
|
||||
machInfo = "Mac:" + Mac + "\n";
|
||||
machInfo = "Mac:" + Mac + "\n";
|
||||
machInfo += "VernonBach Ver:" + VernonBachVer +"|"+STM32Ver+ "\n";
|
||||
machInfo += "FPGA Ver: NO" + FpgaVer + "\n";
|
||||
// machInfo += "PowerOnMode: " + QString::number(powerOnMode) + "\n";
|
||||
// machInfo += "PowerOnMode: " + QString::number(powerOnMode) + "\n";
|
||||
textEditMachInfo->append(machInfo);
|
||||
}
|
||||
}
|
||||
@@ -193,7 +195,7 @@ void LogInfo::readRunStatusText()
|
||||
QDir dir1;
|
||||
dir1.setPath(LOGINFOFILE_DIR);
|
||||
if(!dir1.exists())
|
||||
dir1.mkdir(QString ("/home/plg/loginfo/"));
|
||||
dir1.mkdir(QString ("/home/plg/loginfo/"));
|
||||
fileName=QString("/home/plg/loginfo/")+QDate::currentDate().toString("yyyyMMdd")+"_1.txt";
|
||||
QFile file(fileName);
|
||||
if(file.exists()){
|
||||
@@ -231,7 +233,7 @@ void LogInfo::on_pushButtonExportFile_pressed()
|
||||
//QString dirPath = ui->radioButtonLocal->isChecked()?DOC_ROOT_DIR:UDISK_LOGINFO_ROOT_DIR;
|
||||
QDir dir(UDISK_LOGINFO_ROOT_DIR);
|
||||
if(!dir.exists()){
|
||||
// system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data()));
|
||||
// system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data()));
|
||||
system((char *)((QString("mkdir -p %1").arg(UDISK_LOGINFO_ROOT_DIR)).toLocal8Bit().data()));
|
||||
}
|
||||
|
||||
@@ -246,7 +248,7 @@ void LogInfo::on_pushButtonExportFile_pressed()
|
||||
return;
|
||||
}
|
||||
|
||||
// system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data()));
|
||||
// system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLatin1().data()));
|
||||
system((char *)((QString("cp -r %1/* %2/").arg(LOGINFOFILE_DIR).arg(UDISK_LOGINFO_ROOT_DIR)).toLocal8Bit().data()));
|
||||
//refreshListView(EditMode);
|
||||
system("sync");
|
||||
@@ -268,13 +270,13 @@ void LogInfo::on_pushButtonPreState_pressed(){
|
||||
//qDebug()<<"3333";
|
||||
if(openFileName.isEmpty()) textEdit2->clear();
|
||||
if(fileDialog) {
|
||||
// qDebug()<<"4444";
|
||||
// qDebug()<<"4444";
|
||||
disconnect(fileDialog,SIGNAL(accepted()),0,0); // 如果对话框已经定义,则删除控件关联,否则也会出错。
|
||||
|
||||
}
|
||||
else {//qDebug()<<"5";
|
||||
fileDialog = new MyFileDialog(0);
|
||||
//qDebug()<<"6";
|
||||
//qDebug()<<"6";
|
||||
}
|
||||
//qDebug()<<"7";
|
||||
QDir dir1;
|
||||
@@ -285,7 +287,7 @@ void LogInfo::on_pushButtonPreState_pressed(){
|
||||
if(fileDialog){
|
||||
//qDebug()<<"8";
|
||||
|
||||
if(fileDialog->directory().path()!="/home/plg/loginfo")
|
||||
if(fileDialog->directory().path()!="/home/plg/loginfo")
|
||||
fileDialog->setDirectory(QDir("/home/plg/loginfo"));
|
||||
|
||||
|
||||
@@ -296,7 +298,7 @@ void LogInfo::on_pushButtonPreState_pressed(){
|
||||
//qDebug()<<"read File 5";
|
||||
}
|
||||
//else qDebug()<<"read File:"<<dir1.path();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -355,6 +357,7 @@ void LogInfo::on_pushButtonClearCurrent_pressed()
|
||||
runStatusTextIndex=0;
|
||||
}
|
||||
}
|
||||
|
||||
void LogInfo::onReadRecorder()
|
||||
{
|
||||
QString fileName = ":/buge_record.txt";
|
||||
@@ -367,66 +370,66 @@ void LogInfo::onReadRecorder()
|
||||
else{
|
||||
QTextStream in (&file);
|
||||
textEditMachInfo->setText(in.readAll());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LogInfo::deleteDirectoryContents(const QDir &directory) {
|
||||
QList<QFileInfo> entries = directory.entryInfoList(
|
||||
QDir::NoDotAndDotDot | QDir::AllEntries);
|
||||
QString today = QDate::currentDate().toString(Qt::ISODate);
|
||||
// 使用传统的 for 循环遍历所有条目
|
||||
for (int i = 0; i < entries.size(); ++i) {
|
||||
QFileInfo entryInfo = entries.at(i);
|
||||
QString dirName=entryInfo.baseName();
|
||||
if(today==dirName)
|
||||
continue;
|
||||
QString fullPath = entryInfo.absoluteFilePath();
|
||||
QDir::NoDotAndDotDot | QDir::AllEntries);
|
||||
QString today = QDate::currentDate().toString(Qt::ISODate);
|
||||
// 使用传统的 for 循环遍历所有条目
|
||||
for (int i = 0; i < entries.size(); ++i) {
|
||||
QFileInfo entryInfo = entries.at(i);
|
||||
QString dirName=entryInfo.baseName();
|
||||
if(today==dirName)
|
||||
continue;
|
||||
QString fullPath = entryInfo.absoluteFilePath();
|
||||
|
||||
if (entryInfo.isFile() || entryInfo.isSymLink()) {
|
||||
// 如果是文件或符号链接,尝试删除
|
||||
if (!QFile::remove(fullPath)) {
|
||||
qDebug() << "Failed to remove file or symlink:" << fullPath;
|
||||
}
|
||||
} else if (entryInfo.isDir()) {
|
||||
// 如果是目录,递归调用以删除其内容
|
||||
QDir subDir(fullPath);
|
||||
deleteDirectoryContents(subDir);
|
||||
if (entryInfo.isFile() || entryInfo.isSymLink()) {
|
||||
// 如果是文件或符号链接,尝试删除
|
||||
if (!QFile::remove(fullPath)) {
|
||||
qDebug() << "Failed to remove file or symlink:" << fullPath;
|
||||
}
|
||||
} else if (entryInfo.isDir()) {
|
||||
// 如果是目录,递归调用以删除其内容
|
||||
QDir subDir(fullPath);
|
||||
deleteDirectoryContents(subDir);
|
||||
|
||||
// 目录现在应该是空的,尝试删除它
|
||||
if (!QDir().rmdir(fullPath)) {
|
||||
qDebug() << "Failed to remove directory:" << fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 目录现在应该是空的,尝试删除它
|
||||
if (!QDir().rmdir(fullPath)) {
|
||||
qDebug() << "Failed to remove directory:" << fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除指定文件夹超过七天的文件
|
||||
void LogInfo::deleteOldLog(const QString folderPath,int days){
|
||||
QDir dir(folderPath); // 创建一个QDir对象用于操作传入的文件夹路径
|
||||
if (!dir.exists()) { // 判断传入文件夹是否存在
|
||||
qDebug() << "文件夹不存在";
|
||||
return;
|
||||
}
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime(); // 获取当前时间
|
||||
QDateTime sevenDaysAgo = currentDateTime.addDays(-days); // 计算days天前的日期时间
|
||||
// 目录下的文件和子目录的信息列表,列出所有文件和子目录并按照最后修改时间排序
|
||||
QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time);
|
||||
foreach (QFileInfo fileInfo ,fileInfoList) {
|
||||
if (!fileInfo.isDir()){
|
||||
QString fileExtension = fileInfo.suffix().toLower(); // 获取文件的扩展名并确保它是小写的
|
||||
// 选择删除那种图片类型
|
||||
if (fileExtension == "txt") {
|
||||
if (fileInfo.lastModified() < sevenDaysAgo && fileInfo.fileName().indexOf('_')!=-1) { // 获取最后一个文件夹修改时间和days传入的时间最对比
|
||||
if (QFile::remove(fileInfo.absoluteFilePath())) { // 删除满足条件的文件的绝对路径
|
||||
qDebug() << "删除成功" << fileInfo.absoluteFilePath();
|
||||
} else {
|
||||
qDebug() << "文件删除失败" << fileInfo.absoluteFilePath();
|
||||
}
|
||||
if (!dir.exists()) { // 判断传入文件夹是否存在
|
||||
qDebug() << "文件夹不存在";
|
||||
return;
|
||||
}
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime(); // 获取当前时间
|
||||
QDateTime sevenDaysAgo = currentDateTime.addDays(-days); // 计算days天前的日期时间
|
||||
// 目录下的文件和子目录的信息列表,列出所有文件和子目录并按照最后修改时间排序
|
||||
QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time);
|
||||
foreach (QFileInfo fileInfo ,fileInfoList) {
|
||||
if (!fileInfo.isDir()){
|
||||
QString fileExtension = fileInfo.suffix().toLower(); // 获取文件的扩展名并确保它是小写的
|
||||
// 选择删除那种图片类型
|
||||
if (fileExtension == "txt") {
|
||||
if (fileInfo.lastModified() < sevenDaysAgo && fileInfo.fileName().indexOf('_')!=-1) { // 获取最后一个文件夹修改时间和days传入的时间最对比
|
||||
if (QFile::remove(fileInfo.absoluteFilePath())) { // 删除满足条件的文件的绝对路径
|
||||
qDebug() << "删除成功" << fileInfo.absoluteFilePath();
|
||||
} else {
|
||||
qDebug() << "文件删除失败" << fileInfo.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LogInfo::deleteOldLog()
|
||||
@@ -442,7 +445,7 @@ void LogInfo::truncatelog()
|
||||
const QString fileNameL=QString(LOGINFOFILE_DIR)+dts +"_1.txt";
|
||||
QFile file(fileNameL);
|
||||
|
||||
if(file.size()>204800)//文件大小
|
||||
if(file.size()>204800)//文件大小
|
||||
{
|
||||
QSettings settings("MySoft", "MyApp");
|
||||
int filenum=settings.value(dts,2).toInt();
|
||||
@@ -457,29 +460,29 @@ void LogInfo::truncatelog()
|
||||
|
||||
void LogInfo::setScrollBar(){
|
||||
QString styleSheet = "\n\
|
||||
QTextEdit QScrollBar:vertical {\n\
|
||||
width: 50px; /* 设置垂直滚动条的宽度 */\n\
|
||||
background: rgba(0, 0, 0, 0); /* 滚动条背景透明 */\n\
|
||||
margin: 20px 0 20px 0; /* 为按钮留出空间 */\n\
|
||||
}\n\
|
||||
QTextEdit QScrollBar::handle:vertical {\n\
|
||||
background: rgb(125, 170, 177); /* 滑块颜色 */\n\
|
||||
border-radius: 5px; /* 滑块圆角 */\n\
|
||||
min-height: 40px; /* 滑块最小高度 */\n\
|
||||
}\n\
|
||||
QTextEdit QScrollBar::add-line:vertical {\n\
|
||||
height: 40px; /* 设置向下按钮的高度 */\n\
|
||||
background: rgb(255, 170, 127); /* 按钮颜色 */\n\
|
||||
subcontrol-position: bottom;\n\
|
||||
subcontrol-origin: margin;\n\
|
||||
}\n\
|
||||
QTextEdit QScrollBar::sub-line:vertical {\n\
|
||||
height: 40px; /* 设置向上按钮的高度 */\n\
|
||||
background: rgb(255, 170, 127); /* 按钮颜色 */\n\
|
||||
subcontrol-position: top;\n\
|
||||
subcontrol-origin: margin;\n\
|
||||
}";
|
||||
ui->textEditRunStatus->setStyleSheet(styleSheet);
|
||||
QTextEdit QScrollBar:vertical {\n\
|
||||
width: 50px; /* 设置垂直滚动条的宽度 */\n\
|
||||
background: rgba(0, 0, 0, 0); /* 滚动条背景透明 */\n\
|
||||
margin: 20px 0 20px 0; /* 为按钮留出空间 */\n\
|
||||
}\n\
|
||||
QTextEdit QScrollBar::handle:vertical {\n\
|
||||
background: rgb(125, 170, 177); /* 滑块颜色 */\n\
|
||||
border-radius: 5px; /* 滑块圆角 */\n\
|
||||
min-height: 40px; /* 滑块最小高度 */\n\
|
||||
}\n\
|
||||
QTextEdit QScrollBar::add-line:vertical {\n\
|
||||
height: 40px; /* 设置向下按钮的高度 */\n\
|
||||
background: rgb(255, 170, 127); /* 按钮颜色 */\n\
|
||||
subcontrol-position: bottom;\n\
|
||||
subcontrol-origin: margin;\n\
|
||||
}\n\
|
||||
QTextEdit QScrollBar::sub-line:vertical {\n\
|
||||
height: 40px; /* 设置向上按钮的高度 */\n\
|
||||
background: rgb(255, 170, 127); /* 按钮颜色 */\n\
|
||||
subcontrol-position: top;\n\
|
||||
subcontrol-origin: margin;\n\
|
||||
}";
|
||||
ui->textEditRunStatus->setStyleSheet(styleSheet);
|
||||
ui->textEditRunStatus_2->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
@@ -503,234 +506,173 @@ void LogInfo::updateSysStatusToUI(const AlarmStatus& alarmStatus){
|
||||
ui->labOscVol->setText(alarmStatus.highVol);
|
||||
ui->label_size->setText(alarmStatus.dataSize);
|
||||
|
||||
// 获取总状态
|
||||
getGeneralState(alarmStatus);
|
||||
|
||||
}
|
||||
|
||||
void LogInfo::getGeneralState(AlarmStatus status)
|
||||
void LogInfo::bindSysPara(SysPara *sysPara)
|
||||
{
|
||||
// 有红则红,全绿则绿,红>黄>绿
|
||||
// 检查从后往前判断,因为取最后一个状态QString
|
||||
bool isRed = checkRed(status);
|
||||
if (isRed) {
|
||||
m_stateColor = DEV_STATUS_RED;
|
||||
} else {
|
||||
bool isYellow = checkYellow(status);
|
||||
if (isYellow) {
|
||||
m_stateColor = DEV_STATUS_YELLOW;
|
||||
} else {
|
||||
m_stateColor = DEV_STATUS_GREEN;
|
||||
m_stateStr= tr("正常");
|
||||
}
|
||||
}
|
||||
emit sig_updateGeneralState(m_stateColor, m_stateStr);
|
||||
this->sysPara = sysPara;
|
||||
}
|
||||
|
||||
bool LogInfo::checkRed(AlarmStatus &status)
|
||||
void LogInfo::checkState()
|
||||
{
|
||||
if (status.highVoltageFault == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("高压故障");
|
||||
return true;
|
||||
}
|
||||
if (status.chargeFault == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("相位故障");
|
||||
return true;
|
||||
}
|
||||
if (status.viscosityWarn == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("粘度故障");
|
||||
return true;
|
||||
}
|
||||
if (status.recycleWarn == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("回收故障");
|
||||
return true;
|
||||
}
|
||||
if (status.solveLevelWarn == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("溶液液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkWaterLevel == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("墨水液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkLeak == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("墨水缸满");
|
||||
return true;
|
||||
}
|
||||
if (status.inkSwint == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("墨线开关");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LogInfo::checkYellow(AlarmStatus &status)
|
||||
{
|
||||
if (status.highVoltageFault == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("高压故障");
|
||||
return true;
|
||||
}
|
||||
if (status.chargeFault == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("相位故障");
|
||||
return true;
|
||||
}
|
||||
if (status.viscosityWarn == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("粘度故障");
|
||||
return true;
|
||||
}
|
||||
if (status.recycleWarn == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("回收故障");
|
||||
return true;
|
||||
}
|
||||
if (status.solveLevelWarn == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("溶液液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkWaterLevel == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("墨水液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkLeak == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("墨水缸满");
|
||||
return true;
|
||||
}
|
||||
if (status.inkSwint == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("墨线开关");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
ui->tabWidget->setCurrentIndex(3);
|
||||
}
|
||||
|
||||
void LogInfo::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet = R"(
|
||||
QTabWidget {
|
||||
border: none;
|
||||
background-color: #7B838E;
|
||||
}
|
||||
QTabWidget::pane {
|
||||
border: 1px solid #dddddd;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
background-color: #7B838E;
|
||||
alignment: left;
|
||||
height: 80px;
|
||||
margin: 0;
|
||||
}
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QTabBar {
|
||||
background-color: #7B838E;
|
||||
border: none;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
height: 80px;
|
||||
padding: 0;
|
||||
}
|
||||
QTabBar::tab {
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
width: 140px;
|
||||
height: 80px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
border: none;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
alignment: center bottom;
|
||||
padding-top: 0;
|
||||
}
|
||||
QTabBar::tab {
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
QTabBar::tab:!selected {
|
||||
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #6E757F, stop:1 #96A0A9);
|
||||
border: 2px solid #63535D;
|
||||
border-bottom: none;
|
||||
position: relative;
|
||||
bottom: 0px;
|
||||
}
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #95B2D4, stop:1 #F0F0F0);
|
||||
border: none;
|
||||
position: relative;
|
||||
bottom: 0px;
|
||||
}
|
||||
QWidget#buttonWidget {
|
||||
background-color: #95989D;
|
||||
}
|
||||
|
||||
QTabWidget::pane {
|
||||
border: none;
|
||||
background-color: #f0f0f0;
|
||||
top: -12px;
|
||||
}
|
||||
QPushButton#closeBtn1,QPushButton#closeBtn2,QPushButton#closeBtn3,QPushButton#closeBtn4 {
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
|
||||
QWidget#buttonWidget {
|
||||
background-color: #95989D;
|
||||
}
|
||||
QPushButton#closeBtn1:hover,QPushButton#closeBtn2:hover,QPushButton#closeBtn3:hover, QPushButton#closeBtn4:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn1,QPushButton#closeBtn2,QPushButton#closeBtn3,QPushButton#closeBtn4 {
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn1:pressed,QPushButton#closeBtn2:pressed,QPushButton#closeBtn3:pressed, QPushButton#closeBtn4:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn1:hover,QPushButton#closeBtn2:hover,QPushButton#closeBtn3:hover, QPushButton#closeBtn4:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
QCheckBox {
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
font-weight:500;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn1:pressed,QPushButton#closeBtn2:pressed,QPushButton#closeBtn3:pressed, QPushButton#closeBtn4:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
QCheckBox::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 1px solid #96A0A9;
|
||||
border-radius: 10px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
QCheckBox {
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
font-weight:500;
|
||||
}
|
||||
QCheckBox::indicator:checked {
|
||||
background-color: #95B2D4;
|
||||
border-color: #95B2D4;
|
||||
image: url(:/Demo/image/select.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 1px solid #96A0A9;
|
||||
border-radius: 10px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
QLabel {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked {
|
||||
background-color: #95B2D4;
|
||||
border-color: #95B2D4;
|
||||
image: url(:/Demo/image/select.png);
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
}
|
||||
|
||||
QLabel {
|
||||
font-size: 15px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
|
||||
background-color: #E3E7EC;
|
||||
}
|
||||
)";
|
||||
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
|
||||
background-color: #E3E7EC;
|
||||
}
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void LogInfo::on_btn_clean_clicked()
|
||||
{
|
||||
if (ctrl_loginfo) ctrl_loginfo->emitSigClean();
|
||||
}
|
||||
|
||||
void LogInfo::slt_cleanOver(bool flag)
|
||||
{
|
||||
if (flag) {
|
||||
lockUI();
|
||||
} else {
|
||||
unlockUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LogInfo::lockUI()
|
||||
{
|
||||
ui->closeBtn4->setEnabled(false);
|
||||
ui->gl_state->setEnabled(false);
|
||||
ui->gridLayout_7->setEnabled(false);
|
||||
ui->tabWidget->setTabEnabled(0,false);
|
||||
ui->tabWidget->setTabEnabled(1,false);
|
||||
ui->tabWidget->setTabEnabled(2,false);
|
||||
ui->lb_clean->setText(tr("清洗中,界面锁死"));
|
||||
}
|
||||
|
||||
void LogInfo::unlockUI()
|
||||
{
|
||||
ui->closeBtn4->setEnabled(true);
|
||||
ui->gl_state->setEnabled(true);
|
||||
ui->gridLayout_7->setEnabled(true);
|
||||
ui->tabWidget->setTabEnabled(0,true);
|
||||
ui->tabWidget->setTabEnabled(1,true);
|
||||
ui->tabWidget->setTabEnabled(2,true);
|
||||
ui->lb_clean->setText(tr(""));
|
||||
}
|
||||
|
||||
void LogInfo::showEvent(QShowEvent *event)
|
||||
{
|
||||
// 先执行父类事件
|
||||
QWidget::showEvent(event);
|
||||
// 更新UI和状态
|
||||
if (sysPara) {
|
||||
if(!sysPara->para.isCheckMagnet)
|
||||
{
|
||||
ui->btn_clean->setEnabled( (sysPara->status.currReclaimTankPos<70)
|
||||
&& (sysPara->status.statWarn & WARN_STATUS_HDINT));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->btn_clean->setEnabled( (sysPara->status.currReclaimTankPos<70) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#include "MyFileDialog.h"
|
||||
#include <QDate>
|
||||
#include <QTimer>
|
||||
#include "SysPara.h"
|
||||
#include "myinclude.h"
|
||||
#include "loginfoctrl.h"
|
||||
namespace Ui {
|
||||
class LogInfo;
|
||||
}
|
||||
@@ -34,23 +36,6 @@ typedef struct{
|
||||
QString dataSize;
|
||||
}AlarmStatus;
|
||||
|
||||
//typedef struct {
|
||||
// unsigned char inkSwith;
|
||||
// unsigned char NozzleCover;
|
||||
// unsigned char InkTankFull;
|
||||
// unsigned char InkLevel;
|
||||
// unsigned char SolventLevel;
|
||||
// unsigned char RecyclyFault;
|
||||
// unsigned char ViscosityFault;
|
||||
// unsigned char PhaseFault;
|
||||
// unsigned char HighVoltageFault;
|
||||
// QString pressValue;
|
||||
// QString visoValue;
|
||||
// QString gearPumpRunSpeed;
|
||||
// QString highVol;
|
||||
// QString dataSize;
|
||||
//}AlarmStatus;
|
||||
|
||||
class LogInfo : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -75,6 +60,10 @@ public:
|
||||
void applyStyleSheet(); // 应用样式表
|
||||
|
||||
void updateSysStatusToUI(const AlarmStatus& alarmStatus);
|
||||
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
|
||||
void checkState();
|
||||
protected slots:
|
||||
void deleteOldLog(const QString folderPath, int days);
|
||||
void deleteOldLog();
|
||||
@@ -90,10 +79,12 @@ private slots:
|
||||
void buttonClickedSlot();
|
||||
|
||||
|
||||
void on_btn_clean_clicked();
|
||||
|
||||
void slt_cleanOver(bool flag);
|
||||
signals:
|
||||
void sendButtonClickedSignal(int);
|
||||
void faultTesumePress();
|
||||
void sig_updateGeneralState(DevStatusLightType type, QString stateStr);
|
||||
|
||||
private:
|
||||
Ui::LogInfo *ui;
|
||||
@@ -107,16 +98,14 @@ private:
|
||||
static QString r_CurrentDate;
|
||||
QTimer *timerLogdel;
|
||||
|
||||
LogInfoCtrl *ctrl_loginfo = nullptr;
|
||||
// 锁定全局控件,放出逆清洗
|
||||
void lockUI();
|
||||
void unlockUI();
|
||||
protected:
|
||||
SysPara *sysPara;
|
||||
|
||||
DevStatusLightType m_stateColor = DEV_STATUS_GREEN;
|
||||
//DEV_STATUS_GREEN:正常
|
||||
QString m_stateStr = "正常";
|
||||
//Mainwindow获取机器总状态
|
||||
void getGeneralState(AlarmStatus status);
|
||||
bool checkRed(AlarmStatus &status);
|
||||
bool checkYellow(AlarmStatus &status);
|
||||
|
||||
|
||||
void showEvent(QShowEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // LOGINFO_H
|
||||
|
||||
+134
-21
@@ -35,7 +35,7 @@ MainInstruction::MainInstruction(QWidget *parent) :
|
||||
connect(MTimeSetting,SIGNAL(accepted()),this,SLOT(onMTimeSettingAccepted()));
|
||||
|
||||
|
||||
// setStyleSheet(styleSheet);
|
||||
applyStyleSheet();
|
||||
}
|
||||
|
||||
MainInstruction::~MainInstruction()
|
||||
@@ -50,7 +50,7 @@ void MainInstruction::bindSysPara(SysPara *sysPara){
|
||||
|
||||
void MainInstruction::onGraphicsEditBtnClicked()
|
||||
{
|
||||
// 在arm主机上以全屏模式显示,而在x86上无所谓
|
||||
// 在arm主机上以全屏模式显示,而在x86上无所谓
|
||||
#if defined(ARCH_AARCH64_GNU)
|
||||
m_graphicsEditor->showFullScreen();
|
||||
#else
|
||||
@@ -70,30 +70,30 @@ void MainInstruction::on_createNewFileBtn_clicked()
|
||||
|
||||
void MainInstruction::on_maintenanceIntervalBtn_clicked()
|
||||
{
|
||||
// dialogMaintenanceTimeSettingAuth->clearAuth();
|
||||
// dialogMaintenanceTimeSettingAuth->show();
|
||||
// dialogMaintenanceTimeSettingAuth->clearAuth();
|
||||
// dialogMaintenanceTimeSettingAuth->show();
|
||||
|
||||
onDlgAuthMaintenanceTimeAccepted();
|
||||
}
|
||||
|
||||
|
||||
void MainInstruction::onDlgAuthMaintenanceTimeAccepted(){
|
||||
// QString authString= dialogMaintenanceTimeSettingAuth->getAuth();
|
||||
// if(dlgInputAddr->checWhJmDate(authString)) // 0xa001
|
||||
// {
|
||||
QDate curDate = QDate::currentDate();
|
||||
QString mtEndDatestr = "20" + QString::number(sysPara->RFIDPara.maintenanceEndDate);
|
||||
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
|
||||
int timeoutDay = curDate.daysTo(mtEndDate);
|
||||
MTimeSetting->updateMaintenanceTime(QString("%1 Days").arg(timeoutDay));
|
||||
MTimeSetting->updateMaintenanceIntervalToUI(sysPara->RFIDPara.maintenanceInterval);
|
||||
MTimeSetting->disableMaintenanceTimeSet(false);
|
||||
MTimeSetting->show();
|
||||
// }else
|
||||
// {
|
||||
// QMessageBox::about(this, tr("提示"), tr("密码不正确!"));
|
||||
// return;
|
||||
// }
|
||||
// QString authString= dialogMaintenanceTimeSettingAuth->getAuth();
|
||||
// if(dlgInputAddr->checWhJmDate(authString)) // 0xa001
|
||||
// {
|
||||
QDate curDate = QDate::currentDate();
|
||||
QString mtEndDatestr = "20" + QString::number(sysPara->RFIDPara.maintenanceEndDate);
|
||||
QDate mtEndDate = QDate::fromString(mtEndDatestr,"yyyyMMdd");
|
||||
int timeoutDay = curDate.daysTo(mtEndDate);
|
||||
MTimeSetting->updateMaintenanceTime(QString("%1 Days").arg(timeoutDay));
|
||||
MTimeSetting->updateMaintenanceIntervalToUI(sysPara->RFIDPara.maintenanceInterval);
|
||||
MTimeSetting->disableMaintenanceTimeSet(false);
|
||||
MTimeSetting->show();
|
||||
// }else
|
||||
// {
|
||||
// QMessageBox::about(this, tr("提示"), tr("密码不正确!"));
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
void MainInstruction::maintenanceDialogShow(){
|
||||
@@ -163,7 +163,7 @@ void MainInstruction::ondialogAuthorizationAccepted(){
|
||||
sysPara->status.WorkTimeOut=0;
|
||||
dlgInputAddr->ReadJm();
|
||||
dlgInputAddr->show();
|
||||
// ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr));
|
||||
// ui->labMac->setText(QString("Mac:%1").arg(dlgInputAddr->jd.addr));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -243,3 +243,116 @@ void MainInstruction::slt_timeSetting()
|
||||
|
||||
sysPara->devOp->stm32Wr(0xA1,(unsigned char *)m_datatime,8);
|
||||
}
|
||||
|
||||
void MainInstruction::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet =
|
||||
R"(
|
||||
QWidget#buttonWidget {
|
||||
background-color: #95989D;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn {
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:hover {
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed {
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QLabel {
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
QCheckBox {
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
font-weight:500;
|
||||
}
|
||||
|
||||
QCheckBox::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 1px solid #96A0A9;
|
||||
border-radius: 10px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked {
|
||||
background-color: #95B2D4;
|
||||
border-color: #95B2D4;
|
||||
image: url(:/Demo/image/select.png);
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
|
||||
background-color: #E3E7EC;
|
||||
}
|
||||
|
||||
QTabWidget::pane {
|
||||
border: 1px solid #dddddd;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
|
||||
QTabBar::tab:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ private:
|
||||
// 时间设置
|
||||
TimeSettingDialog timeDia;
|
||||
|
||||
void applyStyleSheet(); // 应用样式表
|
||||
};
|
||||
|
||||
#endif // MAININSTRUCTION_H
|
||||
|
||||
+62
-60
@@ -93,74 +93,76 @@
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>641</width>
|
||||
<height>501</height>
|
||||
<width>601</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabExtra">
|
||||
<attribute name="title">
|
||||
<string>基本设置</string>
|
||||
</attribute>
|
||||
<widget class="QPushButton" name="graphicsEditorBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>182</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>图形编辑器</string>
|
||||
</property>
|
||||
<property name="fixedSize" stdset="0">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_network">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>150</y>
|
||||
<width>182</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>网口通信</string>
|
||||
</property>
|
||||
<property name="fixedSize" stdset="0">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_time">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>30</y>
|
||||
<width>182</width>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间设置</string>
|
||||
</property>
|
||||
<property name="fixedSize" stdset="0">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="graphicsEditorBtn">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>253</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>图形编辑器</string>
|
||||
</property>
|
||||
<property name="fixedSize" stdset="0">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="btn_time">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>253</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>时间设置</string>
|
||||
</property>
|
||||
<property name="fixedSize" stdset="0">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="btn_network">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>253</width>
|
||||
<height>92</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>网口通信</string>
|
||||
</property>
|
||||
<property name="fixedSize" stdset="0">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabService">
|
||||
<attribute name="title">
|
||||
|
||||
+43
-8
@@ -6,11 +6,26 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>817</width>
|
||||
<height>600</height>
|
||||
<width>800</width>
|
||||
<height>607</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame3">
|
||||
<property name="styleSheet">
|
||||
@@ -145,7 +160,7 @@
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>746</width>
|
||||
<width>761</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -171,15 +186,22 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>335</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<widget class="QFrame" name="fra_state">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>16777215</height>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
@@ -580,9 +602,21 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="lb_reclaimtanl">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>reclaimtanl_image</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="image.qrc">:/image/tool.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -613,7 +647,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border:0px;</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>喷嘴开启</string>
|
||||
@@ -647,7 +681,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border:0px;</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>喷嘴关闭</string>
|
||||
@@ -669,6 +703,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
+7
-3
@@ -15,9 +15,13 @@
|
||||
|
||||
#include "zint.h"
|
||||
|
||||
#define U08 unsigned char
|
||||
#define U16 unsigned short
|
||||
#define U32 unsigned int
|
||||
// #define U08 unsigned char
|
||||
// #define U16 unsigned short
|
||||
// #define U32 unsigned int
|
||||
|
||||
typedef unsigned char U08;
|
||||
typedef unsigned short U16;
|
||||
typedef unsigned int U32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<QLineEdit>
|
||||
#include <QKeyEvent>
|
||||
#include "InkJetPrinter.h"
|
||||
|
||||
extern InkJetPrinter *pInkJectPrinter;
|
||||
MyInputMethod::MyInputMethod(QWidget *parent)
|
||||
:QObject(parent)
|
||||
|
||||
+133
-578
@@ -80,472 +80,46 @@ void PrintSetting::on_pushButtonApply_pressed(){
|
||||
}
|
||||
|
||||
void PrintSetting::applyUIPara(){
|
||||
if(sysPara){
|
||||
/*
|
||||
LogInfo::setRunStatusText(tr("addr: %1").arg(addr));
|
||||
LogInfo::setRunStatusText(tr("data: %1").arg(data));
|
||||
LogInfo::setRunStatusText(tr("len: %1").arg(len));
|
||||
if(sysPara){
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; //延时触发
|
||||
sysPara->para.printDelayMs = 200; //重复间隔
|
||||
sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked();
|
||||
ui->spinBoxColDelay->setEnabled(1);
|
||||
sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked();
|
||||
sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked();
|
||||
sysPara->para.currSelectVolPara = ui->comboBox_selcetVolPara->currentIndex();
|
||||
sysPara->para.printColDelay = ui->spinBoxColDelay->value();
|
||||
|
||||
sysPara->para.ExtScreenType = ui->comBoxExtSrceen->currentIndex();
|
||||
sysPara->para.ExtMeterType = ui->comBoxExtMeterType->currentIndex();
|
||||
sysPara->para.gearPumpSpeedAlarm = ui->spinBox_gearPumpSpeedAlarm->value();
|
||||
if(sysPara->para.ExtScreenType==0)
|
||||
{
|
||||
sysPara->status.ExtScreenEn =0;
|
||||
}
|
||||
*/
|
||||
sysPara->para.HighVoltageAmplitude = ui->spinBoxHighVoltageValue->value();
|
||||
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME; //延时触发
|
||||
sysPara->para.printDelayMs = 200; //重复间隔
|
||||
sysPara->para.checkSpace = 0;//ui->checkSpace->isChecked();
|
||||
ui->spinBoxColDelay->setEnabled(1);
|
||||
sysPara->para.leftRightInverse = ui->checkBoxLeftRightInverse->isChecked();
|
||||
sysPara->para.upDownInverse = ui->checkBoxUpDownInverse->isChecked();
|
||||
sysPara->para.currSelectVolPara = ui->comboBox_selcetVolPara->currentIndex();
|
||||
sysPara->para.printColDelay = ui->spinBoxColDelay->value();
|
||||
/*
|
||||
sysPara->para.scanInverse = ui->checkBoxScanInverse->isChecked();
|
||||
sysPara->para.currPrintMode = ui->comboBoxPrintMode->currentIndex();
|
||||
sysPara->para.varLenEn = ui->checkVARLEN->isChecked();
|
||||
sysPara->para.suspendAfterPhaseFault = ui->checkBoxSuspendAfterPhaseFault->isChecked();
|
||||
sysPara->para.powerOffAfterPhaseFault = ui->checkBoxPowerOffAfterPhaseFault->isChecked();
|
||||
sysPara->para.RecycleWarnAction = ui->checkBoxRecycleWarnAction->isChecked();
|
||||
sysPara->para.stopCounterMeterAfterFault = ui->checkBoxStopCounterMeterAfterFault->isChecked();
|
||||
// 回收泵的控制转至系统设置界面 byons@2026年4月22日
|
||||
// sysPara->para.gearPumpEnable = ui->checkBoxGearPumpEnable->isChecked();
|
||||
// sysPara->para.flagOfReclaimPumEnable = ui->checkBox_ReclaimPumpEnable->isChecked();
|
||||
|
||||
sysPara->para.cnt1EndValue = ui->spinBoxCnt1EndValue->value();
|
||||
sysPara->para.cnt1RepeateValue = ui->spinBoxCnt1RepeateCnt->value();
|
||||
sysPara->para.cnt1StartValue = ui->spinBoxCnt1StartValue->value();
|
||||
sysPara->para.cnt1StepValue = ui->spinBoxCnt1StepValue->value();
|
||||
sysPara->para.cnt1CurrValue = ui->spinBoxCnt1CurrValue->value(); //这个值设置没关系,在关机前还会再此被设置
|
||||
sysPara->para.cnt2EndValue = ui->spinBoxCnt2EndValue->value();
|
||||
sysPara->para.cnt2RepeateValue = ui->spinBoxCnt2RepeateCnt->value();
|
||||
sysPara->para.cnt2StartValue = ui->spinBoxCnt2StartValue->value();
|
||||
sysPara->para.cnt2StepValue = ui->spinBoxCnt2StepValue->value();
|
||||
sysPara->para.cnt2CurrValue = ui->spinBoxCnt2CurrValue->value();
|
||||
sysPara->devOp->setHighVoltageAmplitudetoSTM32();
|
||||
|
||||
sysPara->para.newAmplifyPlate = ui->checkBoxNewAmplifyPlate->isChecked();
|
||||
sysPara->para.cnt3EndValue = ui->spinBoxCnt3EndValue->value();
|
||||
sysPara->para.cnt3RepeateValue = ui->spinBoxCnt3RepeateCnt->value();
|
||||
sysPara->para.cnt3StartValue = ui->spinBoxCnt3StartValue->value();
|
||||
sysPara->para.cnt3StepValue = ui->spinBoxCnt3StepValue->value();
|
||||
sysPara->para.cnt3CurrValue = ui->spinBoxCnt3CurrValue->value();
|
||||
sysPara->devOp->writeFpgaCalandar(0);
|
||||
|
||||
sysPara->para.startVoltage = ui->spinBoxStartVoltage->value();
|
||||
sysPara->para.endVoltage = ui->spinBoxEndVoltage->value();
|
||||
sysPara->para.charBold = ui->spinBoxColRepeatCnt->value();
|
||||
*/
|
||||
sysPara->para.HighVoltageAmplitude = ui->spinBoxHighVoltageValue->value();
|
||||
|
||||
// 回收泵的控制转至系统设置界面 byons@2026年4月22日
|
||||
// sysPara->para.gearPumpEnable = ui->checkBoxGearPumpEnable->isChecked();
|
||||
// sysPara->para.flagOfReclaimPumEnable = ui->checkBox_ReclaimPumpEnable->isChecked();
|
||||
|
||||
sysPara->devOp->setHighVoltageAmplitudetoSTM32();
|
||||
|
||||
/*
|
||||
sysPara->status.cnt1CurrentValueInitDoneFlag = !ui->checkBoxResetCnt1CurrValue->isChecked();
|
||||
sysPara->status.cnt2CurrentValueInitDoneFlag = !ui->checkBoxResetCnt2CurrValue->isChecked();
|
||||
sysPara->status.cnt3CurrentValueInitDoneFlag = !ui->checkBoxResetCnt3CurrValue->isChecked();
|
||||
if(sysPara->para.cnt1ByGroupEnalbe)
|
||||
ApplyCnt1GroupSetting();
|
||||
|
||||
sysPara->para.flagOfFastMode = ui->checkBox_FastMode->isChecked();
|
||||
if(sysPara->para.flagOfFastMode){
|
||||
if(ui->comboBoxPrintMode->count()>=3){
|
||||
ui->comboBoxPrintMode->setItemText(0,tr("超高速"));
|
||||
ui->comboBoxPrintMode->setItemText(1,tr("高速"));
|
||||
ui->comboBoxPrintMode->removeItem(2);
|
||||
}
|
||||
}else{
|
||||
if(ui->comboBoxPrintMode->count()<3){
|
||||
ui->comboBoxPrintMode->setItemText(0,tr("快速"));
|
||||
ui->comboBoxPrintMode->setItemText(1,tr("标准"));
|
||||
ui->comboBoxPrintMode->addItem(tr("慢速"));
|
||||
}
|
||||
}
|
||||
|
||||
if(sysPara->para.EditMode==TXTFILE)
|
||||
{
|
||||
sysPara->status.specialVarPrint.SpecialVarEnable = ui->radioButtonSpecialCondition->isChecked();
|
||||
sysPara->status.cnt4CurrValue = ui->spinBoxHiddenValue->value();
|
||||
sysPara->status.specialVarPrint.MeterEnable = ui ->spinBoxMeterEnable->value();
|
||||
sysPara ->status.specialVarPrint.SpecialConditionValue = ui->spinBoxConditionValue->value();
|
||||
if(sysPara->status.specialVarPrint.SpecialVarEnable)
|
||||
sysPara->status.specialVarPrint.SpecialVarEnable = 0xFF;
|
||||
if(sysPara->status.specialVarPrint.MeterEnable)
|
||||
sysPara->status.specialVarPrint.MeterEnable = 0xFF;
|
||||
|
||||
sysPara->para.cnt4CurrValue = sysPara->status.cnt4CurrValue;
|
||||
sysPara->para.HiddenConditionValue = sysPara->status.specialVarPrint.SpecialConditionValue;
|
||||
sysPara->para.HiddenFuncEnable = sysPara->status.specialVarPrint.SpecialVarEnable;
|
||||
sysPara->para.HiddenMeterEnable = sysPara->status.specialVarPrint.MeterEnable;
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
sysPara->devOp->writeFpgaCalandar(0);
|
||||
|
||||
/*
|
||||
sysPara->para.reducedPixelNumRatio = ui->spinBoxReducedPixelNum->value();
|
||||
sysPara->para.reducedPixelMode = ui->comboBoxReducedPixMode->currentIndex();
|
||||
sysPara->para.rowSequenceMode = ui->spinBoxRowSequenceMode->value();
|
||||
|
||||
sysPara->para.pointVoltageAdjustPos = ui->spinBoxPointVoltageAdjustPos->value();
|
||||
sysPara->para.PointVoltageAdjustValue = ui->spinBoxVoltageAdjustValue->value();
|
||||
|
||||
sysPara->para.lineEndAdjustPointCnt = ui->spinBoxLineEndAdjustPointCnt->value();
|
||||
sysPara->para.lineEndAdjustPointDelay = ui->comboBoxLineEndAdjustPointMode->currentIndex();
|
||||
sysPara->para.lastLineEndPointFixedValue = ui->spinBoxLastLineEndPointFixedValue->value();
|
||||
|
||||
sysPara->para.FullColFixVal = ui->radioButtonFUllColFIxVal->isChecked();//2020/3/2
|
||||
sysPara->para.dacScale = ui->dacScaledSpinBox->value();
|
||||
|
||||
sysPara->para.industryIndex = ui->comboBoxIndustry->currentIndex();
|
||||
sysPara->para.recommendedPrintSpeed = ui->comboBoxRecommendedPrintSpeed->currentIndex();
|
||||
|
||||
if(ui->eleCNT1IncEn->isChecked())
|
||||
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x10); // CNT1 +1
|
||||
else
|
||||
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xef); // CNT1 = current
|
||||
|
||||
if(ui->eleCNT2IncEn->isChecked())
|
||||
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x20); // CNT2 +1
|
||||
else
|
||||
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xdf); // CNT2 = current
|
||||
|
||||
if(ui->eleCNT3IncEn->isChecked())
|
||||
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode | 0x40); // CNT3 +1
|
||||
else
|
||||
sysPara->para.eleEyeClearCntInSynMode = (sysPara->para.eleEyeClearCntInSynMode & 0xbf); // CNT3 = current
|
||||
sysPara->para.alterPrint.enable =ui->comboBoxAlterPrintEnable->currentIndex();// 修改后的
|
||||
if(sysPara->para.alterPrint.enable)
|
||||
sysPara->para.textEditLineSpace = 0;
|
||||
sysPara->para.alterPrint.lineSpace = sysPara->para.textEditLineSpace;
|
||||
sysPara->para.alterPrint.startValue = ui->spinBoxXStartValue->value ();
|
||||
sysPara->para.alterPrint.repeatValue = ui->spinBoxXGapValue->value ();
|
||||
sysPara->para.alterPrint.repeatPrintTimes =ui->spinBoxXRepeatTimeValue->value ();
|
||||
sysPara->para.alterPrint.DistanceTail =ui->spinBoxDistanceTail->value ();
|
||||
if( sysPara->para.alterPrint.startValue>= sysPara->para.alterPrint.repeatValue )
|
||||
{
|
||||
sysPara->para.alterPrint.startValue =sysPara->para.alterPrint.repeatValue -1;
|
||||
ui->spinBoxXStartValue->setValue (sysPara->para.alterPrint.startValue);
|
||||
QMessageBox::information(this,tr("提示:交替参数不正确"),tr("要求:起始位置<交替间隔"));
|
||||
}
|
||||
if( sysPara->para.alterPrint.repeatPrintTimes+sysPara->para.alterPrint.startValue
|
||||
> sysPara->para.alterPrint.repeatValue )
|
||||
{
|
||||
sysPara->para.alterPrint.repeatPrintTimes =sysPara->para.alterPrint.repeatValue -sysPara->para.alterPrint.startValue-1;
|
||||
ui->spinBoxXRepeatTimeValue->setValue (sysPara->para.alterPrint.repeatPrintTimes);
|
||||
|
||||
QMessageBox::information(this,tr("提示:交替参数不正确"),tr("要求:(重复次数+起始位置)<交替间隔"));
|
||||
}
|
||||
|
||||
sysPara->para.Cnt1NatureValue = ui->checkBoxCnt1NatureValue->isChecked (); //
|
||||
sysPara->para.speedoverPaushPrint = ui->checkBoxSpeedOver->isChecked();
|
||||
sysPara->para.SynCntEn = ui->checkSynCntEn->isChecked();
|
||||
sysPara->para.Vol1of8En = ui->checkVol1of8En->isChecked();//打印优化
|
||||
sysPara->para.mode0211 = ui->checkmode0211->isChecked();//添加0211模式
|
||||
sysPara->para.cnt1ResetToInitValue = ui->resetToCnt1InitValueCheckBox->isChecked();// 电眼复位时,复位起始值或当前值
|
||||
//sysPara->para.printOnce = ui->checkBoxPrintOnce->isChecked();// 每条信息只喷一次
|
||||
// sysPara->para.printOnce = 0;// 每条信息只喷一次
|
||||
//sysPara->para.printNumPoint = ui->checkBoxNumPoint->isChecked();// 每条信息只喷一次
|
||||
sysPara->para.Reciclar = ui->checkBoxReciclar->isChecked();//sysPara->para.Reciclar = 0; //
|
||||
switch(ui->spinBoxdecimalpointnum->value())
|
||||
//20240625修改小数点位数可选0-3位,FPGA原参数a44d 地址第6号位为 是否打印小数使能信号,1为打印小数,0为不打印小数。
|
||||
//更改为:
|
||||
// a44d 地址第6号位和第7号位为 打印显示小数位数;
|
||||
// 第7,6变量为 11 打印3位小数,
|
||||
// 第7,6变量为 10 打印2位小数,
|
||||
// 第7,6变量为 01 打印1位小数,
|
||||
// 第7,6变量为 00 打印0位小数,
|
||||
{
|
||||
case 0:
|
||||
ui->radioButtonSpecialCondition->setEnabled(true);
|
||||
sysPara->para.printNumPoint = 0;
|
||||
sysPara->para.rrr_nc = 0;
|
||||
break;
|
||||
case 1:
|
||||
ui->radioButtonSpecialCondition->setEnabled(false);
|
||||
ui->spinBoxMeterEnable->setValue(0);
|
||||
sysPara->para.printNumPoint = 1;
|
||||
sysPara->para.rrr_nc = 0;
|
||||
break;
|
||||
case 2:
|
||||
ui->radioButtonSpecialCondition->setEnabled(false);
|
||||
ui->spinBoxMeterEnable->setValue(0);
|
||||
sysPara->para.printNumPoint = 0;
|
||||
sysPara->para.rrr_nc = 1;
|
||||
break;
|
||||
case 3:
|
||||
ui->radioButtonSpecialCondition->setEnabled(false);
|
||||
ui->spinBoxMeterEnable->setValue(0);
|
||||
sysPara->para.printNumPoint = 1;
|
||||
sysPara->para.rrr_nc = 1;
|
||||
break;
|
||||
default:
|
||||
sysPara->para.printNumPoint = 0;
|
||||
sysPara->para.rrr_nc = 0;
|
||||
break;
|
||||
}
|
||||
sysPara->para.stepPrint.startValue = ui->spinBoxJumpStartValue->value();
|
||||
sysPara->para.stepPrint.endValue = ui->spinBoxJumpEndValue->value();
|
||||
sysPara->para.stepPrint.enbale = ui->checkBoxStepPrintEn->isChecked();
|
||||
sysPara->para.stepPrint.StepValue = ui->spinBoxJumpStepValue->value();
|
||||
sysPara->para.ResetSendData = ui->checkBoxResetSendData->isChecked();
|
||||
sysPara->para.eleEyeReTrigDisable = ui->checkBoxEleEyeRetrigDis->isChecked();
|
||||
|
||||
sysPara->para.ResetAllProductCntEn = ui->checkAllProductResetEn->isChecked();
|
||||
sysPara->para.ResetProductCntEn = ui->checkProductResetEn->isChecked();
|
||||
sysPara->para.HVFaultCloseEn = ui->checkHVFaultCloseEn->isChecked();
|
||||
sysPara->para.phaseHighCnt = ui->phaseHighCntSpinBox->value();
|
||||
sysPara->para.charWidthSetEnable = ui->checkBoxCharWidthSet->isChecked();
|
||||
sysPara->para.isCheckMagnet = ui->checkBoxMagnet->isChecked();
|
||||
sysPara->para.isCheckPrintLight = ui->printfLightCheckBox->isChecked();
|
||||
|
||||
sysPara->para.bcOption.var1Num=ui->spinBoxCnt1EndValue->text().length();
|
||||
sysPara->para.bcOption.var2Num=ui->spinBoxCnt2EndValue->text().length();
|
||||
// sysPara->para.bcOption.var3Num=ui->spinBoxCnt2EndValue_2->text().length();
|
||||
|
||||
//qDebug()<<"sysPara->para.bcOption.varNum"<<sysPara->para.bcOption.var1Num<<sysPara->para.bcOption.var2Num;
|
||||
sysPara->para.ExpiryDay = ui->spinBoxExpiryDate->value();
|
||||
sysPara->para.ExpirySplitMode = ui->CBDateFormat1->currentIndex();
|
||||
ui->resetToCnt1InitValueCheckBox->isChecked();
|
||||
//qDebug()<<sysPara->print.ExpiryDay;
|
||||
*/
|
||||
|
||||
// if(sysPara->devOp->writeFpgaPrintPara() != -1) // save para to disk file.
|
||||
// QMessageBox::information(this,tr("提示"),tr("应用成功"));
|
||||
/*
|
||||
//ui->labelCnt1CurrValueTxt->setEnabled(false);
|
||||
// ui->labelCnt2CurrValueTxt->setEnabled(false);
|
||||
ui->spinBoxCnt1CurrValue->setEnabled(false);
|
||||
ui->spinBoxCnt2CurrValue->setEnabled(false);
|
||||
ui->spinBoxCnt3CurrValue->setEnabled(false);
|
||||
|
||||
ui->checkBoxResetCnt1CurrValue->setChecked(false);
|
||||
ui->checkBoxResetCnt2CurrValue->setChecked(false);
|
||||
ui->checkBoxResetCnt3CurrValue->setChecked(false);
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PrintSetting::updateSysParaToUI(){
|
||||
if(sysPara){
|
||||
/*
|
||||
ui->checkVARLEN->setChecked(sysPara->para.varLenEn?1:0);
|
||||
ui->checkBoxNewAmplifyPlate->setChecked(sysPara->para.newAmplifyPlate);
|
||||
ui->comBoxExtSrceen->setCurrentIndex(sysPara->para.ExtScreenType);
|
||||
ui->comBoxExtMeterType->setCurrentIndex(sysPara->para.ExtMeterType);
|
||||
*/
|
||||
ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse);
|
||||
ui->checkBoxUpDownInverse->setChecked(sysPara->para.upDownInverse);
|
||||
sysPara->para.mode0211 = 1;
|
||||
/*
|
||||
ui->checkBoxScanInverse->setChecked(sysPara->para.scanInverse);
|
||||
ui->checkBoxRecycleWarnAction->setChecked(sysPara->para.RecycleWarnAction);
|
||||
ui->checkBoxPowerOffAfterPhaseFault->setChecked(sysPara->para.powerOffAfterPhaseFault);
|
||||
ui->checkBoxSuspendAfterPhaseFault->setChecked(!sysPara->para.powerOffAfterPhaseFault);
|
||||
ui->checkBoxSuspendAfterPhaseFault->setChecked(sysPara->para.suspendAfterPhaseFault);
|
||||
ui->checkBoxStopCounterMeterAfterFault->setEnabled(sysPara->para.suspendAfterPhaseFault);
|
||||
ui->checkBoxStopCounterMeterAfterFault->setChecked(sysPara->para.stopCounterMeterAfterFault);
|
||||
ui->comboBoxPrintMode->setCurrentIndex(sysPara->para.currPrintMode);
|
||||
ui->spinBox_gearPumpSpeedAlarm->setValue(sysPara->para.gearPumpSpeedAlarm);
|
||||
*/
|
||||
/*----------------------------------------*/
|
||||
if(sysPara){
|
||||
ui->checkBoxLeftRightInverse->setChecked(sysPara->para.leftRightInverse);
|
||||
ui->checkBoxUpDownInverse->setChecked(sysPara->para.upDownInverse);
|
||||
sysPara->para.mode0211 = 1;
|
||||
|
||||
ui->spinBoxColDelay->setValue(sysPara->para.printColDelay);
|
||||
ui->spinBoxColDelay->setValue(sysPara->para.printColDelay);
|
||||
|
||||
/*
|
||||
ui->spinBoxColRepeatCnt->setValue(sysPara->para.charBold);
|
||||
ui->spinBoxCnt1EndValue->setValue(sysPara->para.cnt1EndValue);
|
||||
ui->spinBoxCnt1RepeateCnt->setValue(sysPara->para.cnt1RepeateValue);
|
||||
ui->spinBoxCnt1StartValue->setValue(sysPara->para.cnt1StartValue);
|
||||
ui->spinBoxCnt1StepValue->setValue(sysPara->para.cnt1StepValue);
|
||||
ui->spinBoxCnt1CurrValue->setValue(sysPara->para.cnt1CurrValue);
|
||||
ui->spinBoxCnt2EndValue->setValue(sysPara->para.cnt2EndValue);
|
||||
ui->spinBoxCnt2RepeateCnt->setValue(sysPara->para.cnt2RepeateValue);
|
||||
ui->spinBoxCnt2StartValue->setValue(sysPara->para.cnt2StartValue);
|
||||
ui->spinBoxCnt2StepValue->setValue(sysPara->para.cnt2StepValue);
|
||||
ui->spinBoxCnt2CurrValue->setValue(sysPara->para.cnt2CurrValue);
|
||||
ui->spinBoxHighVoltageValue->setValue(sysPara->para.HighVoltageAmplitude);
|
||||
|
||||
ui->spinBoxCnt3EndValue->setValue(sysPara->para.cnt3EndValue);
|
||||
ui->spinBoxCnt3RepeateCnt->setValue(sysPara->para.cnt3RepeateValue);
|
||||
ui->spinBoxCnt3StartValue->setValue(sysPara->para.cnt3StartValue);
|
||||
ui->spinBoxCnt3StepValue->setValue(sysPara->para.cnt3StepValue);
|
||||
ui->spinBoxCnt3CurrValue->setValue(sysPara->para.cnt3CurrValue);
|
||||
ui->comboBox_selcetVolPara->setCurrentIndex(sysPara->para.currSelectVolPara);
|
||||
|
||||
ui->spinBoxStartVoltage->setValue(sysPara->para.startVoltage);
|
||||
// 齿轮泵和回收泵的控制转至系统设置 byons@2026年4月22日
|
||||
// ui->checkBoxGearPumpEnable->setChecked(sysPara->para.gearPumpEnable);
|
||||
// ui->checkBox_ReclaimPumpEnable->setChecked(sysPara->para.flagOfReclaimPumEnable);
|
||||
|
||||
ui->spinBoxEndVoltage->setValue(sysPara->para.endVoltage);
|
||||
*/
|
||||
|
||||
ui->spinBoxHighVoltageValue->setValue(sysPara->para.HighVoltageAmplitude);
|
||||
|
||||
/*
|
||||
ui->spinBoxReducedPixelNum->setValue(sysPara->para.reducedPixelNumRatio);
|
||||
ui->comboBoxReducedPixMode->setCurrentIndex(sysPara->para.reducedPixelMode);
|
||||
ui->spinBoxRowSequenceMode->setValue(sysPara->para.rowSequenceMode);
|
||||
ui->spinBoxPointVoltageAdjustPos->setValue(sysPara->para.pointVoltageAdjustPos);
|
||||
ui->spinBoxVoltageAdjustValue->setValue(sysPara->para.PointVoltageAdjustValue);
|
||||
ui->spinBoxLineEndAdjustPointCnt->setValue(sysPara->para.lineEndAdjustPointCnt);
|
||||
ui->comboBoxLineEndAdjustPointMode->setCurrentIndex(sysPara->para.lineEndAdjustPointDelay);
|
||||
ui->spinBoxLastLineEndPointFixedValue->setValue(sysPara->para.lastLineEndPointFixedValue);
|
||||
// ui->spinBoxFullColFixVal->setValue(sysPara->para.FullColFixVal);
|
||||
ui->radioButtonFUllColFIxVal->setChecked(sysPara->para.FullColFixVal);
|
||||
*/
|
||||
|
||||
ui->comboBox_selcetVolPara->setCurrentIndex(sysPara->para.currSelectVolPara);
|
||||
|
||||
// 齿轮泵和回收泵的控制转至系统设置 byons@2026年4月22日
|
||||
// ui->checkBoxGearPumpEnable->setChecked(sysPara->para.gearPumpEnable);
|
||||
// ui->checkBox_ReclaimPumpEnable->setChecked(sysPara->para.flagOfReclaimPumEnable);
|
||||
|
||||
//隐藏功能
|
||||
|
||||
/*
|
||||
ui->radioButtonSpecialCondition->setChecked(sysPara->para.HiddenFuncEnable);
|
||||
ui->spinBoxHiddenValue->setValue(sysPara->para.cnt4CurrValue);
|
||||
ui->spinBoxConditionValue->setValue(sysPara->para.HiddenConditionValue);
|
||||
ui->spinBoxMeterEnable->setValue(sysPara->para.HiddenMeterEnable);
|
||||
|
||||
// sysPara->status.cnt4CurrValue = sysPara->para.cnt4CurrValue;
|
||||
sysPara->status.specialVarPrint.SpecialConditionValue = sysPara->para.HiddenConditionValue ;
|
||||
sysPara->status.specialVarPrint.SpecialVarEnable =sysPara->para.HiddenFuncEnable ;
|
||||
sysPara->status.specialVarPrint.MeterEnable = sysPara->para.HiddenMeterEnable;
|
||||
if(sysPara->status.specialVarPrint.SpecialVarEnable)
|
||||
sysPara->status.specialVarPrint.SpecialVarEnable = 0xFF;
|
||||
if(sysPara->status.specialVarPrint.MeterEnable)
|
||||
sysPara->status.specialVarPrint.MeterEnable = 0xFF;
|
||||
|
||||
emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked());
|
||||
if(sysPara->para.HiddenFuncEnable)
|
||||
{
|
||||
// emit HiddenFunction(ui->radioButtonSpecialCondition->isChecked());
|
||||
ui->spinBoxdecimalpointnum->setValue(0);
|
||||
ui->spinBoxdecimalpointnum->setEnabled(false);
|
||||
|
||||
ui->radioButtonSpecialCondition->setEnabled(true);
|
||||
ui->spinBoxHiddenValue->setEnabled(true);
|
||||
ui->spinBoxConditionValue->setEnabled(true);
|
||||
ui->spinBoxMeterEnable->setEnabled(true);
|
||||
}
|
||||
|
||||
if(!sysPara->para.rrr_nc)
|
||||
{
|
||||
if(!sysPara->para.printNumPoint)
|
||||
ui->spinBoxdecimalpointnum->setValue(0);
|
||||
else
|
||||
ui->spinBoxdecimalpointnum->setValue(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!sysPara->para.printNumPoint)
|
||||
ui->spinBoxdecimalpointnum->setValue(2);
|
||||
else
|
||||
ui->spinBoxdecimalpointnum->setValue(3);
|
||||
}
|
||||
|
||||
ui->comboBoxIndustry->setCurrentIndex(sysPara->para.industryIndex);
|
||||
ui->comboBoxRecommendedPrintSpeed->setCurrentIndex(sysPara->para.recommendedPrintSpeed);
|
||||
ui->comboBoxAlterPrintEnable->setCurrentIndex (sysPara->para.alterPrint.enable );// 修改后的
|
||||
if(sysPara->para.alterPrint.enable == 0)
|
||||
{
|
||||
ui->spinBoxXStartValue->setEnabled(false);
|
||||
ui->spinBoxXRepeatTimeValue->setEnabled(false);
|
||||
ui->spinBoxXGapValue->setEnabled(false);
|
||||
}
|
||||
ui->spinBoxXStartValue->setValue (sysPara->para.alterPrint.startValue );
|
||||
ui->spinBoxXGapValue->setValue (sysPara->para.alterPrint.repeatValue);
|
||||
ui->spinBoxXRepeatTimeValue->setValue (sysPara->para.alterPrint.repeatPrintTimes);
|
||||
ui->spinBoxDistanceTail->setValue(sysPara->para.alterPrint.DistanceTail );
|
||||
ui->checkBoxCnt1NatureValue->setChecked ( sysPara->para.Cnt1NatureValue); //
|
||||
ui->checkBoxSpeedOver->setChecked(sysPara->para.speedoverPaushPrint);
|
||||
ui->checkSynCntEn->setChecked(sysPara->para.SynCntEn);
|
||||
ui->checkVol1of8En->setChecked(sysPara->para.Vol1of8En);
|
||||
ui->checkBoxEleEyeRetrigDis->setChecked( sysPara->para.eleEyeReTrigDisable );
|
||||
ui->checkmode0211->setChecked(sysPara->para.mode0211);
|
||||
ui->resetToCnt1InitValueCheckBox->setChecked(sysPara->para.cnt1ResetToInitValue);
|
||||
qDebug()<<"checkmode0211:"<<sysPara->para.mode0211;
|
||||
qDebug()<<"checkVol1of8En:"<<sysPara->para.Vol1of8En;
|
||||
qDebug()<<"radioButtonFUllColFIxVal:"<<sysPara->para.FullColFixVal;
|
||||
qDebug()<<"checkBoxCharWidthSet:"<<sysPara->para.charWidthSetEnable;
|
||||
|
||||
//ui->checkBoxPrintOnce->setChecked(sysPara->para.printOnce);
|
||||
//ui->checkBoxNumPoint->setChecked(sysPara->para.printNumPoint);
|
||||
ui->checkBoxReciclar->setChecked(sysPara->para.Reciclar);
|
||||
ui->dacScaledSpinBox->setValue(sysPara->para.dacScale);
|
||||
ui->checkBoxResetSendData->setChecked(sysPara->para.ResetSendData);
|
||||
ui->spinBoxJumpStartValue->setValue( sysPara->para.stepPrint.startValue );
|
||||
ui->spinBoxJumpEndValue->setValue( sysPara->para.stepPrint.endValue );
|
||||
//ui->checkBoxStepPrintEn->setEnabled( sysPara->para.stepPrint.enbale );
|
||||
ui->checkBoxStepPrintEn->setChecked( sysPara->para.stepPrint.enbale );
|
||||
ui->spinBoxJumpStepValue->setValue(sysPara->para.stepPrint.StepValue);
|
||||
|
||||
|
||||
ui->checkProductResetEn->setChecked(sysPara->para.ResetProductCntEn);
|
||||
ui->checkAllProductResetEn->setChecked(sysPara->para.ResetAllProductCntEn);
|
||||
ui->checkHVFaultCloseEn->setChecked(sysPara->para.HVFaultCloseEn);
|
||||
|
||||
// 电眼触发计数器动作 选择
|
||||
ui->eleCNT1IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?1:0);
|
||||
ui->radCNT1ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x10)?0:1);
|
||||
|
||||
ui->eleCNT2IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?1:0);
|
||||
ui->radCNT2ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x20)?0:1);
|
||||
|
||||
ui->eleCNT3IncEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?1:0);
|
||||
ui->radCNT3ResetEn->setChecked( (sysPara->para.eleEyeClearCntInSynMode & 0x40)?0:1);
|
||||
|
||||
ui->checkBoxCharWidthSet->setChecked(sysPara->para.charWidthSetEnable);
|
||||
ui->checkBoxMagnet->setChecked(sysPara->para.isCheckMagnet);
|
||||
ui->printfLightCheckBox->setChecked(sysPara->para.isCheckPrintLight);
|
||||
|
||||
ui->phaseHighCntSpinBox->setValue( sysPara->para.phaseHighCnt);
|
||||
|
||||
sysPara->para.bcOption.var1Num=ui->spinBoxCnt1EndValue->text().length();
|
||||
sysPara->para.bcOption.var2Num=ui->spinBoxCnt2EndValue->text().length();
|
||||
ui->checkBox_FastMode->setChecked(sysPara->para.flagOfFastMode);
|
||||
|
||||
ui->labMac->setText(QString(" Mac:%1").arg(dlgInputAddr->jd.addr));
|
||||
sysPara->status.machineMac = dlgInputAddr->jd.addr;
|
||||
showMachInfo(QString::number(dlgInputAddr->jd.addr));
|
||||
|
||||
ui->CBDateFormat1->setCurrentIndex(sysPara->para.ExpirySplitMode);//p_var->splitMode
|
||||
ui->spinBoxExpiryDate->setValue(sysPara->para.ExpiryDay);
|
||||
//on_spinBoxExpiryDate_valueChanged(sysPara->print.ExpiryVar.);
|
||||
ui->checkBoxSaveCNTStateValue->setCheckState(sysPara->para.isCntSaveStateValue ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
flagOfModuleDecimal = sysPara->para.flagOfModuleDecimal;
|
||||
ModuleDecimalDisplay();
|
||||
flagOfModuleHide = sysPara->para.flagOfModuleHide;
|
||||
ModuleHideDisplay();
|
||||
displayForAdjustVoltage(sysPara->para.flagOfAdjustVoltage);
|
||||
|
||||
LoadCnt1GroupSettingsToUI();
|
||||
if(sysPara->para.mode0211 || sysPara->para.FullColFixVal)
|
||||
{
|
||||
ui->spinBoxStartVoltage->setEnabled(false);
|
||||
ui->spinBoxEndVoltage->setEnabled(false);
|
||||
}
|
||||
if(sysPara->para.flagOfCnt1GroupDisp)
|
||||
{
|
||||
//edit@12-03
|
||||
const int indexTab=ui->tabWidget_2->indexOf(ui->tab_9);
|
||||
if(-1==indexTab)
|
||||
ui->tabWidget_2->addTab(ui->tab_9,tr("其他设置"));
|
||||
|
||||
}
|
||||
if(sysPara->para.flagOfstepPrint)
|
||||
{
|
||||
//edit@12-03
|
||||
const int indexTab=ui->tabWidget->indexOf(ui->tab_6);
|
||||
if(-1==indexTab)
|
||||
ui->tabWidget->addTab(ui->tab_6,tr("跳米设置"));
|
||||
}
|
||||
*/
|
||||
TriggerupdateSysParaToUI();
|
||||
TriggerupdateSysParaToUI();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -595,7 +169,7 @@ void PrintSetting::TriggerupdateSysParaToUI(){
|
||||
|
||||
//ui->spinBoxOutputPulseDelayMs->setEnabled(sysPara->para.pulseOutputEnable);
|
||||
|
||||
ui->spinBoxOutputPulseDelayMs->setEnabled(true /*sysPara->para.outputPulseDelayMs*/);
|
||||
ui->spinBoxOutputPulseDelayMs->setEnabled(isPulseEenable);
|
||||
ui->spinBoxOuputPulseCol->setValue(sysPara->para.OuputPulseCol);
|
||||
ui->checkEyeTriggerSynPrintEn->setChecked (sysPara->para.eleEyeTriggerSynPrintEn);
|
||||
ui->comboBoxSyncActType->setCurrentIndex (sysPara->para.synchronizorActType);
|
||||
@@ -627,7 +201,7 @@ void PrintSetting::on_pushButtonApplyPulseFix_clicked()
|
||||
pulseNumFix->hide();
|
||||
pulseNumFix->show();
|
||||
|
||||
// qDebug()<<"pushButtonApplyPulseFix";
|
||||
// qDebug()<<"pushButtonApplyPulseFix";
|
||||
}
|
||||
|
||||
void PrintSetting::onPulseNumFixDone(float value){
|
||||
@@ -658,17 +232,23 @@ void PrintSetting::applyUITriggerPara(){
|
||||
|
||||
sysPara->para.pulseOutputEnable = ui->checkBoxPulseOutputEnable->isChecked();
|
||||
sysPara->para.productCntPerOutputPulse = ui->spinBoxProductCntPerOutputPulse->value();
|
||||
sysPara->para.outputPulseDelayMs = ui->spinBoxOutputPulseDelayMs->value();
|
||||
// 有脉冲延时使能的时候才可以设置延时
|
||||
if (isEnabled()) {
|
||||
sysPara->para.outputPulseDelayMs = ui->spinBoxOutputPulseDelayMs->value();
|
||||
} else {
|
||||
sysPara->para.outputPulseDelayMs = 0;
|
||||
}
|
||||
|
||||
sysPara->para.OuputPulseCol = ui->spinBoxOuputPulseCol->value();
|
||||
if(((ui->checkEyeTriggerSynPrintEn->checkState()==1 )
|
||||
&&(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
|
||||
&&(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE))
|
||||
|| sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER )
|
||||
{
|
||||
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
|
||||
}
|
||||
else ui->labelOutputPulseDelayMs->setText(tr("延时(毫秒):"));
|
||||
// if(sysPara->devOp->writeFpgaPrintPara() != -1)
|
||||
// QMessageBox::information(this,tr("提示"),tr("应用成功"));
|
||||
// if(sysPara->devOp->writeFpgaPrintPara() != -1)
|
||||
// QMessageBox::information(this,tr("提示"),tr("应用成功"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -700,7 +280,7 @@ void PrintSetting::GetTriggerUIPara(){
|
||||
|
||||
//qDebug()<< (sysPara->para.AltMirrorGap & 0x0fff) << (sysPara->para.AltMirrorGap & 0xf000);
|
||||
|
||||
// if(ui->radioButtonDelayTrigger->isChecked())
|
||||
// if(ui->radioButtonDelayTrigger->isChecked())
|
||||
if(ui->eleEyeEdgetTriggerInner->isChecked() && ui->radioButtonSynTriggerInner->isChecked()){ //都选外部--延时触发
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
|
||||
sysPara->para.printDelayMs = ui->spinBoxEleEyeTriggerIntervalMs->value(); //延时触发的重复间隔
|
||||
@@ -736,7 +316,7 @@ void PrintSetting::GetTriggerUIPara(){
|
||||
void PrintSetting::on_radioButtonDelayTrigger_pressed()
|
||||
{
|
||||
setTriggerUI(PRINT_TRIGGER_TIME);
|
||||
// emit synDisableFontWidth(false);
|
||||
// emit synDisableFontWidth(false);
|
||||
}
|
||||
|
||||
void PrintSetting::on_radioButtonEleEyeEdgetTrigger_pressed()
|
||||
@@ -747,7 +327,7 @@ void PrintSetting::on_radioButtonEleEyeEdgetTrigger_pressed()
|
||||
setEnableSynTriggerSetting(true);
|
||||
else
|
||||
setEnableSynTriggerSetting(false);
|
||||
// emit synDisableFontWidth(false);
|
||||
// emit synDisableFontWidth(false);
|
||||
}
|
||||
|
||||
void PrintSetting::on_radioButtonEleEyeLevelTrigger_pressed()
|
||||
@@ -758,22 +338,22 @@ void PrintSetting::on_radioButtonEleEyeLevelTrigger_pressed()
|
||||
setEnableSynTriggerSetting(true);
|
||||
else
|
||||
setEnableSynTriggerSetting(false);
|
||||
// emit synDisableFontWidth(false);
|
||||
// emit synDisableFontWidth(false);
|
||||
}
|
||||
|
||||
void PrintSetting::on_radioButtonSynTrigger_pressed()
|
||||
{
|
||||
//edit@11-19
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
|
||||
// setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER);
|
||||
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
|
||||
// //72版本禁用字符宽度
|
||||
// if(72 == FpgaVer){
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(0);
|
||||
// }else if (67 == FpgaVer)
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
|
||||
// emit synDisableFontWidth(true);
|
||||
// setTriggerUI(PRINT_TRIGGER_SYNCHRONIZER);
|
||||
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
|
||||
// //72版本禁用字符宽度
|
||||
// if(72 == FpgaVer){
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(0);
|
||||
// }else if (67 == FpgaVer)
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(1);
|
||||
// emit synDisableFontWidth(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -803,7 +383,7 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
||||
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
|
||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
|
||||
ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)"));
|
||||
ui->labelEleMaskTime->setText(tr("抑止距离(毫米)"));
|
||||
ui->labelOutputPulseDelayMs->setText(tr("延时(毫米):"));
|
||||
if(ui->comboBoxSyncActType->currentIndex() || 0b11) //如果不是在正反转打印的模式下,就切换到正反转模式
|
||||
{
|
||||
@@ -812,7 +392,7 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
||||
}
|
||||
else
|
||||
{
|
||||
// ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
// ui->radioButtonSynTrigger->setChecked(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
#ifndef NON_CABLE
|
||||
ui->spinBoxSynTriggerPrintLen->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
#endif
|
||||
@@ -825,12 +405,12 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
||||
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
// ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
// ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
//ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
|
||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
|
||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
|
||||
ui->labelEleMaskTime->setText(tr("封锁间隔(毫秒)"));
|
||||
ui->labelEleMaskTime->setText(tr("抑止距离(毫秒)"));
|
||||
ui->labelOutputPulseDelayMs->setText( ui->radioButtonSynTrigger->isChecked()?tr("延时(毫米):"):tr("延时(毫秒):"));
|
||||
|
||||
}
|
||||
@@ -842,8 +422,8 @@ void PrintSetting::setTriggerUI(int triggerMode){
|
||||
ui->radioButtonDelayTrigger->setChecked(triggerMode == PRINT_TRIGGER_TIME);
|
||||
ui->spinBoxDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||
ui->labelDelayTriggerValue->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||
// ui->comboBoxTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||
// ui->labelTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||
// ui->comboBoxTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||
// ui->labelTimeTriggerMode->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||
|
||||
ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
||||
ui->radioButtonEleEyeLevelTrigger->setChecked(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL);
|
||||
@@ -863,7 +443,7 @@ void PrintSetting::setTriggerUI(int triggerMode){
|
||||
)
|
||||
{
|
||||
//ui->radioButtonSynTrigger->setChecked(1);
|
||||
// ui->spinBoxSynTriggerPrintLen->setEnabled(0);
|
||||
// ui->spinBoxSynTriggerPrintLen->setEnabled(0);
|
||||
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
|
||||
ui->labelSynTriggerPrintLen->setEnabled(1);
|
||||
ui->lineEditTriggerPulsePerMm->setEnabled(1);
|
||||
@@ -882,7 +462,7 @@ void PrintSetting::setTriggerUI(int triggerMode){
|
||||
|
||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
|
||||
ui->labelEleMaskTime->setText(tr("封锁间隔(毫米)"));
|
||||
ui->labelEleMaskTime->setText(tr("抑止距离(毫米)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -899,9 +479,7 @@ void PrintSetting::setTriggerUI(int triggerMode){
|
||||
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
//ui->checkBoxAutoSpeedEN->setEnabled (triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
//ui->labelEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
//ui->spinBoxEleMaskTime->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||
|
||||
if(triggerMode == PRINT_TRIGGER_SYNCHRONIZER)
|
||||
{
|
||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
||||
@@ -927,20 +505,20 @@ void PrintSetting::setTriggerUI(int triggerMode){
|
||||
//72版本禁用该输入框
|
||||
//67打开
|
||||
// if(triggerMode== PRINT_TRIGGER_SYNCHRONIZER){
|
||||
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
|
||||
// if(72==FpgaVer)
|
||||
// {
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
|
||||
// }
|
||||
// else if(67==FpgaVer)
|
||||
// {
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(true);
|
||||
// }
|
||||
// const unsigned short &FpgaVer=sysPara->status.build_dat.builTime;
|
||||
// if(72==FpgaVer)
|
||||
// {
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
|
||||
// }
|
||||
// else if(67==FpgaVer)
|
||||
// {
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(true);
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setValue(0);
|
||||
// ui->spinBoxSynTriggerPrintLenRatio->setEnabled(false);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -963,139 +541,110 @@ void PrintSetting::setSynPrintMode(int mode){
|
||||
|
||||
void PrintSetting::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet = R"(
|
||||
QTabWidget {
|
||||
QString styleSheet =
|
||||
R"(
|
||||
QTabWidget {
|
||||
border: none;
|
||||
background-color: #7B838E;
|
||||
}
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
background-color: #7B838E;
|
||||
alignment: left;
|
||||
height: 80px;
|
||||
margin: 0;
|
||||
}
|
||||
QTabBar::tab:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
QTabBar {
|
||||
background-color: #7B838E;
|
||||
border: none;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
height: 80px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
width: 140px;
|
||||
height: 80px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
border: none;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
alignment: center bottom;
|
||||
padding-top: 0;
|
||||
}
|
||||
QTabBar::tab {
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
QTabBar::tab:!selected {
|
||||
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #6E757F, stop:1 #96A0A9);
|
||||
border: 2px solid #63535D;
|
||||
QTabBar::tab {
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
position: relative;
|
||||
bottom: 0px;
|
||||
}
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #95B2D4, stop:1 #F0F0F0);
|
||||
border: none;
|
||||
position: relative;
|
||||
bottom: 0px;
|
||||
}
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
|
||||
QTabWidget::pane {
|
||||
border: none;
|
||||
background-color: #f0f0f0;
|
||||
top: -12px;
|
||||
}
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QWidget#buttonWidget {
|
||||
QWidget#buttonWidget {
|
||||
background-color: #95989D;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton#closeBtn {
|
||||
QPushButton#closeBtn {
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:hover {
|
||||
QPushButton#closeBtn:hover {
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed {
|
||||
QPushButton#closeBtn:pressed {
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
}
|
||||
|
||||
QLabel {
|
||||
QLabel {
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
QCheckBox {
|
||||
QCheckBox {
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
font-weight:500;
|
||||
}
|
||||
}
|
||||
|
||||
QCheckBox::indicator {
|
||||
QCheckBox::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 1px solid #96A0A9;
|
||||
border-radius: 10px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked {
|
||||
QCheckBox::indicator:checked {
|
||||
background-color: #95B2D4;
|
||||
border-color: #95B2D4;
|
||||
image: url(:/Demo/image/select.png);
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
}
|
||||
|
||||
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
|
||||
QWidget#fileTab, QWidget#extraTab, QWidget#settingsTab, QWidget#serviceTab {
|
||||
background-color: #E3E7EC;
|
||||
}
|
||||
)";
|
||||
|
||||
// closeBtn->setObjectName("closeBtn");
|
||||
// buttonWidget->setObjectName("buttonWidget");
|
||||
}
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
@@ -1178,11 +727,17 @@ void PrintSetting::on_radioButtonSynTriggerExternal_clicked()
|
||||
|
||||
void PrintSetting::on_radioButtonEleEyeEdgetTrigger_clicked()
|
||||
{
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE;
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_EDGE;
|
||||
}
|
||||
|
||||
void PrintSetting::on_radioButtonEleEyeLevelTrigger_clicked()
|
||||
{
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL;
|
||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL;
|
||||
}
|
||||
|
||||
|
||||
void PrintSetting::on_checkBoxPulseOutputEnable_clicked(bool checked)
|
||||
{
|
||||
isPulseEenable = checked;
|
||||
ui->spinBoxOutputPulseDelayMs->setEnabled(checked);
|
||||
}
|
||||
|
||||
@@ -73,11 +73,15 @@ private slots:
|
||||
|
||||
void on_radioButtonSynTriggerExternal_clicked();
|
||||
|
||||
void on_checkBoxPulseOutputEnable_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::PrintSetting *ui;
|
||||
|
||||
PulseNumFix *pulseNumFix;
|
||||
|
||||
bool isPulseEenable = false;
|
||||
|
||||
void init();
|
||||
void applyStyleSheet(); // 应用样式表
|
||||
|
||||
|
||||
+81
-89
@@ -26,7 +26,7 @@
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -35,8 +35,8 @@
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>30</y>
|
||||
<x>220</x>
|
||||
<y>90</y>
|
||||
<width>122</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
@@ -57,8 +57,8 @@
|
||||
<widget class="QSpinBox" name="spinBoxHighVoltageValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>20</y>
|
||||
<x>350</x>
|
||||
<y>80</y>
|
||||
<width>121</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
@@ -82,8 +82,8 @@
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>80</y>
|
||||
<x>220</x>
|
||||
<y>160</y>
|
||||
<width>121</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
@@ -104,8 +104,8 @@
|
||||
<widget class="QSpinBox" name="spinBoxColDelay">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>70</y>
|
||||
<x>350</x>
|
||||
<y>150</y>
|
||||
<width>122</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
@@ -123,8 +123,8 @@
|
||||
<widget class="QLabel" name="label_38">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>149</x>
|
||||
<y>120</y>
|
||||
<x>160</x>
|
||||
<y>230</y>
|
||||
<width>181</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
@@ -139,9 +139,9 @@
|
||||
<widget class="QComboBox" name="comboBox_selcetVolPara">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>120</y>
|
||||
<width>185</width>
|
||||
<x>351</x>
|
||||
<y>230</y>
|
||||
<width>220</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -158,80 +158,15 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5行5点阵</string>
|
||||
<string>32点阵对5点阵的优化</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4行7点阵</string>
|
||||
<string>32点阵对4点阵的优化</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>199</y>
|
||||
<width>231</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxUpDownInverse">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>37</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>信息上下颠倒</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/updown.png</normaloff>:/icon/updown.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxLeftRightInverse">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>37</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>信息左右颠倒</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/leftright.png</normaloff>:/icon/leftright.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
@@ -737,7 +672,7 @@ border-radius: 5px;</string>
|
||||
<x>40</x>
|
||||
<y>50</y>
|
||||
<width>431</width>
|
||||
<height>171</height>
|
||||
<height>211</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
@@ -925,7 +860,7 @@ border-radius: 5px;</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>20</y>
|
||||
<y>30</y>
|
||||
<width>171</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
@@ -963,8 +898,8 @@ border-radius: 5px;</string>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>560</x>
|
||||
<y>130</y>
|
||||
<x>530</x>
|
||||
<y>150</y>
|
||||
<width>191</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
@@ -1052,8 +987,8 @@ border-radius: 5px;</string>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<y>310</y>
|
||||
<x>300</x>
|
||||
<y>270</y>
|
||||
<width>171</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
@@ -1103,8 +1038,8 @@ border-radius: 5px;</string>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>330</y>
|
||||
<x>60</x>
|
||||
<y>300</y>
|
||||
<width>231</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@@ -1472,6 +1407,63 @@ QRadioButton {
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="other">
|
||||
<attribute name="title">
|
||||
<string>其他设置</string>
|
||||
</attribute>
|
||||
<widget class="QCheckBox" name="checkBoxUpDownInverse">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>120</y>
|
||||
<width>135</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>37</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>信息上下颠倒</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/updown.png</normaloff>:/icon/updown.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBoxLeftRightInverse">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>220</y>
|
||||
<width>135</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>37</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>信息左右颠倒</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/leftright.png</normaloff>:/icon/leftright.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="closeBtn">
|
||||
<property name="geometry">
|
||||
|
||||
@@ -163,6 +163,7 @@ HEADERS += Public.h \
|
||||
Log/logger.h \
|
||||
Log/logmessage.h \
|
||||
Log/logglobal.h \
|
||||
loginfoctrl.h
|
||||
|
||||
|
||||
FORMS += \
|
||||
@@ -314,7 +315,8 @@ SOURCES +=\
|
||||
scene/piccodeitem.cpp \
|
||||
Log/filelogger.cpp \
|
||||
Log/logger.cpp \
|
||||
Log/logmessage.cpp
|
||||
Log/logmessage.cpp \
|
||||
loginfoctrl.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1218,35 +1218,6 @@ void SystemManage::on_pushButtonAutoClean_pressed()
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void SystemManage::on_pushButtonFontToUdisk_pressed()
|
||||
{
|
||||
//
|
||||
QMessageBox::StandardButton ret;
|
||||
ret = QMessageBox::information(this, tr("警告"),
|
||||
tr("是否确认导出字库到U盘?"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (ret == QMessageBox::Ok)
|
||||
{
|
||||
QFile file("/udisk");
|
||||
if(!file.exists()){
|
||||
QMessageBox::warning(this, tr("错误"),
|
||||
tr("U盘不可识别!"));
|
||||
return;
|
||||
}
|
||||
|
||||
system((char *)((QString("cp /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/* /udisk/.")).toLatin1().data()));
|
||||
system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));//am335x
|
||||
system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));
|
||||
system((char *)((QString("mkdir /udisk/zk")).toLatin1().data()));
|
||||
// system((char *)((QString("cp /opt/zk/* /udisk/zk/ ")).toLatin1().data()));
|
||||
QMessageBox::information(this, tr("提示"),
|
||||
tr("字库导出完成!"));
|
||||
//emit configChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SystemManage::on_pushButtonMotorTest_pressed()
|
||||
{
|
||||
QMessageBox::StandardButton ret;
|
||||
|
||||
@@ -91,8 +91,6 @@ private slots:
|
||||
/***2019/10/23 */
|
||||
//void on_pushButtonAutoClean_clicked();
|
||||
|
||||
void on_pushButtonFontToUdisk_pressed();
|
||||
|
||||
void on_pushButtonMotorTest_pressed();
|
||||
|
||||
void on_pushButtonPushAir_pressed();
|
||||
|
||||
+3
-26
@@ -39,7 +39,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>680</x>
|
||||
<y>530</y>
|
||||
<y>492</y>
|
||||
<width>100</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@@ -77,13 +77,13 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>750</width>
|
||||
<height>502</height>
|
||||
<height>471</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -620,29 +620,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonFontToUdisk">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>导出字库</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/udisk.png</normaloff>:/icon/udisk.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonAutoClean">
|
||||
<property name="enabled">
|
||||
|
||||
+42
-73
@@ -47,6 +47,12 @@ SystemSetting::SystemSetting(QWidget *parent) :
|
||||
dialogUpateMm =new DialogAuthorization;
|
||||
connect(dialogUpateMm,SIGNAL(accepted()),this,SLOT(ondialogAuthorizationAccepted()));
|
||||
|
||||
if (ctrl_loginfo == nullptr) {
|
||||
ctrl_loginfo = LogInfoCtrl::instance();
|
||||
connect(ctrl_loginfo, &LogInfoCtrl::sig_clean,
|
||||
this, &SystemSetting::on_pushButtonCleanUP_pressed);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
ui->label->hide();
|
||||
@@ -89,6 +95,20 @@ void SystemSetting::buttonClickedSlot()
|
||||
}
|
||||
}
|
||||
|
||||
void SystemSetting::lockUI()
|
||||
{
|
||||
ui->checkBtn->setEnabled(false);
|
||||
ui->closeBtn->setEnabled(false);
|
||||
ui->pushButtonHighVoltageData->setEnabled(false);
|
||||
}
|
||||
|
||||
void SystemSetting::unlockUI()
|
||||
{
|
||||
ui->checkBtn->setEnabled(true);
|
||||
ui->closeBtn->setEnabled(true);
|
||||
ui->pushButtonHighVoltageData->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void SystemSetting::SystemupdateSysParaToUI(){
|
||||
updateSysParaToUI();
|
||||
@@ -237,6 +257,8 @@ void SystemSetting::updateSysStatusToUI(){
|
||||
enCleanUpAppendFlag=5;
|
||||
//sysPara->devOp->controlReclaimTankClose(1);
|
||||
//ui->label_status->setText(tr("正在关回收槽......"));
|
||||
if(ctrl_loginfo) ctrl_loginfo->emitSigCleanOver(false);
|
||||
unlockUI();
|
||||
}
|
||||
else if(sysPara->status.currReclaimTankPos ==0 && (enCleanUpAppendFlag==5 ||enCleanUpAppendFlag==4)) //?
|
||||
{
|
||||
@@ -248,10 +270,6 @@ void SystemSetting::updateSysStatusToUI(){
|
||||
enCleanUpAppendFlag=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,10 +312,14 @@ void SystemSetting::on_pushButtonCleanUP_pressed()
|
||||
|
||||
enCleanUpAppendFlag=1;// 开始启动手动模式
|
||||
sysPara->devOp->mainInkCtrl();
|
||||
if (ctrl_loginfo) ctrl_loginfo->emitSigCleanOver(true);
|
||||
lockUI();
|
||||
timer2->start(2000); // 暂时循环一下2s
|
||||
}
|
||||
else if (msgBox.clickedButton() == cancleCleanButton) {
|
||||
enCleanUpAppendFlag=3;
|
||||
if (ctrl_loginfo) ctrl_loginfo->emitSigCleanOver(false);
|
||||
unlockUI();
|
||||
timerHandler2();
|
||||
return ;
|
||||
}
|
||||
@@ -352,7 +374,6 @@ void SystemSetting::timerHandler2(){
|
||||
}
|
||||
else if(enCleanUpAppendFlag==3){// 清洗完成
|
||||
enCleanUpAppendFlag=4;
|
||||
// emit setRunStatus(tr("清洗完成"));
|
||||
sysPara->devOp->controlCycleValve(false);
|
||||
sysPara->devOp->controlViscosityPump(false);
|
||||
sysPara->devOp->controlReclaimTankClose(1);
|
||||
@@ -365,6 +386,9 @@ void SystemSetting::timerHandler2(){
|
||||
}
|
||||
else if(enCleanUpAppendFlag==4){
|
||||
emit setRunStatus(tr("清洗完成"));
|
||||
if (ctrl_loginfo) ctrl_loginfo->emitSigCleanOver(false);
|
||||
unlockUI();
|
||||
|
||||
if(sysPara->status.currReclaimTankPos==0){
|
||||
enCleanUpAppendFlag=0;
|
||||
if(timer2->isActive()) timer2->stop();
|
||||
@@ -697,75 +721,20 @@ void SystemSetting::on_spinBoxOscillatorVoltage_valueChanged(int arg1)
|
||||
}
|
||||
#include "Public.h"
|
||||
|
||||
void SystemSetting::on_pushButtonInterFace_pressed()
|
||||
{
|
||||
QString s1 = Public::ReadLanguageName();
|
||||
if(s1 =="English") {
|
||||
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_ENGLISH;
|
||||
}
|
||||
else if(s1 =="Korean") {
|
||||
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_KOREAN;
|
||||
}
|
||||
else{
|
||||
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_CHINESE;
|
||||
}
|
||||
|
||||
dlgLanguage.setCurrentLanguage();
|
||||
dlgLanguage.show();
|
||||
|
||||
|
||||
/*
|
||||
QFile file(SYS_ROOT_DIR"UseEn");
|
||||
|
||||
QMessageBox::StandardButton ret;
|
||||
ret = QMessageBox::information(this, tr("警告"),
|
||||
tr("确定要切换显示语言吗?\r\n(重启才能生效)"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (ret != QMessageBox::Ok){
|
||||
return;
|
||||
}
|
||||
|
||||
QString s1 = Public::ReadLanguageName();
|
||||
|
||||
if(file.open(QIODevice::ReadWrite| QIODevice::Truncate)) {
|
||||
QByteArray buf;
|
||||
buf.clear();
|
||||
if(s1 =="English") {// English--> Vietnamese
|
||||
QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面"));
|
||||
buf.append("Vietnamese\r\n");
|
||||
buf.append("YN_utf8.txt\r\n");
|
||||
}
|
||||
else if(s1 =="Vietnamese") {// Vietnamese--> Chinese
|
||||
QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面"));
|
||||
buf.append("Chinese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else{// Chinese--> English
|
||||
QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面"));
|
||||
buf.append("English\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
file.write(buf);
|
||||
file.close();
|
||||
setInterfaceMode();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void SystemSetting::setInterfaceMode()
|
||||
{
|
||||
QString s1 = Public::ReadLanguageName();
|
||||
if(s1 =="English") {// English--> Vietnamese
|
||||
ui->pushButtonInterFace->setText( tr("Tiếng Việt(Vietnamese interface)"));
|
||||
}
|
||||
else if(s1 =="Vietnamese") {// Vietnamese--> Chinese
|
||||
ui->pushButtonInterFace->setText( tr("Chinese interface(中文界面)"));
|
||||
}
|
||||
else{// Chinese--> English
|
||||
ui->pushButtonInterFace->setText( tr("English interface(英文界面)"));
|
||||
}
|
||||
|
||||
}
|
||||
//void SystemSetting::setInterfaceMode()
|
||||
//{
|
||||
// QString s1 = Public::ReadLanguageName();
|
||||
// if(s1 =="English") {// English--> Vietnamese
|
||||
// ui->pushButtonInterFace->setText( tr("Tiếng Việt(Vietnamese interface)"));
|
||||
// }
|
||||
// else if(s1 =="Vietnamese") {// Vietnamese--> Chinese
|
||||
// ui->pushButtonInterFace->setText( tr("Chinese interface(中文界面)"));
|
||||
// }
|
||||
// else{// Chinese--> English
|
||||
// ui->pushButtonInterFace->setText( tr("English interface(英文界面)"));
|
||||
// }
|
||||
//}
|
||||
|
||||
void SystemSetting::applyStyleSheet()
|
||||
{
|
||||
|
||||
+7
-3
@@ -9,6 +9,7 @@
|
||||
#include "DialogAuthorization.h"
|
||||
#include "dlgmutilanguage.h"
|
||||
#include <iostream>
|
||||
#include "loginfoctrl.h"
|
||||
namespace Ui {
|
||||
class SystemSetting;
|
||||
}
|
||||
@@ -40,7 +41,7 @@ Q_SIGNALS:
|
||||
void setRunStatus(QString);
|
||||
void pressureAdjust();
|
||||
private slots:
|
||||
void setInterfaceMode();
|
||||
// void setInterfaceMode();
|
||||
void SystemupdateSysParaToUI();
|
||||
|
||||
void on_spinBoxReclaimPumpPower_valueChanged(int arg1);
|
||||
@@ -50,7 +51,6 @@ private slots:
|
||||
|
||||
void timerHandler();
|
||||
void on_spinBoxOscillatorVoltage_valueChanged(int arg1);
|
||||
void on_pushButtonInterFace_pressed();
|
||||
void ondialogAuthorizationAccepted();
|
||||
void onCleanUPNow();
|
||||
void timerHandler2();
|
||||
@@ -63,11 +63,15 @@ signals:
|
||||
|
||||
private:
|
||||
Ui::SystemSetting *ui;
|
||||
DlgMutiLanguage dlgLanguage;
|
||||
QTimer *timer,*timer2, *SetinkcloseCountTimer, *timerAuto;
|
||||
unsigned char enCleanUpAppendFlag; // 0空闲,1关开回收槽,2手动,3清洗,4恢复,5停止,6
|
||||
bool r_PumpValveControledByHand;
|
||||
DialogAuthorization *dialogUpateMm;
|
||||
LogInfoCtrl *ctrl_loginfo = nullptr;
|
||||
|
||||
// 清洗中,界面锁死
|
||||
void lockUI();
|
||||
void unlockUI();
|
||||
};
|
||||
|
||||
#endif // SSYSTEMSETTING_H
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "SystemUpdate.h"
|
||||
#include "ui_SystemUpdate.h"
|
||||
#include "SystemManage.h"
|
||||
#include "Public.h"
|
||||
#include "InputMethod.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
SystemUpdate::SystemUpdate(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -17,6 +20,11 @@ SystemUpdate::~SystemUpdate()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SystemUpdate::bindSysPara(SysPara *sysPara)
|
||||
{
|
||||
dlgLanguage.bindSysPara(sysPara);
|
||||
}
|
||||
|
||||
/*关闭按键*/
|
||||
void SystemUpdate::on_closeBtn_clicked()
|
||||
{
|
||||
@@ -92,3 +100,44 @@ void SystemUpdate::on_pushButtonUpdateCharLib_clicked()
|
||||
emit sendUpDateChARLIBSignal();
|
||||
}
|
||||
|
||||
|
||||
void SystemUpdate::on_pushButtonFontToUdisk_clicked()
|
||||
{
|
||||
QMessageBox::StandardButton ret;
|
||||
ret = QMessageBox::information(this, tr("警告"),
|
||||
tr("是否确认导出字库到U盘?"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (ret == QMessageBox::Ok)
|
||||
{
|
||||
QFile file("/udisk");
|
||||
if(!file.exists()){
|
||||
QMessageBox::warning(this, tr("错误"),
|
||||
tr("U盘不可识别!"));
|
||||
return;
|
||||
}
|
||||
|
||||
system((char *)((QString("cp /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/* /udisk/.")).toLatin1().data()));
|
||||
system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));//am335x
|
||||
system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));
|
||||
system((char *)((QString("mkdir /udisk/zk")).toLatin1().data()));
|
||||
QMessageBox::information(this, tr("提示"),
|
||||
tr("字库导出完成!"));
|
||||
}
|
||||
}
|
||||
|
||||
void SystemUpdate::on_pushButtonInterFace_clicked()
|
||||
{
|
||||
QString s1 = Public::ReadLanguageName();
|
||||
if(s1 =="English") {
|
||||
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_ENGLISH;
|
||||
}
|
||||
else if(s1 =="Korean") {
|
||||
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_KOREAN;
|
||||
}
|
||||
else{
|
||||
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_CHINESE;
|
||||
}
|
||||
|
||||
dlgLanguage.setCurrentLanguage();
|
||||
dlgLanguage.show();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#define UPDATESOFT 3
|
||||
#define UPDATECHARLIB 4
|
||||
|
||||
#include "dlgmutilanguage.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
@@ -20,10 +22,14 @@ public:
|
||||
explicit SystemUpdate(QWidget *parent = 0);
|
||||
~SystemUpdate();
|
||||
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
|
||||
private:
|
||||
Ui::SystemUpdate *ui;
|
||||
void applyStyleSheet(); // 应用样式表
|
||||
|
||||
DlgMutiLanguage dlgLanguage;
|
||||
|
||||
signals:
|
||||
void sendButtonClickedSignal(int index);
|
||||
|
||||
@@ -38,6 +44,8 @@ private slots:
|
||||
void on_pushButtonUpdateSoftware_clicked();
|
||||
void on_pushButtonUpdateCharLib_clicked();
|
||||
void on_closeBtn_clicked();
|
||||
void on_pushButtonFontToUdisk_clicked();
|
||||
void on_pushButtonInterFace_clicked();
|
||||
};
|
||||
|
||||
#endif // SYSTEMUPDATE_H
|
||||
|
||||
+133
-96
@@ -38,107 +38,144 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>130</y>
|
||||
<width>601</width>
|
||||
<height>268</height>
|
||||
<x>80</x>
|
||||
<y>190</y>
|
||||
<width>614</width>
|
||||
<height>128</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonProgramFPGA">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>烧录FPGA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonUpdateSoftware">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>更新软件</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/updatesoftware.png</normaloff>:/icon/updatesoftware.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButtonProgramFPGA">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>烧录FPGA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonProgramStm32">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>烧录单片机软件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonUpdateCharLib">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>更新字库</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/updatefont.png</normaloff>:/icon/updatefont.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButtonUpdateSoftware">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>更新软件</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/updatesoftware.png</normaloff>:/icon/updatesoftware.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButtonInterFace">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>界面语言设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButtonProgramStm32">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>烧录单片机软件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButtonUpdateCharLib">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>更新字库</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/updatefont.png</normaloff>:/icon/updatefont.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButtonFontToUdisk">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>导出字库</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="image.qrc">
|
||||
<normaloff>:/icon/udisk.png</normaloff>:/icon/udisk.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
+992
-1179
File diff suppressed because it is too large
Load Diff
+1
-98
@@ -14,104 +14,7 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
// 下拉框
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
|
||||
QSpinBox::up-button {
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QSpinBox::up-arrow {
|
||||
image: url(image/up_white.png);
|
||||
}
|
||||
|
||||
QSpinBox::down-button {
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QSpinBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
}
|
||||
</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
|
||||
+3
-76
@@ -14,80 +14,7 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
// 下拉框
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<widget class="QPushButton" name="checkBtn">
|
||||
<property name="geometry">
|
||||
@@ -123,8 +50,8 @@ QComboBox QAbstractItemView {
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>10</y>
|
||||
<width>781</width>
|
||||
<height>461</height>
|
||||
<width>771</width>
|
||||
<height>472</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
|
||||
+1
-1
@@ -633,7 +633,7 @@ void dlgQrCode::setCntCheckBoxHide(bool hideEn){
|
||||
}
|
||||
}
|
||||
|
||||
void dlgQrCode::setSysPara(SysPara * sysPara)
|
||||
void dlgQrCode::bindSysPara(SysPara * sysPara)
|
||||
{
|
||||
this->sysPara = sysPara;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public:
|
||||
void setCntCheckBoxHide(bool hideEn);
|
||||
QString getCounterText( int counter,int QRCntNum);
|
||||
void MatrixEnCode(unsigned char *intext,int Size);
|
||||
void setSysPara(SysPara * sysPara);
|
||||
void bindSysPara(SysPara * sysPara);
|
||||
|
||||
void bindTxTEdit(QTextEdit *textEdit);
|
||||
public slots:
|
||||
|
||||
+94
-71
@@ -2,6 +2,8 @@
|
||||
#include "ui_dlgmutilanguage.h"
|
||||
#include "InputMethod.h"
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QTime>
|
||||
#include <unistd.h>
|
||||
|
||||
DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) :
|
||||
@@ -9,7 +11,7 @@ DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) :
|
||||
ui(new Ui::DlgMutiLanguage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// ui->listWidget->hide();
|
||||
// ui->listWidget->hide();
|
||||
connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage()));
|
||||
LangIndex=INPUT_METHOD_TYPE_CHINESE;
|
||||
}
|
||||
@@ -32,89 +34,110 @@ void DlgMutiLanguage::setCurrentLanguage(){
|
||||
}
|
||||
|
||||
int DlgMutiLanguage::getCurrentLanguage(){
|
||||
// LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
// if(ui->radioButton_2->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面"));
|
||||
// buf.append("English\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
// else if(ui->radioButton_3->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面"));
|
||||
// buf.append("Vietnamese\r\n");
|
||||
// buf.append("YN_utf8.txt\r\n");
|
||||
// }
|
||||
// /*else if(ui->radioButton->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
// if(ui->radioButton_2->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面"));
|
||||
// buf.append("English\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
// else if(ui->radioButton_3->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面"));
|
||||
// buf.append("Vietnamese\r\n");
|
||||
// buf.append("YN_utf8.txt\r\n");
|
||||
// }
|
||||
// /*else if(ui->radioButton->isChecked()) {
|
||||
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
|
||||
// }*/
|
||||
// else {
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面"));
|
||||
// buf.append("Chinese\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
// }*/
|
||||
// else {
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面"));
|
||||
// buf.append("Chinese\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
return LangIndex;
|
||||
}
|
||||
void DlgMutiLanguage::SetNewLanguage(){
|
||||
|
||||
LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
|
||||
QFile file("/home/plg/UseEn");
|
||||
QFile file("/home/plg/UseEn");
|
||||
|
||||
QByteArray buf;
|
||||
buf.clear();
|
||||
QByteArray buf;
|
||||
buf.clear();
|
||||
|
||||
if(file.open(QIODevice::ReadWrite)) {//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看
|
||||
if(file.open(QIODevice::ReadWrite)) {//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看
|
||||
|
||||
|
||||
if(ui->radioButton_2->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
buf.append("English\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
if(ui->radioButton_2->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
buf.append("English\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_3->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Turkish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_4->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_SPANISH;
|
||||
buf.append("Spanish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_5->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_THAI;
|
||||
buf.append("Thai\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_6->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Vietnamese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_7->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_Farsi;
|
||||
buf.append("Farsi\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_korean->isChecked()){
|
||||
LangIndex = INPUT_METHOD_TYPE_KOREAN;
|
||||
buf.append("Korean\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else {
|
||||
buf.append("Chinese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
file.write(buf);
|
||||
fsync(file.handle());
|
||||
file.close();
|
||||
|
||||
}
|
||||
else if(ui->radioButton_3->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Turkish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
// 提示重启
|
||||
QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"),
|
||||
tr("是否重启?"),
|
||||
QMessageBox::Ok);
|
||||
if (ret == QMessageBox::Ok) {
|
||||
sysPara->saveParaToFile(); // 关机前将相关配置保存
|
||||
sysPara->saveRFIDPara();
|
||||
mySleep(200);
|
||||
system("sync");//缓存同步
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
else if(ui->radioButton_4->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_SPANISH;
|
||||
buf.append("Spanish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_5->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_THAI;
|
||||
buf.append("Thai\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_6->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Vietnamese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_7->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_Farsi;
|
||||
buf.append("Farsi\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_korean->isChecked()){
|
||||
LangIndex = INPUT_METHOD_TYPE_KOREAN;
|
||||
buf.append("Korean\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else {
|
||||
buf.append("Chinese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
file.write(buf);
|
||||
fsync(file.handle());
|
||||
file.close();
|
||||
}
|
||||
|
||||
void DlgMutiLanguage::mySleep(unsigned int msec)
|
||||
{
|
||||
QTime dieTime = QTime::currentTime().addMSecs(msec);
|
||||
|
||||
while( QTime::currentTime() < dieTime )
|
||||
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -1,13 +1,16 @@
|
||||
#ifndef DLGMUTILANGUAGE_H
|
||||
#define DLGMUTILANGUAGE_H
|
||||
|
||||
#include "ParaSettingUI.h"
|
||||
#include "SysPara.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class DlgMutiLanguage;
|
||||
}
|
||||
|
||||
class DlgMutiLanguage : public QDialog
|
||||
class DlgMutiLanguage : public QDialog,public ParaSettingUI
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -23,6 +26,7 @@ public slots:
|
||||
private:
|
||||
Ui::DlgMutiLanguage *ui;
|
||||
|
||||
void mySleep(unsigned int msec);
|
||||
};
|
||||
|
||||
#endif // DLGMUTILANGUAGE_H
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
## [InkJetPrinter](../InkJetPrinter.h)
|
||||
+992
-1179
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,8 @@ FileManageWidget::FileManageWidget(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
applyStyleSheet();
|
||||
|
||||
// 安装事件过滤器用于判断当前焦点位于系统文件列表还是U盘文件列表,高亮获得焦点的列表
|
||||
ui->systemFileListView->installEventFilter(this);
|
||||
ui->udiskFileListView->installEventFilter(this);
|
||||
@@ -202,3 +204,46 @@ void FileManageWidget::copyFiles(QListWidget *from, QListWidget *to)
|
||||
qInfo() << "Command: " << cmd << ", result: " << ret;
|
||||
}
|
||||
}
|
||||
|
||||
void FileManageWidget::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet = R"(
|
||||
|
||||
QPushButton#closeBtn {
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ private:
|
||||
|
||||
// 用于文件显示列表中,存放每个文件名对应的绝对路径所用的数据键
|
||||
static constexpr int AbsPathRole = Qt::UserRole + 1;
|
||||
|
||||
void applyStyleSheet(); // 应用样式表
|
||||
};
|
||||
|
||||
#endif // FILEMANAGEWIDGET_H
|
||||
|
||||
@@ -6,9 +6,15 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>786</width>
|
||||
<height>498</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
|
||||
+1556
-1408
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
#include "loginfoctrl.h"
|
||||
|
||||
void LogInfoCtrl::emitSigClean()
|
||||
{
|
||||
emit sig_clean();
|
||||
}
|
||||
|
||||
void LogInfoCtrl::emitSigCleanOver(bool flag)
|
||||
{
|
||||
emit sig_cleanOver(flag);
|
||||
}
|
||||
|
||||
void LogInfoCtrl::emitSigShow()
|
||||
{
|
||||
emit sig_show();
|
||||
}
|
||||
|
||||
LogInfoCtrl::LogInfoCtrl()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef LOGINFOCTRL_H
|
||||
#define LOGINFOCTRL_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class LogInfoCtrl : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static LogInfoCtrl* instance() {
|
||||
static LogInfoCtrl ins;
|
||||
return &ins;
|
||||
}
|
||||
|
||||
void emitSigClean();
|
||||
void emitSigCleanOver(bool flag);
|
||||
void emitSigShow();
|
||||
|
||||
private:
|
||||
LogInfoCtrl();
|
||||
|
||||
signals:
|
||||
void sig_clean();
|
||||
void sig_cleanOver(bool flag);
|
||||
void sig_show();
|
||||
};
|
||||
|
||||
#endif // LOGINFOCTRL_H
|
||||
+207
-90
@@ -29,6 +29,7 @@
|
||||
#include <string>
|
||||
#include "scene/PicDateItem.h"
|
||||
#include "scene/PicScheduleShiftItem.h"
|
||||
#include "scene/piccodeitem.h"
|
||||
#include <QElapsedTimer>
|
||||
|
||||
extern MyInputMethod *myInputMethod;
|
||||
@@ -40,7 +41,6 @@ MainWidget::MainWidget(QWidget* parent)
|
||||
{
|
||||
// 加载UI文件
|
||||
ui.setupUi(this);
|
||||
initSheet();
|
||||
|
||||
// 关联成员变量到UI控件
|
||||
m_EditBtn = ui.m_EditBtn;
|
||||
@@ -69,10 +69,12 @@ MainWidget::MainWidget(QWidget* parent)
|
||||
// ui.labelRunStatus->setWordWrap(true);
|
||||
|
||||
ui.sub3->installEventFilter(this);
|
||||
ui.fra_state->installEventFilter(this);
|
||||
ui.labelTotalProductCnt->hide();
|
||||
ui.lb_counter->hide();
|
||||
|
||||
enablePrintButton(true);
|
||||
changeHighLight(false);
|
||||
enablePrintButton(false);
|
||||
}
|
||||
|
||||
MainWidget::~MainWidget()
|
||||
@@ -1398,7 +1400,7 @@ bool MainWidget::dateTimeItemsDotUpdate()
|
||||
if(!item)
|
||||
continue;
|
||||
|
||||
if(item->sourceType() != SourceType::DATETIME && item->sourceType() != SourceType::SCHEDULE_SHIFT)
|
||||
if(item->sourceType() != SourceType::DATETIME && item->sourceType() != SourceType::SCHEDULE_SHIFT && item->sourceType() != SourceType::CODE)
|
||||
continue;
|
||||
|
||||
if(item->sourceType() == SourceType::DATETIME) {
|
||||
@@ -1423,6 +1425,18 @@ bool MainWidget::dateTimeItemsDotUpdate()
|
||||
continue;
|
||||
}
|
||||
|
||||
if(item->sourceType() == SourceType::CODE) {
|
||||
auto codeItem = dynamic_cast<PicCodeItem*>(item);
|
||||
if(!codeItem)
|
||||
continue;
|
||||
|
||||
QVector<int> counterValus{sysPara->para.cnt1CurrValue, sysPara->para.cnt2CurrValue};
|
||||
auto b = codeItem->updateVariants(counterValus);
|
||||
isUpdate |= b;
|
||||
if(!b)
|
||||
continue;
|
||||
}
|
||||
|
||||
QImage img = item->preview();
|
||||
if(img.isNull()) {
|
||||
++nbInvaliedDatetimePreview;
|
||||
@@ -1430,10 +1444,10 @@ bool MainWidget::dateTimeItemsDotUpdate()
|
||||
}
|
||||
|
||||
auto sceneRect = pPicScene->sceneRect();
|
||||
QRectF itemRect(item->pos(), img.size());
|
||||
auto boundingRect = pPicScene->itemsBoundingRect();
|
||||
QRectF itemRect(item->pos() - boundingRect.topLeft(), img.size());
|
||||
totalOfDatetimeNumber++;
|
||||
|
||||
|
||||
// 裁剪item位置, 确保item位于场景内
|
||||
// 如果item超出了场景范围,则裁剪img并更新itemRect,只显示场景内的部分
|
||||
QRectF intersectRect = itemRect.intersected(sceneRect);
|
||||
@@ -1457,9 +1471,6 @@ bool MainWidget::dateTimeItemsDotUpdate()
|
||||
totalOfProcessedDots += imageToPrintData(img, (int)itemRect.left(), (int)itemRect.top());
|
||||
}
|
||||
|
||||
// if(totalOfProcessedDots)
|
||||
// LogInfo::setRunStatusText(QString("totalOfProcessedDots: %1").arg(totalOfProcessedDots));
|
||||
|
||||
return isUpdate;
|
||||
}
|
||||
|
||||
@@ -1636,26 +1647,13 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
}
|
||||
sysPara->status.isPrinting=false;
|
||||
|
||||
// setRunStatus(tr("开始打印1")); hlp
|
||||
// qDebug()<<QString("mainwindow 打印内容:%1").arg(ui->textEdit->toPlainText());
|
||||
|
||||
SendPrintDataToFpga(0); // 0--正常打印,1--打印交替部分信息1; 2--打印交替部分信息2,
|
||||
// if(sysPara->para.isCheckInsertTime)
|
||||
// {
|
||||
// if(!startPrintingFlag)
|
||||
// {
|
||||
// LogInfo::setRunStatusText(tr("开始打印"));
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LogInfo::setRunStatusText(tr("开始打印"));
|
||||
// }
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
// ui->labelSynColDelay->setText("");
|
||||
sysPara->status.lastSynColDelay = -1; //目的是为了清空原来的数据
|
||||
/*--------------------------------暂停按钮------------------------------*/
|
||||
// ui->pushButtonPausePrint->setEnabled(true);
|
||||
// ui->pushButtonPausePrint->setText(tr("暂停打印"));
|
||||
|
||||
/*---------------------------------开关回收槽------------------------------*/
|
||||
enableReclaimCtrlButton(false);
|
||||
// updatePrintDisplayLabel(); hlp
|
||||
@@ -1665,13 +1663,11 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
sysPara->devOp->printCtrl(PRINT_CTRL_START);
|
||||
printintFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//如果已经在打印,则不要在发送start命令,只要更新相应的数据即可
|
||||
// if(!printintFlag) //如果在暂停,重复取消暂停
|
||||
// on_pushButtonPausePrint_pressed();
|
||||
}
|
||||
|
||||
startPrintingFlag = true;sysPara->status.isPrinting=true;
|
||||
|
||||
// 高亮切换
|
||||
changeHighLight(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1713,6 +1709,8 @@ void MainWidget::on_m_StopBtn_clicked()
|
||||
|
||||
}
|
||||
}
|
||||
// 高亮切换
|
||||
changeHighLight(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1887,32 +1885,76 @@ void MainWidget::reclaimTanOpen()
|
||||
void MainWidget::initSheet()
|
||||
{
|
||||
// 仅当前按钮生效
|
||||
ui.m_StartBtn->setStyleSheet(R"(
|
||||
QPushButton {
|
||||
background-color: #27ae60;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #bdc3c7;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
)");
|
||||
ui.m_StartBtn->setStyleSheet(
|
||||
R"(
|
||||
QPushButton {
|
||||
background-color: #1e8449;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #bdc3c7; /* 灰色背景 */
|
||||
color: #7f8c8d; /* 灰色文字 */
|
||||
border: 1px solid #95a5a6; /* 灰色边框 */
|
||||
}
|
||||
)");
|
||||
|
||||
ui.m_StopBtn->setStyleSheet(R"(
|
||||
QPushButton {
|
||||
background-color: #e74c3c;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
ui.m_StopBtn->setStyleSheet(
|
||||
R"(
|
||||
QPushButton {
|
||||
background-color: #e74c3c;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #bdc3c7; /* 灰色背景 */
|
||||
color: #7f8c8d; /* 灰色文字 */
|
||||
border: 1px solid #95a5a6; /* 灰色边框 */
|
||||
}
|
||||
)");
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #bdc3c7;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
// this->setStyleSheet(styleSheet);
|
||||
void MainWidget::changeHighLight(bool isStart)
|
||||
{
|
||||
initSheet();
|
||||
if (isStart) {
|
||||
QString highlightStyle =
|
||||
R"(
|
||||
QPushButton {
|
||||
background-color: #27ae60;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
border: 3px solid #f39c12;
|
||||
box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #bdc3c7; /* 灰色背景 */
|
||||
color: #7f8c8d; /* 灰色文字 */
|
||||
border: 1px solid #95a5a6; /* 灰色边框 */
|
||||
}
|
||||
)";
|
||||
m_StartBtn->setStyleSheet(highlightStyle);
|
||||
|
||||
|
||||
} else {
|
||||
QString highlightStyle =
|
||||
R"(
|
||||
QPushButton {
|
||||
background-color: #f07167;
|
||||
color: black;
|
||||
border-radius: 5px;
|
||||
border: 3px solid #f39c12;
|
||||
box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #bdc3c7; /* 灰色背景 */
|
||||
color: #7f8c8d; /* 灰色文字 */
|
||||
border: 1px solid #95a5a6; /* 灰色边框 */
|
||||
}
|
||||
)";
|
||||
m_StopBtn->setStyleSheet(highlightStyle);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::on_m_RightBtn_clicked()
|
||||
@@ -2028,17 +2070,8 @@ static int oldsizeSTM32 = -1;
|
||||
static int reclaimTankDelay = 0;
|
||||
void MainWidget::updateSysStatusToUI(){ //100ms
|
||||
if(sysPara){
|
||||
if(sysPara->para.gearPumpEnable)
|
||||
{
|
||||
// ui->label_11->setText(tr("齿轮泵转速"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// ui->label_11->setText(tr("隔膜位置"));
|
||||
}
|
||||
RefreshStatusLight();
|
||||
if(sysPara->status.lastProductCnt != sysPara->status.productCnt){ //产品计数
|
||||
//ui.labelProductCnt->setText(QString::number(sysPara->status.productCnt));
|
||||
updateTotalCnt(0);
|
||||
}
|
||||
|
||||
@@ -2047,9 +2080,6 @@ void MainWidget::updateSysStatusToUI(){ //100ms
|
||||
sysPara->status.ExpiryDispUpdate--;
|
||||
m_PrintDisplay->update();// 2018.5.25
|
||||
}
|
||||
// if(sysPara->para.alterPrint.enable==1) ui->labelXFileName->setText (tr("交替打印"));
|
||||
// else if(sysPara->para.alterPrint.enable==2) ui->labelXFileName->setText (tr("电眼交替"));
|
||||
// else ui->labelXFileName->setText ("");
|
||||
/*--------------------------------------------------------------------------*/
|
||||
//if(sysPara->para.printTriggerMode == PRINT_TRIGGER_SYNCHRONIZER && printintFlag){ //同步器速度
|
||||
if((
|
||||
@@ -2265,6 +2295,107 @@ void MainWidget::updateSysStatusToUI(){ //100ms
|
||||
|
||||
}
|
||||
|
||||
bool MainWidget::checkRed(AlarmStatus &status)
|
||||
{
|
||||
if (status.highVoltageFault == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("高压故障");
|
||||
return true;
|
||||
}
|
||||
if (status.chargeFault == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("相位故障");
|
||||
return true;
|
||||
}
|
||||
if (status.viscosityWarn == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("粘度故障");
|
||||
return true;
|
||||
}
|
||||
if (status.recycleWarn == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("回收故障");
|
||||
return true;
|
||||
}
|
||||
if (status.solveLevelWarn == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("溶液液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkWaterLevel == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("墨水液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkLeak == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("墨水缸满");
|
||||
return true;
|
||||
}
|
||||
if (status.inkSwint == DEV_STATUS_RED) {
|
||||
m_stateStr = tr("墨线开关");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainWidget::checkYellow(AlarmStatus &status)
|
||||
{
|
||||
if (status.highVoltageFault == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("高压故障");
|
||||
return true;
|
||||
}
|
||||
if (status.chargeFault == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("相位故障");
|
||||
return true;
|
||||
}
|
||||
if (status.viscosityWarn == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("粘度故障");
|
||||
return true;
|
||||
}
|
||||
if (status.recycleWarn == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("回收故障");
|
||||
return true;
|
||||
}
|
||||
if (status.solveLevelWarn == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("溶液液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkWaterLevel == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("墨水液位");
|
||||
return true;
|
||||
}
|
||||
if (status.inkLeak == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("墨水缸满");
|
||||
return true;
|
||||
}
|
||||
if (status.inkSwint == DEV_STATUS_YELLOW) {
|
||||
m_stateStr = tr("墨线开关");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWidget::updateGeneralState(AlarmStatus status)
|
||||
{
|
||||
// 有红则红,全绿则绿,红>黄>绿
|
||||
// 检查从后往前判断,因为取最后一个状态QString
|
||||
bool isRed = checkRed(status);
|
||||
if (isRed) {
|
||||
m_stateColor = DEV_STATUS_RED;
|
||||
} else {
|
||||
bool isYellow = checkYellow(status);
|
||||
if (isYellow) {
|
||||
m_stateColor = DEV_STATUS_YELLOW;
|
||||
} else {
|
||||
m_stateColor = DEV_STATUS_GREEN;
|
||||
m_stateStr= tr("正常");
|
||||
}
|
||||
}
|
||||
|
||||
if (m_stateColor == DEV_STATUS_GREEN) {
|
||||
ui.fra_state->setStyleSheet("background-color: #ccffcc;");
|
||||
} else if (m_stateColor == DEV_STATUS_RED) {
|
||||
ui.fra_state->setStyleSheet("background-color: #ff6b6b;");
|
||||
} else {
|
||||
ui.fra_state->setStyleSheet("background-color: #ffd93c;");
|
||||
}
|
||||
ui.lb_generalState->setText(m_stateStr);
|
||||
}
|
||||
|
||||
|
||||
int MainWidget::calculateMaxSpeed(int backup)
|
||||
{
|
||||
@@ -3039,18 +3170,9 @@ void MainWidget::handleEmptySize()
|
||||
return;
|
||||
}
|
||||
|
||||
void MainWidget::updatePrintDisplayLabel(){
|
||||
// if(sysPara && !sysPara->status.reclainTankReachEnd){
|
||||
// setRunStatus(tr("回收槽未到底!!!!!!"));
|
||||
// }
|
||||
// else if(startPrintingFlag ){
|
||||
// if(printintFlag)
|
||||
// setRunStatus(tr("正在喷印..............."));
|
||||
// else
|
||||
// setRunStatus(tr("暂停喷印..............."));
|
||||
// }
|
||||
// else
|
||||
// setRunStatus("");
|
||||
void MainWidget::updatePrintDisplayLabel()
|
||||
{
|
||||
m_PrintDisplay->update();
|
||||
}
|
||||
|
||||
void MainWidget::RefreshStatusLight(){//100ms
|
||||
@@ -3344,18 +3466,6 @@ bool MainWidget::updatePhaseIndicatorLight(){
|
||||
return sysPara->status.lastPhaseFault;
|
||||
}
|
||||
|
||||
void MainWidget::updateGeneralState(DevStatusLightType type, QString stateStr)
|
||||
{
|
||||
if (type == DEV_STATUS_GREEN) {
|
||||
ui.frame->setStyleSheet("background-color: #ccffcc;");
|
||||
} else if (type == DEV_STATUS_RED) {
|
||||
ui.frame->setStyleSheet("background-color: #ff6b6b;");
|
||||
} else {
|
||||
ui.frame->setStyleSheet("background-color: #ffd93c;");
|
||||
}
|
||||
ui.lb_generalState->setText(stateStr);
|
||||
}
|
||||
|
||||
bool MainWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
@@ -3363,9 +3473,16 @@ bool MainWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
if (watched == ui.sub3 || watched == ui.labelProductCnt) {
|
||||
if (m_setNumDlg) {
|
||||
m_setNumDlg->show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
if (watched == ui.fra_state || ui.lb_generalState) {
|
||||
LogInfoCtrl::instance()->emitSigShow();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+11
-1
@@ -82,6 +82,14 @@ public:
|
||||
int getCurrPrintStatus();
|
||||
|
||||
void updateSysStatusToUI(); //重载
|
||||
//Mainwindow获取机器总状态
|
||||
DevStatusLightType m_stateColor = DEV_STATUS_GREEN;
|
||||
//DEV_STATUS_GREEN:正常
|
||||
QString m_stateStr = "正常";
|
||||
bool checkRed(AlarmStatus &status);
|
||||
bool checkYellow(AlarmStatus &status);
|
||||
void updateGeneralState(AlarmStatus status);
|
||||
|
||||
|
||||
void updateTotalCnt(int en);
|
||||
int calculateMaxSpeed(int backup);
|
||||
@@ -95,7 +103,6 @@ public:
|
||||
|
||||
void RefreshStatusLight();
|
||||
bool updatePhaseIndicatorLight();
|
||||
void updateGeneralState(DevStatusLightType type, QString stateStr);
|
||||
|
||||
bool flagOfClearHighVltageWarnning;
|
||||
|
||||
@@ -151,6 +158,9 @@ private:
|
||||
void reclaimTanOpen();
|
||||
|
||||
void initSheet();
|
||||
|
||||
// 高亮切换
|
||||
void changeHighLight(bool isStart);
|
||||
private slots:
|
||||
void airPushingProcess();
|
||||
void buttonClickedSlot();
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 696 B |
+225
-3
@@ -5,6 +5,7 @@
|
||||
#include "CounterEditor.h"
|
||||
#include <QDebug>
|
||||
#include <QKeyEvent>
|
||||
#include "DlgQrcodeFormat.h"
|
||||
|
||||
// 使用SysPara的相关参数构造CounterEditorVM
|
||||
CounterEditorVM makeCounterVM(SysPara* sysPara, COUNTER_TYPE type, int digitalNum)
|
||||
@@ -53,6 +54,8 @@ BarcodeEditor::BarcodeEditor(QWidget *parent) :
|
||||
m_vm.dateViewModel = DateItemModel::createDefaultReplaceModel();
|
||||
m_dateReplaceEditor->setDateModel(m_vm.dateViewModel);
|
||||
|
||||
connect(ui->cbBoxType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BarcodeEditor::onTypeChanged);
|
||||
|
||||
connect(&m_barcodeFormatEditor, &DlgBarcodeFormat::accepted, this, &BarcodeEditor::onBarcodeFormatConfirmed);
|
||||
connect(&m_qrcodeFormatEditor, &DlgQrcodeFormat::accepted, this, &BarcodeEditor::onQrcodeFormatConfirmed);
|
||||
}
|
||||
@@ -86,6 +89,21 @@ void BarcodeEditor::bindViewModel(const BarcodeViewModel& vm)
|
||||
{
|
||||
m_vm = vm;
|
||||
|
||||
// 通用设置视图模型
|
||||
auto b = ui->widGeneralSettings->blockSignals(true);
|
||||
ui->widGeneralSettings->setViewModel(vm.generalSettingsVM);
|
||||
ui->widGeneralSettings->blockSignals(b);
|
||||
|
||||
// 内容模版
|
||||
b = ui->lineEditContent->blockSignals(true);
|
||||
ui->lineEditContent->setText(m_vm.contentPattern);
|
||||
ui->lineEditContent->blockSignals(b);
|
||||
|
||||
// 类型选择框
|
||||
b = ui->cbBoxType->blockSignals(true);
|
||||
ui->cbBoxType->setCurrentIndex(m_vm.type);
|
||||
ui->cbBoxType->blockSignals(b);
|
||||
|
||||
// 缺失的代替表用默认值补齐
|
||||
DateItemModel& dateVm = m_vm.dateViewModel;
|
||||
if (dateVm.dataMap.isEmpty() || dateVm.daysMap.isEmpty() || dateVm.monthsMap.isEmpty()
|
||||
@@ -154,8 +172,15 @@ void BarcodeEditor::bindViewModel(const BarcodeViewModel& vm)
|
||||
|
||||
BarcodeViewModel BarcodeEditor::viewModel()
|
||||
{
|
||||
m_vm.contentPattern = ui->lineEditContent->text();
|
||||
m_vm.type = (BarcodeType) (ui->cbBoxType->currentIndex());
|
||||
|
||||
// 从子编辑器拉取最新值回写到 m_vm
|
||||
|
||||
// 通用设置
|
||||
m_vm.generalSettingsVM = ui->widGeneralSettings->viewModel();
|
||||
|
||||
// 日期设置,如果存在 {t} 变量
|
||||
if(m_vm.contentPattern.contains("{t}")) {
|
||||
DateFormatEditorVM fmt = m_dateFormatEditor->viewModel();
|
||||
m_vm.dateViewModel.datetimePattern = fmt.pattern;
|
||||
@@ -182,6 +207,7 @@ BarcodeViewModel BarcodeEditor::viewModel()
|
||||
m_vm.dateViewModel.hoursMap = rep.hoursMap;
|
||||
}
|
||||
|
||||
// 计数器设置,如果存在 {c} 变量
|
||||
if(m_vm.contentPattern.contains("{c}")) {
|
||||
CounterEditorVM cnt = m_counterEditor->viewModel();
|
||||
m_vm.counterViewModel.counterType = cnt.counterType;
|
||||
@@ -191,6 +217,58 @@ BarcodeViewModel BarcodeEditor::viewModel()
|
||||
return m_vm;
|
||||
}
|
||||
|
||||
void BarcodeEditor::restoreViewModel()
|
||||
{
|
||||
m_vm.generalSettingsVM = ItemGeneralSettingsVM();
|
||||
m_vm.contentPattern = "";
|
||||
m_vm.counterViewModel = CounterViewModel();
|
||||
m_vm.dateViewModel = DateItemModel::createDefaultReplaceModel();
|
||||
m_vm.type = BARCODE_TYPE_BARCODE;
|
||||
m_vm.format.setValue(DlgBarcodeFormatVM());
|
||||
bindViewModel(m_vm);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 逻辑基本类似 CounterVarSet::applyUIPara
|
||||
*
|
||||
*/
|
||||
void BarcodeEditor::applyCounterConfigToSysPara()
|
||||
{
|
||||
if(!m_vm.contentPattern.contains("{c}"))
|
||||
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
|
||||
}
|
||||
|
||||
m_sysPara->devOp->writeFpgaCalandar(0);
|
||||
}
|
||||
|
||||
void BarcodeEditor::onBtnFormatClicked()
|
||||
{
|
||||
if(m_vm.type == BARCODE_TYPE_BARCODE) {
|
||||
@@ -228,12 +306,15 @@ void BarcodeEditor::onBtnCounterClicked()
|
||||
void BarcodeEditor::onCheckBtnClicked()
|
||||
{
|
||||
m_vm = viewModel();
|
||||
applyCounterConfigToSysPara();
|
||||
emit accepted();
|
||||
hide();
|
||||
}
|
||||
|
||||
void BarcodeEditor::onCloseBtnClicked()
|
||||
{
|
||||
emit rejected();
|
||||
hide();
|
||||
}
|
||||
|
||||
void BarcodeEditor::onBarcodeFormatConfirmed()
|
||||
@@ -256,6 +337,19 @@ void BarcodeEditor::onQrcodeFormatConfirmed()
|
||||
ui->cbBoxType->blockSignals(b);
|
||||
}
|
||||
|
||||
void BarcodeEditor::onTypeChanged(int i)
|
||||
{
|
||||
if(m_vm.type == i)
|
||||
return;
|
||||
|
||||
m_vm.type = (BarcodeType)(i);
|
||||
if(m_vm.type == BARCODE_TYPE_BARCODE) {
|
||||
m_vm.format.setValue(DlgBarcodeFormatVM());
|
||||
}
|
||||
else
|
||||
m_vm.format.setValue(DlgQrcodeFormatVM());
|
||||
}
|
||||
|
||||
bool BarcodeEditor::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if(obj == ui->lineEditContent) {
|
||||
@@ -269,9 +363,17 @@ bool BarcodeEditor::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
|
||||
// 碰到 {t} 或 {c},直接删除
|
||||
QString varText = text.mid(cursor - 3, 3);
|
||||
if(varText == "{t}" || varText == "{c}") {
|
||||
ui->lineEditContent->setText(text.remove(cursor - 3, 3));
|
||||
auto datePatternPos = text.indexOf("{t}");
|
||||
auto counterPatternPos = text.indexOf("{c}");
|
||||
if(datePatternPos >= 0 || counterPatternPos >= 0) {
|
||||
if(datePatternPos < cursor && cursor <= datePatternPos + 3) {
|
||||
ui->lineEditContent->setText(text.remove(datePatternPos, 3));
|
||||
return true;
|
||||
}
|
||||
else if(counterPatternPos < cursor && cursor <= counterPatternPos + 3) {
|
||||
ui->lineEditContent->setText(text.remove(counterPatternPos, 3));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,3 +444,123 @@ void BarcodeEditor::onContentChanged(QString content)
|
||||
|
||||
m_vm.contentPattern = content;
|
||||
}
|
||||
|
||||
void BarcodeViewModel::saveToXml(const BarcodeViewModel &vm, QXmlStreamAttributes &attrs)
|
||||
{
|
||||
attrs.append("barcodeContentPattern", vm.contentPattern);
|
||||
attrs.append("barcodeType", QString::number(int(vm.type)));
|
||||
|
||||
if(vm.type == BARCODE_TYPE_BARCODE) {
|
||||
DlgBarcodeFormatVM barcodeFormat = vm.format.value<DlgBarcodeFormatVM>();
|
||||
attrs.append("barcodeFormat", barcodeFormat.type);
|
||||
attrs.append("barcodeHeight", QString::number(barcodeFormat.height));
|
||||
attrs.append("barcodeWidth", QString::number(barcodeFormat.width));
|
||||
attrs.append("barcodeScale", QString::number(barcodeFormat.scale));
|
||||
attrs.append("barcodeInkType", QString::number(int(barcodeFormat.inkType)));
|
||||
attrs.append("barcodeTxtVisible", barcodeFormat.txtVisible ? "true" : "false");
|
||||
}
|
||||
else {
|
||||
DlgQrcodeFormatVM qrcodeFormat = vm.format.value<DlgQrcodeFormatVM>();
|
||||
attrs.append("qrcodeFormat", QString::number(qrcodeFormat.type));
|
||||
attrs.append("qrcodeSize", QString::number(qrcodeFormat.size));
|
||||
attrs.append("qrcodeLevel", QString::number(int(qrcodeFormat.level)));
|
||||
attrs.append("qrcodeInkType", QString::number(int(qrcodeFormat.inkType)));
|
||||
}
|
||||
|
||||
if(vm.contentPattern.contains("{t}")) {
|
||||
DateItemModel::saveToXml(vm.dateViewModel, attrs);
|
||||
}
|
||||
|
||||
if(vm.contentPattern.contains("{c}")) {
|
||||
attrs.append("counterType", QString::number(vm.counterViewModel.counterType));
|
||||
attrs.append("counterDigitalNum", QString::number(vm.counterViewModel.digitalNum));
|
||||
}
|
||||
}
|
||||
|
||||
BarcodeViewModel BarcodeViewModel::loadFromXml(const QXmlStreamAttributes &attrs)
|
||||
{
|
||||
BarcodeViewModel vm;
|
||||
vm.contentPattern = attrs.value("barcodeContentPattern").toString();
|
||||
vm.type = static_cast<BarcodeType>(attrs.value("barcodeType").toInt());
|
||||
if(vm.type == BARCODE_TYPE_BARCODE) {
|
||||
DlgBarcodeFormatVM barcodeFormat;
|
||||
barcodeFormat.type = attrs.value("barcodeFormat").toString();
|
||||
barcodeFormat.height = attrs.value("barcodeHeight").toInt();
|
||||
barcodeFormat.width = attrs.value("barcodeWidth").toInt();
|
||||
barcodeFormat.scale = attrs.value("barcodeScale").toInt();
|
||||
barcodeFormat.inkType = static_cast<InkType>(attrs.value("barcodeInkType").toInt());
|
||||
barcodeFormat.txtVisible = attrs.value("barcodeTxtVisible").toString() == "true";
|
||||
vm.format.setValue(barcodeFormat);
|
||||
}
|
||||
else {
|
||||
DlgQrcodeFormatVM qrcodeFormat;
|
||||
qrcodeFormat.type = static_cast<QRCodeType>(attrs.value("qrcodeFormat").toInt());
|
||||
qrcodeFormat.size = static_cast<QRCodeSize>(attrs.value("qrcodeSize").toInt());
|
||||
qrcodeFormat.level = static_cast<QRCodeLevel>(attrs.value("qrcodeLevel").toInt());
|
||||
qrcodeFormat.inkType = static_cast<InkType>(attrs.value("qrcodeInkType").toInt());
|
||||
vm.format.setValue(qrcodeFormat);
|
||||
}
|
||||
|
||||
if(vm.contentPattern.contains("{t}")) {
|
||||
DateItemModel::loadFromXml(vm.dateViewModel, attrs);
|
||||
}
|
||||
|
||||
if(vm.contentPattern.contains("{c}")) {
|
||||
vm.counterViewModel.counterType = static_cast<COUNTER_TYPE>(attrs.value("counterType").toInt());
|
||||
vm.counterViewModel.digitalNum = attrs.value("counterDigitalNum").toInt();
|
||||
}
|
||||
|
||||
return vm;
|
||||
}
|
||||
|
||||
|
||||
QString BarcodeViewModel::toString(const BarcodeViewModel &vm)
|
||||
{
|
||||
QString str;
|
||||
str += QString("type: %1\r\n").arg(int(vm.type));
|
||||
str += QString("contentPattern: \"%1\"\r\n").arg(vm.contentPattern);
|
||||
|
||||
// counterViewModel
|
||||
str += QString("counterViewModel: \r\n");
|
||||
str += QString("\t counter type: %1\r\n").arg(vm.counterViewModel.counterType);
|
||||
str += QString("\t digital number: %1\r\n").arg(vm.counterViewModel.digitalNum);
|
||||
str += QString("\t letter space: %1\r\n").arg(vm.counterViewModel.letterSpace);
|
||||
|
||||
// dateViewModel
|
||||
str += QString("dateViewModel: \r\n");
|
||||
str += QString("\t pattern: \"%1\"\r\n").arg(vm.dateViewModel.datetimePattern);
|
||||
|
||||
int expirationValue = 0;
|
||||
int expirationType = 0;
|
||||
if(vm.dateViewModel.daysOffset > 0) {
|
||||
expirationValue = vm.dateViewModel.daysOffset;
|
||||
expirationType = EXPIRATION_TYPE_DAY;
|
||||
}
|
||||
else if(vm.dateViewModel.monthsOffset > 0) {
|
||||
expirationValue = vm.dateViewModel.monthsOffset;
|
||||
expirationType = EXPIRATION_TYPE_MONTH;
|
||||
}
|
||||
str += QString("\t expirationValue: %1\r\n").arg(expirationValue);
|
||||
str += QString("\t expirationType: %1\r\n").arg(expirationType);
|
||||
|
||||
// format
|
||||
str += QString("format: \n");
|
||||
if(vm.type == BARCODE_TYPE_BARCODE) {
|
||||
DlgBarcodeFormatVM barcodeFormat = vm.format.value<DlgBarcodeFormatVM>();
|
||||
str += QString("\t type: \"%1\"\r\n").arg(barcodeFormat.type);
|
||||
str += QString("\t height: %1\r\n").arg(barcodeFormat.height);
|
||||
str += QString("\t width: %1\r\n").arg(barcodeFormat.width);
|
||||
str += QString("\t scale: %1\r\n").arg(barcodeFormat.scale);
|
||||
str += QString("\t inkType: %1\r\n").arg(int(barcodeFormat.inkType));
|
||||
str += QString("\t txtVisible: %1\r\n").arg(barcodeFormat.txtVisible ? "true" : "false");
|
||||
}
|
||||
else {
|
||||
DlgQrcodeFormatVM qrcodeFormat = vm.format.value<DlgQrcodeFormatVM>();
|
||||
str += QString("\t type: %1\r\n").arg(int(qrcodeFormat.type));
|
||||
str += QString("\t size: %1\r\n").arg(int(qrcodeFormat.size));
|
||||
str += QString("\t level: %1\r\n").arg(int(qrcodeFormat.level));
|
||||
str += QString("\t inkType: %1\r\n").arg(int(qrcodeFormat.inkType));
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
+58
-5
@@ -8,6 +8,7 @@
|
||||
#include "dlgQrcodeFormat.h"
|
||||
#include "DlgBarcodeFormat.h"
|
||||
#include <QVariant>
|
||||
#include "ItemGeneralSettings.h"
|
||||
|
||||
class DateFormatEditor;
|
||||
class DateReplaceEditor;
|
||||
@@ -25,11 +26,57 @@ enum BarcodeType {
|
||||
* 仅当 contentPattern 含有相应变量时,counterViewModel / dateViewModel 字段才有意义。
|
||||
*/
|
||||
struct BarcodeViewModel {
|
||||
QString contentPattern; // 条形码内容模版,例如 "ABC{t}{c1}"
|
||||
CounterViewModel counterViewModel; // 计数器视图模型
|
||||
DateItemModel dateViewModel; // 日期视图模型
|
||||
BarcodeType type = BARCODE_TYPE_BARCODE;
|
||||
QVariant format;
|
||||
ItemGeneralSettingsVM generalSettingsVM; // 通用设置视图模型
|
||||
QString contentPattern; // 条形码内容模版,例如 "ABC{t}{c1}"
|
||||
CounterViewModel counterViewModel; // 计数器视图模型
|
||||
DateItemModel dateViewModel; // 日期视图模型
|
||||
BarcodeType type = BARCODE_TYPE_BARCODE; // 条形码 或 二维码
|
||||
QVariant format; // 条形码/二维码 格式设置,如果是条形码,则实际类型为 DlgBarcodeFormatVM,如果是二维码,则实际类型为 DlgQrcodeFormatVM
|
||||
|
||||
std::function<QImage()> imageGenerator; // 条形码/二维码 图片生成函数
|
||||
|
||||
/**
|
||||
* @brief 将vm保存到xml属性集
|
||||
*
|
||||
* @param vm 条码视图模型
|
||||
* @param attrs xml属性集
|
||||
*/
|
||||
static void saveToXml(const BarcodeViewModel& vm, QXmlStreamAttributes& attrs);
|
||||
|
||||
/**
|
||||
* @brief 从xml属性集加载条码视图模型
|
||||
*
|
||||
* @param attrs xml属性集
|
||||
* @return BarcodeViewModel 条码视图模型
|
||||
*/
|
||||
static BarcodeViewModel loadFromXml(const QXmlStreamAttributes& attrs);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param vm 条码视图模型
|
||||
* @return QString 字符串表示
|
||||
*
|
||||
* @example
|
||||
* type: 0
|
||||
* contentPattern: ABC{t}{c1}
|
||||
* counterViewModel:
|
||||
* \t counter type: 7
|
||||
* \t digital number: 2
|
||||
* \t letter space: 2
|
||||
* dateViewModel:
|
||||
* \t pattern: "yyyy-MM-dd HH:mm:ss"
|
||||
* \t expirationValue: 0
|
||||
* \t expirationType: 0
|
||||
* format:
|
||||
* \t type: "BARCODE_128"
|
||||
* \t height: 9
|
||||
* \t width: 36
|
||||
* \t scale: 1
|
||||
* \t inkType: 0
|
||||
* \t txtVisible: false
|
||||
*/
|
||||
static QString toString(const BarcodeViewModel& vm);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(BarcodeViewModel);
|
||||
@@ -75,6 +122,10 @@ public:
|
||||
*/
|
||||
BarcodeViewModel viewModel();
|
||||
|
||||
void restoreViewModel();
|
||||
|
||||
void applyCounterConfigToSysPara();
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
@@ -126,6 +177,8 @@ private slots:
|
||||
*/
|
||||
void onQrcodeFormatConfirmed();
|
||||
|
||||
void onTypeChanged(int i);
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
|
||||
+20
-2
@@ -126,9 +126,15 @@ QSpinBox::down-arrow {
|
||||
<x>520</x>
|
||||
<y>540</y>
|
||||
<width>101</width>
|
||||
<height>50</height>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>✓</string>
|
||||
</property>
|
||||
@@ -139,9 +145,21 @@ QSpinBox::down-arrow {
|
||||
<x>640</x>
|
||||
<y>540</y>
|
||||
<width>101</width>
|
||||
<height>50</height>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>✕</string>
|
||||
</property>
|
||||
|
||||
@@ -257,15 +257,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>BarCodeType</tabstop>
|
||||
<tabstop>comboBoxInkColor</tabstop>
|
||||
<tabstop>BarCodeHeigh</tabstop>
|
||||
<tabstop>BarCodeDot</tabstop>
|
||||
<tabstop>BarCodeScale</tabstop>
|
||||
<tabstop>checkBoxAddText</tabstop>
|
||||
<tabstop>checkBtn</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
@@ -280,7 +271,7 @@
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>417</x>
|
||||
<y>379</y>
|
||||
<y>460</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
||||
@@ -6,6 +6,7 @@ DlgQrcodeFormat::DlgQrcodeFormat(QWidget *parent) :
|
||||
ui(new Ui::DlgQrcodeFormat)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setViewModel(m_vm);
|
||||
}
|
||||
|
||||
DlgQrcodeFormat::~DlgQrcodeFormat()
|
||||
|
||||
@@ -31,7 +31,7 @@ enum QRCodeSize {
|
||||
};
|
||||
|
||||
struct DlgQrcodeFormatVM {
|
||||
QRCodeType type = QR_CODE_TYPE_DATA_MATRIX;
|
||||
QRCodeType type = QR_CODE_TYPE_QRCODE;
|
||||
QRCodeLevel level = QR_CODE_LEVEL_L;
|
||||
QRCodeSize size = QR_CODE_SIZE_DEFAULT;
|
||||
InkType inkType = INK_TYPE_BLACK;
|
||||
|
||||
+452
-2
@@ -1,4 +1,312 @@
|
||||
#include "ItemCommon.h"
|
||||
#include "DlgQrcodeFormat.h"
|
||||
#include "DlgBarcodeFormat.h"
|
||||
#include <QtQREnCode/qrencode.h>
|
||||
#include "Matrix/dm200.h"
|
||||
#include "BarCode/barcode.h"
|
||||
#include <QPainter>
|
||||
#include <cstring>
|
||||
|
||||
/**
|
||||
* @brief 将libqrencode的QRcode结构渲染成QImage
|
||||
*
|
||||
* 避免依赖文件系统或PostScript输出,直接在内存中生成可用于UI显示或打印的图像。
|
||||
* 使用2D像素数组而非向量,支持任意缩放因子。
|
||||
*/
|
||||
static QImage renderQRCode(const QRcode *qrcode, int moduleSize = 4, QRgb foreground = 0xff000000, QRgb background = 0xffffffff)
|
||||
{
|
||||
if (!qrcode || qrcode->width <= 0) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
int margin = 1;
|
||||
int imageSize = (qrcode->width + margin * 2) * moduleSize;
|
||||
QImage image(imageSize, imageSize, QImage::Format_ARGB32);
|
||||
image.fill(background);
|
||||
|
||||
const unsigned char *data = qrcode->data;
|
||||
for (int y = 0; y < qrcode->width; ++y) {
|
||||
for (int x = 0; x < qrcode->width; ++x) {
|
||||
bool moduleOn = (data[y * qrcode->width + x] & 0x01) != 0;
|
||||
QRgb color = moduleOn ? foreground : background;
|
||||
int px = (margin + x) * moduleSize;
|
||||
int py = (margin + y) * moduleSize;
|
||||
for (int dy = 0; dy < moduleSize; ++dy) {
|
||||
for (int dx = 0; dx < moduleSize; ++dx) {
|
||||
image.setPixel(px + dx, py + dy, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 将DataMatrix位图网格渲染成QImage
|
||||
*
|
||||
* iec16022ecc200返回原始位数组,需转换为可视化图像以供UI或打印使用。
|
||||
* 与renderQRCode采用相同的像素化策略,确保两种编码方式的输出一致性。
|
||||
*/
|
||||
static QImage renderDataMatrix(const unsigned char *grid, int cols, int rows, int moduleSize = 1, QRgb foreground = 0xff000000, QRgb background = 0xffffffff)
|
||||
{
|
||||
if (!grid || cols <= 0 || rows <= 0) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
int width = cols * moduleSize;
|
||||
int height = rows * moduleSize;
|
||||
QImage image(width, height, QImage::Format_ARGB32);
|
||||
image.fill(background);
|
||||
|
||||
for (int y = 0; y < rows; ++y) {
|
||||
for (int x = 0; x < cols; ++x) {
|
||||
bool bit = (grid[y * cols + x] & 0x01) != 0;
|
||||
QRgb color = bit ? foreground : background;
|
||||
int px = x * moduleSize;
|
||||
int py = y * moduleSize;
|
||||
for (int dy = 0; dy < moduleSize; ++dy) {
|
||||
for (int dx = 0; dx < moduleSize; ++dx) {
|
||||
image.setPixel(px + dx, py + dy, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static QRecLevel qrCodeLevelFromEnum(QRCodeLevel level)
|
||||
{
|
||||
switch (level) {
|
||||
case QR_CODE_LEVEL_M: return QR_ECLEVEL_M;
|
||||
case QR_CODE_LEVEL_Q: return QR_ECLEVEL_Q;
|
||||
case QR_CODE_LEVEL_H: return QR_ECLEVEL_H;
|
||||
default: return QR_ECLEVEL_L;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 根据格式配置生成二维码或DataMatrix图像
|
||||
*
|
||||
* 支持两种编码方式:
|
||||
* - DataMatrix:适合小容量数据和有限空间环境(如工业标签)
|
||||
* - QR Code:高容量、高可靠性,广泛应用于商业和物流
|
||||
*
|
||||
* 直接在内存中渲染,避免对dlgQrCode或外部库的依赖。
|
||||
* 颜色反转机制(INK_TYPE_WHITE)用于支持黑底白码的特殊打印场景。
|
||||
*/
|
||||
static QImage generateQRCodeImage(const QString &content, const DlgQrcodeFormatVM &vm)
|
||||
{
|
||||
if (content.isEmpty()) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QRecLevel level = qrCodeLevelFromEnum(vm.level);
|
||||
|
||||
// 适配黑底白码场景(逆色):打印机某些模式下需要反转前景/背景色
|
||||
QRgb foreground = vm.inkType == INK_TYPE_WHITE ? 0x00ffffff : 0xff000000;
|
||||
QRgb background = vm.inkType == INK_TYPE_WHITE ? 0xff000000 : 0x00ffffff;
|
||||
|
||||
QByteArray bytes = content.toUtf8();
|
||||
|
||||
// DataMatrix:调用者指定尺寸约束(sizeType),库返回实际分配的网格
|
||||
if (vm.type == QR_CODE_TYPE_DATA_MATRIX) {
|
||||
short cols = 0;
|
||||
short rows = 0;
|
||||
short sizeType = static_cast<short>(vm.size);
|
||||
// iec16022ecc200会根据sizeType调整输出尺寸,支持灵活的条码宽高比
|
||||
unsigned char *grid = iec16022ecc200(&cols, &rows, reinterpret_cast<unsigned char *>(bytes.data()), &sizeType);
|
||||
if (!grid || cols <= 0 || rows <= 0) {
|
||||
if (grid) {
|
||||
free(grid);
|
||||
}
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QImage image = renderDataMatrix(grid, cols, rows, 1, foreground, background);
|
||||
free(grid);
|
||||
return image;
|
||||
}
|
||||
|
||||
// QR Code:版本0表示自动选择版本(1-40),确保内容总是被编码
|
||||
QRcode *qrcode = QRcode_encodeString(bytes.constData(), 0, level, QR_MODE_8, 1);
|
||||
if (!qrcode) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QImage image = renderQRCode(qrcode, 1, foreground, background);
|
||||
QRcode_free(qrcode);
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 将Barcode_Item的编码数据(partial)渲染成QImage
|
||||
*
|
||||
* partial字段存储压缩的条形码宽度数据(高4位=空白宽度,低3位=黑条宽度),
|
||||
* 需展开为像素数组。barWidth参数控制每个模块的物理宽度(用于放大)。
|
||||
*
|
||||
* 这种直接渲染方式避免了PostScript生成和文件I/O的开销。
|
||||
*/
|
||||
static QImage renderBarcodeImage(const Barcode_Item *bc, int barHeight = 12, int barWidth = 1, QRgb foreground = 0xff000000, QRgb background = 0xffffffff)
|
||||
{
|
||||
if (!bc || !bc->partial) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
// 约束:barHeight和barWidth必须为正值。默认值支持小尺寸标签的视觉清晰度
|
||||
if (barHeight <= 0) {
|
||||
barHeight = 12;
|
||||
}
|
||||
if (barWidth <= 0) {
|
||||
barWidth = 1;
|
||||
}
|
||||
|
||||
// xoffset=8提供左边距(4像素),用于对齐打印布局和改善美观度
|
||||
int xoffset = 8;
|
||||
int len = static_cast<int>(strlen(bc->partial));
|
||||
// 计算条形码总宽度:每字节的低4位表示条纹宽度单位数之和
|
||||
int bcWidth1 = 0;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
bcWidth1 += (bc->partial[i] & 0x0f);
|
||||
}
|
||||
// 最终宽度 = 左边距 + 条纹单位总数 * 每单位像素数
|
||||
int imageWidth = (xoffset >> 1) + bcWidth1 * barWidth;
|
||||
if (imageWidth <= 0 || barHeight <= 0) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QImage image(imageWidth, barHeight, QImage::Format_ARGB32);
|
||||
image.fill(background);
|
||||
|
||||
for (int y = 0; y < barHeight; ++y) {
|
||||
int xpos = xoffset >> 1;
|
||||
for (int n = 0; n < len; ++n) {
|
||||
// partial数据编码方案:奇数索引=黑条,偶数索引=空白
|
||||
// 低3位存储实际宽度,需乘以barWidth得到像素宽度
|
||||
int run = (bc->partial[n] & 0x07) * barWidth;
|
||||
if (n & 1) {
|
||||
// 奇数索引:绘制黑条(前景色)
|
||||
for (int k = 0; k < run; ++k) {
|
||||
if (xpos >= 0 && xpos < imageWidth) {
|
||||
image.setPixel(xpos, y, foreground);
|
||||
}
|
||||
++xpos;
|
||||
}
|
||||
} else {
|
||||
// 偶数索引:跳过空白区域(已由背景色填充)
|
||||
xpos += run;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static int barcodeTypeFromString(const QString &type)
|
||||
{
|
||||
QString t = type.trimmed().toUpper();
|
||||
if (t == "BARCODE_128") return BARCODE_128;
|
||||
if (t == "BARCODE_93") return BARCODE_93;
|
||||
if (t == "BARCODE_ISBN") return BARCODE_ISBN;
|
||||
if (t == "BARCODE_EAN") return BARCODE_EAN;
|
||||
if (t == "BARCODE_UPC") return BARCODE_UPC;
|
||||
if (t == "BARCODE_39") return BARCODE_39;
|
||||
if (t == "BARCODE_CBR") return BARCODE_CBR;
|
||||
if (t == "BARCODE_PLS") return BARCODE_PLS;
|
||||
if (t == "BARCODE_MSI") return BARCODE_MSI;
|
||||
return BARCODE_128;
|
||||
}
|
||||
|
||||
static QString barcodeTypeNameFromIndex(int index)
|
||||
{
|
||||
switch (index) {
|
||||
case 0: return QLatin1String("BARCODE_128");
|
||||
case 1: return QLatin1String("BARCODE_93");
|
||||
case 2: return QLatin1String("BARCODE_ISBN");
|
||||
case 3: return QLatin1String("BARCODE_EAN");
|
||||
case 4: return QLatin1String("BARCODE_UPC");
|
||||
case 5: return QLatin1String("BARCODE_39");
|
||||
case 6: return QLatin1String("BARCODE_CBR");
|
||||
case 7: return QLatin1String("BARCODE_PLS");
|
||||
case 8: return QLatin1String("BARCODE_MSI");
|
||||
default: return QLatin1String("BARCODE_128");
|
||||
}
|
||||
}
|
||||
|
||||
static QImage generateQRCodeImage(const QString &content, int qrType)
|
||||
{
|
||||
DlgQrcodeFormatVM vm;
|
||||
vm.type = qrType == 0 ? QR_CODE_TYPE_DATA_MATRIX : QR_CODE_TYPE_QRCODE;
|
||||
return generateQRCodeImage(content, vm);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 根据格式配置生成条形码图像
|
||||
*
|
||||
* 支持多种条形码标准(128、93、EAN等),直接渲染到QImage,无需文件操作。
|
||||
* 避免对QBarCode类的依赖,实现自包含的编码流程。
|
||||
*/
|
||||
static QImage generateBarCodeImage(const QString &content, const DlgBarcodeFormatVM &vm)
|
||||
{
|
||||
if (content.isEmpty()) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
// UTF-8编码确保国际字符被正确处理,与打印驱动兼容
|
||||
QByteArray bytes = content.toUtf8();
|
||||
|
||||
// Barcode_Create内部用strdup复制字符串,无需手动生命周期管理
|
||||
struct Barcode_Item *bc = Barcode_Create(bytes.data());
|
||||
if (!bc) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
int encodingFlag = barcodeTypeFromString(vm.type);
|
||||
|
||||
// BARCODE_OUT_PS: 预期PostScript格式输出(internal flag),BARCODE_OUT_NOHEADERS: 不生成PS头
|
||||
int flags = encodingFlag | BARCODE_OUT_PS | BARCODE_OUT_NOHEADERS;
|
||||
|
||||
// 传递缩放倍数到库,影响条纹宽度和字体大小的计算(510/60为库内部单位转换)
|
||||
int width = qMax(1, vm.scale) * 510;
|
||||
int height = qMax(1, vm.scale) * 60;
|
||||
|
||||
if (Barcode_Position(bc, width, height, 0, 0, 0.0) < 0 || Barcode_Encode(bc, flags) < 0) {
|
||||
Barcode_Delete(bc);
|
||||
return QImage();
|
||||
}
|
||||
|
||||
// 黑底白码支持(INK_TYPE_WHITE表示反向模式)
|
||||
QRgb foreground = vm.inkType == INK_TYPE_WHITE ? 0x00ffffff : 0xff000000;
|
||||
QRgb background = vm.inkType == INK_TYPE_WHITE ? 0xff000000 : 0x00ffffff;
|
||||
QImage image = renderBarcodeImage(bc, vm.height, vm.width, foreground, background);
|
||||
Barcode_Delete(bc);
|
||||
|
||||
// 可选文本叠加:某些应用场景(如物流标签)需要条码旁显示人类可读的内容
|
||||
if (vm.txtVisible) {
|
||||
QPainter painter(&image);
|
||||
painter.setPen(foreground);
|
||||
QFont font = painter.font();
|
||||
// 字体大小自适应:防止文本溢出图像,同时保持可读性
|
||||
font.setPixelSize(qMin(12, image.height()));
|
||||
painter.setFont(font);
|
||||
painter.drawText(image.rect().adjusted(1, 1, -1, -1), Qt::AlignBottom | Qt::AlignHCenter, content);
|
||||
}
|
||||
|
||||
// 最终放大:scale>1时对整个图像进行像素放大(用于低DPI打印环保模式)
|
||||
if (vm.scale > 1) {
|
||||
image = image.scaled(image.width() * vm.scale, image.height() * vm.scale, Qt::KeepAspectRatio, Qt::FastTransformation);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static QImage generateBarCodeImage(const QString &content, int barCodeType)
|
||||
{
|
||||
DlgBarcodeFormatVM vm;
|
||||
vm.type = barcodeTypeNameFromIndex(barCodeType);
|
||||
return generateBarCodeImage(content, vm);
|
||||
}
|
||||
|
||||
QString generateTxtFromDateItemModel(const DateItemModel &model, const QDateTime &time)
|
||||
{
|
||||
@@ -87,12 +395,154 @@ QString generateTxtFromBarcodeViewModel(const BarcodeViewModel &vm, const std::a
|
||||
}
|
||||
|
||||
pos = vm.contentPattern.indexOf("{c}");
|
||||
if(pos != 1) {
|
||||
if(pos != -1) {
|
||||
auto cntValue = vm.counterViewModel.counterType == COUNTER_TYPE_1 ? counterValues[0] : counterValues[1];
|
||||
auto valueStr = QString("%1").arg(cntValue, 10, QChar('0'));;
|
||||
valueStr.right(vm.counterViewModel.digitalNum);
|
||||
valueStr = valueStr.right(vm.counterViewModel.digitalNum);
|
||||
txt.replace(pos, 3, valueStr);
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 统一的条码/二维码生成入口
|
||||
*
|
||||
* @details
|
||||
* 目的:将二维码和条形码编码逻辑独立出来,避免对UI对话框类(dlgQrCode、QBarCode)的依赖,
|
||||
* 实现在数据层直接进行编码,支持后端打印任务、异步处理等场景。
|
||||
*
|
||||
* 多态format参数设计的理由:
|
||||
* - 支持便利调用(int):向后兼容现有代码路径,使用库默认配置
|
||||
* - 支持细粒度控制(DlgQrcodeFormatVM/DlgBarcodeFormatVM):UI配置直通生成函数
|
||||
* - 避免序列化开销:QVariant作为类型安全的通用容器
|
||||
*
|
||||
* @param content 已格式化的文本内容(由调用者负责模板替换如{t}、{c})
|
||||
* @param type 条码类型(BARCODE_TYPE_QRCODE 或 BARCODE_TYPE_BARCODE)
|
||||
* @param format 配置参数容器,支持以下类型:
|
||||
* - BARCODE_TYPE_QRCODE: DlgQrcodeFormatVM(完整配置)或 int(0=DataMatrix, 1=QRCode,使用默认值)
|
||||
* - BARCODE_TYPE_BARCODE: DlgBarcodeFormatVM(完整配置)或 int(条形码类型索引,使用默认值)
|
||||
* @return QImage 生成的图像;失败返回空QImage
|
||||
*/
|
||||
QImage generateBarcodeImage(const QString &content, BarcodeType type, const QVariant &format)
|
||||
{
|
||||
if (content.isEmpty()) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
if (type == BARCODE_TYPE_QRCODE) {
|
||||
// 优先级:完整VM配置 > 简化int配置 > 默认配置
|
||||
// 原因:支持从UI直接传递结构体,同时保留向后兼容的快速路径
|
||||
if (format.canConvert<DlgQrcodeFormatVM>()) {
|
||||
DlgQrcodeFormatVM vm = format.value<DlgQrcodeFormatVM>();
|
||||
return generateQRCodeImage(content, vm);
|
||||
}
|
||||
if (format.isValid() && format.canConvert<int>()) {
|
||||
return generateQRCodeImage(content, format.toInt());
|
||||
}
|
||||
return generateQRCodeImage(content, static_cast<int>(QR_CODE_TYPE_QRCODE));
|
||||
}
|
||||
|
||||
if (type == BARCODE_TYPE_BARCODE) {
|
||||
if (format.canConvert<DlgBarcodeFormatVM>()) {
|
||||
DlgBarcodeFormatVM vm = format.value<DlgBarcodeFormatVM>();
|
||||
return generateBarCodeImage(content, vm);
|
||||
}
|
||||
if (format.isValid() && format.canConvert<int>()) {
|
||||
return generateBarCodeImage(content, format.toInt());
|
||||
}
|
||||
return generateBarCodeImage(content, DlgBarcodeFormatVM());
|
||||
}
|
||||
|
||||
return QImage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 将 QImage 中所有等于 bg 的边缘像素裁掉,仅保留有效内容的最小外接矩形
|
||||
*
|
||||
* 复刻自 PicTextItem 的 clipImage:用四个方向扫描确定 left/top/right/bottom 边界,
|
||||
* 然后调用 QImage::copy 输出裁剪后的图像。这样字符串如 "aaa" 不会保留 "j" 才会用到的下行空白,
|
||||
* 节省后续打印或合成时的画布空间。
|
||||
*/
|
||||
static QImage clipTxtImage(const QImage &img, QRgb bg)
|
||||
{
|
||||
if (img.isNull()) {
|
||||
return img;
|
||||
}
|
||||
|
||||
QRect clipRect;
|
||||
for (int x = 0; x < img.width(); ++x) {
|
||||
for (int y = 0; y < img.height(); ++y) {
|
||||
if (img.pixel(x, y) != bg) {
|
||||
clipRect.setLeft(x);
|
||||
goto top;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 整张图都是背景色,直接返回原图(无可裁剪内容)
|
||||
return img;
|
||||
|
||||
top:
|
||||
for (int y = 0; y < img.height(); ++y) {
|
||||
for (int x = 0; x < img.width(); ++x) {
|
||||
if (img.pixel(x, y) != bg) {
|
||||
clipRect.setTop(y);
|
||||
goto right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
right:
|
||||
for (int x = img.width() - 1; x >= 0; --x) {
|
||||
for (int y = 0; y < img.height(); ++y) {
|
||||
if (img.pixel(x, y) != bg) {
|
||||
clipRect.setRight(x + 1);
|
||||
goto bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bottom:
|
||||
for (int y = img.height() - 1; y >= 0; --y) {
|
||||
for (int x = 0; x < img.width(); ++x) {
|
||||
if (img.pixel(x, y) != bg) {
|
||||
clipRect.setBottom(y + 1);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return img.copy(clipRect);
|
||||
}
|
||||
|
||||
QImage txtToImage(const QString &txt, const QFont &font, const QColor &fgColor, const QColor &bgColor)
|
||||
{
|
||||
if (txt.isEmpty()) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
// 用 QFontMetrics 计算给定字体下文本的水平推进宽度和单行高度,
|
||||
// 这样初始画布刚好能容纳整段文本,避免后续裁剪时出现截断
|
||||
QFontMetrics fm(font);
|
||||
int width = fm.horizontalAdvance(txt);
|
||||
int height = fm.height();
|
||||
if (width <= 0 || height <= 0) {
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QImage img(width, height, QImage::Format_ARGB32);
|
||||
|
||||
QRgb bgRgb = bgColor.rgba();
|
||||
img.fill(bgRgb);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&img);
|
||||
painter.setFont(font);
|
||||
painter.setPen(fgColor);
|
||||
painter.drawText(img.rect(), txt);
|
||||
painter.end();
|
||||
|
||||
// 按背景色裁剪,使输出图像紧贴文字像素的最小包围盒(详见函数注释)
|
||||
return clipTxtImage(img, bgRgb);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,26 @@
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include "BarcodeEditor.h"
|
||||
#include <array>
|
||||
#include <QImage>
|
||||
|
||||
/**
|
||||
* @brief 根据日期视图模型和时间生成字符串
|
||||
* @param model 包含日期格式模版和相关配置的视图模型
|
||||
* @param time 用于生成字符串的时间
|
||||
* @return QString 生成的字符串
|
||||
* @remark
|
||||
* 该函数根据 model.datetimePattern 中的格式模版生成字符串,支持以下格式:
|
||||
* - yyyy: 四位数年份,支持替换为自定义字符串(通过 model.yearsMap)
|
||||
* - YY: 两位数年份
|
||||
* - MM: 两位数月份,支持替换为自定义字符串(通过 model.monthsMap)
|
||||
* - dd: 两位数日期,支持替换为自定义字符串(通过 model.daysMap)
|
||||
* - HH: 两位数小时,支持替换为自定义字符串(通过 model.hoursMap)
|
||||
* - mm: 两位数分钟
|
||||
* - ss: 两位数秒钟
|
||||
* - w: 星期几,支持替换为自定义字符串(通过 model.weeksMap)
|
||||
* - c: 年中周数
|
||||
*/
|
||||
QString generateTxtFromDateItemModel(const DateItemModel& model, const QDateTime& time);
|
||||
|
||||
/**
|
||||
@@ -28,4 +47,30 @@ QString generateTxtFromDateItemModel(const DateItemModel& model, const QDateTime
|
||||
*/
|
||||
QString generateTxtFromBarcodeViewModel(const BarcodeViewModel& vm, const std::array<int, 2> counterValues, const QDateTime& time);
|
||||
|
||||
/**
|
||||
* @brief 根据条形码类型和内容生成条形码或二维码图像
|
||||
* @param content 已格式化的文本内容
|
||||
* @param type 条码类型
|
||||
* @param format 配置参数
|
||||
* @return QImage 生成的图像;如果失败返回空图像
|
||||
* @note
|
||||
* format 参数类型:
|
||||
* - BARCODE_TYPE_QRCODE: DlgQrcodeFormatVM 或 int
|
||||
* - BARCODE_TYPE_BARCODE: DlgBarcodeFormatVM 或 int
|
||||
* 如果 format 是 int 类型, 对于 QR Code,0 表示 Data Matrix,1 表示 QR Code;对于条形码,int 值对应 DlgBarcodeFormatVM 中 type 的索引。
|
||||
* 如果 format 是 int 类型,则使用默认配置并根据 int 值选择二维码或条形码的子类型;如果 format 是对应的 VM 类型,则使用其中的详细配置。
|
||||
*/
|
||||
QImage generateBarcodeImage(const QString& content, BarcodeType type, const QVariant& format);
|
||||
|
||||
/**
|
||||
* @brief 将文本转换为图像
|
||||
* @param txt 要转换的文本
|
||||
* @param font 文本使用的字体
|
||||
* @param fgColor 文本颜色,默认为黑色
|
||||
* @param bgColor 背景颜色,默认为白色
|
||||
* @return QImage 转换后的图像
|
||||
* @note 返回的字符串图像会裁剪至最小边界以节省空间。例如字符串"aaa"的高度会比"bbbjjj"小,因为前者没有上下行部分。
|
||||
*/
|
||||
QImage txtToImage(const QString& txt, const QFont& font, const QColor& fgColor = Qt::black, const QColor& bgColor = Qt::white);
|
||||
|
||||
#endif // _ITEM_COMMON_H_
|
||||
+111
-47
@@ -18,6 +18,14 @@ ItemGeneralSettings::ItemGeneralSettings(QWidget *parent) :
|
||||
|
||||
connect(&m_directionButtonGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),
|
||||
this, &ItemGeneralSettings::ondirectionChanged);
|
||||
connect(ui->boldSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &ItemGeneralSettings::onBoldSpinBoxValueChanged);
|
||||
connect(ui->txtSpanSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &ItemGeneralSettings::onLetterSpaceSpinBoxChanged);
|
||||
connect(ui->invertCheckBox, &QCheckBox::stateChanged,
|
||||
this, [this](int state) { onColorReversalCheckBoxChecked(state == Qt::Checked); });
|
||||
|
||||
initUI();
|
||||
}
|
||||
|
||||
ItemGeneralSettings::~ItemGeneralSettings()
|
||||
@@ -28,35 +36,51 @@ ItemGeneralSettings::~ItemGeneralSettings()
|
||||
void ItemGeneralSettings::edit(PicTextItem *item)
|
||||
{
|
||||
m_currItem = item;
|
||||
if(!m_currItem) {
|
||||
ui->boldSpinBox->setValue(ui->boldSpinBox->minimum());
|
||||
ui->txtSpanSpinBox->setValue(ui->txtSpanSpinBox->minimum());
|
||||
ui->normalRBtn->setChecked(true);
|
||||
ui->invertCheckBox->setChecked(false);
|
||||
ui->previewWidget->setImg(QImage());
|
||||
return;
|
||||
|
||||
// 从item快照创建ViewModel(如果item为空,使用默认值)
|
||||
setViewModel(ItemGeneralSettingsVM::fromItem(item));
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::initUI()
|
||||
{
|
||||
ui->densitySpinBox->setValue(0);
|
||||
ui->invertCheckBox->setChecked(false);
|
||||
ui->alternateCheckBox->setChecked(false);
|
||||
ui->boldSpinBox->setValue(0);
|
||||
ui->txtSpanSpinBox->setValue(0);
|
||||
ui->normalRBtn->setChecked(true);
|
||||
ui->applyCounterCheckBox->setChecked(false);
|
||||
ui->counterIDSpinBox->setValue(0);
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::setViewModel(const ItemGeneralSettingsVM &vm)
|
||||
{
|
||||
m_vmSnapshot = vm;
|
||||
m_vm = vm;
|
||||
|
||||
// 阻止信号以避免重复回调
|
||||
auto blockBold = ui->boldSpinBox->blockSignals(true);
|
||||
auto blockSpan = ui->txtSpanSpinBox->blockSignals(true);
|
||||
auto blockInvert = ui->invertCheckBox->blockSignals(true);
|
||||
|
||||
// 根据m_vm更新UI显示
|
||||
ui->boldSpinBox->setValue(m_vm.boldMultiple);
|
||||
ui->txtSpanSpinBox->setValue(m_vm.letterSpace);
|
||||
|
||||
auto dirBtn = m_directionButtonGroup.button(m_vm.direction);
|
||||
if (dirBtn) {
|
||||
dirBtn->setChecked(true);
|
||||
}
|
||||
|
||||
auto b = ui->boldSpinBox->blockSignals(true);
|
||||
ui->boldSpinBox->setValue(item->boldMultiple());
|
||||
ui->boldSpinBox->blockSignals(b);
|
||||
ui->invertCheckBox->setChecked(m_vm.colorReversal);
|
||||
|
||||
b = ui->txtSpanSpinBox->blockSignals(true);
|
||||
ui->txtSpanSpinBox->setValue(item->letterSpace());
|
||||
ui->txtSpanSpinBox->blockSignals(b);
|
||||
// 恢复信号
|
||||
ui->boldSpinBox->blockSignals(blockBold);
|
||||
ui->txtSpanSpinBox->blockSignals(blockSpan);
|
||||
ui->invertCheckBox->blockSignals(blockInvert);
|
||||
|
||||
auto dirBtn = m_directionButtonGroup.button(item->direction());
|
||||
b = dirBtn->blockSignals(true);
|
||||
dirBtn->setChecked(true);
|
||||
dirBtn->blockSignals(b);
|
||||
|
||||
b = ui->invertCheckBox->blockSignals(true);
|
||||
ui->invertCheckBox->setChecked(item->colorReversal());
|
||||
ui->invertCheckBox->blockSignals(b);
|
||||
|
||||
// 文字、日期、轮班可调字符间距
|
||||
// 计数器类的字符间距由 @see CounterVarSet 单独调整
|
||||
switch(item->sourceType()) {
|
||||
// 字间距可见性由item的类型决定
|
||||
switch(m_vm.sourceType) {
|
||||
case SourceType::TEXT:
|
||||
case SourceType::DATETIME:
|
||||
case SourceType::SCHEDULE_SHIFT:
|
||||
@@ -68,43 +92,83 @@ void ItemGeneralSettings::edit(PicTextItem *item)
|
||||
break;
|
||||
}
|
||||
|
||||
ui->previewWidget->setImg(m_currItem->preview());
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::applyToItem(PicTextItem *item)
|
||||
{
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
// VM的属性被逐一应用到item
|
||||
item->setDirection(m_vm.direction);
|
||||
item->setBoldMultiple(m_vm.boldMultiple);
|
||||
item->setLetterSpace(m_vm.letterSpace);
|
||||
item->setColorReversal(m_vm.colorReversal);
|
||||
item->applyModify();
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::ondirectionChanged(int dir)
|
||||
{
|
||||
if(!m_currItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_currItem->setDirection(ItemDirectionType(dir));
|
||||
m_currItem->applyModify();
|
||||
ui->previewWidget->setImg(m_currItem->preview());
|
||||
// 只更新VM,不直接修改item
|
||||
m_vm.direction = ItemDirectionType(dir);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::onBoldSpinBoxValueChanged(int multiple)
|
||||
{
|
||||
if(m_currItem) {
|
||||
m_currItem->setBoldMultiple(multiple);
|
||||
m_currItem->applyModify();
|
||||
ui->previewWidget->setImg(m_currItem->preview());
|
||||
}
|
||||
// 只更新VM
|
||||
m_vm.boldMultiple = multiple;
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::onLetterSpaceSpinBoxChanged(int space)
|
||||
{
|
||||
if(m_currItem) {
|
||||
m_currItem->setLetterSpace(space);
|
||||
m_currItem->applyModify();
|
||||
ui->previewWidget->setImg(m_currItem->preview());
|
||||
}
|
||||
// 只更新VM
|
||||
m_vm.letterSpace = space;
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::onColorReversalCheckBoxChecked(bool b)
|
||||
{
|
||||
if(m_currItem) {
|
||||
m_currItem->setColorReversal(b);
|
||||
m_currItem->applyModify();
|
||||
ui->previewWidget->setImg(m_currItem->preview());
|
||||
// 只更新VM
|
||||
m_vm.colorReversal = b;
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void ItemGeneralSettings::updatePreview()
|
||||
{
|
||||
// 预览需要基于item的source和m_vm的属性组合渲染
|
||||
// 如果m_currItem为空,显示空图像
|
||||
if (!m_currItem) {
|
||||
if(m_vm.imageGenerator) {
|
||||
ui->previewWidget->setImg(m_vm.imageGenerator());
|
||||
}
|
||||
else {
|
||||
ui->previewWidget->setImg(QImage());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 临时应用VM到item以获取预览,随后还原
|
||||
auto backupDir = m_currItem->direction();
|
||||
auto backupBold = m_currItem->boldMultiple();
|
||||
auto backupSpace = m_currItem->letterSpace();
|
||||
auto backupReverse = m_currItem->colorReversal();
|
||||
|
||||
m_currItem->setDirection(m_vm.direction);
|
||||
m_currItem->setBoldMultiple(m_vm.boldMultiple);
|
||||
m_currItem->setLetterSpace(m_vm.letterSpace);
|
||||
m_currItem->setColorReversal(m_vm.colorReversal);
|
||||
m_currItem->applyModify();
|
||||
|
||||
ui->previewWidget->setImg(m_currItem->preview());
|
||||
|
||||
// 还原原始状态(preview()后item的属性不应该被留下改动)
|
||||
m_currItem->setDirection(backupDir);
|
||||
m_currItem->setBoldMultiple(backupBold);
|
||||
m_currItem->setLetterSpace(backupSpace);
|
||||
m_currItem->setColorReversal(backupReverse);
|
||||
m_currItem->applyModify();
|
||||
}
|
||||
@@ -5,11 +5,52 @@
|
||||
#include <QButtonGroup>
|
||||
#include "pictextitem.h"
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
|
||||
namespace Ui {
|
||||
class ItemGeneralSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 图元通用属性的ViewModel
|
||||
*
|
||||
* 目的:解耦UI编辑器与PicTextItem,支持灵活的数据绑定和批量操作。
|
||||
* UI修改属性时先更新VM,再决定何时应用到item(实时或延迟)。
|
||||
*/
|
||||
struct ItemGeneralSettingsVM {
|
||||
// 图元类型,用于判断是否显示字间距
|
||||
SourceType sourceType = SourceType::UNKNOWN;
|
||||
|
||||
ItemDirectionType direction = NORMAL;
|
||||
int boldMultiple = 1;
|
||||
int letterSpace = 0;
|
||||
bool colorReversal = false;
|
||||
|
||||
std::function<QImage()> imageGenerator; // 图片生成函数
|
||||
|
||||
// 便利方法:从PicTextItem快照创建VM
|
||||
static ItemGeneralSettingsVM fromItem(PicTextItem *item) {
|
||||
ItemGeneralSettingsVM vm;
|
||||
if (item) {
|
||||
vm.sourceType = item->sourceType();
|
||||
vm.direction = item->direction();
|
||||
vm.boldMultiple = item->boldMultiple();
|
||||
vm.letterSpace = item->letterSpace();
|
||||
vm.colorReversal = item->colorReversal();
|
||||
}
|
||||
return vm;
|
||||
}
|
||||
|
||||
// 检查是否有改动
|
||||
bool hasDifference(const ItemGeneralSettingsVM &other) const {
|
||||
return sourceType != other.sourceType ||
|
||||
direction != other.direction ||
|
||||
boldMultiple != other.boldMultiple ||
|
||||
letterSpace != other.letterSpace ||
|
||||
colorReversal != other.colorReversal;
|
||||
}
|
||||
};
|
||||
|
||||
class ItemGeneralSettings : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -18,10 +59,45 @@ public:
|
||||
explicit ItemGeneralSettings(QWidget *parent = nullptr);
|
||||
~ItemGeneralSettings();
|
||||
|
||||
/**
|
||||
* @brief 加载PicTextItem的属性到ViewModel,初始化UI
|
||||
*
|
||||
* 原因:UI应该显示item的状态,但不应该直接持有指针长期修改。
|
||||
* edit()后,用户对UI的编辑会更新m_vm,而不是直接改item。
|
||||
*/
|
||||
void edit(PicTextItem* item);
|
||||
|
||||
/**
|
||||
* @brief 设置当前ViewModel
|
||||
*
|
||||
* @param vm
|
||||
*/
|
||||
void setViewModel(const ItemGeneralSettingsVM& vm);
|
||||
|
||||
/**
|
||||
* @brief 获取当前ViewModel
|
||||
*
|
||||
* 调用者可以检查是否有改动,并决定是否应用
|
||||
*/
|
||||
ItemGeneralSettingsVM viewModel() const { return m_vm; }
|
||||
|
||||
/**
|
||||
* @brief 将ViewModel的属性应用到指定的PicTextItem
|
||||
*
|
||||
* 解耦的核心:UI不再直接修改item,而是通过VM进行间接修改。
|
||||
* 这支持撤销/重做、批量编辑等高级功能。
|
||||
*/
|
||||
void applyToItem(PicTextItem* item);
|
||||
|
||||
/**
|
||||
* @brief 当前编辑的item源引用(可能为空)
|
||||
*
|
||||
* 主要用于获取preview()时作为示例源,不用于直接修改
|
||||
*/
|
||||
PicTextItem* currentItem() { return m_currItem; }
|
||||
|
||||
void initUI();
|
||||
|
||||
private slots:
|
||||
void ondirectionChanged(int dir);
|
||||
void onBoldSpinBoxValueChanged(int multiple);
|
||||
@@ -29,10 +105,23 @@ private slots:
|
||||
void onColorReversalCheckBoxChecked(bool b);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief 刷新预览,基于当前VM和item的source渲染
|
||||
*/
|
||||
void updatePreview();
|
||||
|
||||
Ui::ItemGeneralSettings *ui;
|
||||
QButtonGroup m_directionButtonGroup;
|
||||
|
||||
// 原始item的快照,用于preview()和后续应用
|
||||
PicTextItem* m_currItem = nullptr;
|
||||
|
||||
// UI编辑的状态,独立于m_currItem
|
||||
ItemGeneralSettingsVM m_vm;
|
||||
|
||||
// 初始加载时的VM状态,用于检测改动
|
||||
ItemGeneralSettingsVM m_vmSnapshot;
|
||||
|
||||
QPainter m_painter;
|
||||
};
|
||||
|
||||
|
||||
+3
-38
@@ -12,7 +12,7 @@ PicDateItem::PicDateItem(QGraphicsItem *parent, QGraphicsScene *scene, const Sou
|
||||
updateDatetimeStr();
|
||||
});
|
||||
|
||||
m_timer.start();
|
||||
// m_timer.start();
|
||||
}
|
||||
|
||||
QVariant PicDateItem::source()
|
||||
@@ -70,48 +70,13 @@ void PicDateItem::setCustomAttrs(const QXmlStreamAttributes &attrs)
|
||||
// yearsMap = "2023<subbr>2023年<br>2024<subbr>2024年<br>2025<subbr>2025年"
|
||||
|
||||
auto m = DateItemModel();
|
||||
m.dataMap = attrs.value("dataMap").toString().split("<br>");
|
||||
m.daysMap = attrs.value("daysMap").toString().split("<br>");
|
||||
m.hoursMap = attrs.value("hoursMap").toString().split("<br>");
|
||||
m.monthsMap = attrs.value("monthsMap").toString().split("<br>");
|
||||
m.weeksMap = attrs.value("weeksMap").toString().split("<br>");
|
||||
|
||||
auto yearsMap = attrs.value("yearsMap").toString().split("<br>");
|
||||
for(auto it = yearsMap.begin(); it != yearsMap.end(); ++it) {
|
||||
auto yearPair = it->split("<subbr>");
|
||||
if(yearPair.size() == 2) {
|
||||
m.yearsMap[yearPair[0].toInt()] = yearPair[1];
|
||||
}
|
||||
}
|
||||
|
||||
m.monthsOffset = attrs.value("monthsOffset").toInt();
|
||||
m.daysOffset = attrs.value("daysOffset").toInt();
|
||||
m.datetimePattern = attrs.value("datetimePattern").toString();
|
||||
DateItemModel::loadFromXml(m, attrs);
|
||||
setModel(std::move(m));
|
||||
}
|
||||
|
||||
void PicDateItem::saveCustomAttrs(QXmlStreamAttributes &attrs)
|
||||
{
|
||||
auto dataMap = m_model.dataMap.join("<br>");
|
||||
auto daysMap = m_model.daysMap.join("<br>");
|
||||
auto hoursMap = m_model.hoursMap.join("<br>");
|
||||
auto monthsMap = m_model.monthsMap.join("<br>");
|
||||
auto weeksMap = m_model.weeksMap.join("<br>");
|
||||
|
||||
QString yearsMap;
|
||||
for(auto it = m_model.yearsMap.begin(); it != m_model.yearsMap.end(); ++it) {
|
||||
yearsMap.append(QString("%1<subbr>%2<br>").arg(it.key()).arg(it.value()));
|
||||
}
|
||||
|
||||
attrs.append("dataMap", dataMap);
|
||||
attrs.append("daysMap", daysMap);
|
||||
attrs.append("hoursMap", hoursMap);
|
||||
attrs.append("monthsMap", monthsMap);
|
||||
attrs.append("weeksMap", weeksMap);
|
||||
attrs.append("yearsMap", yearsMap);
|
||||
attrs.append("datetimePattern", m_model.datetimePattern);
|
||||
attrs.append("monthsOffset", QString::number(m_model.monthsOffset));
|
||||
attrs.append("daysOffset", QString::number(m_model.daysOffset));
|
||||
DateItemModel::saveToXml(m_model, attrs);
|
||||
}
|
||||
|
||||
QImage PicDateItem::itemImage()
|
||||
|
||||
@@ -9,7 +9,7 @@ PicScheduleShiftItem::PicScheduleShiftItem(QGraphicsItem *parent, QGraphicsScene
|
||||
connect(&m_updateTimer, &QTimer::timeout, [this](){
|
||||
updateScheduleName();
|
||||
});
|
||||
m_updateTimer.start();
|
||||
// m_updateTimer.start();
|
||||
}
|
||||
|
||||
QVariant PicScheduleShiftItem::source()
|
||||
|
||||
@@ -44,6 +44,7 @@ ScheduleShiftsEditor::ScheduleShiftsEditor(QWidget *parent) :
|
||||
|
||||
ui->btnAdd->setEnabled(false);
|
||||
ui->btnRemove->setEnabled(false);
|
||||
applyStyleSheet();
|
||||
}
|
||||
|
||||
ScheduleShiftsEditor::~ScheduleShiftsEditor()
|
||||
@@ -162,7 +163,101 @@ void ScheduleShiftsEditor::applyDataModel()
|
||||
|
||||
void ScheduleShiftsEditor::applyStyleSheet()
|
||||
{
|
||||
// TODO:: 应用样式表
|
||||
QString styleSheet =
|
||||
R"(
|
||||
/*
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
*/
|
||||
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QTabWidget::pane {
|
||||
border: 1px solid #dddddd;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
QTabBar::tab:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
)";
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
SelectedStyleTimeEdit::SelectedStyleTimeEdit(QWidget *parent)
|
||||
|
||||
@@ -149,26 +149,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="scheduleShiftsEditTab">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}</string>
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>班时编号</string>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ViewModels.h"
|
||||
#include <QDebug>
|
||||
|
||||
DateItemModel DateItemModel::createDefaultReplaceModel()
|
||||
{
|
||||
@@ -28,3 +29,81 @@ DateItemModel DateItemModel::createDefaultReplaceModel()
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
void DateItemModel::loadFromXml(DateItemModel &vm, const QXmlStreamAttributes &attrs)
|
||||
{
|
||||
auto& m = vm;
|
||||
m.dataMap = attrs.value("dataMap").toString().split("<br>");
|
||||
m.daysMap = attrs.value("daysMap").toString().split("<br>");
|
||||
m.hoursMap = attrs.value("hoursMap").toString().split("<br>");
|
||||
m.monthsMap = attrs.value("monthsMap").toString().split("<br>");
|
||||
m.weeksMap = attrs.value("weeksMap").toString().split("<br>");
|
||||
|
||||
auto yearsMap = attrs.value("yearsMap").toString().split("<br>");
|
||||
for(auto it = yearsMap.begin(); it != yearsMap.end(); ++it) {
|
||||
auto yearPair = it->split("<subbr>");
|
||||
if(yearPair.size() == 2) {
|
||||
m.yearsMap[yearPair[0].toInt()] = yearPair[1];
|
||||
}
|
||||
}
|
||||
|
||||
m.monthsOffset = attrs.value("monthsOffset").toInt();
|
||||
m.daysOffset = attrs.value("daysOffset").toInt();
|
||||
m.datetimePattern = attrs.value("datetimePattern").toString();
|
||||
}
|
||||
|
||||
void DateItemModel::saveToXml(const DateItemModel &vm, QXmlStreamAttributes &attrs)
|
||||
{
|
||||
auto& m = vm;
|
||||
auto dataMap = m.dataMap.join("<br>");
|
||||
auto daysMap = m.daysMap.join("<br>");
|
||||
auto hoursMap = m.hoursMap.join("<br>");
|
||||
auto monthsMap = m.monthsMap.join("<br>");
|
||||
auto weeksMap = m.weeksMap.join("<br>");
|
||||
|
||||
QString yearsMap;
|
||||
for(auto it = m.yearsMap.begin(); it != m.yearsMap.end(); ++it) {
|
||||
yearsMap.append(QString("%1<subbr>%2<br>").arg(it.key()).arg(it.value()));
|
||||
}
|
||||
|
||||
attrs.append("dataMap", dataMap);
|
||||
attrs.append("daysMap", daysMap);
|
||||
attrs.append("hoursMap", hoursMap);
|
||||
attrs.append("monthsMap", monthsMap);
|
||||
attrs.append("weeksMap", weeksMap);
|
||||
attrs.append("yearsMap", yearsMap);
|
||||
attrs.append("datetimePattern", m.datetimePattern);
|
||||
attrs.append("monthsOffset", QString::number(m.monthsOffset));
|
||||
attrs.append("daysOffset", QString::number(m.daysOffset));
|
||||
}
|
||||
|
||||
void CounterViewModel::loadFromXml(CounterViewModel &vm, const QXmlStreamAttributes &attrs)
|
||||
{
|
||||
auto typeRef = attrs.value("counter_type");
|
||||
auto digitalNumRef = attrs.value("digital_num");
|
||||
|
||||
bool ok = false;
|
||||
int counterType = typeRef.toInt(&ok);
|
||||
if(!ok || (counterType != COUNTER_TYPE_1 && COUNTER_TYPE_2 != counterType)) {
|
||||
qWarning() << "Invalied counter type: " << counterType;
|
||||
return;
|
||||
}
|
||||
|
||||
ok = false;
|
||||
int digitalNum = digitalNumRef.toInt(&ok);
|
||||
if(!ok || digitalNum <= 0) {
|
||||
qWarning() << "Invalied counter digital number: " << digitalNum;
|
||||
return;
|
||||
}
|
||||
|
||||
vm.counterType = static_cast<COUNTER_TYPE>(counterType);
|
||||
vm.digitalNum = digitalNum;
|
||||
qInfo() << "Loaded attrs from xml: " << " counter type: " << counterType << ", digitalNum: " << digitalNum;
|
||||
}
|
||||
|
||||
void CounterViewModel::saveToXml(CounterViewModel &vm, QXmlStreamAttributes &attrs)
|
||||
{
|
||||
attrs.append("counter_type", QString::number(vm.counterType));
|
||||
attrs.append("digital_num", QString::number(vm.digitalNum));
|
||||
qInfo() << "Set attrs to xml: " << " counter type: " << vm.counterType << ", digitalNum: " << vm.digitalNum;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QSharedPointer>
|
||||
#include "SysPara.h"
|
||||
#include <QMap>
|
||||
#include <QXmlStreamAttributes>
|
||||
|
||||
enum InkType {
|
||||
INK_TYPE_BLACK,
|
||||
@@ -32,6 +33,9 @@ struct CounterViewModel {
|
||||
int letterSpace = 2;
|
||||
int charWidth = 0; // 字符宽度,仅在 enbCustomCharWidth == true 时有意义
|
||||
bool enbCustomCharWidth = false;
|
||||
|
||||
static void loadFromXml(CounterViewModel& vm, const QXmlStreamAttributes& attrs);
|
||||
static void saveToXml(CounterViewModel& vm, QXmlStreamAttributes& attrs);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(CounterViewModel);
|
||||
@@ -52,6 +56,8 @@ struct DateItemModel {
|
||||
QStringList hoursMap;
|
||||
|
||||
static DateItemModel createDefaultReplaceModel();
|
||||
static void loadFromXml(DateItemModel& vm, const QXmlStreamAttributes& attrs);
|
||||
static void saveToXml(const DateItemModel& vm, QXmlStreamAttributes& attrs);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(DateItemModel);
|
||||
|
||||
+52
-8
@@ -1,38 +1,82 @@
|
||||
#include "piccodeitem.h"
|
||||
|
||||
|
||||
#include "ItemCommon.h"
|
||||
#include <QDebug>
|
||||
|
||||
PicCodeItem::PicCodeItem(QGraphicsItem *parent, QGraphicsScene *scene, const SourceType type)
|
||||
:PicTextItem(parent, scene, type)
|
||||
:PicTextItem(parent, scene, type),
|
||||
m_currCounterValues({0, 0})
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable);
|
||||
setFlag(QGraphicsItem::ItemIsFocusable);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
|
||||
connect(&m_dateVarTimer, &QTimer::timeout, this, [this](){
|
||||
updateVariants();
|
||||
});
|
||||
|
||||
// m_dateVarTimer.start(50);
|
||||
}
|
||||
|
||||
PicCodeItem::~PicCodeItem()
|
||||
{
|
||||
m_dateVarTimer.stop();
|
||||
}
|
||||
|
||||
QVariant PicCodeItem::source()
|
||||
{
|
||||
return imagePath;
|
||||
return m_currCodeTxt;
|
||||
}
|
||||
|
||||
void PicCodeItem::setSource(QVariant var)
|
||||
{
|
||||
imagePath = var.toString();
|
||||
applyModify();
|
||||
}
|
||||
|
||||
void PicCodeItem::setBarcodeViewModel(const BarcodeViewModel &vm)
|
||||
{
|
||||
m_vm = vm;
|
||||
m_currCodeTxt = "";
|
||||
updateVariants();
|
||||
qInfo() << "Barcode model: \r\n" << qPrintable(BarcodeViewModel::toString(vm));
|
||||
}
|
||||
|
||||
BarcodeViewModel PicCodeItem::barcodeViewModel()
|
||||
{
|
||||
return m_vm;
|
||||
}
|
||||
|
||||
bool PicCodeItem::updateVariants(const QVector<int> counters)
|
||||
{
|
||||
m_currCounterValues = counters;
|
||||
return updateVariants();
|
||||
}
|
||||
|
||||
QImage PicCodeItem::itemImage()
|
||||
{
|
||||
return QImage(imagePath);
|
||||
return m_codeImage;
|
||||
}
|
||||
|
||||
void PicCodeItem::setCustomAttrs(const QXmlStreamAttributes &attrs)
|
||||
{
|
||||
imagePath = attrs.value("CodeImage").toString();
|
||||
auto vm = BarcodeViewModel::loadFromXml(attrs);
|
||||
setBarcodeViewModel(vm);
|
||||
}
|
||||
|
||||
void PicCodeItem::saveCustomAttrs(QXmlStreamAttributes &attrs)
|
||||
{
|
||||
attrs.append("CodeImage", imagePath);
|
||||
BarcodeViewModel::saveToXml(m_vm, attrs);
|
||||
}
|
||||
|
||||
bool PicCodeItem::updateVariants()
|
||||
{
|
||||
auto txt = generateTxtFromBarcodeViewModel(m_vm, {m_currCounterValues[0], m_currCounterValues[1]}, QDateTime::currentDateTime());
|
||||
if(txt != m_currCodeTxt || m_currCodeTxt.isEmpty()) {
|
||||
m_currCodeTxt = txt;
|
||||
m_codeImage = generateBarcodeImage(txt, m_vm.type, m_vm.format);
|
||||
applyModify();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+15
-5
@@ -2,19 +2,24 @@
|
||||
#define PICCODEITEM_H
|
||||
|
||||
#include "pictextitem.h"
|
||||
|
||||
|
||||
#include "BarcodeEditor.h"
|
||||
#include <QTimer>
|
||||
|
||||
class PicCodeItem : public PicTextItem
|
||||
{
|
||||
public:
|
||||
PicCodeItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0,
|
||||
const SourceType type = SourceType::CODE);
|
||||
virtual ~PicCodeItem() {}
|
||||
virtual ~PicCodeItem();
|
||||
|
||||
virtual QVariant source() override;
|
||||
virtual void setSource(QVariant var) override;
|
||||
|
||||
void setBarcodeViewModel(const BarcodeViewModel& vm);
|
||||
BarcodeViewModel barcodeViewModel();
|
||||
|
||||
bool updateVariants(const QVector<int> counters);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief itemImage 子类可以重新实现该方法用于返回已经渲染好了的但未应用方向、水平拉伸的图像
|
||||
@@ -29,9 +34,14 @@ protected:
|
||||
virtual void saveCustomAttrs(QXmlStreamAttributes& attrs);
|
||||
|
||||
private:
|
||||
// 保存图片的绝对路径
|
||||
QString imagePath = "";
|
||||
|
||||
bool updateVariants();
|
||||
|
||||
BarcodeViewModel m_vm;
|
||||
QVector<int> m_currCounterValues;
|
||||
QString m_currCodeTxt;
|
||||
QImage m_codeImage;
|
||||
QTimer m_dateVarTimer;
|
||||
};
|
||||
|
||||
#endif // PICCODEITEM_H
|
||||
|
||||
@@ -55,6 +55,7 @@ void PicScene::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QGraphicsScene::keyPressEvent(event);
|
||||
}
|
||||
|
||||
//edit@12-09
|
||||
void PicScene::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
@@ -112,6 +113,7 @@ void PicScene::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
|
||||
emit showTextWidthHeight();
|
||||
}
|
||||
|
||||
//edit@12-09
|
||||
void PicScene::setIsdrawBackground(bool newIsdrawBackground)
|
||||
{
|
||||
|
||||
+1
-1
@@ -72,6 +72,6 @@ private:
|
||||
|
||||
bool IsdrawBackground;
|
||||
|
||||
QGraphicsObject* currFocusItem;
|
||||
QGraphicsObject* currFocusItem = nullptr;
|
||||
};
|
||||
#endif // PICSCENE_H
|
||||
|
||||
+992
-1179
File diff suppressed because it is too large
Load Diff
+23
-36
@@ -845,6 +845,25 @@
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButtonCleanUP">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>喷嘴逆清洗</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButtonHighVoltageData">
|
||||
<property name="enabled">
|
||||
@@ -858,7 +877,7 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>260</width>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -870,41 +889,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButtonInterFace">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>260</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>界面语言设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButtonCleanUP">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>喷嘴逆清洗</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="checkBtn">
|
||||
@@ -939,6 +923,9 @@
|
||||
<class>ClickLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>ClickLabel.h</header>
|
||||
<slots>
|
||||
<signal>pressed()</signal>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
+66
-43
@@ -191,6 +191,11 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
emit sig_showEditCounter(vm);
|
||||
});
|
||||
|
||||
connect(ui.btnBarcode, &QPushButton::clicked, [this](){
|
||||
pPicScene->clearSelection();
|
||||
showBarcodeEditor();
|
||||
});
|
||||
|
||||
// X,Y label connection
|
||||
connect(pPicScene, &PicScene::focusedItemPosChanged, this, &TestPrintWidget::onSceneFocusedItemPosChanged);
|
||||
|
||||
@@ -214,6 +219,8 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
itemEditor = new ItemEditor();
|
||||
connect(itemEditor, &ItemEditor::accepted, this, &TestPrintWidget::onItemEditorAccepted);
|
||||
|
||||
connect(&m_barcodeEditor, &BarcodeEditor::accepted, this, &TestPrintWidget::slt_BarCodeItemDone);
|
||||
|
||||
initSelecteCodeDlg();
|
||||
|
||||
// 网络通信,暂时屏蔽
|
||||
@@ -252,6 +259,7 @@ QPixmap TestPrintWidget::loadIcon(const QString& iconName, const QSize& size)
|
||||
void TestPrintWidget::on_openfileButton_pressed()
|
||||
{
|
||||
pPicScene->clearSelection();
|
||||
pPicScene->clearFocus();
|
||||
dialogFileOperation->refreshListView(editMode);
|
||||
dialogFileOperation->exec();
|
||||
}
|
||||
@@ -1219,39 +1227,41 @@ void TestPrintWidget::onCreateSceneImage(QString filePath)
|
||||
|
||||
void TestPrintWidget::on_KeyUp_clicked()
|
||||
{
|
||||
pViewer->setFocus();
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Up,Qt::NoModifier);
|
||||
#endif
|
||||
moveSelectedItem(Qt::Key_Up);
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_KeyLeft_clicked()
|
||||
{
|
||||
pViewer->setFocus();
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Left,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Left,Qt::NoModifier);
|
||||
#endif
|
||||
moveSelectedItem(Qt::Key_Left);
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_KeyRight_clicked()
|
||||
{
|
||||
pViewer->setFocus();
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Right,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Right,Qt::NoModifier);
|
||||
#endif
|
||||
moveSelectedItem(Qt::Key_Right);
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_KeyDown_clicked()
|
||||
{
|
||||
pViewer->setFocus();
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Down,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(Qt::Key_Down,Qt::NoModifier);
|
||||
#endif
|
||||
moveSelectedItem(Qt::Key_Down);
|
||||
}
|
||||
|
||||
void TestPrintWidget::moveSelectedItem(Qt::Key key)
|
||||
{
|
||||
pViewer->setFocus();
|
||||
auto selectedItems = pPicScene->selectedItems();
|
||||
QGraphicsItem* lastItem = nullptr;
|
||||
if(selectedItems.size() >= 1) {
|
||||
lastItem = selectedItems.last();
|
||||
}
|
||||
|
||||
if(lastItem) {
|
||||
lastItem->setFocus();
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WIN32
|
||||
//QWSServer::sendKeyEvent(0,Qt::Key_Up,Qt::NoModifier,true,false); //向系统发送键盘事件
|
||||
MyInputMethod::sendEvent(key, Qt::NoModifier);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_delButton_pressed()
|
||||
@@ -1371,13 +1381,12 @@ void TestPrintWidget::onBtnItemConfigClicked()
|
||||
}
|
||||
|
||||
if (item->sourceType() == SourceType::CODE) {
|
||||
QString s = item->source().toString();
|
||||
editCodeFlag = true;
|
||||
if (s.contains(QString("QR")) || s.contains(QString("DMT"))) {
|
||||
emit sendButtonClickedSignal(202);
|
||||
} else if (s.contains(QString("BAR"))) {
|
||||
emit sendButtonClickedSignal(201);
|
||||
}
|
||||
auto codeItem = dynamic_cast<PicCodeItem*>(item);
|
||||
if(!codeItem)
|
||||
return;
|
||||
|
||||
m_barcodeEditor.bindViewModel(codeItem->barcodeViewModel());
|
||||
showBarcodeEditor(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1414,26 +1423,37 @@ void TestPrintWidget::on_newfileButton_pressed(){
|
||||
sendButtonClickedSignal(21); //新建文件完成
|
||||
}
|
||||
|
||||
void TestPrintWidget::slt_BarCodeItemDone(QString str)
|
||||
void TestPrintWidget::slt_BarCodeItemDone()
|
||||
{
|
||||
if (editCodeFlag) {
|
||||
on_delButton_pressed();
|
||||
editCodeFlag = false;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
addCodeItem(str);
|
||||
m_TextEdit->clear();
|
||||
if(flag)
|
||||
return;
|
||||
|
||||
int index = checkSelectScene();
|
||||
if (index == -1) return;
|
||||
|
||||
QString html = m_TextEdit->toHtml();
|
||||
foreach (QGraphicsItem *item, pPicScene->selectedItems())
|
||||
{
|
||||
PicCodeItem *pItem = (PicCodeItem*)item;
|
||||
pItem->setHtml(html);
|
||||
pItem->setSource(str);
|
||||
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);
|
||||
}
|
||||
|
||||
void TestPrintWidget::slt_QRCodeItemDone(QString str)
|
||||
@@ -1619,11 +1639,14 @@ void TestPrintWidget::addCounterItem(CounterViewModel vm, QSharedPointer<QFont>
|
||||
}
|
||||
}
|
||||
|
||||
void TestPrintWidget::on_btnBarcode_clicked()
|
||||
void TestPrintWidget::showBarcodeEditor(bool restoreViewModel)
|
||||
{
|
||||
#if defined(ARCH_AARCH64)
|
||||
m_barcodeEditor.setWindowState(Qt::WindowFullScreen);
|
||||
#endif
|
||||
if(restoreViewModel)
|
||||
m_barcodeEditor.restoreViewModel();
|
||||
|
||||
m_barcodeEditor.show();
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -67,6 +67,7 @@ public:
|
||||
void on_KeyLeft_clicked();
|
||||
void on_KeyRight_clicked();
|
||||
void on_KeyDown_clicked();
|
||||
|
||||
void on_delButton_pressed();
|
||||
|
||||
void setFontNameIndex(float);
|
||||
@@ -98,7 +99,7 @@ public slots:
|
||||
|
||||
void on_newfileButton_pressed();
|
||||
|
||||
void slt_BarCodeItemDone(QString str);
|
||||
void slt_BarCodeItemDone();
|
||||
|
||||
void slt_QRCodeItemDone(QString str);
|
||||
protected:
|
||||
@@ -116,7 +117,7 @@ private slots:
|
||||
|
||||
void addDateItem();
|
||||
|
||||
void on_btnBarcode_clicked();
|
||||
void showBarcodeEditor(bool restoreVM = true);
|
||||
|
||||
void onBtnArrowClicked();
|
||||
|
||||
@@ -137,6 +138,12 @@ private:
|
||||
|
||||
void parseVbfile(QXmlStreamReader &reader);
|
||||
|
||||
/**
|
||||
* @brief 对 on_KeyUp_clicked 等按键事件的简便包装
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
void moveSelectedItem(Qt::Key key);
|
||||
|
||||
// 加载图标(保留原功能)
|
||||
QPixmap loadIcon(const QString& iconName, const QSize& size = QSize(40, 40));
|
||||
|
||||
Reference in New Issue
Block a user