sane_user中提供设置对话框的接口
This commit is contained in:
parent
f57b75e92e
commit
2fb6bcc3fb
|
@ -3,7 +3,7 @@
|
|||
#include "dialog_device_scan.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
#if 0
|
||||
#ifdef HG_CMP_MSC
|
||||
|
||||
DeviceUserMgr::DeviceUserMgr(QWidget *wnd)
|
||||
{
|
||||
|
@ -104,8 +104,11 @@ DeviceUser::~DeviceUser()
|
|||
|
||||
HGResult DeviceUser::ShowSettingDlg()
|
||||
{
|
||||
// 弹出配置对话框
|
||||
return HGBASE_ERR_OK;
|
||||
#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()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "base/HGDef.h"
|
||||
#include <QDialog>
|
||||
|
||||
#if 0
|
||||
#ifdef HG_CMP_MSC
|
||||
#include "twain_user/HGTwain.h"
|
||||
|
||||
class DeviceUserMgr : public QObject
|
||||
|
@ -15,7 +15,7 @@ public:
|
|||
DeviceUserMgr(QWidget *wnd);
|
||||
~DeviceUserMgr();
|
||||
|
||||
// 弹出设备选择对话框,sane选择设备,twain选择twain源
|
||||
// 弹出设备选择对话框,选择twain源
|
||||
class DeviceUser* OpenDeviceUser();
|
||||
|
||||
private:
|
||||
|
@ -50,7 +50,6 @@ private:
|
|||
};
|
||||
|
||||
#else
|
||||
|
||||
#include "sane_user/HGSane.h"
|
||||
|
||||
class DeviceUserMgr : public QObject
|
||||
|
@ -61,7 +60,7 @@ public:
|
|||
DeviceUserMgr(QWidget *wnd);
|
||||
~DeviceUserMgr();
|
||||
|
||||
// 弹出设备选择对话框,sane选择设备,twain选择twain源
|
||||
// 弹出设备选择对话框,选择设备
|
||||
class DeviceUser* OpenDeviceUser();
|
||||
|
||||
private:
|
||||
|
|
|
@ -8,6 +8,6 @@ HGSane_GetDeviceCount
|
|||
HGSane_GetDeviceName
|
||||
HGSane_OpenDevice
|
||||
HGSane_CloseDevice
|
||||
HGSane_GetDeviceHandle
|
||||
HGSane_ShowDeviceSettingDlg
|
||||
HGSane_StartDevice
|
||||
HGSane_StopDevice
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
CImageApply::CImageApply(void)
|
||||
{
|
||||
#if 0
|
||||
std::cout << "cv::useOptimized():" << cv::useOptimized() << std::endl;
|
||||
std::cout << "HardwareSupport(CV_CPU_MMX): " << cv::checkHardwareSupport(CV_CPU_MMX) << std::endl;
|
||||
std::cout << "HardwareSupport(CV_CPU_SSE): " << cv::checkHardwareSupport(CV_CPU_SSE) << std::endl;
|
||||
|
@ -44,9 +45,11 @@ CImageApply::CImageApply(void)
|
|||
std::cout << "HardwareSupport(CV_CPU_AVX512_CNL): " << cv::checkHardwareSupport(CV_CPU_AVX512_CNL) << std::endl;
|
||||
std::cout << "HardwareSupport(CV_CPU_AVX512_CLX): " << cv::checkHardwareSupport(CV_CPU_AVX512_CLX) << std::endl;
|
||||
std::cout << "HardwareSupport(CV_CPU_AVX512_ICL): " << cv::checkHardwareSupport(CV_CPU_AVX512_ICL) << std::endl;
|
||||
|
||||
#endif
|
||||
cv::setUseOptimized(false);
|
||||
#if 0
|
||||
std::cout << "cv::useOptimized():" << cv::useOptimized() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
CImageApply::~CImageApply(void)
|
||||
|
|
|
@ -90,7 +90,11 @@ HGResult HGAPI HGSane_CloseDevice(HGSaneDevice dev)
|
|||
return saneDeviceImpl->Close();
|
||||
}
|
||||
|
||||
HGResult HGAPI HGSane_GetDeviceHandle(HGSaneDevice dev, SANE_Handle* handle)
|
||||
#ifdef HG_CMP_MSC
|
||||
HGResult HGAPI HGSane_ShowDeviceSettingDlg(HGSaneDevice dev, HWND parent)
|
||||
#else
|
||||
HGResult HGAPI HGSane_ShowDeviceSettingDlg(HGSaneDevice dev, class QWidget* parent)
|
||||
#endif
|
||||
{
|
||||
if (NULL == dev)
|
||||
{
|
||||
|
@ -98,7 +102,7 @@ HGResult HGAPI HGSane_GetDeviceHandle(HGSaneDevice dev, SANE_Handle* handle)
|
|||
}
|
||||
|
||||
HGSaneDeviceImpl* saneDeviceImpl = (HGSaneDeviceImpl*)dev;
|
||||
return saneDeviceImpl->GetHandle(handle);
|
||||
return saneDeviceImpl->ShowSettingDlg(parent);
|
||||
}
|
||||
|
||||
HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "../base/HGBaseErr.h"
|
||||
#include "HGSaneErr.h"
|
||||
#include "../base/HGImage.h"
|
||||
#include "sane.h"
|
||||
|
||||
HG_DECLARE_HANDLE(HGSaneManager);
|
||||
HG_DECLARE_HANDLE(HGSaneDevice);
|
||||
|
@ -27,7 +26,11 @@ HGEXPORT HGResult HGAPI HGSane_OpenDevice(HGSaneManager mgr, HGUInt index, HGSan
|
|||
|
||||
HGEXPORT HGResult HGAPI HGSane_CloseDevice(HGSaneDevice dev);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGSane_GetDeviceHandle(HGSaneDevice dev, SANE_Handle *handle);
|
||||
#ifdef HG_CMP_MSC
|
||||
HGEXPORT HGResult HGAPI HGSane_ShowDeviceSettingDlg(HGSaneDevice dev, HWND parent);
|
||||
#else
|
||||
HGEXPORT HGResult HGAPI HGSane_ShowDeviceSettingDlg(HGSaneDevice dev, class QWidget* parent);
|
||||
#endif
|
||||
|
||||
HGEXPORT HGResult HGAPI HGSane_StartDevice(HGSaneDevice dev, HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
|
||||
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam, HGChar* errInfo, HGUInt errInfoLen);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
HGSaneManagerImpl::HGSaneManagerImpl()
|
||||
{
|
||||
m_dll = NULL;
|
||||
m_saneDlgDll = NULL;
|
||||
m_f_sane_init = NULL;
|
||||
m_f_sane_exit = NULL;
|
||||
m_f_sane_get_devices = NULL;
|
||||
|
@ -17,6 +18,7 @@ HGSaneManagerImpl::HGSaneManagerImpl()
|
|||
m_f_sane_get_parameters = NULL;
|
||||
m_f_sane_get_option_descriptor = NULL;
|
||||
m_f_sane_control_option = NULL;
|
||||
m_f_show_setting_ui = NULL;
|
||||
}
|
||||
|
||||
HGSaneManagerImpl::~HGSaneManagerImpl()
|
||||
|
@ -42,8 +44,16 @@ HGResult HGSaneManagerImpl::Create(const HGChar* sanePath)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HGBase_CreateDll("HGSaneDlg.dll", &m_saneDlgDll);
|
||||
if (NULL != m_saneDlgDll)
|
||||
{
|
||||
HGBase_GetDllProcAddress(m_saneDlgDll, "show_setting_ui", (HGPointer*)&m_f_show_setting_ui);
|
||||
}
|
||||
|
||||
if (SANE_STATUS_GOOD != m_f_sane_init(NULL, NULL))
|
||||
{
|
||||
HGBase_DestroyDll(m_saneDlgDll);
|
||||
m_saneDlgDll = NULL;
|
||||
HGBase_DestroyDll(m_dll);
|
||||
m_dll = NULL;
|
||||
return HGSANE_ERR_FAIL;
|
||||
|
@ -62,6 +72,9 @@ HGResult HGSaneManagerImpl::Destroy()
|
|||
}
|
||||
|
||||
m_f_sane_exit();
|
||||
|
||||
HGBase_DestroyDll(m_saneDlgDll);
|
||||
m_saneDlgDll = NULL;
|
||||
HGBase_DestroyDll(m_dll);
|
||||
m_dll = NULL;
|
||||
return HGBASE_ERR_OK;
|
||||
|
@ -290,14 +303,18 @@ HGResult HGSaneDeviceImpl::Close()
|
|||
return HGBASE_ERR_OK;
|
||||
}
|
||||
|
||||
HGResult HGSaneDeviceImpl::GetHandle(SANE_Handle* handle)
|
||||
#ifdef HG_CMP_MSC
|
||||
HGResult HGSaneDeviceImpl::ShowSettingDlg(HWND parent)
|
||||
#else
|
||||
HGResult HGSaneDeviceImpl::ShowSettingDlg(class QWidget* parent)
|
||||
#endif
|
||||
{
|
||||
if (NULL == handle)
|
||||
if (NULL == m_mgrImpl->m_f_show_setting_ui)
|
||||
{
|
||||
return HGBASE_ERR_INVALIDARG;
|
||||
return HGBASE_ERR_FAIL;
|
||||
}
|
||||
|
||||
*handle = m_devHandle;
|
||||
m_mgrImpl->m_f_show_setting_ui(m_devHandle, parent);
|
||||
return HGBASE_ERR_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,11 @@ typedef SANE_String_Const (*f_sane_strstatus)(SANE_Status status);
|
|||
typedef SANE_Status (*f_sane_get_parameters)(SANE_Handle handle, SANE_Parameters* params);
|
||||
typedef SANE_Option_Descriptor* (*f_sane_get_option_descriptor)(SANE_Handle handle, SANE_Int option);
|
||||
typedef SANE_Status (*f_sane_control_option)(SANE_Handle handle, SANE_Int option, SANE_Action action, void* value, SANE_Int* info);
|
||||
#ifdef HG_CMP_MSC
|
||||
typedef void (*f_show_setting_ui)(SANE_Handle handle, HWND parent);
|
||||
#else
|
||||
typedef void (*f_show_setting_ui)(SANE_Handle handle, class QWidget* parent);
|
||||
#endif
|
||||
|
||||
class HGSaneManagerImpl
|
||||
{
|
||||
|
@ -44,6 +49,7 @@ private:
|
|||
|
||||
private:
|
||||
HGDll m_dll;
|
||||
HGDll m_saneDlgDll;
|
||||
f_sane_init m_f_sane_init;
|
||||
f_sane_exit m_f_sane_exit;
|
||||
f_sane_get_devices m_f_sane_get_devices;
|
||||
|
@ -57,6 +63,7 @@ private:
|
|||
f_sane_get_parameters m_f_sane_get_parameters;
|
||||
f_sane_get_option_descriptor m_f_sane_get_option_descriptor;
|
||||
f_sane_control_option m_f_sane_control_option;
|
||||
f_show_setting_ui m_f_show_setting_ui;
|
||||
std::list<class HGSaneDeviceImpl*> m_listDeviceImpl;
|
||||
};
|
||||
|
||||
|
@ -68,7 +75,11 @@ public:
|
|||
|
||||
HGResult Open(const HGChar *devName, HGChar* errInfo, HGUInt errInfoLen);
|
||||
HGResult Close();
|
||||
HGResult GetHandle(SANE_Handle* handle);
|
||||
#ifdef HG_CMP_MSC
|
||||
HGResult ShowSettingDlg(HWND parent);
|
||||
#else
|
||||
HGResult ShowSettingDlg(class QWidget *parent);
|
||||
#endif
|
||||
HGResult Start(HGSane_DeviceEventFunc eventFunc, HGPointer eventParam,
|
||||
HGSane_DeviceImageFunc imageFunc, HGPointer imageParam, HGChar* errInfo, HGUInt errInfoLen);
|
||||
HGResult Stop();
|
||||
|
|
Loading…
Reference in New Issue