From 75ee563a111cf437d3ff04c9afe2bdf0a355a480 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Tue, 17 May 2022 18:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=89=AB=E6=8F=8F=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=E9=A9=B1=E5=8A=A8=E5=B1=82=E5=92=8CUI=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scanner/cutdialog.cpp | 74 ++++++++++++++++++------------- app/scanner/cutpapertool.cpp | 1 + app/scanner/dialog_aquireinto.cpp | 2 +- app/scanner/hg_settingdialog.cpp | 16 ++++--- app/scanner/mainwindow.cpp | 8 ++-- 5 files changed, 57 insertions(+), 44 deletions(-) diff --git a/app/scanner/cutdialog.cpp b/app/scanner/cutdialog.cpp index 6c0d8c00..f0aba18b 100644 --- a/app/scanner/cutdialog.cpp +++ b/app/scanner/cutdialog.cpp @@ -3,6 +3,8 @@ #include #include #include +#include "../../utility/HGString.h" +#include "sane/sane_option_definitions.h" cutDialog::cutDialog(QWidget *parent) : QWidget(parent), @@ -35,24 +37,28 @@ void cutDialog::setPaperSize(QString type, const int w) { paperType = type; - if(paperType == "A3") h_w = 420.0/297; - else if(paperType == "A4") h_w = 297.0/210; - else if(paperType == std::string("A4横向").c_str()) h_w = 210/297.0; - else if(paperType == "A5") h_w = 210.0/148; - else if(paperType == std::string("A5横向").c_str()) h_w = 148/210.0; - else if(paperType == "A6") h_w = 148.0/105; - else if(paperType == std::string("A6横向").c_str()) h_w = 105/148.0; - else if(paperType == "B4") h_w = 353.0/250; - else if(paperType == "B5") h_w = 250.0/176; - else if(paperType == std::string("B5横向").c_str()) h_w = 176/250.0; - else if(paperType == "B6") h_w = 176.0/125; - else if(paperType == std::string("B6横向").c_str()) h_w = 125/176.0; - else if(paperType == std::string("信封").c_str()) h_w = 279.0/210; - else if(paperType == std::string("信封横向").c_str()) h_w = 210.0/279; - else if(paperType == std::string("双倍信封").c_str()) h_w = 850.0/550; - else if(paperType == "Legal") h_w = 2800.0/1700; - else if(paperType == std::string("最大尺寸").c_str()) h_w = 3307.0*2/2338; - else if(paperType == std::string("匹配原始尺寸").c_str()) { + if (paperType == OPTION_VALUE_ZZCC_A3) h_w = 420.0 / 297.0; + else if (paperType == OPTION_VALUE_ZZCC_8K) h_w = 390.0 / 270.0; + else if (paperType == OPTION_VALUE_ZZCC_16K) h_w = 270.0 / 190.0; + else if (paperType == OPTION_VALUE_ZZCC_16KHX) h_w = 190.0 / 270.0; + else if (paperType == OPTION_VALUE_ZZCC_A4) h_w = 297.0 / 210.0; + else if (paperType == OPTION_VALUE_ZZCC_A4HX) h_w = 210.0 / 297.0; + else if (paperType == OPTION_VALUE_ZZCC_A5) h_w = 210.0 / 148.0; + else if (paperType == OPTION_VALUE_ZZCC_A5HX) h_w = 148.0 / 210.0; + else if (paperType == OPTION_VALUE_ZZCC_A6) h_w = 148.0 / 105.0; + else if (paperType == OPTION_VALUE_ZZCC_A6HX) h_w = 105.0 / 148.0; + else if (paperType == OPTION_VALUE_ZZCC_B4) h_w = 353.0 / 250.0; + else if (paperType == OPTION_VALUE_ZZCC_B5) h_w = 250.0 / 176.0; + else if (paperType == OPTION_VALUE_ZZCC_B5HX) h_w = 176.0 / 250.0; + else if (paperType == OPTION_VALUE_ZZCC_B6) h_w = 176.0 / 125.0; + else if (paperType == OPTION_VALUE_ZZCC_B6HX) h_w = 125.0 / 176.0; + else if (paperType == OPTION_VALUE_ZZCC_Letter) h_w = 279.0 / 216.0; + else if (paperType == OPTION_VALUE_ZZCC_LetterHX) h_w = 216.0 / 279.0; + else if (paperType == OPTION_VALUE_ZZCC_DoubleLetter) h_w = 559.0 / 216.0; + else if (paperType == OPTION_VALUE_ZZCC_LEGAL) h_w = 356.0 / 216.0; + else if (paperType == OPTION_VALUE_ZZCC_SLSJ) h_w = 560.0 / 270.0; + else if(paperType == OPTION_VALUE_ZZCC_ZDSMCC) h_w = 3307.0*2/2338; + else if(paperType == OPTION_VALUE_ZZCC_PPYSCC) { if(dpi == 100.0) h_w = 1795.0/1189; if(dpi == 150.0) h_w = 1795.0/1784; if(dpi == 200.0) h_w = 3307.0/2338; @@ -67,22 +73,26 @@ void cutDialog::setPaperSize(QString type, const int w) else if (type.contains("6")) divisor = 8; else divisor = 4; paperWidth = w; - if(type.contains(std::string("横向").c_str())) paperWidth = paperWidth*h_w*1.5; + if(type.contains(StdStringToUtf8("横向").c_str())) + paperWidth = paperWidth*h_w*1.5; double realW = paperWidth; - if(paperType == "A3" || paperType == std::string("A4横向").c_str()) realRate = 297.0/realW; - else if(paperType == "A4" || paperType == std::string("A5横向").c_str()) realRate = 210.0/realW; - else if(paperType == "A5" || paperType == std::string("A6横向").c_str()) realRate = 148.0/realW; - else if(paperType == "A6") realRate = 105.0/realW; - else if(paperType == "B4" || paperType == std::string("B5横向").c_str()) realRate = 250.0/realW; - else if(paperType == "B5" || paperType == std::string("B6横向").c_str()) realRate = 176.0/realW; - else if(paperType == "B6") realRate = 125.0/realW; - else if(paperType == std::string("信封").c_str()) realRate = 216.0/realW; - else if(paperType == std::string("信封横向").c_str()) realRate = 279.0/realW; - else if(paperType == std::string("双倍信封").c_str()) realRate = 432.0/realW; - else if(paperType == "Legal") realRate = 297.0/realW; - else if(paperType == std::string("最大尺寸").c_str()) realRate = 297.0/realW; - else if(paperType == std::string("匹配原始尺寸").c_str()) { + if (paperType == OPTION_VALUE_ZZCC_A3 || paperType == OPTION_VALUE_ZZCC_A4HX) realRate = 297.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_A4 || paperType == OPTION_VALUE_ZZCC_A5HX) realRate = 210.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_A5 || paperType == OPTION_VALUE_ZZCC_A6HX) realRate = 148.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_A6) realRate = 105.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_16K) realRate = 190.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_8K || paperType == OPTION_VALUE_ZZCC_16KHX) realRate = 270.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_B4 || paperType == OPTION_VALUE_ZZCC_B5HX) realRate = 250.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_B5 || paperType == OPTION_VALUE_ZZCC_B6HX) realRate = 176.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_B6) realRate = 125.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_Letter) realRate = 216.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_LetterHX) realRate = 279.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_DoubleLetter) realRate = 216.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_LEGAL) realRate = 216.0 / realW; + else if (paperType == OPTION_VALUE_ZZCC_SLSJ) realRate = 270.0 / realW; + else if(paperType == OPTION_VALUE_ZZCC_ZDSMCC) realRate = 297.0/realW; + else if(paperType == OPTION_VALUE_ZZCC_PPYSCC) { if(dpi == 100.0) realRate = 1189.0*0.039377/dpi/realW; if(dpi == 150.0) realRate = 1784*0.039377/dpi/realW; if(dpi == 200.0) realRate = 2338*0.039377/dpi/realW; diff --git a/app/scanner/cutpapertool.cpp b/app/scanner/cutpapertool.cpp index 2fdd48f9..6a990b08 100644 --- a/app/scanner/cutpapertool.cpp +++ b/app/scanner/cutpapertool.cpp @@ -17,6 +17,7 @@ CutPaperTool::CutPaperTool(QWidget *parent) : //setPaperType(200,"A4",400); ui->widget->setSizeType(MILLIM); setSizeLabel(); + ui->pbtn_init->setFixedWidth(160); this->setFixedWidth(ui->widget->width()+20); } diff --git a/app/scanner/dialog_aquireinto.cpp b/app/scanner/dialog_aquireinto.cpp index 8180be07..f93c107e 100644 --- a/app/scanner/dialog_aquireinto.cpp +++ b/app/scanner/dialog_aquireinto.cpp @@ -32,7 +32,7 @@ Dialog_AquireInto::Dialog_AquireInto(QWidget* parent) : ui->cbtn_subFolderByColor->setChecked(getCfgValue("aquire", "subFolderByColor", false)); #if defined(OEM_HANWANG) ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("HWScan"))); -#elif defined(OEM_LISICHEN) +#elif defined(OEM_LISICHENG) ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("LXScan"))); #else ui->lineEdit_fileName->setText(getCfgValue("aquire", "namePrefix", QString("HGScan"))); diff --git a/app/scanner/hg_settingdialog.cpp b/app/scanner/hg_settingdialog.cpp index 18140789..bfbe5125 100644 --- a/app/scanner/hg_settingdialog.cpp +++ b/app/scanner/hg_settingdialog.cpp @@ -941,13 +941,20 @@ void hg_settingdialog::slot_string_list_comboBoxClicked() std::string comboBoxcurrentItem(comboBox->currentText().toUtf8()); int type = comboBox->property(hg_settingdialog::property_combox_data_type_.c_str()).toInt(); - if (id == m_paperSizeId) + if (id == m_dpiId) + { + m_dpiValue = atoi(comboBoxcurrentItem.c_str()); + qDebug("dpi=%d", m_dpiValue); + } + else if (id == m_paperSizeId) { m_paperSizeValue = comboBoxcurrentItem.c_str(); + qDebug("paperSize=%s", comboBoxcurrentItem.c_str()); } else if (id == m_colorModeId) { m_colorModeValue = comboBoxcurrentItem.c_str(); + qDebug("colorMode=%s", comboBoxcurrentItem.c_str()); } const SANE_Option_Descriptor* opt = nullptr; @@ -1004,7 +1011,7 @@ void hg_settingdialog::slot_cutButtonClicked() int bottom = 0.03937 * m_cutBottomValue * m_dpiValue; CutPaperTool dlg(this); - dlg.setPaperType(m_dpiValue, m_paperSizeValue, m_cutWidth); + dlg.setPaperType(m_dpiValue, m_paperSizeValue, 300); QRectF rc(left, top, right - left, bottom - top); dlg.setCutRect(rc); if (dlg.exec()) @@ -1241,11 +1248,6 @@ void hg_settingdialog::slot_sliderClicked(int value) QSlider *slider = qobject_cast(sender()); SANE_Int id = slider->property("controls_id").toInt(); - if (id == m_dpiId) - { - m_dpiValue = value; - } - const SANE_Option_Descriptor* opt = nullptr; for(int i = 0; i < m_list_getOpt.size(); i++) if (m_list_getOpt.at(i).first == id) diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index 81db7f2c..a4dd8309 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -64,7 +64,7 @@ MainWindow::MainWindow(QWidget *parent) #if defined(OEM_HANWANG) this->setWindowIcon(QIcon(":images/image_rsc/logo/Hanvon_logo1.ico")); this->setWindowTitle(tr("HanvonScan")); -#elif defined(OEM_LISICHEN) +#elif defined(OEM_LISICHENG) this->setWindowIcon(QIcon(":images/image_rsc/logo/Lanxum_logo.ico")); this->setWindowTitle(tr("LanxumScan")); #else @@ -240,7 +240,7 @@ MainWindow::MainWindow(QWidget *parent) if (password.isEmpty()) #if defined(OEM_HANWANG) m_password = "hanvonscan"; -#elif defined(OEM_LISICHEN) +#elif defined(OEM_LISICHENG) m_password = "lanxum"; #else m_password = "huagoscan"; @@ -2273,7 +2273,7 @@ void MainWindow::on_act_help_triggered() #if defined(HG_CMP_MSC) #if defined(OEM_HANWANG) QString filename = QApplication::applicationDirPath() + "/HanvonScan_App_Help_manual.pdf"; -#elif defined(OEM_LISICHEN) +#elif defined(OEM_LISICHENG) QString filename = QApplication::applicationDirPath() + "/Lanxum_App_Help_manual.pdf"; #else QString filename = QApplication::applicationDirPath() + "/HuaGoScan_App_Help_manual.pdf"; @@ -2281,7 +2281,7 @@ void MainWindow::on_act_help_triggered() #else #if defined(OEM_HANWANG) QString filename = "/opt/apps/com.huagaochina.huagoscan/entries/help/HanvonScan_App_Help_manual.pdf"; -#elif defined(OEM_LISICHEN) +#elif defined(OEM_LISICHENG) QString filename = "/opt/apps/com.huagaochina.huagoscan/entries/help/Lanxum_App_Help_manual.pdf"; #else QString filename = "/opt/apps/com.huagaochina.huagoscan/entries/help/HuaGoScan_App_Help_manual.pdf";