diff --git a/app/HGProductionTool/ProductionTool_zh_CN.qm b/app/HGProductionTool/ProductionTool_zh_CN.qm
index 665de74..a5af882 100644
Binary files a/app/HGProductionTool/ProductionTool_zh_CN.qm and b/app/HGProductionTool/ProductionTool_zh_CN.qm differ
diff --git a/app/HGProductionTool/ProductionTool_zh_CN.ts b/app/HGProductionTool/ProductionTool_zh_CN.ts
index e4f69be..c021f6d 100644
--- a/app/HGProductionTool/ProductionTool_zh_CN.ts
+++ b/app/HGProductionTool/ProductionTool_zh_CN.ts
@@ -124,12 +124,12 @@
否
-
+
确定
-
+
取消
@@ -286,32 +286,32 @@
-
+
账户:
-
+
密码:
-
+
数据库地址:
-
+
数据库端口:
-
+
FTP地址:
-
+
FTP端口:
@@ -324,12 +324,12 @@
端口号:
-
+
登录
-
+
退出
@@ -349,17 +349,17 @@
关闭
-
+
登录
-
+
提示
-
+
登录失败:
@@ -500,133 +500,145 @@
-
+
+
+
+
+
+
上一步
-
+
通过
-
+
不通过
-
+
开始测试
-
+
左旋转
-
+
右旋转
-
+
关闭
-
+
加载图片
-
+
下一步
-
+
+
设备已连接
-
+
设备未连接
-
+
设备型号:
-
+
序列号:
-
+
+
设备连接状态:
-
+
加载上一次上传的图片
-
-
+
+
+ 设备已断开
+
+
+
+
提示
-
+
确定
-
+
取消
-
+
序号
-
+
测试项
-
+
测试状态
-
+
未测试
-
+
不通过
-
+
不支持
-
+
通过
-
+
无图
@@ -692,7 +704,7 @@
上传配置文件
-
+
账户在其他地方登录
@@ -701,104 +713,108 @@
网络连接断开
-
+
你已被管理员账户强制下线
-
+
数据库错误
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
提示
-
-
-
+
+
+
测试中,请勿关闭!
-
+
检测到设备连接,是否启动测试?
-
+
确定
-
+
取消
-
-
+
+
不能创建更多项目
-
- 设备已断开连接
+ 设备已断开连接
-
+
+
+ 打开设备失败
+
+
+
保存
-
+
xls表格(*.xls)
-
+
导出成功
-
+
导出失败
-
+
非法的用户
-
+
密码错误
-
+
数据库错误
-
+
连接错误
-
+
错误
@@ -806,14 +822,14 @@
QObject
-
+
success
成功:
-
-
+
+
失败:
diff --git a/app/HGProductionTool/form_maininterface.cpp b/app/HGProductionTool/form_maininterface.cpp
index 1d9d519..01c25f0 100644
--- a/app/HGProductionTool/form_maininterface.cpp
+++ b/app/HGProductionTool/form_maininterface.cpp
@@ -65,6 +65,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha
, m_mainwnd(mainwnd)
, m_hg(nullptr)
, m_handle(handle)
+ , m_disconnect(false)
, m_pdtToolDbuserMgr(pdtToolDbuserMgr)
, m_pdtToolDbDevice(pdtToolDbDevice)
, m_serialNum(serialNum)
@@ -89,7 +90,8 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha
str = tr("Device has connected");
else
str = tr("Device hasnot connected");
- ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum + tr(" connect status:") + str);
+ ui->label_sn->setText(tr("Device type:") + m_devType + tr(" SerialNum:") + m_serialNum);
+ ui->label_devStatus->setText(tr(" connect status:") + str);
setMinimumWidth(500);
ui->tableWidget->setMinimumWidth(400);
@@ -150,6 +152,13 @@ hgscanner *Form_mainInterface::getScanner()
return m_hg;
}
+void Form_mainInterface::setDevDisconnect()
+{
+ QString str = tr("Device has disconnected");
+ ui->label_devStatus->setText(tr(" connect status:") + str);
+ m_disconnect = true;
+}
+
void Form_mainInterface::paintEvent(QPaintEvent *event)
{
(void)event;
@@ -166,6 +175,11 @@ void Form_mainInterface::on_testResult(QString text)
updateUiEnabled(true);
m_isTesting = false;
m_mainwnd->releaseTesting();
+
+ if (m_disconnect)
+ {
+ m_mainwnd->RemoveInterface(this);
+ }
}
void Form_mainInterface::on_testResultImg(void *img)
@@ -195,6 +209,11 @@ void Form_mainInterface::on_testDistortion(QString name, void *data)
updateUiEnabled(true);
m_isTesting = false;
m_mainwnd->releaseTesting();
+
+ if (m_disconnect)
+ {
+ m_mainwnd->RemoveInterface(this);
+ }
}
}
diff --git a/app/HGProductionTool/form_maininterface.h b/app/HGProductionTool/form_maininterface.h
index 2d5e851..ffb4f08 100644
--- a/app/HGProductionTool/form_maininterface.h
+++ b/app/HGProductionTool/form_maininterface.h
@@ -29,6 +29,7 @@ public:
QString getDevName();
SANE_Handle getDevHandle();
hgscanner *getScanner();
+ void setDevDisconnect();
protected:
void paintEvent(QPaintEvent *event) override;
@@ -87,6 +88,7 @@ private:
class MainWindow *m_mainwnd;
hgscanner *m_hg;
SANE_Handle m_handle;
+ bool m_disconnect;
HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
HGPdtToolDbDevice m_pdtToolDbDevice;
QString m_serialNum;
diff --git a/app/HGProductionTool/form_maininterface.ui b/app/HGProductionTool/form_maininterface.ui
index ece8e75..ee4b6c6 100644
--- a/app/HGProductionTool/form_maininterface.ui
+++ b/app/HGProductionTool/form_maininterface.ui
@@ -23,6 +23,13 @@
+ -
+
+
+ devStatus
+
+
+
-
diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp
index 8c814ba..2c12a31 100644
--- a/app/HGProductionTool/mainwindow.cpp
+++ b/app/HGProductionTool/mainwindow.cpp
@@ -374,24 +374,30 @@ void MainWindow::on_sane_dev_arrive(QString devName)
{
SANE_Handle devHandle = nullptr;
sane_open(devName.toStdString().c_str(), &devHandle);
-
- Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle));
- if (dlg.exec())
+ if (nullptr != devHandle)
{
- HGPdtToolDbDevice pdtToolDbDevice = nullptr;
- HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
-
- Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
- dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle));
- if (!AddInterface(mainInterface))
+ Dialog_InputSerialNum dlg(this, getDevSn(devHandle), getDevType(devHandle));
+ if (dlg.exec())
{
- QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
- delete mainInterface;
+ HGPdtToolDbDevice pdtToolDbDevice = nullptr;
+ HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
+
+ Form_mainInterface *mainInterface = new Form_mainInterface(this, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
+ dlg.GetSn(), dlg.GetDevType(), devName, getDevFwNum(devHandle));
+ if (!AddInterface(mainInterface))
+ {
+ QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
+ delete mainInterface;
+ }
+ }
+ else
+ {
+ sane_close(devHandle);
}
}
else
{
- sane_close(devHandle);
+ QMessageBox::information(this, tr("tips"), tr("Open device failed"));
}
}
}
@@ -401,8 +407,11 @@ void MainWindow::on_sane_dev_remove(QString devName)
Form_mainInterface *interface = FindInterfaceByDevName(devName);
if (interface != nullptr)
{
- QMessageBox::information(this, tr("tips"), tr("The device has disconnected"));
- RemoveInterface(interface);
+ interface->setDevDisconnect();
+ if (!interface->isTesting())
+ {
+ RemoveInterface(interface);
+ }
}
}