Merge branch 'dev' of http://192.168.10.5:8099/sane/code_app into dev
This commit is contained in:
commit
3d0b78683a
Binary file not shown.
|
@ -2738,7 +2738,7 @@ Please contact the equipment supplier promptly to purchase a replacement paper r
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="2903"/>
|
<location filename="mainwindow.cpp" line="2903"/>
|
||||||
<source><p>Vendor: %1</p></source>
|
<source><p>Vendor: %1</p></source>
|
||||||
<translation><p>Vendor: %1</p></translation>
|
<translation><p>Manufacturer/Developer: %1</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="2909"/>
|
<location filename="mainwindow.cpp" line="2909"/>
|
||||||
|
@ -2750,24 +2750,24 @@ Please contact the equipment supplier promptly to purchase a replacement paper r
|
||||||
<location filename="mainwindow.cpp" line="2908"/>
|
<location filename="mainwindow.cpp" line="2908"/>
|
||||||
<location filename="mainwindow.cpp" line="2912"/>
|
<location filename="mainwindow.cpp" line="2912"/>
|
||||||
<source><p>Company website: <a href=%1>%1</p></source>
|
<source><p>Company website: <a href=%1>%1</p></source>
|
||||||
<translation><p>Company website: <a href=%1>%1</p></translation>
|
<translation><p>Company URL: <a href=%1>%1</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="2906"/>
|
<location filename="mainwindow.cpp" line="2906"/>
|
||||||
<location filename="mainwindow.cpp" line="2913"/>
|
<location filename="mainwindow.cpp" line="2913"/>
|
||||||
<source><p>Company address: %1</p></source>
|
<source><p>Company address: %1</p></source>
|
||||||
<translation><p>Company address: %1</p></translation>
|
<translation><p>Address: %1</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="2907"/>
|
<location filename="mainwindow.cpp" line="2907"/>
|
||||||
<location filename="mainwindow.cpp" line="2914"/>
|
<location filename="mainwindow.cpp" line="2914"/>
|
||||||
<source><p>Company telephone: %1</p></source>
|
<source><p>Company telephone: %1</p></source>
|
||||||
<translation><p>Company telephone: %1</p></translation>
|
<translation><p>Contact number: %1</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="2915"/>
|
<location filename="mainwindow.cpp" line="2915"/>
|
||||||
<source><p>Company GPS: <a href=%1>%2</p></source>
|
<source><p>Company GPS: <a href=%1>%2</p></source>
|
||||||
<translation><p>Company GPS: <a href=%1>%2</p></translation>
|
<translation><p>Navigation address: <a href=%1>%2</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="mainwindow.cpp" line="2915"/>
|
<location filename="mainwindow.cpp" line="2915"/>
|
||||||
|
|
|
@ -45,9 +45,9 @@
|
||||||
#include "HGUIGlobal.h"
|
#include "HGUIGlobal.h"
|
||||||
#include "HGString.h"
|
#include "HGString.h"
|
||||||
#include "app_cfg.h"
|
#include "app_cfg.h"
|
||||||
|
#include "app_about_info/appAboutInfo.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "dialog_wrong_img.h"
|
#include "dialog_wrong_img.h"
|
||||||
#include "../../code_device/hgdriver/hgdev/char_const.h"
|
|
||||||
#include "lang/app_language.h"
|
#include "lang/app_language.h"
|
||||||
|
|
||||||
#define PASSWORD_KEY 4
|
#define PASSWORD_KEY 4
|
||||||
|
@ -2900,39 +2900,65 @@ void MainWindow::on_act_help_triggered()
|
||||||
|
|
||||||
void MainWindow::on_act_about_triggered()
|
void MainWindow::on_act_about_triggered()
|
||||||
{
|
{
|
||||||
if (m_devUser == nullptr)
|
const char* oem = HGVERSION_OEMNAME_HUAGO;
|
||||||
{
|
|
||||||
QMessageBox::information(this, tr("Prompt"), tr("Please go to 'Menu Bar ->Scan' to select a device"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(OEM_HANWANG)
|
||||||
HGTwainDeviceCustomInfo info = {0};
|
oem = HGVERSION_OEMNAME_HANVON;
|
||||||
m_devUser->GetDeviceCustomInfo(&info);
|
#elif defined(OEM_LISICHENG)
|
||||||
#else
|
oem = HGVERSION_OEMNAME_LANXUM;
|
||||||
HGSaneDeviceCustomInfo info = {0};
|
#elif defined(OEM_CANGTIAN)
|
||||||
m_devUser->GetDeviceCustomInfo(&info);
|
oem = HGVERSION_OEMNAME_CUMTENN;
|
||||||
|
#elif defined(OEM_ZHONGJING)
|
||||||
|
oem = HGVERSION_OEMNAME_MICROTEK;
|
||||||
|
#elif defined(OEM_ZIGUANG)
|
||||||
|
oem = HGVERSION_OEMNAME_UNIS;
|
||||||
|
#elif defined(OEM_NEUTRAL)
|
||||||
|
oem = HGVERSION_OEMNAME_NEUTRAL;
|
||||||
|
#elif defined(OEM_DELI)
|
||||||
|
oem = HGVERSION_OEMNAME_DELI;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HGChar version[32] = { 0 };
|
||||||
|
getCurrVersion(HGVERSION_APPNAME_SCANNER, oem, version, 32);
|
||||||
|
|
||||||
QString title = tr("about %1").arg(windowTitle());
|
QString title = tr("about %1").arg(windowTitle());
|
||||||
QString content;
|
QString content;
|
||||||
content += tr("<p>DriverVer: %1</p>").arg(QString(info.driverVer));
|
content += tr("<p>DriverVer: %1</p>").arg(QString::fromLocal8Bit(version));
|
||||||
content += tr("<p>Vendor: %1</p>").arg(QString::fromLocal8Bit(info.vendor));
|
|
||||||
|
#if defined(OEM_NEUTRAL)
|
||||||
|
QMessageBox::about(this, title, content);
|
||||||
|
#else
|
||||||
|
|
||||||
#if defined(OEM_ZHONGJING)
|
#if defined(OEM_ZHONGJING)
|
||||||
content += tr("<p>Company address: %1</p>").arg(QString::fromLocal8Bit(info.comAddr));
|
QString appLang = getCfgValue("global", "language", QString("chinese"));
|
||||||
content += tr("<p>Company telephone: %1</p>").arg(QString(info.comTel));
|
if (appLang == "chinese")
|
||||||
content += tr("<p>Company website: <a href=%1>%1</p>").arg(QString(info.comUrl));
|
{
|
||||||
content += tr("<p>Copyright: %1</p>").arg(QString::fromLocal8Bit(info.copyright));
|
content += tr("<p>Vendor: %1</p>").arg(QString::fromLocal8Bit(COMPANY_NAME));
|
||||||
|
content += tr("<p>Company address: %1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_ADDRESS));
|
||||||
|
content += tr("<p>Company telephone: %1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_TEL));
|
||||||
|
content += tr("<p>Company website: <a href=%1>%1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_URL));
|
||||||
|
content += tr("<p>Copyright: %1</p>").arg(QString::fromLocal8Bit(BRAND_COPYRIGHT));
|
||||||
|
}
|
||||||
|
else if(appLang == "english")
|
||||||
|
{
|
||||||
|
content += tr("<p>Vendor: %1</p>").arg(QString::fromLocal8Bit(COMPANY_NAME_EN));
|
||||||
|
content += tr("<p>Company address: %1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_ADDRESS_EN));
|
||||||
|
content += tr("<p>Company telephone: %1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_TEL));
|
||||||
|
content += tr("<p>Company website: <a href=%1>%1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_URL));
|
||||||
|
content += tr("<p>Copyright: %1</p>").arg(QString::fromLocal8Bit(BRAND_COPYRIGHT_EN));
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
content += tr("<p>Copyright: %1</p>").arg(QString::fromLocal8Bit(info.copyright));
|
content += tr("<p>Vendor: %1</p>").arg(QString::fromLocal8Bit(COMPANY_NAME));
|
||||||
content += tr("<p>Company website: <a href=%1>%1</p>").arg(QString(info.comUrl));
|
content += tr("<p>Copyright: %1</p>").arg(QString::fromLocal8Bit(BRAND_COPYRIGHT));
|
||||||
content += tr("<p>Company address: %1</p>").arg(QString::fromLocal8Bit(info.comAddr));
|
content += tr("<p>Company website: <a href=%1>%1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_URL));
|
||||||
content += tr("<p>Company telephone: %1</p>").arg(QString(info.comTel));
|
content += tr("<p>Company address: %1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_ADDRESS));
|
||||||
content += tr("<p>Company GPS: <a href=%1>%2</p>").arg(QString(info.comGps)).arg(tr("Baidu map access"));
|
content += tr("<p>Company telephone: %1</p>").arg(QString::fromLocal8Bit(BRAND_COMPANY_TEL));
|
||||||
|
content += tr("<p>Company GPS: <a href=%1>%2</p>").arg(QString::fromLocal8Bit(BRAND_URL_GPS)).arg(tr("Baidu map access"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QMessageBox::about(this, title, content);
|
QMessageBox::about(this, title, content);
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_scannerSettings_triggered()
|
void MainWindow::on_act_scannerSettings_triggered()
|
||||||
|
@ -2957,6 +2983,7 @@ void MainWindow::on_act_scannerSettings_triggered()
|
||||||
deviceIsOnline = false;
|
deviceIsOnline = false;
|
||||||
else if (HGSANE_ERR_FAIL == ret)
|
else if (HGSANE_ERR_FAIL == ret)
|
||||||
openSucceed = false;
|
openSucceed = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!deviceIsOnline)
|
if (!deviceIsOnline)
|
||||||
{
|
{
|
||||||
|
@ -2968,8 +2995,6 @@ void MainWindow::on_act_scannerSettings_triggered()
|
||||||
QMessageBox::information(this, tr("Prompt"), tr("Open failed"));
|
QMessageBox::information(this, tr("Prompt"), tr("Open failed"));
|
||||||
deleteDevUser();
|
deleteDevUser();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_acquire_triggered()
|
void MainWindow::on_act_acquire_triggered()
|
||||||
|
@ -3866,6 +3891,120 @@ void MainWindow::deleteDevUser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HGResult MainWindow::getCurrVersion(const HGChar* appName, const HGChar* oemName, HGChar* version, HGUInt maxLen)
|
||||||
|
{
|
||||||
|
if (NULL == version || 0 == maxLen)
|
||||||
|
{
|
||||||
|
return HGBASE_ERR_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ver = "0.0.0.0";
|
||||||
|
|
||||||
|
if (appName == HGVERSION_APPNAME_SCANNER)
|
||||||
|
{
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
|
std::string regName;
|
||||||
|
if (oemName == HGVERSION_OEMNAME_HANVON)
|
||||||
|
regName = "SOFTWARE\\HanvonScan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_LANXUM)
|
||||||
|
regName = "SOFTWARE\\LanxumScan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_CUMTENN)
|
||||||
|
regName = "SOFTWARE\\CumtennScan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_MICROTEK)
|
||||||
|
regName = "SOFTWARE\\MicrotekScan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_UNIS)
|
||||||
|
regName = "SOFTWARE\\UniScan";
|
||||||
|
else
|
||||||
|
regName = "SOFTWARE\\HuaGoScan";
|
||||||
|
|
||||||
|
HKEY hKey = NULL;
|
||||||
|
RegOpenKeyExA(HKEY_LOCAL_MACHINE, regName.c_str(), 0, KEY_QUERY_VALUE, &hKey);
|
||||||
|
if (NULL != hKey)
|
||||||
|
{
|
||||||
|
CHAR szData[MAX_PATH] = { 0 };
|
||||||
|
DWORD cbData = MAX_PATH;
|
||||||
|
if (ERROR_SUCCESS == RegQueryValueExA(hKey, "AppVersion", NULL, NULL, (LPBYTE)szData, &cbData))
|
||||||
|
{
|
||||||
|
ver = szData;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
std::string appName;
|
||||||
|
std::string osName = GetOSName();
|
||||||
|
if ("UnionTech" == osName)
|
||||||
|
{
|
||||||
|
if (oemName == HGVERSION_OEMNAME_HANVON)
|
||||||
|
appName = "com.hanvonchina.hanvonscan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_LANXUM)
|
||||||
|
appName = "com.lanxumchina.lanxumscan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_CUMTENN)
|
||||||
|
appName = "com.cumtennchina.cumtennscan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_MICROTEK)
|
||||||
|
appName = "com.microtekchina.microtekscan";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_UNIS)
|
||||||
|
appName = "com.unischina.uniscan";
|
||||||
|
else
|
||||||
|
appName = "com.huagaochina.huagoscan";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oemName == HGVERSION_OEMNAME_HANVON)
|
||||||
|
appName = "scanner-driver-hanvon";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_LANXUM)
|
||||||
|
appName = "scanner-driver-lanxum";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_CUMTENN)
|
||||||
|
appName = "scanner-driver-cumtenn";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_MICROTEK)
|
||||||
|
appName = "scanner-driver-microtek";
|
||||||
|
else if (oemName == HGVERSION_OEMNAME_UNIS)
|
||||||
|
appName = "scanner-driver-unis";
|
||||||
|
else
|
||||||
|
appName = "scanner-driver-huagao";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string cmd = "dpkg -l " + appName;
|
||||||
|
FILE* fp = popen(cmd.c_str(), "r");
|
||||||
|
if (NULL != fp)
|
||||||
|
{
|
||||||
|
char buff[2048] = { 0 };
|
||||||
|
fread(buff, 2048, 1, fp);
|
||||||
|
|
||||||
|
char* p = strstr(buff, appName.c_str());
|
||||||
|
if (NULL != p)
|
||||||
|
{
|
||||||
|
char* p2 = p + appName.size();
|
||||||
|
while (!isdigit(*p2) && '.' != *p2)
|
||||||
|
++p2;
|
||||||
|
|
||||||
|
int len = (int)strlen(p2);
|
||||||
|
for (int i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
if (!isdigit(p2[i]) && '.' != p2[i])
|
||||||
|
{
|
||||||
|
p2[i] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ver = p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(fp);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxLen < ver.size() + 1)
|
||||||
|
{
|
||||||
|
return HGBASE_ERR_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(version, ver.c_str());
|
||||||
|
return HGBASE_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(HG_CMP_MSC)
|
#if !defined(HG_CMP_MSC)
|
||||||
void MainWindow::checkRollerLife()
|
void MainWindow::checkRollerLife()
|
||||||
{
|
{
|
||||||
|
|
|
@ -245,6 +245,7 @@ private:
|
||||||
void initAcquireIntoComboBox();
|
void initAcquireIntoComboBox();
|
||||||
void updateSideBar();
|
void updateSideBar();
|
||||||
void deleteDevUser();
|
void deleteDevUser();
|
||||||
|
HGResult getCurrVersion(const HGChar* appName, const HGChar* oemName, HGChar* version, HGUInt maxLen);
|
||||||
|
|
||||||
#if !defined(HG_CMP_MSC)
|
#if !defined(HG_CMP_MSC)
|
||||||
void checkRollerLife();
|
void checkRollerLife();
|
||||||
|
|
|
@ -114,7 +114,7 @@ unix {
|
||||||
|
|
||||||
CONFIG += unversioned_libname unversioned_soname
|
CONFIG += unversioned_libname unversioned_soname
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
# QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||||
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
||||||
QMAKE_LFLAGS += -z defs -B direct
|
QMAKE_LFLAGS += -z defs -B direct
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ unix {
|
||||||
|
|
||||||
CONFIG += unversioned_libname unversioned_soname
|
CONFIG += unversioned_libname unversioned_soname
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
# QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||||
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
||||||
QMAKE_LFLAGS += -z defs -B direct
|
QMAKE_LFLAGS += -z defs -B direct
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ unix {
|
||||||
|
|
||||||
CONFIG += unversioned_libname unversioned_soname
|
CONFIG += unversioned_libname unversioned_soname
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
# QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||||
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
||||||
QMAKE_LFLAGS += -z defs -B direct
|
QMAKE_LFLAGS += -z defs -B direct
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ unix {
|
||||||
|
|
||||||
CONFIG += unversioned_libname unversioned_soname
|
CONFIG += unversioned_libname unversioned_soname
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
# QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||||
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
||||||
QMAKE_LFLAGS += -z defs -B direct
|
QMAKE_LFLAGS += -z defs -B direct
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ unix {
|
||||||
|
|
||||||
CONFIG += unversioned_libname unversioned_soname
|
CONFIG += unversioned_libname unversioned_soname
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
# QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||||
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
||||||
QMAKE_LFLAGS += -z defs -B direct
|
QMAKE_LFLAGS += -z defs -B direct
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ unix {
|
||||||
|
|
||||||
CONFIG += unversioned_libname unversioned_soname
|
CONFIG += unversioned_libname unversioned_soname
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
# QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
|
||||||
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
QMAKE_LFLAGS += -Wl,-rpath,\'\$\$ORIGIN\' -Wl,--exclude-libs,ALL
|
||||||
QMAKE_LFLAGS += -z defs -B direct
|
QMAKE_LFLAGS += -z defs -B direct
|
||||||
|
|
||||||
|
|
|
@ -962,7 +962,7 @@ HGResult HGSaneDeviceImpl::GetScanMode(HGChar *scanMode, HGUInt maxLen)
|
||||||
HGChar *value = (char*)malloc(opt->size * 2 + 4);
|
HGChar *value = (char*)malloc(opt->size * 2 + 4);
|
||||||
if (strcmp(opt->name, SANE_STD_OPT_NAME_SCAN_MODE) == 0)
|
if (strcmp(opt->name, SANE_STD_OPT_NAME_SCAN_MODE) == 0)
|
||||||
{
|
{
|
||||||
SANE_Status ret = m_sourceImpl->m_saneApi.sane_control_option_api(m_devHandle, i, SANE_ACTION_GET_VALUE, &value, &method);
|
SANE_Status ret = m_sourceImpl->m_saneApi.sane_control_option_api(m_devHandle, i, SANE_ACTION_GET_VALUE, value, &method);
|
||||||
if (ret == SANE_STATUS_GOOD)
|
if (ret == SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
strcpy(scanMode, value);
|
strcpy(scanMode, value);
|
||||||
|
|
|
@ -19,8 +19,6 @@ Dialog_Device_Scan::Dialog_Device_Scan(const SANEAPI* saneApi, SANE_Handle dev,
|
||||||
m_eventParam = eventParam;
|
m_eventParam = eventParam;
|
||||||
m_imageCallback = imageCallback;
|
m_imageCallback = imageCallback;
|
||||||
m_imageParam = imageParam;
|
m_imageParam = imageParam;
|
||||||
m_buffer = NULL;
|
|
||||||
m_bufferSize = 0;
|
|
||||||
m_stopThread = HGFALSE;
|
m_stopThread = HGFALSE;
|
||||||
m_thread = NULL;
|
m_thread = NULL;
|
||||||
|
|
||||||
|
@ -64,10 +62,6 @@ void Dialog_Device_Scan::on_eventFunc(int flag, QString errInfo)
|
||||||
HGBase_CloseThread(m_thread);
|
HGBase_CloseThread(m_thread);
|
||||||
m_thread = NULL;
|
m_thread = NULL;
|
||||||
|
|
||||||
free(m_buffer);
|
|
||||||
m_buffer = NULL;
|
|
||||||
m_bufferSize = 0;
|
|
||||||
|
|
||||||
ui->pushButton_Cancel->setVisible(false);
|
ui->pushButton_Cancel->setVisible(false);
|
||||||
ui->pushButton_Complete->setVisible(true);
|
ui->pushButton_Complete->setVisible(true);
|
||||||
ui->label_imgRecived->setVisible(false);
|
ui->label_imgRecived->setVisible(false);
|
||||||
|
@ -103,19 +97,6 @@ void Dialog_Device_Scan::on_imageCount(int count)
|
||||||
|
|
||||||
void Dialog_Device_Scan::startScan()
|
void Dialog_Device_Scan::startScan()
|
||||||
{
|
{
|
||||||
SANE_Parameters params;
|
|
||||||
memset(¶ms, 0, sizeof(SANE_Parameters));
|
|
||||||
SANE_Status stat = m_saneAPI.sane_get_parameters_api(m_saneDev, ¶ms);
|
|
||||||
assert(SANE_STATUS_GOOD == stat);
|
|
||||||
|
|
||||||
m_bufferSize = params.bytes_per_line * params.lines;
|
|
||||||
m_buffer = (HGByte *)malloc(m_bufferSize);
|
|
||||||
if (NULL == m_buffer)
|
|
||||||
{
|
|
||||||
ui->label->setText(tr("Out of memory"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_stopThread = HGFALSE;
|
m_stopThread = HGFALSE;
|
||||||
HGBase_OpenThread(ThreadFunc, this, &m_thread);
|
HGBase_OpenThread(ThreadFunc, this, &m_thread);
|
||||||
|
|
||||||
|
@ -159,13 +140,26 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
||||||
SANE_Parameters params;
|
SANE_Parameters params;
|
||||||
memset(¶ms, 0, sizeof(SANE_Parameters));
|
memset(¶ms, 0, sizeof(SANE_Parameters));
|
||||||
SANE_Status stat1 = p->m_saneAPI.sane_get_parameters_api(p->m_saneDev, ¶ms);
|
SANE_Status stat1 = p->m_saneAPI.sane_get_parameters_api(p->m_saneDev, ¶ms);
|
||||||
|
if (SANE_STATUS_GOOD != stat1)
|
||||||
|
{
|
||||||
|
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(stat1)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
HGUInt bufferSize = params.bytes_per_line * params.lines;
|
||||||
|
HGByte *buffer = (HGByte *)malloc(bufferSize);
|
||||||
|
if (NULL == buffer)
|
||||||
|
{
|
||||||
|
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_NO_MEM)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
SANE_Int readSize = 0;
|
SANE_Int readSize = 0;
|
||||||
SANE_Status stat2 = SANE_STATUS_GOOD;
|
SANE_Status stat2 = SANE_STATUS_GOOD;
|
||||||
while (readSize < p->m_bufferSize)
|
while (readSize < bufferSize)
|
||||||
{
|
{
|
||||||
SANE_Int len = 0;
|
SANE_Int len = 0;
|
||||||
stat2 = p->m_saneAPI.sane_read_api(p->m_saneDev, p->m_buffer + readSize, p->m_bufferSize - readSize, &len);
|
stat2 = p->m_saneAPI.sane_read_api(p->m_saneDev, buffer + readSize, bufferSize - readSize, &len);
|
||||||
readSize += len;
|
readSize += len;
|
||||||
if (SANE_STATUS_GOOD != stat2)
|
if (SANE_STATUS_GOOD != stat2)
|
||||||
{
|
{
|
||||||
|
@ -175,24 +169,28 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
||||||
|
|
||||||
if (SANE_STATUS_GOOD == stat2)
|
if (SANE_STATUS_GOOD == stat2)
|
||||||
{
|
{
|
||||||
// m_bufferSize空间不够
|
// bufferSize空间不够
|
||||||
|
free(buffer);
|
||||||
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_NO_MEM)));
|
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_NO_MEM)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (SANE_STATUS_EOF == stat2)
|
else if (SANE_STATUS_EOF == stat2)
|
||||||
{
|
{
|
||||||
if (SANE_STATUS_GOOD != stat1 || 0 == readSize || readSize != params.bytes_per_line * params.lines)
|
if (0 == readSize || readSize != params.bytes_per_line * params.lines)
|
||||||
{
|
{
|
||||||
|
free(buffer);
|
||||||
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_IO_ERROR)));
|
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(SANE_STATUS_IO_ERROR)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (SANE_STATUS_CANCELLED == stat2)
|
else if (SANE_STATUS_CANCELLED == stat2)
|
||||||
{
|
{
|
||||||
|
free(buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
free(buffer);
|
||||||
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(stat2)));
|
emit p->eventFunc(-1, QString::fromUtf8(p->m_saneAPI.sane_strstatus_api(stat2)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +213,7 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
||||||
HGImageInfo imgInfo = { (HGUInt)params.pixels_per_line, (HGUInt)params.lines,
|
HGImageInfo imgInfo = { (HGUInt)params.pixels_per_line, (HGUInt)params.lines,
|
||||||
imgType, (HGUInt)params.bytes_per_line, HGBASE_IMGORIGIN_TOP };
|
imgType, (HGUInt)params.bytes_per_line, HGBASE_IMGORIGIN_TOP };
|
||||||
HGImage img = NULL;
|
HGImage img = NULL;
|
||||||
HGBase_CreateImageWithData((HGByte*)p->m_buffer, &imgInfo, &img);
|
HGBase_CreateImageWithData(buffer, &imgInfo, &img);
|
||||||
if (NULL != img)
|
if (NULL != img)
|
||||||
{
|
{
|
||||||
p->m_imageCallback(img, p->m_imageParam);
|
p->m_imageCallback(img, p->m_imageParam);
|
||||||
|
@ -224,6 +222,10 @@ void HGAPI Dialog_Device_Scan::ThreadFunc(HGThread thread, HGPointer param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(buffer);
|
||||||
|
buffer = NULL;
|
||||||
|
bufferSize = 0;
|
||||||
|
|
||||||
SANE_Status stat3 = p->m_saneAPI.sane_start_api(p->m_saneDev);
|
SANE_Status stat3 = p->m_saneAPI.sane_start_api(p->m_saneDev);
|
||||||
if (SANE_STATUS_NO_DOCS == stat3)
|
if (SANE_STATUS_NO_DOCS == stat3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,8 +50,6 @@ private:
|
||||||
void *m_eventParam;
|
void *m_eventParam;
|
||||||
show_scan_ui_image_callback m_imageCallback;
|
show_scan_ui_image_callback m_imageCallback;
|
||||||
void *m_imageParam;
|
void *m_imageParam;
|
||||||
HGByte* m_buffer;
|
|
||||||
HGInt m_bufferSize;
|
|
||||||
volatile HGBool m_stopThread;
|
volatile HGBool m_stopThread;
|
||||||
HGThread m_thread;
|
HGThread m_thread;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ver_2
|
||||||
void WSServer::Connect(const ConnectParam* param)
|
void WSServer::Connect(const ConnectParam* param)
|
||||||
{
|
{
|
||||||
assert(NULL != param && this == param->svr);
|
assert(NULL != param && this == param->svr);
|
||||||
|
#if 0
|
||||||
if (!m_vectorUser.empty())
|
if (!m_vectorUser.empty())
|
||||||
{
|
{
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
|
@ -38,13 +38,14 @@ namespace ver_2
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
WebUser* user = new WSUser(this, m_currUserId, param->ip, param->port, param->socket);
|
WebUser* user = new WSUser(this, m_currUserId, param->ip, param->port, param->socket);
|
||||||
user->Open();
|
user->Open();
|
||||||
++m_currUserId;
|
++m_currUserId;
|
||||||
m_vectorUser.push_back(user);
|
m_vectorUser.push_back(user);
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
lstrcpyA(nid.szTip, "扫描服务程序(已连接)");
|
sprintf(nid.szTip, "扫描服务程序(连接数 %u)", m_vectorUser.size());
|
||||||
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,11 +141,8 @@ void WebServer::DisConnect(const DisConnectParam* param)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
if (m_vectorUser.empty())
|
sprintf(nid.szTip, "扫描服务程序(连接数 %u)", m_vectorUser.size());
|
||||||
{
|
|
||||||
lstrcpyA(nid.szTip, "扫描服务程序(未连接)");
|
|
||||||
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
Shell_NotifyIconA(NIM_MODIFY, &nid);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ int main()
|
||||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
|
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
|
||||||
nid.uCallbackMessage = WM_TRAY;
|
nid.uCallbackMessage = WM_TRAY;
|
||||||
nid.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON_HGWEBSERVICE));
|
nid.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON_HGWEBSERVICE));
|
||||||
lstrcpyA(nid.szTip, "扫描服务程序(未连接)");
|
lstrcpyA(nid.szTip, "扫描服务程序(连接数 0)");
|
||||||
Shell_NotifyIconA(NIM_ADD, &nid);
|
Shell_NotifyIconA(NIM_ADD, &nid);
|
||||||
|
|
||||||
ShowWindow(hWnd, SW_HIDE);
|
ShowWindow(hWnd, SW_HIDE);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue