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 @@ - + OK 确定 - + Cancel 取消 @@ -286,32 +286,32 @@ - + account: 账户: - + password: 密码: - + dbHost: 数据库地址: - + dbPort: 数据库端口: - + ftpHost: FTP地址: - + ftpPort: FTP端口: @@ -324,12 +324,12 @@ 端口号: - + LOG IN 登录 - + EXIT 退出 @@ -349,17 +349,17 @@ 关闭 - + LogIn 登录 - + tips 提示 - + Login failed: 登录失败: @@ -500,133 +500,145 @@ - + + devStatus + + + + Privious Step 上一步 - + PASS 通过 - + FAIL 不通过 - + START 开始测试 - + LeftRotate 左旋转 - + RightRotate 右旋转 - + STOP 关闭 - + SHOWIMG 加载图片 - + Next Step 下一步 - + + Device has connected 设备已连接 - + Device hasnot connected 设备未连接 - + Device type: 设备型号: - + SerialNum: 序列号: - + + connect status: 设备连接状态: - + load last image which uploaded last time 加载上一次上传的图片 - - + + Device has disconnected + 设备已断开 + + + + tips 提示 - + yes 确定 - + no 取消 - + ID 序号 - + Test items 测试项 - + status 测试状态 - + not test 未测试 - + not pass 不通过 - + not support 不支持 - + pass 通过 - + no image 无图 @@ -692,7 +704,7 @@ 上传配置文件 - + Account login elsewhere 账户在其他地方登录 @@ -701,104 +713,108 @@ 网络连接断开 - + You have been forced offline by the administrator account 你已被管理员账户强制下线 - + Data base error 数据库错误 - - - - - - - - - - + + + + + + + + + + tips 提示 - - - + + + Is testing, do not close! 测试中,请勿关闭! - + Are you sure to connect the new device 检测到设备连接,是否启动测试? - + yes 确定 - + no 取消 - - + + cannot create more table 不能创建更多项目 - The device has disconnected - 设备已断开连接 + 设备已断开连接 - + + Open device failed + 打开设备失败 + + + save 保存 - + xls(*.xls) xls表格(*.xls) - + export succeed 导出成功 - + export failed 导出失败 - + Illegal user 非法的用户 - + Wrong password 密码错误 - + Database error 数据库错误 - + connect error 连接错误 - + Failed 错误 @@ -806,14 +822,14 @@ QObject - + success: success 成功: - - + + failed: 失败: 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); + } } }