Compare commits

..

3 Commits

32 changed files with 1367 additions and 36 deletions

View File

@ -0,0 +1,11 @@
<RCC>
<qresource prefix="/qt">
<file>etc/qt.conf</file>
</qresource>
<qresource prefix="/translation">
</qresource>
<qresource prefix="/images">
<file>image_rsc/ico/logo.ico</file>
<file>image_rsc/png/logo.png</file>
</qresource>
</RCC>

108
app/scantool/dialog_add.cpp Normal file
View File

@ -0,0 +1,108 @@
#include "dialog_add.h"
#include "ui_dialog_add.h"
#include "dialog_button.h"
#include <QMessageBox>
Dialog_Add::Dialog_Add(class Dialog_Button *btnDlg)
: QDialog(btnDlg)
, ui(new Ui::Dialog_Add)
, m_btnDlg(btnDlg)
, m_index(-1)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
// 添加
this->setWindowTitle(tr("Add"));
ui->comboBoxDeviceType->addItem("G100");
ui->comboBoxDeviceType->addItem("G200");
ui->comboBoxDeviceType->addItem("G300");
ui->comboBoxDeviceType->addItem("G400");
ui->comboBoxButtonType->addItem("Button 1");
ui->comboBoxButtonType->addItem("Button 2");
ui->comboBoxButtonType->addItem("Button 3");
m_scanParam.deviceType = DeviceType(ui->comboBoxDeviceType->currentIndex() + 1);
m_scanParam.buttonType = ButtonType(ui->comboBoxButtonType->currentIndex() + 1);
m_scanParam.deviceConfig.clear();
m_scanParam.saveParam = Dialog_AquireInto::GetDefSaveParam();
}
Dialog_Add::Dialog_Add(class Dialog_Button *btnDlg, const ScanParam &scanParam, int index)
: QDialog(btnDlg)
, ui(new Ui::Dialog_Add)
, m_btnDlg(btnDlg)
, m_index(index)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
// 修改
this->setWindowTitle(tr("Modify"));
ui->comboBoxDeviceType->addItem("G100");
ui->comboBoxDeviceType->addItem("G200");
ui->comboBoxDeviceType->addItem("G300");
ui->comboBoxDeviceType->addItem("G400");
ui->comboBoxButtonType->addItem("Button 1");
ui->comboBoxButtonType->addItem("Button 2");
ui->comboBoxButtonType->addItem("Button 3");
m_scanParam = scanParam;
ui->comboBoxDeviceType->setCurrentIndex(m_scanParam.deviceType - 1);
ui->comboBoxButtonType->setCurrentIndex(m_scanParam.buttonType - 1);
}
Dialog_Add::~Dialog_Add()
{
delete ui;
}
ScanParam Dialog_Add::GetScanParam()
{
return m_scanParam;
}
void Dialog_Add::on_pushButtonDeviceConfig_clicked()
{
Dialog_Param dlg(m_scanParam.deviceType, m_scanParam.deviceConfig, this);
if (dlg.exec())
{
m_scanParam.deviceConfig = dlg.GetDeviceConfig();
}
}
void Dialog_Add::on_pushButtonSaveParam_clicked()
{
Dialog_AquireInto dlg(m_scanParam.saveParam, this);
if (dlg.exec())
{
m_scanParam.saveParam = dlg.GetSaveParam();
}
}
void Dialog_Add::on_comboBoxDeviceType_currentIndexChanged(int index)
{
m_scanParam.deviceType = DeviceType(index + 1);
m_scanParam.deviceConfig.clear();
}
void Dialog_Add::on_comboBoxButtonType_currentIndexChanged(int index)
{
m_scanParam.buttonType = ButtonType(index + 1);
}
void Dialog_Add::on_pushButtonOK_clicked()
{
if (m_btnDlg->FindScanParam(m_scanParam.deviceType, m_scanParam.buttonType, m_index))
{
QMessageBox::information(this, tr("Tips"), tr("Item find in list"));
return;
}
accept();
}
void Dialog_Add::on_pushButtonCancel_clicked()
{
reject();
}

58
app/scantool/dialog_add.h Normal file
View File

@ -0,0 +1,58 @@
#ifndef DIALOG_ADD_H
#define DIALOG_ADD_H
#include <QDialog>
#include "dialog_param.h"
#include "dialog_aquireinto.h"
namespace Ui {
class Dialog_Add;
}
enum ButtonType
{
DeviceType_1 = 1,
DeviceType_2,
DeviceType_3
};
struct ScanParam
{
DeviceType deviceType;
ButtonType buttonType;
std::string deviceConfig;
SaveParam saveParam;
};
class Dialog_Add : public QDialog
{
Q_OBJECT
public:
explicit Dialog_Add(class Dialog_Button *btnDlg);
Dialog_Add(class Dialog_Button *btnDlg, const ScanParam &scanParam, int index);
~Dialog_Add();
ScanParam GetScanParam();
private slots:
void on_pushButtonDeviceConfig_clicked();
void on_pushButtonSaveParam_clicked();
void on_comboBoxDeviceType_currentIndexChanged(int index);
void on_comboBoxButtonType_currentIndexChanged(int index);
void on_pushButtonOK_clicked();
void on_pushButtonCancel_clicked();
private:
Ui::Dialog_Add *ui;
class Dialog_Button *m_btnDlg;
ScanParam m_scanParam;
int m_index;
};
#endif // DIALOG_ADD_H

