From dc0acb42a7a4c034356fb9a160a00b38f903275e Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Sat, 14 May 2022 13:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E6=8F=8F=E8=87=B3=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E4=B8=AD=E5=AE=9E=E7=8E=B0=E9=A2=9C=E8=89=B2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=AD=90=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scanner/mainwindow.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index dd4950c0..7d8fa041 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -690,6 +690,8 @@ void MainWindow::on_new_image(void *img) HGImage image = (HGImage)img; HGUInt dpi = 96; + QString colorModeName = QString(OPTION_VALUE_YSMS_24WCS); + SANE_Int num_dev_options = 0; sane_control_option(cur_dev_.handle(), 0, SANE_ACTION_GET_VALUE, &num_dev_options, nullptr); for (int i = 1; i < num_dev_options; ++i) @@ -698,21 +700,24 @@ void MainWindow::on_new_image(void *img) if (nullptr == desp) continue; - std::string title = Utf8ToStdString(desp->title); - TrimString(title); - HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "title=%s", title.c_str()); - if (SANE_TYPE_INT == desp->type) { SANE_Int value = 0; sane_control_option(cur_dev_.handle(), i, SANE_ACTION_GET_VALUE, &value, nullptr); - HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, " valueType=INT, value=%d", value); - - if (0 == strcmp(title.c_str(), "分辨率")) + if (0 == strcmp(desp->title, OPTION_TITLE_FBL)) { dpi = (HGUInt)value; } } + else if (SANE_TYPE_STRING == desp->type) + { + SANE_Char value[256]; + sane_control_option(cur_dev_.handle(), i, SANE_ACTION_GET_VALUE, value, nullptr); + if (0 == strcmp(desp->title, OPTION_TITLE_YSMS)) + { + colorModeName = QString(value); + } + } } HGBase_SetImageDpi(image, dpi, dpi); @@ -790,12 +795,19 @@ void MainWindow::on_new_image(void *img) { assert(m_scanFileName.isEmpty()); assert(nullptr == m_scanImgFmtWriter); - HGBase_CreateDir(getStdString(m_aquireIntoSaveParam.m_savePath).c_str()); + + QString savePath = m_aquireIntoSaveParam.m_savePath; + if (m_aquireIntoSaveParam.m_isUseSubfolderByColor) + { + savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + colorModeName + "/"); + } + + HGBase_CreateDir(getStdString(savePath).c_str()); QString scanFileName; while (1) { - scanFileName = QString(tr("%1%2%3.%4")).arg(m_aquireIntoSaveParam.m_savePath) + scanFileName = QString(tr("%1%2%3.%4")).arg(savePath) .arg(m_aquireIntoSaveParam.m_fileNamePrefix) .arg(m_aquireIntoSaveParam.m_fileNameStartIndex, m_aquireIntoSaveParam.m_fileNameDigits, 10, QLatin1Char('0')) .arg(m_aquireIntoSaveParam.m_fileNameExt);