sane双张提示只弹窗一次

This commit is contained in:
yangjiaxuan 2023-10-18 10:48:29 +08:00
parent 5536b0a932
commit 5b85b3ef02
3 changed files with 8 additions and 2 deletions

View File

@ -216,6 +216,7 @@ DeviceUser::DeviceUser(QWidget *wnd, HGSaneSource source, const QString &passwor
m_source = source; m_source = source;
m_saneDev = nullptr; m_saneDev = nullptr;
m_password = password; m_password = password;
m_reserveImage = false;
} }
DeviceUser::~DeviceUser() DeviceUser::~DeviceUser()
@ -366,6 +367,7 @@ void HGAPI DeviceUser::DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer
if (HGSANE_EVENT_TYPE_SCANFINISHED == event) if (HGSANE_EVENT_TYPE_SCANFINISHED == event)
{ {
emit p->scanFinishEvent(); emit p->scanFinishEvent();
p->m_reserveImage = false;
} }
else if (HGSANE_EVENT_TYPE_WORKING == event) else if (HGSANE_EVENT_TYPE_WORKING == event)
{ {
@ -377,13 +379,14 @@ HGUInt HGAPI DeviceUser::DeviceImageFunc(HGSaneDevice dev, HGImage image, HGUInt
{ {
DeviceUser* p = (DeviceUser*)param; DeviceUser* p = (DeviceUser*)param;
HGUInt result = HGBASE_ERR_OK; HGUInt result = HGBASE_ERR_OK;
if (HGSANE_IMAGE_TYPE_DOUBLE == type) if (HGSANE_IMAGE_TYPE_DOUBLE == type && !p->m_reserveImage)
{ {
emit p->abnormalImage(image, &result); emit p->abnormalImage(image, &result);
} }
if (HGBASE_ERR_OK == result) if (HGBASE_ERR_OK == result)
{ {
p->m_reserveImage = true;
emit p->newImage(image); emit p->newImage(image);
} }
else else

View File

@ -133,6 +133,8 @@ private:
HGSaneSource m_source; HGSaneSource m_source;
HGSaneDevice m_saneDev; HGSaneDevice m_saneDev;
QString m_password; QString m_password;
bool m_reserveImage;
}; };
#endif #endif

View File

@ -7,8 +7,9 @@ Dialog_AbnormalImage::Dialog_AbnormalImage(HGImage image, QWidget *parent) :
ui(new Ui::Dialog_AbnormalImage) ui(new Ui::Dialog_AbnormalImage)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint);
m_result = HGBASE_ERR_OK; m_result = HGBASE_ERR_FAIL;
m_view = new HGImgView(this); m_view = new HGImgView(this);
m_view->addImage(image); m_view->addImage(image);