117
app/scantool/dialog_add.ui Normal file
View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_Add</class>
<widget class="QDialog" name="Dialog_Add">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>310</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>80</x>
<y>110</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>扫描按钮:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>80</x>
<y>70</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>设备类型:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBoxDeviceType">
<property name="geometry">
<rect>
<x>160</x>
<y>70</y>
<width>171</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBoxButtonType">
<property name="geometry">
<rect>
<x>160</x>
<y>110</y>
<width>171</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButtonDeviceConfig">
<property name="geometry">
<rect>
<x>80</x>
<y>160</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>设备配置</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonSaveParam">
<property name="geometry">
<rect>
<x>220</x>
<y>160</y>
<width>111</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>保存设置</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonOK">
<property name="geometry">
<rect>
<x>230</x>
<y>270</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonCancel">
<property name="geometry">
<rect>
<x>320</x>
<y>270</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,27 @@
#include "dialog_aquireinto.h"
#include "ui_dialog_aquireinto.h"
Dialog_AquireInto::Dialog_AquireInto(const SaveParam &saveParam, QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog_AquireInto)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
}
Dialog_AquireInto::~Dialog_AquireInto()
{
delete ui;
}
SaveParam Dialog_AquireInto::GetSaveParam()
{
SaveParam saveParam;
return saveParam;
}
SaveParam Dialog_AquireInto::GetDefSaveParam()
{
SaveParam saveParam;
return saveParam;
}

View File

