解决国产系统扫描流程不报错和只有一台设备时选择源不弹窗的问题

This commit is contained in:
yangjiaxuan 2023-08-01 17:16:55 +08:00
parent aa6b788d98
commit eb4f37e48a
2 changed files with 19 additions and 14 deletions

View File

@ -176,20 +176,20 @@ class DeviceUser* DeviceUserMgr::OpenDeviceUser()
QMessageBox::information(m_wnd, tr("tips"), tr("no device"));
return nullptr;
}
else if (1 == devCount)
{
HGChar errInfo[256];
HGSaneDevice dev = nullptr;
HGSane_OpenDevice(source, 0, &dev, errInfo, 256);
if (nullptr == dev)
{
HGSane_CloseSource(source);
QMessageBox::information(m_wnd, tr("tips"), QString::fromUtf8(errInfo));
return nullptr;
}
// else if (1 == devCount)
// {
// HGChar errInfo[256];
// HGSaneDevice dev = nullptr;
// HGSane_OpenDevice(source, 0, &dev, errInfo, 256);
// if (nullptr == dev)
// {
// HGSane_CloseSource(source);
// QMessageBox::information(m_wnd, tr("tips"), QString::fromUtf8(errInfo));
// return nullptr;
// }
return new DeviceUser(m_wnd, source, dev, m_password);
}
// return new DeviceUser(m_wnd, source, dev, m_password);
// }
HGSaneDevice dev = nullptr;
HGSane_OpenSelectedDevice(source, m_wnd, &dev);

View File

@ -225,10 +225,15 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
}
SANE_Status stat3 = p->m_saneAPI.sane_start_api(p->m_saneDev);
if (SANE_STATUS_GOOD != stat3)
if (SANE_STATUS_NO_DOCS == stat3)
{
emit p->eventFunc(0, tr("Scan complete"));
break;
}
else if (SANE_STATUS_GOOD != stat3)
{
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(stat3)));
break;
}
}
}