解决HGSaneUser库在linux上的编译问题
This commit is contained in:
parent
80a407939f
commit
44a16deae0
|
@ -71,7 +71,7 @@ DeviceUserMgr::DeviceUserMgr(QWidget *wnd)
|
|||
{
|
||||
m_wnd = wnd;
|
||||
m_saneMgr = nullptr;
|
||||
HGSane_CreateManager("sane.dll", &m_saneMgr);
|
||||
HGSane_CreateManager(&m_saneMgr);
|
||||
}
|
||||
|
||||
DeviceUserMgr::~DeviceUserMgr()
|
||||
|
@ -82,20 +82,26 @@ DeviceUserMgr::~DeviceUserMgr()
|
|||
|
||||
class DeviceUser* DeviceUserMgr::OpenDeviceUser()
|
||||
{
|
||||
HGSaneDevice dev = nullptr;
|
||||
#ifdef HG_CMP_MSC
|
||||
HGSane_OpenSelectedDevice(m_saneMgr, (HWND)m_wnd->winId(), &dev);
|
||||
#else
|
||||
HGSane_OpenSelectedDevice(m_saneMgr, m_wnd, &dev);
|
||||
#endif
|
||||
if (nullptr == dev)
|
||||
HGSaneSource source = nullptr;
|
||||
HGSane_OpenSelectedSource(m_saneMgr, m_wnd, &source);
|
||||
if (nullptr == source)
|
||||
return nullptr;
|
||||
return new DeviceUser(m_wnd, dev);
|
||||
|
||||
HGSaneDevice dev = nullptr;
|
||||
HGSane_OpenSelectedDevice(source, m_wnd, &dev);
|
||||
if (nullptr == dev)
|
||||
{
|
||||
HGSane_CloseSource(source);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new DeviceUser(m_wnd, source, dev);
|
||||
}
|
||||
|
||||
DeviceUser::DeviceUser(QWidget *wnd, HGSaneDevice dev)
|
||||
DeviceUser::DeviceUser(QWidget *wnd, HGSaneSource source, HGSaneDevice dev)
|
||||
{
|
||||
m_wnd = wnd;
|
||||
m_source = source;
|
||||
m_saneDev = dev;
|
||||
}
|
||||
|
||||
|
@ -103,6 +109,8 @@ DeviceUser::~DeviceUser()
|
|||
{
|
||||
HGSane_CloseDevice(m_saneDev);
|
||||
m_saneDev = nullptr;
|
||||
HGSane_CloseSource(m_source);
|
||||
m_source = nullptr;
|
||||
}
|
||||
|
||||
QString DeviceUser::GetName()
|
||||
|
@ -114,20 +122,12 @@ QString DeviceUser::GetName()
|
|||
|
||||
HGResult DeviceUser::ShowSettingDlg()
|
||||
{
|
||||
#ifdef HG_CMP_MSC
|
||||
return HGSane_ShowDeviceSettingDlg(m_saneDev, (HWND)m_wnd->winId());
|
||||
#else
|
||||
return HGSane_ShowDeviceSettingDlg(m_saneDev, m_wnd);
|
||||
#endif
|
||||
}
|
||||
|
||||
HGResult DeviceUser::StartScan()
|
||||
{
|
||||
#ifdef HG_CMP_MSC
|
||||
return HGSane_StartDeviceWithUI(m_saneDev, (HWND)m_wnd->winId(), DeviceImageFunc, this);
|
||||
#else
|
||||
return HGSane_StartDeviceWithUI(m_saneDev, m_wnd, DeviceImageFunc, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void HGAPI DeviceUser::DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param)
|
||||
|
|
|
@ -75,7 +75,7 @@ class DeviceUser : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
friend class DeviceUserMgr;
|
||||
DeviceUser(QWidget *wnd, HGSaneDevice dev);
|
||||
DeviceUser(QWidget *wnd, HGSaneSource source, HGSaneDevice dev);
|
||||
public:
|
||||
~DeviceUser();
|
||||
|
||||
|
@ -94,6 +94,7 @@ signals:
|
|||
|
||||
private:
|
||||
QWidget *m_wnd;
|
||||
HGSaneSource m_source;
|
||||
HGSaneDevice m_saneDev;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,8 @@ HGResult HGSaneManagerImpl::OpenSelectedSource(HGWindow parent, class HGSaneSour
|
|||
f_sane_init fInit = NULL;
|
||||
f_sane_exit fExit = NULL;
|
||||
SANEAPI saneAPI;
|
||||
if (-2 == show_srclist_ui(parent, &dll, &fInit, &fExit, &saneAPI))
|
||||
char manuName[256];
|
||||
if (-2 == show_srclist_ui(parent, &dll, &fInit, &fExit, &saneAPI, manuName, 256))
|
||||
{
|
||||
return HGBASE_ERR_NOTSUPPORT;
|
||||
}
|
||||
|
@ -92,7 +93,7 @@ HGResult HGSaneManagerImpl::OpenSelectedSource(HGWindow parent, class HGSaneSour
|
|||
}
|
||||
|
||||
HGSaneSourceImpl* newSourceImpl = new HGSaneSourceImpl(this);
|
||||
HGResult ret = newSourceImpl->Init(dll, fInit, fExit, &saneAPI);
|
||||
HGResult ret = newSourceImpl->Init(manuName, dll, fInit, fExit, &saneAPI);
|
||||
if (HGBASE_ERR_OK != ret)
|
||||
{
|
||||
delete newSourceImpl;
|
||||
|
|
|
@ -13,7 +13,8 @@ extern HINSTANCE g_hInst;
|
|||
extern bool g_ownApplication;
|
||||
#endif
|
||||
|
||||
int show_srclist_ui(HGWindow parent, HGDll *dll, f_sane_init *fInit, f_sane_exit *fExit, SANEAPI* saneApi)
|
||||
int show_srclist_ui(HGWindow parent, HGDll *dll, f_sane_init *fInit, f_sane_exit *fExit,
|
||||
SANEAPI* saneApi, char *manuName, unsigned int maxLen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@ typedef SANE_Status (*f_sane_init)(SANE_Int* version_code, SANE_Auth_Callback au
|
|||
typedef void (*f_sane_exit)(void);
|
||||
typedef void (*show_scan_ui_image_callback)(const SANE_Parameters *imageFormat, const SANE_Byte *imageData, void * callbackParam);
|
||||
|
||||
HGEXPORT int show_srclist_ui(HGWindow parent, HGDll *dll, f_sane_init *fInit, f_sane_exit *fExit, SANEAPI* saneApi);
|
||||
HGEXPORT int show_srclist_ui(HGWindow parent, HGDll *dll, f_sane_init *fInit, f_sane_exit *fExit,
|
||||
SANEAPI* saneApi, char *manuName, unsigned int maxLen);
|
||||
HGEXPORT int show_devlist_ui(const SANEAPI* saneApi, HGWindow parent, SANE_Handle *handle, char *devName, unsigned int maxLen);
|
||||
HGEXPORT int show_setting_ui(const SANEAPI* saneApi, SANE_Handle handle, const char *devName, HGWindow parent);
|
||||
HGEXPORT int show_scan_ui(const SANEAPI* saneApi, SANE_Handle handle, const char *devName, HGWindow parent,
|
||||
|
|
Loading…
Reference in New Issue