@ -0,0 +1,46 @@
#ifndef DIALOG_AQUIREINTO_H
#define DIALOG_AQUIREINTO_H
#include <QDialog>
namespace Ui {
class Dialog_AquireInto;
}
struct SaveParam
{
QString m_savePath;
bool m_isUseSubfolderByTime;
bool m_isUseSubfolderByBlankPages;
bool m_isUseSubfolderByColor;
int m_jpegQuality;
int m_tiffCompressionBW;
int m_tiffCompression;
int m_tiffQuality;
QString m_fileNamePrefix;
int m_fileNameStartIndex;
int m_fileNameDigits;
int m_fileNameOddEventType;
QString m_fileNameExt;
bool m_isOcr;
bool m_isSaveAsMultiPage;
int m_multiPagesType;
int m_customMultiPages;
};
class Dialog_AquireInto : public QDialog
{
Q_OBJECT
public:
explicit Dialog_AquireInto(const SaveParam &saveParam, QWidget *parent = nullptr);
~Dialog_AquireInto();
SaveParam GetSaveParam();
static SaveParam GetDefSaveParam();
private:
Ui::Dialog_AquireInto *ui;
};
#endif // DIALOG_AQUIREINTO_H

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_AquireInto</class>
<widget class="QDialog" name="Dialog_AquireInto">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>644</width>
<height>510</height>
</rect>
</property>
<property name="windowTitle">
<string>Save Param</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>290</x>
<y>470</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog_AquireInto</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog_AquireInto</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,205 @@
#include "dialog_button.h"
#include "ui_dialog_button.h"
#include <QCloseEvent>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QMessageBox>
#include "cJSON.h"
#include "sqlite3.h"
Dialog_Button::Dialog_Button(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog_Button)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
ui->tableWidget->setColumnCount(5);
ui->tableWidget->setColumnWidth(0, 20);
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setStyleSheet("selection-background-color:rgb(0, 120, 215)");
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableWidget->horizontalHeader()->setFixedHeight(40);
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(""));
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Device Type"));
ui->tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Button Type"));
ui->tableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem("Device Config"));
ui->tableWidget->setHorizontalHeaderItem(4, new QTableWidgetItem("Save Param"));
ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
// TODO 读取配置文件设置m_vScanParams
ui->tableWidget->setRowCount((int)m_vScanParams.size());
for (int index = 0; index < (int)m_vScanParams.size(); ++index)
{
ui->tableWidget->setRowHeight(index, 30);
QCheckBox *checkBox = new QCheckBox(ui->tableWidget);
connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(on_listItemCheckbox_stateChanged(int)));
QHBoxLayout *layout = new QHBoxLayout(ui->tableWidget);
layout->addWidget(checkBox, 0, Qt::AlignCenter);
layout->setMargin(0);
QWidget *widget = new QWidget(ui->tableWidget);
widget->setLayout(layout);
ui->tableWidget->setCellWidget(index, 0, widget);
const char *devTypeStr[] = {NULL, "G100", "G200", "G300", "G400"};
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(devTypeStr[m_vScanParams[index].deviceType]));
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 1)->setFlags(ui->tableWidget->item(index, 1)->flags() & ~Qt::ItemIsEditable);
const char *btnTypeStr[] = {NULL, "Button 1", "Button 2", "Button 3"};
ui->tableWidget->setItem(index, 2, new QTableWidgetItem(btnTypeStr[m_vScanParams[index].buttonType]));
ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 2)->setFlags(ui->tableWidget->item(index, 2)->flags() & ~Qt::ItemIsEditable);
ui->tableWidget->setItem(index, 3, new QTableWidgetItem("-"));
ui->tableWidget->item(index, 3)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 3)->setFlags(ui->tableWidget->item(index, 3)->flags() & ~Qt::ItemIsEditable);
ui->tableWidget->setItem(index, 4, new QTableWidgetItem("-"));
ui->tableWidget->item(index, 4)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 4)->setFlags(ui->tableWidget->item(index, 4)->flags() & ~Qt::ItemIsEditable);
}
ui->tableWidget->selectRow(0);
}
Dialog_Button::~Dialog_Button()
{
delete ui;
}
bool Dialog_Button::GetScanParam(DeviceType deviceType, ButtonType buttonType, ScanParam &scanParam)
{
for (int i = 0; i < (int)m_vScanParams.size(); ++i)
{
if (deviceType == m_vScanParams[i].deviceType && buttonType == m_vScanParams[i].buttonType)
{
scanParam = m_vScanParams[i];
return true;
}
}
return false;
}
bool Dialog_Button::FindScanParam(DeviceType deviceType, ButtonType buttonType, int ignoreIndex)
{
for (int i = 0; i < (int)m_vScanParams.size(); ++i)
{
if (deviceType == m_vScanParams[i].deviceType && buttonType == m_vScanParams[i].buttonType)
{
if (-1 == ignoreIndex) // 表示均不忽略
{
return true;
}
else if (i != ignoreIndex)
{
return true;
}
}
}
return false;
}
void Dialog_Button::closeEvent(QCloseEvent *e)
{
hide(); // 隐藏主窗口
e->ignore(); //忽略关闭事件,这样才不会关闭程序
}
void Dialog_Button::on_pushButtonAdd_clicked()
{
Dialog_Add dlg(this);
if (dlg.exec())
{
ScanParam scanParam = dlg.GetScanParam();
m_vScanParams.push_back(scanParam);
// TODO 保存m_vScanParams
ui->tableWidget->setRowCount((int)m_vScanParams.size());
int index = (int)m_vScanParams.size() - 1;
ui->tableWidget->setRowHeight(index, 30);
QCheckBox *checkBox = new QCheckBox(ui->tableWidget);
connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(on_listItemCheckbox_stateChanged(int)));
QHBoxLayout *layout = new QHBoxLayout(ui->tableWidget);
layout->addWidget(checkBox, 0, Qt::AlignCenter);
layout->setMargin(0);
QWidget *widget = new QWidget(ui->tableWidget);
widget->setLayout(layout);
ui->tableWidget->setCellWidget(index, 0, widget);
const char *devTypeStr[] = {NULL, "G100", "G200", "G300", "G400"};
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(devTypeStr[m_vScanParams[index].deviceType]));
ui->tableWidget->item(index, 1)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 1)->setFlags(ui->tableWidget->item(index, 1)->flags() & ~Qt::ItemIsEditable);
const char *btnTypeStr[] = {NULL, "Button 1", "Button 2", "Button 3"};
ui->tableWidget->setItem(index, 2, new QTableWidgetItem(btnTypeStr[m_vScanParams[index].buttonType]));
ui->tableWidget->item(index, 2)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 2)->setFlags(ui->tableWidget->item(index, 2)->flags() & ~Qt::ItemIsEditable);
ui->tableWidget->setItem(index, 3, new QTableWidgetItem("-"));
ui->tableWidget->item(index, 3)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 3)->setFlags(ui->tableWidget->item(index, 3)->flags() & ~Qt::ItemIsEditable);
ui->tableWidget->setItem(index, 4, new QTableWidgetItem("-"));
ui->tableWidget->item(index, 4)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(index, 4)->setFlags(ui->tableWidget->item(index, 4)->flags() & ~Qt::ItemIsEditable);
ui->tableWidget->selectRow(index);
}
}
void Dialog_Button::on_pushButtonModify_clicked()
{
int index = ui->tableWidget->currentRow();
if (-1 == index)
{
QMessageBox::information(this, tr("Tips"), tr("No item selected"));
return;
}
Dialog_Add dlg(this, m_vScanParams[index], index);
if (dlg.exec())
{
ScanParam scanParam = dlg.GetScanParam();
m_vScanParams[index] = scanParam;
// TODO 保存m_vScanParams
const char *devTypeStr[] = {NULL, "G100", "G200", "G300", "G400"};
ui->tableWidget->item(index, 1)->setText(QString::fromStdString(devTypeStr[m_vScanParams[index].deviceType]));
const char *btnTypeStr[] = {NULL, "Button 1", "Button 2", "Button 3"};
ui->tableWidget->item(index, 2)->setText(QString::fromStdString(btnTypeStr[m_vScanParams[index].buttonType]));
}
}
void Dialog_Button::on_pushButtonRemove_clicked()
{
int index = ui->tableWidget->currentRow();
if (-1 == index)
{
QMessageBox::information(this, tr("Tips"), tr("No item selected"));
return;
}
QMessageBox msg(QMessageBox::Question, tr("Question"),
tr("Are you sure you want to remove the item?"),
QMessageBox::Yes | QMessageBox::No, this);
msg.exec();
if (msg.clickedButton() != msg.button(QMessageBox::Yes))
{
return;
}
m_vScanParams.erase(m_vScanParams.begin() + index);
// TODO 保存m_vScanParams
ui->tableWidget->removeRow(index);
}

