实现扫描到对话框上的全部功能,与旧版本统一
This commit is contained in:
parent
461158e30e
commit
b729bbaa4d
|
@ -690,8 +690,6 @@ 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)
|
||||
|
@ -709,15 +707,6 @@ void MainWindow::on_new_image(void *img)
|
|||
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);
|
||||
|
@ -748,8 +737,28 @@ void MainWindow::on_new_image(void *img)
|
|||
}
|
||||
else if (2 == m_scanType)
|
||||
{
|
||||
++m_aquireIntoPageIndex;
|
||||
if ((1 == m_aquireIntoSaveParam.m_fileNameOddEventType && 1 != m_aquireIntoPageIndex % 2)
|
||||
|| (2 == m_aquireIntoSaveParam.m_fileNameOddEventType && 0 != m_aquireIntoPageIndex % 2))
|
||||
{
|
||||
HGBase_DestroyImage(image);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_aquireIntoSaveParam.m_isSaveAsMultiPage)
|
||||
{
|
||||
if (1 == m_aquireIntoSaveParam.m_multiPagesType && m_aquireIntoMultiPageCount == m_aquireIntoSaveParam.m_customMultiPages)
|
||||
{
|
||||
if (nullptr != m_scanImgFmtWriter)
|
||||
{
|
||||
HGImgFmt_CloseImageWriter(m_scanImgFmtWriter);
|
||||
m_scanImgFmtWriter = nullptr;
|
||||
m_thumb->addItem(m_scanFileName);
|
||||
m_scanFileName.clear();
|
||||
++m_aquireIntoSaveParam.m_fileNameStartIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (nullptr == m_scanImgFmtWriter)
|
||||
{
|
||||
assert(m_scanFileName.isEmpty());
|
||||
|
@ -789,6 +798,7 @@ void MainWindow::on_new_image(void *img)
|
|||
saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_JPEG;
|
||||
saveInfo.tiffJpegQuality = (HGUInt)m_aquireIntoSaveParam.m_tiffQuality;
|
||||
HGImgFmt_SaveImageToWriter(m_scanImgFmtWriter, image, &saveInfo);
|
||||
++m_aquireIntoMultiPageCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -797,9 +807,42 @@ void MainWindow::on_new_image(void *img)
|
|||
assert(nullptr == m_scanImgFmtWriter);
|
||||
|
||||
QString savePath = m_aquireIntoSaveParam.m_savePath;
|
||||
if (m_aquireIntoSaveParam.m_isUseSubfolderByBlankPages)
|
||||
{
|
||||
HGBool isBlank = HGFALSE;
|
||||
HGImgProc_ImageBlankCheck(image, nullptr, &isBlank);
|
||||
if (isBlank)
|
||||
{
|
||||
m_aquireIntoInBlank = true;
|
||||
HGBase_DestroyImage(image);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_aquireIntoInBlank)
|
||||
{
|
||||
++m_aquireIntoBatchStartIndex;
|
||||
}
|
||||
|
||||
m_aquireIntoInBlank = false;
|
||||
}
|
||||
|
||||
char batchDir[20];
|
||||
sprintf(batchDir, "batch%d", m_aquireIntoBatchStartIndex);
|
||||
savePath = getStdFileName(savePath + batchDir + "/");
|
||||
}
|
||||
|
||||
if (m_aquireIntoSaveParam.m_isUseSubfolderByColor)
|
||||
{
|
||||
savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + colorModeName + "/");
|
||||
QString colorModeName = StdStringToUtf8("未知").c_str();
|
||||
HGImageInfo imgInfo;
|
||||
HGBase_GetImageInfo(image, &imgInfo);
|
||||
if (HGBASE_IMGTYPE_RGB == imgInfo.type)
|
||||
colorModeName = StdStringToUtf8("彩色").c_str();
|
||||
else if (HGBASE_IMGTYPE_GRAY == imgInfo.type)
|
||||
colorModeName = StdStringToUtf8("灰度").c_str();
|
||||
|
||||
savePath = getStdFileName(savePath + colorModeName + "/");
|
||||
}
|
||||
|
||||
HGBase_CreateDir(getStdString(savePath).c_str());
|
||||
|
@ -2444,14 +2487,19 @@ void MainWindow::on_act_acquireInto_triggered()
|
|||
m_singleScan = false;
|
||||
m_scanType = 2;
|
||||
m_aquireIntoSaveParam = dlg.getSaveParam();
|
||||
m_aquireIntoInBlank = true;
|
||||
m_aquireIntoBatchStartIndex = 0;
|
||||
m_aquireIntoPageIndex = 0;
|
||||
m_aquireIntoMultiPageCount = 0;
|
||||
|
||||
QDateTime dateTime = QDateTime::currentDateTime();
|
||||
if (m_aquireIntoSaveParam.m_isUseSubfolderByTime)
|
||||
{
|
||||
QDate date = QDate::currentDate();
|
||||
QString newSavePath = m_aquireIntoSaveParam.m_savePath + date.toString("yyyy-MM-dd") + "/";
|
||||
m_aquireIntoSaveParam.m_savePath = getStdFileName(newSavePath);
|
||||
m_aquireIntoSaveParam.m_savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + dateTime.toString("yyyy-MM-dd") + "/");
|
||||
}
|
||||
|
||||
m_aquireIntoSaveParam.m_savePath = getStdFileName(m_aquireIntoSaveParam.m_savePath + dateTime.toString("yyyyMMddhhmmss") + "/");
|
||||
|
||||
if (!startSpaceCheck(this))
|
||||
{
|
||||
m_dialogLog->updateStatus(cur_dev_.is_online() && 0 != m_scanType, m_isScanning);
|
||||
|
|
|
@ -238,6 +238,10 @@ private:
|
|||
QString m_scanFileName;
|
||||
HGImgFmtWriter m_scanImgFmtWriter;
|
||||
AquireIntoSaveParam m_aquireIntoSaveParam;
|
||||
bool m_aquireIntoInBlank;
|
||||
int m_aquireIntoBatchStartIndex;
|
||||
int m_aquireIntoPageIndex;
|
||||
int m_aquireIntoMultiPageCount;
|
||||
bool m_isScanning;
|
||||
|
||||
class HGLineEdit* m_multiPageLineEdit;
|
||||
|
|
Loading…
Reference in New Issue