调整app扫描事件,删除demo工程
|
@ -1,110 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/translation">
|
||||
<file>Demo_zh_CN.qm</file>
|
||||
<file>qt_zh_CN.qm</file>
|
||||
<file>Demo_zh_EN.qm</file>
|
||||
</qresource>
|
||||
<qresource prefix="/images">
|
||||
<file>image_rsc/action/btnEmailScanedImages.png</file>
|
||||
<file>image_rsc/action/btnFitWindow.png</file>
|
||||
<file>image_rsc/action/btnFitWindowWidth.png</file>
|
||||
<file>image_rsc/action/btnHelp.png</file>
|
||||
<file>image_rsc/action/btnNext.png</file>
|
||||
<file>image_rsc/action/btnNextPage.png</file>
|
||||
<file>image_rsc/action/btnOriginalSize.png</file>
|
||||
<file>image_rsc/action/btnPrevious.png</file>
|
||||
<file>image_rsc/action/btnPreviousPage.png</file>
|
||||
<file>image_rsc/action/btnRotateLeft.png</file>
|
||||
<file>image_rsc/action/btnRotateRight.png</file>
|
||||
<file>image_rsc/action/btnSaveScanedImages.png</file>
|
||||
<file>image_rsc/action/btnScan.png</file>
|
||||
<file>image_rsc/action/btnScannerSetting.png</file>
|
||||
<file>image_rsc/action/btnZoomIn.png</file>
|
||||
<file>image_rsc/action/btnZoomOut.png</file>
|
||||
<file>image_rsc/actions/admin.png</file>
|
||||
<file>image_rsc/actions/close.png</file>
|
||||
<file>image_rsc/actions/contrast.png</file>
|
||||
<file>image_rsc/actions/curve.png</file>
|
||||
<file>image_rsc/actions/cut.png</file>
|
||||
<file>image_rsc/actions/fullscreen.png</file>
|
||||
<file>image_rsc/actions/help.png</file>
|
||||
<file>image_rsc/actions/nextfile.png</file>
|
||||
<file>image_rsc/actions/nextpage.png</file>
|
||||
<file>image_rsc/actions/open.png</file>
|
||||
<file>image_rsc/actions/previousfile.png</file>
|
||||
<file>image_rsc/actions/previouspage.png</file>
|
||||
<file>image_rsc/actions/print.png</file>
|
||||
<file>image_rsc/actions/redo.png</file>
|
||||
<file>image_rsc/actions/rotate-anticlockwise.png</file>
|
||||
<file>image_rsc/actions/rotate-clockwise.png</file>
|
||||
<file>image_rsc/actions/save.png</file>
|
||||
<file>image_rsc/actions/saveAs.png</file>
|
||||
<file>image_rsc/actions/scan.png</file>
|
||||
<file>image_rsc/actions/settings.png</file>
|
||||
<file>image_rsc/actions/sortpages.png</file>
|
||||
<file>image_rsc/actions/undo.png</file>
|
||||
<file>image_rsc/actions/zoom-fitscreen.png</file>
|
||||
<file>image_rsc/actions/zoom-fitwidth.png</file>
|
||||
<file>image_rsc/actions/zoom-in.png</file>
|
||||
<file>image_rsc/actions/zoom-origin.png</file>
|
||||
<file>image_rsc/actions/zoom-out.png</file>
|
||||
<file>image_rsc/adjust/Img_BightnessReduce.png</file>
|
||||
<file>image_rsc/adjust/Img_BrightnessIncrease.png</file>
|
||||
<file>image_rsc/adjust/Img_ContrastIncrease.png</file>
|
||||
<file>image_rsc/adjust/Img_ContrastReduce.png</file>
|
||||
<file>image_rsc/example/example_arrow.png</file>
|
||||
<file>image_rsc/example/example_black_after.png</file>
|
||||
<file>image_rsc/example/example_black_before.png</file>
|
||||
<file>image_rsc/example/example_crop_after.png</file>
|
||||
<file>image_rsc/example/example_deskew_after.png</file>
|
||||
<file>image_rsc/example/example_deskew_before.png</file>
|
||||
<file>image_rsc/example/example_fillblack_before.png</file>
|
||||
<file>image_rsc/example/example_fillblack_concave.png</file>
|
||||
<file>image_rsc/example/example_fillblack_convex.png</file>
|
||||
<file>image_rsc/example/example_fillcolor_auto.png</file>
|
||||
<file>image_rsc/example/example_fillcolor_before.png</file>
|
||||
<file>image_rsc/example/example_fillcolor_default.png</file>
|
||||
<file>image_rsc/fullscreen/btnNext.png</file>
|
||||
<file>image_rsc/fullscreen/btnPrevious.png</file>
|
||||
<file>image_rsc/logo/auge_logo.ico</file>
|
||||
<file>image_rsc/logo/Hanvon_logo1.ico</file>
|
||||
<file>image_rsc/logo/Hanvon_logo2.ico</file>
|
||||
<file>image_rsc/logo/HG_Logo.png</file>
|
||||
<file>image_rsc/logo/HUAGO-LOGO-for UI.jpg</file>
|
||||
<file>image_rsc/logo/HUAGO-LOGO-for UI.png</file>
|
||||
<file>image_rsc/logo/Lanxum_logo.ico</file>
|
||||
<file>image_rsc/logo/Cumtenn_logo.ico</file>
|
||||
<file>image_rsc/logo/logo.ico</file>
|
||||
<file>image_rsc/logo/NoBrand_logo.ico</file>
|
||||
<file>image_rsc/logo/RightWay_logo.ico</file>
|
||||
<file>image_rsc/logo/waiting.gif</file>
|
||||
<file>image_rsc/statusbar/statusBar_admin.png</file>
|
||||
<file>image_rsc/scroll/bottom_Hot.png</file>
|
||||
<file>image_rsc/scroll/bottom_Normal.png</file>
|
||||
<file>image_rsc/scroll/bottom_Push.png</file>
|
||||
<file>image_rsc/scroll/defItemImage.png</file>
|
||||
<file>image_rsc/scroll/hScrollImage.png</file>
|
||||
<file>image_rsc/scroll/hScrollSlider_Hot.png</file>
|
||||
<file>image_rsc/scroll/hScrollSlider_Normal.png</file>
|
||||
<file>image_rsc/scroll/hScrollSlider_Push.png</file>
|
||||
<file>image_rsc/scroll/left_Hot.png</file>
|
||||
<file>image_rsc/scroll/left_Normal.png</file>
|
||||
<file>image_rsc/scroll/left_Push.png</file>
|
||||
<file>image_rsc/scroll/nullScrollImage.png</file>
|
||||
<file>image_rsc/scroll/right_Hot.png</file>
|
||||
<file>image_rsc/scroll/right_Normal.png</file>
|
||||
<file>image_rsc/scroll/right_Push.png</file>
|
||||
<file>image_rsc/scroll/top_Hot.png</file>
|
||||
<file>image_rsc/scroll/top_Normal.png</file>
|
||||
<file>image_rsc/scroll/top_Push.png</file>
|
||||
<file>image_rsc/scroll/vScrollImage.png</file>
|
||||
<file>image_rsc/scroll/vScrollSlider_Hot.png</file>
|
||||
<file>image_rsc/scroll/vScrollSlider_Normal.png</file>
|
||||
<file>image_rsc/scroll/vScrollSlider_Push.png</file>
|
||||
<file>image_rsc/action/btnEdit.png</file>
|
||||
<file>image_rsc/logo/Microtek_logo.ico</file>
|
||||
<file>image_rsc/logo/uniscan.ico</file>
|
||||
<file>image_rsc/actions/imageEdit.png</file>
|
||||
<file>image_rsc/actions/scanInto.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,168 +0,0 @@
|
|||
#include "device_user.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
|
||||
DeviceUserMgr::DeviceUserMgr(QWidget *wnd)
|
||||
{
|
||||
m_wnd = wnd;
|
||||
m_twainDSM = nullptr;
|
||||
HGTwain_CreateDSM((HWND)m_wnd->winId(), &m_twainDSM);
|
||||
}
|
||||
|
||||
DeviceUserMgr::~DeviceUserMgr()
|
||||
{
|
||||
HGTwain_DestroyDSM(m_twainDSM);
|
||||
m_twainDSM = nullptr;
|
||||
}
|
||||
|
||||
class DeviceUser* DeviceUserMgr::OpenDeviceUser()
|
||||
{
|
||||
HGTwainDS ds = nullptr;
|
||||
HGTwain_OpenSelectedDSEx(m_twainDSM, &ds);
|
||||
if (nullptr == ds)
|
||||
return nullptr;
|
||||
return new DeviceUser(m_wnd, ds);
|
||||
}
|
||||
|
||||
DeviceUser::DeviceUser(QWidget *wnd, HGTwainDS ds)
|
||||
{
|
||||
m_wnd = wnd;
|
||||
m_twainDS = ds;
|
||||
}
|
||||
|
||||
DeviceUser::~DeviceUser()
|
||||
{
|
||||
HGTwain_CloseDS(m_twainDS);
|
||||
m_twainDS = nullptr;
|
||||
}
|
||||
|
||||
QString DeviceUser::GetName()
|
||||
{
|
||||
HGChar devName[256];
|
||||
HGTwain_GetDSName(m_twainDS, devName, 256);
|
||||
return QString(devName);
|
||||
}
|
||||
|
||||
HGResult DeviceUser::ShowSettingDlg()
|
||||
{
|
||||
return HGTwain_EnableDSUIOnly(m_twainDS, (HWND)m_wnd->winId(), DSEventFunc, this);
|
||||
}
|
||||
|
||||
HGResult DeviceUser::StartScan()
|
||||
{
|
||||
return HGTwain_EnableDS(m_twainDS, HGFALSE, nullptr, DSEventFunc, this, DSImageFunc, this);
|
||||
}
|
||||
|
||||
void HGAPI DeviceUser::DSEventFunc(HGTwainDS ds, HGUInt event, HGPointer param)
|
||||
{
|
||||
DeviceUser* p = (DeviceUser*)param;
|
||||
emit p->scanEvent(event);
|
||||
}
|
||||
|
||||
void HGAPI DeviceUser::DSImageFunc(HGTwainDS ds, HGImage image, HGPointer param)
|
||||
{
|
||||
DeviceUser* p = (DeviceUser*)param;
|
||||
emit p->newImage(image);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
DeviceUserMgr::DeviceUserMgr(QWidget *wnd)
|
||||
{
|
||||
m_wnd = wnd;
|
||||
m_saneMgr = nullptr;
|
||||
HGSane_CreateManager(&m_saneMgr);
|
||||
}
|
||||
|
||||
DeviceUserMgr::~DeviceUserMgr()
|
||||
{
|
||||
HGSane_DestroyManager(m_saneMgr);
|
||||
m_saneMgr = nullptr;
|
||||
}
|
||||
|
||||
class DeviceUser* DeviceUserMgr::OpenDeviceUser()
|
||||
{
|
||||
HGSaneSource source = nullptr;
|
||||
HGSane_OpenSelectedSource(m_saneMgr, m_wnd, &source);
|
||||
if (nullptr == source)
|
||||
return nullptr;
|
||||
|
||||
HGUInt devCount = 0;
|
||||
HGSane_GetDeviceCount(source, &devCount);
|
||||
if (0 == devCount)
|
||||
{
|
||||
HGSane_CloseSource(source);
|
||||
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;
|
||||
}
|
||||
|
||||
return new DeviceUser(m_wnd, source, 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, HGSaneSource source, HGSaneDevice dev)
|
||||
{
|
||||
m_wnd = wnd;
|
||||
m_source = source;
|
||||
m_saneDev = dev;
|
||||
}
|
||||
|
||||
DeviceUser::~DeviceUser()
|
||||
{
|
||||
HGSane_CloseDevice(m_saneDev);
|
||||
m_saneDev = nullptr;
|
||||
HGSane_CloseSource(m_source);
|
||||
m_source = nullptr;
|
||||
}
|
||||
|
||||
QString DeviceUser::GetName()
|
||||
{
|
||||
HGChar devName[256];
|
||||
HGSane_GetSourceName(m_source, devName, 256);
|
||||
return QString(devName);
|
||||
}
|
||||
|
||||
HGResult DeviceUser::ShowSettingDlg()
|
||||
{
|
||||
return HGSane_ShowDeviceSettingDlg(m_saneDev, m_wnd);
|
||||
}
|
||||
|
||||
HGResult DeviceUser::StartScan()
|
||||
{
|
||||
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)
|
||||
{
|
||||
DeviceUser* p = (DeviceUser*)param;
|
||||
emit p->newImage(image);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,106 +0,0 @@
|
|||
#ifndef __DEVICE_USER_H__
|
||||
#define __DEVICE_USER_H__
|
||||
|
||||
#include "base/HGDef.h"
|
||||
#include <QDialog>
|
||||
|
||||
#if defined(HG_CMP_MSC)
|
||||
#include "twain_user/HGTwain.h"
|
||||
|
||||
class DeviceUserMgr : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceUserMgr(QWidget *wnd);
|
||||
~DeviceUserMgr();
|
||||
|
||||
// 弹出设备选择对话框,选择twain源
|
||||
class DeviceUser* OpenDeviceUser();
|
||||
|
||||
private:
|
||||
QWidget *m_wnd;
|
||||
HGTwainDSM m_twainDSM;
|
||||
};
|
||||
|
||||
class DeviceUser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class DeviceUserMgr;
|
||||
DeviceUser(QWidget *wnd, HGTwainDS ds);
|
||||
public:
|
||||
~DeviceUser();
|
||||
|
||||
// 获取设备名字
|
||||
QString GetName();
|
||||
// 弹出配置对话框
|
||||
HGResult ShowSettingDlg();
|
||||
// 弹出扫描对话框
|
||||
HGResult StartScan();
|
||||
|
||||
private:
|
||||
static void HGAPI DSEventFunc(HGTwainDS ds, HGUInt event, HGPointer param);
|
||||
static void HGAPI DSImageFunc(HGTwainDS ds, HGImage image, HGPointer param);
|
||||
|
||||
signals:
|
||||
void newImage(void *image);
|
||||
void scanEvent(HGUInt event);
|
||||
|
||||
private:
|
||||
QWidget *m_wnd;
|
||||
HGTwainDS m_twainDS;
|
||||
};
|
||||
|
||||
#else
|
||||
#include "sane_user/HGSane.h"
|
||||
|
||||
class DeviceUserMgr : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceUserMgr(QWidget *wnd);
|
||||
~DeviceUserMgr();
|
||||
|
||||
// 弹出设备选择对话框,选择设备
|
||||
class DeviceUser* OpenDeviceUser();
|
||||
|
||||
private:
|
||||
QWidget *m_wnd;
|
||||
HGSaneManager m_saneMgr;
|
||||
};
|
||||
|
||||
class DeviceUser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class DeviceUserMgr;
|
||||
DeviceUser(QWidget *wnd, HGSaneSource source, HGSaneDevice dev);
|
||||
public:
|
||||
~DeviceUser();
|
||||
|
||||
// 获取设备名字
|
||||
QString GetName();
|
||||
// 弹出配置对话框
|
||||
HGResult ShowSettingDlg();
|
||||
// 弹出扫描对话框
|
||||
HGResult StartScan();
|
||||
|
||||
private:
|
||||
static void HGAPI DeviceEventFunc(HGSaneDevice dev, HGUInt event, HGPointer param);
|
||||
static void HGAPI DeviceImageFunc(HGSaneDevice dev, HGImage image, HGPointer param);
|
||||
|
||||
signals:
|
||||
void newImage(void *image);
|
||||
void scanEvent(HGUInt event);
|
||||
|
||||
private:
|
||||
QWidget *m_wnd;
|
||||
HGSaneSource m_source;
|
||||
HGSaneDevice m_saneDev;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __DEVICE_USER_H__ */
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 926 B |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 927 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 641 B |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 585 KiB |
Before Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 1001 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 168 B |