View File

@ -0,0 +1,39 @@
#ifndef DIALOG_BUTTON_H
#define DIALOG_BUTTON_H
#include <QDialog>
#include <string>
#include <vector>
#include "dialog_add.h"
namespace Ui {
class Dialog_Button;
}
class Dialog_Button : public QDialog
{
Q_OBJECT
public:
explicit Dialog_Button(QWidget *parent = nullptr);
~Dialog_Button();
bool GetScanParam(DeviceType deviceType, ButtonType buttonType, ScanParam &scanParam);
bool FindScanParam(DeviceType deviceType, ButtonType buttonType, int ignoreIndex);
protected:
virtual void closeEvent(QCloseEvent *e) override;
private slots:
void on_pushButtonAdd_clicked();
void on_pushButtonModify_clicked();
void on_pushButtonRemove_clicked();
private:
Ui::Dialog_Button *ui;
std::vector<ScanParam> m_vScanParams;
};
#endif // DIALOG_BUTTON_H

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_Button</class>
<widget class="QDialog" name="Dialog_Button">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>751</width>
<height>542</height>
</rect>
</property>
<property name="windowTitle">
<string>Button Setting</string>
</property>
<widget class="QTableWidget" name="tableWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>731</width>
<height>481</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButtonAdd">
<property name="geometry">
<rect>
<x>450</x>
<y>10</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonModify">
<property name="geometry">
<rect>
<x>550</x>
<y>10</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Modify</string>
</property>
</widget>
<widget class="QPushButton" name="pushButtonRemove">
<property name="geometry">
<rect>
<x>650</x>
<y>10</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,21 @@
#include "dialog_param.h"
#include "ui_dialog_param.h"
Dialog_Param::Dialog_Param(DeviceType deviceType, const std::string &deviceConfig, QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog_Param)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
}
Dialog_Param::~Dialog_Param()
{
delete ui;
}
std::string Dialog_Param::GetDeviceConfig()
{
std::string deviceConfig;
return deviceConfig;
}

View File

@ -0,0 +1,32 @@
#ifndef DIALOG_PARAM_H
#define DIALOG_PARAM_H
#include <QDialog>
namespace Ui {
class Dialog_Param;
}
enum DeviceType
{
DeviceType_G100 = 1,
DeviceType_G200,
DeviceType_G300,
DeviceType_G400
};
class Dialog_Param : public QDialog
{
Q_OBJECT
public:
explicit Dialog_Param(DeviceType deviceType, const std::string &deviceConfig, QWidget *parent = nullptr);
~Dialog_Param();
std::string GetDeviceConfig();
private:
Ui::Dialog_Param *ui;
};
#endif // DIALOG_PARAM_H

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_Param</class>
<widget class="QDialog" name="Dialog_Param">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>708</width>
<height>542</height>
</rect>
</property>
<property name="windowTitle">
<string>Device Config</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>350</x>
<y>500</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog_Param</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog_Param</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,24 @@
#include "dialog_scan.h"
#include "ui_dialog_scan.h"
#include <QCloseEvent>
#include "dialog_button.h"
Dialog_Scan::Dialog_Scan(class Dialog_Button *btnDlg, QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog_Scan)
, m_btnDlg(btnDlg)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
}
Dialog_Scan::~Dialog_Scan()
{
delete ui;
}
void Dialog_Scan::closeEvent(QCloseEvent *e)
{
hide(); // 隐藏主窗口
e->ignore(); //忽略关闭事件,这样才不会关闭程序
}

View File

