解决国产系统上sane-user的编译问题

This commit is contained in:
luoliangyi 2023-05-23 14:52:45 +08:00
parent 8350e95a20
commit e93c519014
9 changed files with 33 additions and 20 deletions

View File

@ -150,7 +150,12 @@ HGResult DeviceUser::ShowSettingDlg()
HGResult DeviceUser::StartScan()
{
return HGSane_StartDeviceWithUI(m_saneDev, m_wnd, DeviceImageFunc, this);
return HGSane_StartDevice(m_saneDev, m_wnd, DeviceEventFunc, this, DeviceImageFunc, this);
}
void HGAPI DeviceUser::DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param)
{
}
void HGAPI DeviceUser::DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param)

View File

@ -88,6 +88,7 @@ public:
HGResult StartScan();
private:
static void HGAPI DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param);
static void HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param);
signals:

View File

@ -212,12 +212,12 @@ HGResult DeviceUser::ShowSettingDlg()
HGResult DeviceUser::StartScan()
{
return HGSane_StartDeviceWithUI(m_saneDev, m_wnd, DeviceImageFunc, this);
return HGSane_StartDevice(m_saneDev, m_wnd, DeviceEventFunc, this, DeviceImageFunc, this);
}
HGResult DeviceUser::StartSingleScan()
{
return HGSane_StartDeviceWithSingleScan(m_saneDev, m_wnd, DeviceImageFunc, this);
return HGSane_StartDeviceWithSingleScan(m_saneDev, m_wnd, DeviceEventFunc, this, DeviceImageFunc, this);
}
HGResult DeviceUser::GetDeviceCustomInfo(HGSaneDeviceCustomInfo *info)
@ -270,6 +270,11 @@ HGResult DeviceUser::ClearDeviceLog()
return HGSane_ClearDeviceLog(m_saneDev);
}
void HGAPI DeviceUser::DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param)
{
}
void HGAPI DeviceUser::DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param)
{
DeviceUser* p = (DeviceUser*)param;

View File

@ -109,6 +109,7 @@ public:
HGResult ClearDeviceLog();
private:
static void HGAPI DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param);
static void HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param);
signals:

View File

@ -301,8 +301,8 @@ HGResult HGAPI HGSane_ClearDeviceLog(HGSaneDevice dev)
return saneDeviceImpl->ClearDeviceLog();
}
HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam)
HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam)
{
if (NULL == dev)
{
@ -313,8 +313,8 @@ HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGWindow parent, HGDSEventFu
return saneDeviceImpl->Start(parent, eventFunc, eventParam, imageFunc, imageParam);
}
HGResult HGAPI HGSane_StartDeviceWithSingleScan(HGSaneDevice dev, HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam)
HGResult HGAPI HGSane_StartDeviceWithSingleScan(HGSaneDevice dev, HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam)
{
if (NULL == dev)
{

View File

@ -90,10 +90,10 @@ HGEXPORT HGResult HGAPI HGSane_GetDeviceLog(HGSaneDevice dev, const HGChar *file
HGEXPORT HGResult HGAPI HGSane_ClearDeviceLog(HGSaneDevice dev);
HGEXPORT HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam);
HGEXPORT HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam);
HGEXPORT HGResult HGAPI HGSane_StartDeviceWithSingleScan(HGSaneDevice dev, HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam);
HGEXPORT HGResult HGAPI HGSane_StartDeviceWithSingleScan(HGSaneDevice dev, HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam);
#endif /* __HGSANE_H__ */

View File

@ -724,8 +724,8 @@ HGResult HGSaneDeviceImpl::ShowSettingDlg(HGWindow parent)
return HGBASE_ERR_OK;
}
HGResult HGSaneDeviceImpl::Start(HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam)
HGResult HGSaneDeviceImpl::Start(HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam)
{
HGResult ret = GetValueInt32(0x8818, &m_dpi);
if (HGBASE_ERR_OK != ret)
@ -748,8 +748,8 @@ HGResult HGSaneDeviceImpl::Start(HGWindow parent, HGDSEventFunc eventFunc, HGPoi
return HGBASE_ERR_OK;
}
HGResult HGSaneDeviceImpl::StartWithSingleScan(HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam)
HGResult HGSaneDeviceImpl::StartWithSingleScan(HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam)
{
HGChar scanMode[256] = {0};
HGResult ret = GetValueStr256(0x882E, scanMode, 256);

View File

@ -82,10 +82,10 @@ public:
HGResult ClearDriverLog();
HGResult GetDeviceLog(const HGChar *fileName);
HGResult ClearDeviceLog();
HGResult Start(HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam);
HGResult StartWithSingleScan(HGWindow parent, HGDSEventFunc eventFunc, HGPointer eventParam,
HGDSImageFunc imageFunc, HGPointer imageParam);
HGResult Start(HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam);
HGResult StartWithSingleScan(HGWindow parent, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam);
private:
HGResult SetValueInt32(HGUInt optionId, HGInt value);

View File

@ -182,7 +182,8 @@ int show_scan_ui(const SANEAPI* saneApi, SANE_Handle handle, const char *devName
translator.load(":translation/SaneUI_zh_CN.qm");
QCoreApplication::installTranslator(&translator);
Dialog_Device_Scan dlg(saneApi, handle, devName, callback, callbackParam, qParent);
Dialog_Device_Scan dlg(saneApi, handle, devName, eventCallback, eventParam,
imageCallback, imageParam, qParent);
dlg.exec();
QCoreApplication::removeTranslator(&translator);
return 0;