@ -0,0 +1,26 @@
#ifndef DIALOG_SCAN_H
#define DIALOG_SCAN_H
#include <QDialog>
namespace Ui {
class Dialog_Scan;
}
class Dialog_Scan : public QDialog
{
Q_OBJECT
public:
explicit Dialog_Scan(class Dialog_Button *btnDlg, QWidget *parent = nullptr);
~Dialog_Scan();
protected:
virtual void closeEvent(QCloseEvent *e) override;
private:
Ui::Dialog_Scan *ui;
class Dialog_Button *m_btnDlg;
};
#endif // DIALOG_SCAN_H

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_Scan</class>
<widget class="QDialog" name="Dialog_Scan">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>403</width>
<height>239</height>
</rect>
</property>
<property name="windowTitle">
<string>Scan Setting</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>80</x>
<y>110</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>设备列表:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>160</x>
<y>100</y>
<width>161</width>
<height>31</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

2
app/scantool/etc/qt.conf Normal file
View File

@ -0,0 +1,2 @@
[Platforms]
WindowsArguments = dpiawareness=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

11
app/scantool/main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
//w.show();
return a.exec();
}

View File

@ -0,0 +1,80 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
#include <QCloseEvent>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
m_btnDlg = new Dialog_Button(this);
m_scanDlg = new Dialog_Scan(m_btnDlg, this);
m_trayIcon = new QSystemTrayIcon(this);
m_trayIcon->setIcon(QIcon(":images/image_rsc/png/logo.png"));
m_trayIcon->show();
m_trayIcon->setToolTip(tr("HuaGao Scan Tool"));
qRegisterMetaType<QSystemTrayIcon::ActivationReason>("QSystemTrayIcon::ActivationReason");
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::on_trayActivated);
m_scanAction = new QAction(tr("Scan Setting"), this);
connect(m_scanAction, &QAction::triggered, this, &MainWindow::on_showScanSettingDlg);
m_btnAction = new QAction(tr("Button Setting"), this);
connect(m_btnAction, &QAction::triggered, this, &MainWindow::on_showButtonSettingDlg);
m_quitAction = new QAction(tr("Exit"), this);
connect(m_quitAction, &QAction::triggered, this, &QCoreApplication::quit); //应用程序的退出
//创建菜单,添加菜单项
m_trayIconMenu = new QMenu(this);
m_trayIconMenu->addAction(m_scanAction);
m_trayIconMenu->addAction(m_btnAction);
m_trayIconMenu->addSeparator(); //分割线
m_trayIconMenu->addAction(m_quitAction);
//给系统托盘添加右键菜单
m_trayIcon->setContextMenu(m_trayIconMenu);
}
MainWindow::~MainWindow()
{
delete m_scanDlg;
delete m_btnDlg;
delete ui;
}
void MainWindow::closeEvent(QCloseEvent *e)
{
if (m_trayIcon->isVisible()) //托盘是显示的
{
hide(); // 隐藏主窗口
e->ignore(); //忽略关闭事件,这样才不会关闭程序
}
}
void MainWindow::on_trayActivated(QSystemTrayIcon::ActivationReason reason)
{
if (QSystemTrayIcon::Trigger == reason)
{
}
else if (QSystemTrayIcon::DoubleClick == reason)
{
m_btnDlg->show();
}
else if (QSystemTrayIcon::MiddleClick == reason)
{
}
}
void MainWindow::on_showScanSettingDlg()
{
m_scanDlg->show();
}
void MainWindow::on_showButtonSettingDlg()
{
m_btnDlg->show();
}

41
app/scantool/mainwindow.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include "dialog_scan.h"
#include "dialog_button.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
protected:
virtual void closeEvent(QCloseEvent *e) override;
private slots:
void on_trayActivated(QSystemTrayIcon::ActivationReason reason);
void on_showScanSettingDlg();
void on_showButtonSettingDlg();
private:
Ui::MainWindow *ui;
Dialog_Button *m_btnDlg;
Dialog_Scan *m_scanDlg;
QSystemTrayIcon* m_trayIcon;
QAction *m_scanAction;
QAction *m_btnAction;
QAction *m_quitAction;
QMenu *m_trayIconMenu;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>706</width>
<height>506</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>706</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="act_selectDevice">
<property name="text">
<string>act_selectDevice</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,127 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
DEFINES += UNTITLED_LIBRARY
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += QT_NO_VERSION_TAGGING
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
include($$PWD/../HGOEM.pri)
CONFIG(debug, debug|release) {
MY_CONFIGURE = Debug
}
CONFIG(release, debug|release) {
MY_CONFIGURE = Release
}
win32 {
MY_OS = windows
TARGET = $${OEM_PREFIX}ScanTool
contains(QT_ARCH, i386) {
MY_ARCH = x86
}
contains(QT_ARCH, x86_64) {
MY_ARCH = x64
}
CONFIG(release, debug|release) {
QMAKE_LFLAGS_RELEASE += /MAP
QMAKE_CFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /debug /opt:ref
}
LIBS += -lgdi32 -lgdiplus -ldbghelp -luser32 -ladvapi32
LIBS += -L$$PWD/../../build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE} -l$${OEM_PREFIX}Base -l$${OEM_PREFIX}ImgFmt -l$${OEM_PREFIX}ImgProc
LIBS += -L$$PWD/../../../../release/win/$${MY_ARCH}/OEM/$${OEM_NAME}
}
INCLUDEPATH += $$PWD/../../../modules/base
INCLUDEPATH += $$PWD/../../../third_party/sqlite
INCLUDEPATH += $$PWD/../../../third_party/json
DESTDIR = $$PWD/../../build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}
UI_DIR = $$PWD/../../temp/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}/$${TARGET}
MOC_DIR = $$PWD/../../temp/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}/$${TARGET}
OBJECTS_DIR = $$PWD/../../temp/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}/$${TARGET}
RCC_DIR = $$PWD/../../temp/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE}/$${TARGET}
message(MY_OS: $$MY_OS)
message(MY_ARCH: $$MY_ARCH)
message(OEM_PREFIX: $$OEM_PREFIX)
message(OEM_PREFIX2: $$OEM_PREFIX2)
message(OEM_NAME: $$OEM_NAME)
message(MY_CONFIGURE: $$MY_CONFIGURE)
message(TARGET: $$TARGET)
message(DESTDIR: $$DESTDIR)
message(UI_DIR: $$UI_DIR)
message(MOC_DIR: $$MOC_DIR)
message(OBJECTS_DIR: $$OBJECTS_DIR)
message(RCC_DIR: $$RCC_DIR)
win32 {
CONFIG(release, debug|release) {
DESTEXE_PATH = $${PWD}/../../../../release/win/$${MY_ARCH}/$${MY_CONFIGURE}/
DESTEXE_PATH = $$replace(DESTEXE_PATH, /, \\)
message(DESTEXE_PATH: $$DESTEXE_PATH)
SRCEXE_FILE = $${DESTDIR}/$${TARGET}.exe
SRCEXE_FILE = $$replace(SRCEXE_FILE, /, \\)
message(SRCEXE_FILE: $$SRCEXE_FILE)
SRCPDB_FILE = $${DESTDIR}/$${TARGET}.pdb
SRCPDB_FILE = $$replace(SRCPDB_FILE, /, \\)
message(SRCPDB_FILE: $$SRCPDB_FILE)
QMAKE_POST_LINK += xcopy /y $$SRCEXE_FILE $$DESTEXE_PATH && xcopy /y $$SRCPDB_FILE $$DESTEXE_PATH
}
}
SOURCES += \
../../../app/scantool/dialog_add.cpp \
../../../app/scantool/dialog_aquireinto.cpp \
../../../app/scantool/dialog_button.cpp \
../../../app/scantool/dialog_param.cpp \
../../../app/scantool/dialog_scan.cpp \
../../../app/scantool/main.cpp \
../../../app/scantool/mainwindow.cpp \
../../../third_party/json/cJSON.c \
../../../third_party/sqlite/sqlite3.c
HEADERS += \
../../../app/scantool/dialog_add.h \
../../../app/scantool/dialog_aquireinto.h \
../../../app/scantool/dialog_button.h \
../../../app/scantool/dialog_param.h \
../../../app/scantool/dialog_scan.h \
../../../app/scantool/mainwindow.h \ \
../../../third_party/json/cJSON.h \
../../../third_party/sqlite/sqlite3.h
FORMS += \
../../../app/scantool/dialog_add.ui \
../../../app/scantool/dialog_aquireinto.ui \
../../../app/scantool/dialog_button.ui \
../../../app/scantool/dialog_param.ui \
../../../app/scantool/dialog_scan.ui \
../../../app/scantool/mainwindow.ui
RESOURCES += \
../../../app/scantool/ScanTool_resource.qrc

View File

@ -13,7 +13,8 @@ SUBDIRS += \
HGWebService \
HGUpgrade \
HGFWUpgrade \
HGScanner2
HGScanner2 \
HGScanTool
HGImgFmt.depends = \
HGBase
@ -61,3 +62,8 @@ HGScanner2.depends = \
HGImgProc \
HGVersion \
HGTwainUser
HGScanTool.depends = \
HGBase \
HGImgFmt \
HGImgProc

View File

@ -61,7 +61,6 @@ namespace ver_2
HGBase_OpenThread(ThreadFunc, this, &m_thread);
m_initDevice = false;
m_devNameList.clear();
m_openDevice = false;
m_devName.clear();
m_sn.clear();
@ -78,6 +77,8 @@ namespace ver_2
m_scanning = false;
m_scanEvent = NULL;
m_dpi = 200;
m_curBatchTime.clear();
m_curImgIndex = 0;
HGChar cfgPath[256];
HGBase_GetConfigPath(cfgPath, 256);
@ -276,7 +277,7 @@ namespace ver_2
if ((mask & GlobalConfig::fileSavePathMask) && cfg.fileSavePath.empty())
return -1;
if ((mask & GlobalConfig::fileNameModeMask) && ("date_time" != cfg.fileNameMode && "random" != cfg.fileNameMode
&& "sn_date_time" != cfg.fileNameMode))
&& "sn_date_time" != cfg.fileNameMode) && "folder_time_img_order" != cfg.fileNameMode)
return -1;
if ((mask & GlobalConfig::imageFormatMask) && ("jpg" != cfg.imageFormat && "bmp" != cfg.imageFormat && "png" != cfg.imageFormat && "tif" != cfg.imageFormat
&& "pdf" != cfg.imageFormat && "ofd" != cfg.imageFormat && "ocr-pdf" != cfg.imageFormat && "ocr-ofd" != cfg.imageFormat))
@ -1381,7 +1382,6 @@ namespace ver_2
std::string errInfo2;
CloseDevice(errInfo2);
sane_exit();
m_devNameList.clear();
m_initDevice = false;
m_initIden.clear();
@ -1406,9 +1406,21 @@ namespace ver_2
return -1;
}
HGBase_EnterLock(m_lock);
deviceNameList = m_devNameList;
HGBase_LeaveLock(m_lock);
const SANE_Device** device = NULL;
sane_get_devices(&device, SANE_TRUE);
if (NULL == device)
{
errInfo.clear();
return 0;
}
const SANE_Device** p = device;
while (NULL != *p)
{
deviceNameList.push_back((*p)->name);
++p;
}
errInfo.clear();
return 0;
}
@ -1672,6 +1684,14 @@ namespace ver_2
m_scanning = true;
errInfo.clear();
HGTimeInfo timeInfo;
HGBase_GetLocalTime(&timeInfo);
char filePath[256] = { 0 };
sprintf(filePath, "%04d-%02d-%02d-%02d.%02d.%02d", timeInfo.year, timeInfo.month, timeInfo.day, timeInfo.hour, timeInfo.minute, timeInfo.second);
m_curBatchTime = filePath;
return 0;
}
@ -1700,6 +1720,8 @@ namespace ver_2
m_scanGetBase64 = false;
m_scanning = false;
m_dpi = 200;
m_curBatchTime.clear();
m_curImgIndex = 0;
errInfo.clear();
return 0;
@ -3325,6 +3347,21 @@ namespace ver_2
sprintf(filePath, "%s%s%s_%04d%02d%02d%02d%02d%02d%03d.%s", savePath, m_globalCfg.fileNamePrefix.c_str(), m_sn.c_str(), timeInfo.year,
timeInfo.month, timeInfo.day, timeInfo.hour, timeInfo.minute, timeInfo.second, timeInfo.milliseconds, suffix.c_str());
}
else if ("folder_time_img_order" == m_globalCfg.fileNameMode)
{
if (!m_curBatchTime.empty())
{
strcat(savePath, m_curBatchTime.c_str());
strcat(savePath, "/");
HGBase_StandardiseFileName(savePath, savePath, 256);
}
HGBase_CreateDir(savePath);
HGTimeInfo timeInfo;
HGBase_GetLocalTime(&timeInfo);
sprintf(filePath, "%s%s%s.%s", savePath, m_globalCfg.fileNamePrefix.c_str(), std::to_string(m_curImgIndex).c_str(), suffix.c_str());
}
else
{
HGTimeInfo timeInfo;
@ -4356,7 +4393,6 @@ namespace ver_2
HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "SANE_EVENT_DEVICE_ARRIVED, name=%s", Utf8ToStdString(sane_dev->name).c_str());
HGBase_EnterLock(p->m_lock);
p->m_devNameList.push_back(sane_dev->name);
std::list<class WSUser *>::iterator iter;
for (iter = p->m_user.begin(); iter != p->m_user.end(); ++iter)
{
@ -4383,14 +4419,6 @@ namespace ver_2
}
HGBase_EnterLock(p->m_lock);
for (int i = 0; i < (int)p->m_devNameList.size(); ++i)
{
if (0 == strcmp(sane_dev->name, p->m_devNameList[i].c_str()))
{
p->m_devNameList.erase(p->m_devNameList.begin() + i);
break;
}
}
std::list<class WSUser *>::iterator iter;
for (iter = p->m_user.begin(); iter != p->m_user.end(); ++iter)
{
@ -4485,6 +4513,8 @@ namespace ver_2
HGBase_CreateImageFromData(data, &imgInfo, NULL, 0, HGBASE_IMGORIGIN_TOP, &img);
if (NULL != img)
{
p->m_curImgIndex++;
HGBase_SetImageDpi(img, p->m_dpi, p->m_dpi);
HGBase_EnterLock(p->m_lock);

View File

@ -320,7 +320,6 @@ namespace ver_2
HGThread m_thread;
bool m_initDevice;
std::vector<std::string> m_devNameList;
bool m_openDevice;
SANE_Handle m_devHandle;
std::string m_devName;
@ -345,5 +344,8 @@ namespace ver_2
int m_bindNameWidth;
int m_bindNameBase;
std::list<std::string> m_saveFilePathList;
std::string m_curBatchTime;
int m_curImgIndex;
};
}

View File

@ -1,4 +1,4 @@
#include "base/HGDef.h"
#include "base/HGDef.h"
#include "base/HGInc.h"
#include "base/HGCrash.h"
#include "base/HGThread.h"
@ -13,7 +13,7 @@
#include "MsgPumpCallback.h"
#include "curl/curl.h"
HGMsgPump msgPumpV1 = NULL;
//HGMsgPump msgPumpV1 = NULL;
HGMsgPump msgPumpV2 = NULL;
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
@ -75,6 +75,8 @@ static void HGAPI ThreadFuncV2(HGThread thread, HGPointer param)
#if defined(HG_CMP_MSC)
#ifndef _DEBUG
#if defined(OEM_HANWANG)
#define SERVICE_NAME TEXT("HWWebService")
#elif defined(OEM_LISICHENG)
@ -102,12 +104,12 @@ void WINAPI ServiceCtrlHandler(DWORD dwControl)
{
case SERVICE_CONTROL_STOP: // 暂停控制
ServiceStatus.dwCurrentState = SERVICE_STOPPED;// 状态设置为停止
HGBase_ExitMsgPump(msgPumpV1);
//HGBase_ExitMsgPump(msgPumpV1);
HGBase_ExitMsgPump(msgPumpV2);
break;
case SERVICE_CONTROL_SHUTDOWN:// 关机控制
ServiceStatus.dwCurrentState = SERVICE_STOPPED;// 状态设置为停止
HGBase_ExitMsgPump(msgPumpV1);
//HGBase_ExitMsgPump(msgPumpV1);
HGBase_ExitMsgPump(msgPumpV2);
break;
default:
@ -139,9 +141,9 @@ void WINAPI ServiceMain(DWORD dwNumServicesArgs, LPTSTR* lpServiceArgVectors)
assert(0 == ret);
curl_global_init(CURL_GLOBAL_ALL);
HGBase_CreateMsgPump(&msgPumpV1);
HGThread threadV1 = NULL;
HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
//HGBase_CreateMsgPump(&msgPumpV1);
//HGThread threadV1 = NULL;
//HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
HGBase_CreateMsgPump(&msgPumpV2);
HGThread threadV2 = NULL;
@ -154,10 +156,10 @@ void WINAPI ServiceMain(DWORD dwNumServicesArgs, LPTSTR* lpServiceArgVectors)
threadV2 = NULL;
HGBase_DestroyMsgPump(msgPumpV2);
msgPumpV2 = NULL;
HGBase_CloseThread(threadV1);
threadV1 = NULL;
HGBase_DestroyMsgPump(msgPumpV1);
msgPumpV1 = NULL;
//HGBase_CloseThread(threadV1);
//threadV1 = NULL;
//HGBase_DestroyMsgPump(msgPumpV1);
//msgPumpV1 = NULL;
curl_global_cleanup();
WSACleanup();
@ -184,12 +186,14 @@ int main()
int main()
{
HGBase_RegisterCrashFunc(CrashFunc, NULL);
WSADATA ws = { 0 };
int ret = WSAStartup(MAKEWORD(2, 2), &ws);
assert(0 == ret);
curl_global_init(CURL_GLOBAL_ALL);
HGBase_CreateMsgPump(&msgPumpV1);
HGThread threadV1 = NULL;
HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
//HGBase_CreateMsgPump(&msgPumpV1);
//HGThread threadV1 = NULL;
//HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
HGBase_CreateMsgPump(&msgPumpV2);
HGThread threadV2 = NULL;
@ -199,10 +203,42 @@ int main()
threadV2 = NULL;
HGBase_DestroyMsgPump(msgPumpV2);
msgPumpV2 = NULL;
HGBase_CloseThread(threadV1);
threadV1 = NULL;
HGBase_DestroyMsgPump(msgPumpV1);
msgPumpV1 = NULL;
//HGBase_CloseThread(threadV1);
//threadV1 = NULL;
//HGBase_DestroyMsgPump(msgPumpV1);
//msgPumpV1 = NULL;
curl_global_cleanup();
WSACleanup();
return 0;
}
#endif
#else
int main()
{
HGBase_RegisterCrashFunc(CrashFunc, NULL);
curl_global_init(CURL_GLOBAL_ALL);
//HGBase_CreateMsgPump(&msgPumpV1);
//HGThread threadV1 = NULL;
//HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
HGBase_CreateMsgPump(&msgPumpV2);
HGThread threadV2 = NULL;
HGBase_OpenThread(ThreadFuncV2, msgPumpV2, &threadV2);
HGBase_CloseThread(threadV2);
threadV2 = NULL;
HGBase_DestroyMsgPump(msgPumpV2);
msgPumpV2 = NULL;
//HGBase_CloseThread(threadV1);
//threadV1 = NULL;
//HGBase_DestroyMsgPump(msgPumpV1);
//msgPumpV1 = NULL;
curl_global_cleanup();
return 0;