diff --git a/src/algorithm/ImageProcess.cpp b/src/algorithm/ImageProcess.cpp index f551549..c6bd257 100644 --- a/src/algorithm/ImageProcess.cpp +++ b/src/algorithm/ImageProcess.cpp @@ -240,7 +240,6 @@ cv::Mat ImageProcess::findCircleByBackground(const Mat &srcImg, const Mat& backg } if (nIndex != -1) { - radius = EDCircle[nIndex].r * REAIZE; center.x = (EDCircle[nIndex].center.x * REAIZE); center.y = (EDCircle[nIndex].center.y * REAIZE); return DetectCircle(srcImg, backgroundImg, center, radius, bEqual, cParam); diff --git a/tpvs17/tpMain/QPLCDevice.cpp b/tpvs17/tpMain/QPLCDevice.cpp index 0644585..16fff75 100644 --- a/tpvs17/tpMain/QPLCDevice.cpp +++ b/tpvs17/tpMain/QPLCDevice.cpp @@ -139,9 +139,9 @@ void QPLCDevice::onAckTrigerCam(int stationID) sendByteData(sdata.toLatin1()); } -Q_SLOT void QPLCDevice::on_client_connect_status(QString ip, int port, ServerStatus status) +Q_SLOT void QPLCDevice::on_client_connect_status(QString strID, ServerStatus status) { - QString clientName = QString("%1:%2").arg(ip).arg(port); + QString clientName = strID; switch (status) { case TCPSERVER_ON_CLIENT_CONNECTED: if (!m_clientList.contains(clientName)) diff --git a/tpvs17/tpMain/QPLCDevice.h b/tpvs17/tpMain/QPLCDevice.h index 21cae87..a142ae3 100644 --- a/tpvs17/tpMain/QPLCDevice.h +++ b/tpvs17/tpMain/QPLCDevice.h @@ -28,7 +28,7 @@ public: void onSendHeartBit();//·¢ËÍÐÄÌø void onAckTrigerCam(int stationID);//·¢Ëʹ¥·¢Ӧ´ð Q_SLOT void on_serv_status_changed(int id, ServerStatus status); - Q_SLOT void on_client_connect_status(QString ip, int port, ServerStatus status); + Q_SLOT void on_client_connect_status(QString strID, ServerStatus status); bool getClinetInfo(QString &client); signals: diff --git a/tpvs17/tpMain/lpMainWin.cpp b/tpvs17/tpMain/lpMainWin.cpp index 6f8b109..d65f052 100644 --- a/tpvs17/tpMain/lpMainWin.cpp +++ b/tpvs17/tpMain/lpMainWin.cpp @@ -1122,6 +1122,14 @@ void lpMainWin::closeEvent(QCloseEvent *event) return event->accept(); } +void lpMainWin::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui.retranslateUi(this); + } +} + void lpMainWin::onSetModel() { /* diff --git a/tpvs17/tpMain/lpMainWin.h b/tpvs17/tpMain/lpMainWin.h index 9283342..0f2a86f 100644 --- a/tpvs17/tpMain/lpMainWin.h +++ b/tpvs17/tpMain/lpMainWin.h @@ -23,7 +23,6 @@ #include "CoreCtrl/CDllDesigner.h" #include "lpdesigner.h" #include "lpImageCaliUI.h" -//#include "QPLCDevice.h" #include "lpSystemConfigUI.h" #include #include "QCryptokeyUI.h" @@ -149,6 +148,7 @@ private: protected: virtual void timerEvent(QTimerEvent *event); virtual void closeEvent(QCloseEvent *event); + virtual void changeEvent(QEvent *event); private: Ui::lpMainWin ui; diff --git a/tpvs17/tpMain/lpRawTcp/lpRawTcpClientSession.h b/tpvs17/tpMain/lpRawTcp/lpRawTcpClientSession.h index 3aced6d..01c3bc4 100644 --- a/tpvs17/tpMain/lpRawTcp/lpRawTcpClientSession.h +++ b/tpvs17/tpMain/lpRawTcp/lpRawTcpClientSession.h @@ -20,11 +20,16 @@ public: Q_SLOT void on_data_to_send(int sess_id, QSharedPointer); QString getClientIP(); int getClientPort(); + + void setClientID(QString strID) { + m_strID = strID; + }; + QString getClientID()const { + return m_strID; + }; signals: void data_received(int, QSharedPointer); void sess_disconnected(int); - - private: void socket_close(); @@ -34,5 +39,6 @@ private: QTcpSocket *psocket_{ nullptr }; int socket_descriptor_; RecvDataFunc _func; + QString m_strID; }; #endif //__TP_RAW_CLIENTSESSION_H__ diff --git a/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.cpp b/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.cpp index 1493507..6d4f6a3 100644 --- a/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.cpp +++ b/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.cpp @@ -94,8 +94,10 @@ void lptkRawTcpServer::incomingConnection(qintptr socketDescriptor) int n = strIP.lastIndexOf(":"); strIP = strIP.mid(n).remove(":"); int port = pclientSess->getClientPort(); + QString strID = QString("%1:%2").arg(strIP).arg(port); + pclientSess->setClientID(strID); emit client_status_changed(socketDescriptor, TCPSERVER_ON_CLIENT_CONNECTED); - emit client_connect_status(strIP, port, TCPSERVER_ON_CLIENT_CONNECTED); + emit client_connect_status(strID, TCPSERVER_ON_CLIENT_CONNECTED); } void lptkRawTcpServer::on_data_received(int sess_id, QSharedPointer data_ptr) @@ -123,11 +125,8 @@ void lptkRawTcpServer::on_sess_disconnected(int sess_id) cli_sess.pThrd_->exit(0); } - QString strIP = cli_sess.pSess_->getClientIP(); - int n = strIP.lastIndexOf(":"); - strIP = strIP.mid(n).remove(":"); - int port = cli_sess.pSess_->getClientPort(); - emit client_connect_status(strIP, port, TCPSERVER_ON_CLIENT_DISCONNECTED); + QString strID = cli_sess.pSess_->getClientID(); + emit client_connect_status(strID, TCPSERVER_ON_CLIENT_DISCONNECTED); delete cli_sess.pThrd_; delete cli_sess.pSess_; @@ -156,4 +155,4 @@ void lptkRawTcpServer::broadcast_send_data(QSharedPointer data_ptr) emit data_to_send(it.key(), data_ptr); it++; } -} \ No newline at end of file +} diff --git a/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.h b/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.h index 92499bd..ab57b77 100644 --- a/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.h +++ b/tpvs17/tpMain/lpRawTcp/lptkRawTcpServer.h @@ -43,7 +43,7 @@ signals: void client_status_changed(int, ServerStatus); void data_received(int, QSharedPointer); void data_to_send(int, QSharedPointer); - void client_connect_status(QString ip, int port, ServerStatus); + void client_connect_status(QString strID, ServerStatus); public slots: void on_sess_disconnected(int); diff --git a/tpvs17/tpMain/lpmain_en.ts b/tpvs17/tpMain/lpmain_en.ts index 2a15cf7..9f17259 100644 --- a/tpvs17/tpMain/lpmain_en.ts +++ b/tpvs17/tpMain/lpmain_en.ts @@ -4,23 +4,20 @@ CChannelInfo - 开始读取json文件数据... - Reading json's file data... + Reading json's file data... - 数据读取完成... - Read complete... + Read complete... CWheelNet - IP参数设置 IP Config - IP Config + IP Config @@ -51,52 +48,44 @@ QAddChannelDlg - 新建通道 Add New Channel - Add New Channel + Add New Channel - 发送结果: Results: - Results: + Results: - 通道名称: Name: - Name: + Name: - 备注: About: - About: + About: - 确认 OK - OK + OK - 取消 Cancel - Cancel + Cancel - 警告 Warning - Warning + Warning - 数据不能为空,请输入 Data cannot be empty, please enter - Data cannot be empty, please enter + Data cannot be empty, please enter @@ -172,57 +161,44 @@ QAddTimeDlg - 时间参数设置 - Time Setting + Time Setting - 确认 - OK + OK - 取消 - Cancel + Cancel - 时间参数: - Time Info: + Time Info: - 起始时间 - Start: + Start: - 班次名称: - Name: + Name: - - hh:mm - hh:mm + hh:mm - 结束时间 - End : + End : - - 当天 - Same day + Same day - - 隔天 - Text day + Text day @@ -352,150 +328,172 @@ QChannelManager - 通道信息管理 Channel Mamager - Channel Mamager + Channel Mamager - 所有通道数据 All channel Info - All channel Info + All channel Info - 发送结果: Result: - Result: + Result: - 通道名称: Name: - Name: + Name: - 备注: About: - About: + About: - 是否设为默认(NG流向的通道) Set to default - Set to default + Set to default - 确认修改 OK - OK + OK - 退出 - Cancel + Cancel - 编号 - Num + Num - 通道名 - Name + Name - 备注 - About + About - 发送结果 - Result + Result - 是否为默认 - Is dafault + Is dafault - 默认 - Default + Default QChannelMgrDlg - QChannelMgrDlg - QChannelMgrDlg + QChannelMgrDlg - 所有型号及图像 - All models and images + All models and images - 型号: - Model: + Model: - 通道: - Channer: + Channer: - 查找: - Find: + Find: - - 隐藏 - Hide + Hide - 修改 - Modify + Modify - 0 - 0 + 0 - 通道分配: - Channel assignment: + Channel assignment: - 删除通道 - Delete channel + Delete channel - 增加通道 - Add channel + Add channel - 刷新 - Refresh + Refresh - 通道管理 - Channel management + Channel management + + + + QCryptokeyUI + + + 注册 + + + + + 退出 + + + + + 机器码: + + + + + 注册码: + + + + + 激活 + + + + + 请输入注册码 + + + + + 激活状态: + + + + + 未激活 + + + + + + + 提示 + @@ -565,98 +563,79 @@ p, li { white-space: pre-wrap; } QDia2ThSetting - 直径标定 - Diameter Standard + Diameter Standard - K:表示斜率,B:基准点,直径=高度*K+B - K: rate, B: base point, Diameter = H * K + B + K: rate, B: base point, Diameter = H * K + B - 确认修改 - OK + OK - 退出 - Cancel + Cancel - B: - B: + B: - K: - K: + K: - 提示 - Warning + Warning - 修改完成,参数已生效! - The modification is completed and the parameters are in effect! + The modification is completed and the parameters are in effect! - 确定 - OK + OK QIPConfigDlg - QIPConfigDlg - QIPConfigDlg + QIPConfigDlg - 本机服务器IP地址设置 - Server address Settings + Server address Settings - - IP 地址(I): - Address: + Address: - 关闭服务 - Close Server + Close Server - 开放端口: - Port: + Port: - 打开服务 - Open Server + Open Server - 目标客户端IP地址设置 - Client Address Settings + Client Address Settings - 源端口: - Port: + Port: - 确定 - OK + OK @@ -727,118 +706,118 @@ p, li { white-space: pre-wrap; } QModelMgrDlg - + 轮毂信息: Wheel information: - + 型号 Model - + 0% 0% - + 阈值调节 Threshold - + 严格 Strict - + 旋转次数 Rotations - + 缩略图 Thumbnail - + 宽松 Easy - + 厚度(mm) Thickness(mm) - + 直径(mm) Diameter(mm) - + 加入训练 Add to train - + 基本操作 Basic operation - - + + 删除模板 Delete - + 训练当前模板 Training - + 训练模板 Train - + 添加新的模板 Add new - + 新建模板 New - + 训练所有模板,消耗时间会较长 Training all templates will take longer - + 训练全部 Train all - + 确认修改,每次修改模板的参数后都要确认修改才有效 Confirm the modification, every time you modify the parameters of the template, you must confirm the modification to be effective - + 修改确认 Confirm - + 修改型号名 Modify name - + 图片显示: Image display: @@ -847,19 +826,19 @@ p, li { white-space: pre-wrap; } TextLabel - - + + 添加已裁剪的轮毂图片 Add cropped wheel image - + 追加 Add - - + + 删除所有模板 Delete all @@ -879,25 +858,25 @@ p, li { white-space: pre-wrap; } Quantity - + modelID modelID - - - - - - - - - - - - + + + + + + + + + + + + 提示 Prompt @@ -923,252 +902,252 @@ p, li { white-space: pre-wrap; } Failed to add, you cannot add a picture with a detection background as a template! ! ! - + 加载完成 Download finished - - - + + + 请选择一个您要修改的型号! Please select a model you want to modify! - + 修改了模板 Modified template - + 的参数 The parameters of the - + 修改成功! Successfully modified! - - + + 请选择一个您要删除的型号 Please select a model you want to delete - + 按下了删除模板按钮 Press the Delete Template button - + 是否删除型号 Whether to delete the model - + 产品模板 Product template - + 删除了模板 Template deleted - - - - - - - - + + + + + + + + 共 common - - - - - + + + + + 个型号 Model number - + 按下了添加模板按钮 Press the Add Template button - + 产品信息设置 Product information settings - + 添加了一个新的模型 Added a new model - + 请选择一个您要训练的型号! Please select a model you want to train! - - + + 训练模板线程未退出,请稍等 The training template thread did not exit, please wait - + 将对所有型号模板进行重新训练,期间系统的检测功能将不能正常运行直到模板训练完成,全部重新训练模板将需要很长时间,期间将不能进行其他工作,是否继续执行? All model templates will be retrained. During this period, the system's detection function will not operate normally until the template training is completed. It will take a long time for all templates to be retrained, during which other work will not be possible. Do you want to continue? - + 确定删除该图像? Determine to delete the image? - + 模板图片删除 Template picture deletion - - - + + + 个图像 Image - + 警告 Warning - + 即将删除模板库里的所有模板,是否继续? All templates in the template library will be deleted. Do you want to continue? - + 再次确认,是否全部删除? Confirm again, delete all? - + 没有模板!!! No template!!! - + 全部删除完成!!! Complete deletion!!! - + 图像数量少于 The number of images is less than - + 个,请及时补充训练样本 , please add training samples in time - - - - - - - + + + + + + + 模板更新进度 Template update progress - + 正在初始化所有模板 共需要训练%1个模板,请稍后..... All templates are being initialized. A total of%1 templates need to be trained. Please wait a moment... - + 正在训练%1的模板 已完成%2/%3,请稍后..... The template training %1 is complete %2/%3, please wait... - + %1的模板获取特征 已完成%2/%3,请稍后..... Template capture feature for %1 is complete for %2/%3, please wait... - + %1的模板训练完成 已完成%2/%3,请稍后..... Template training for %1 completed %2/%3, please wait... - + 全部模板更新完成!%1s All templates updated!The %1 s - + 对全部模板进行了重新训练,共%1个模板 All templates were retrained, with a total of%1 template - + 模板正在准备请稍后..... The template is being prepared Please wait a moment..... - - - - - - - - - - - - + + + + + + + + + + + + 模板训练进度 Template training progress - - + + %1型号没有图片不能训练! %1 Model can not be trained without pictures! - + %1的模板 正在获取特征值,请稍后.... The%1 template is getting the characteristic value. Please wait... - + 训练完成!%1s Training completed! %1s - + 训练了模板:%1 Model training:%1 - + 确认 OK - + 取消 Cancel @@ -1184,44 +1163,41 @@ p, li { white-space: pre-wrap; } QObject - 虚拟相机触发 - Virtual camera trigger + Virtual camera trigger - 硬件相机触发 - Hardware camera trigger + Hardware camera trigger - 调试免登陆 - Debugging free login + Debugging free login - 正常工作模式 - Normal working mode + Normal working mode - 传感器触发 - Sensor trigger + Sensor trigger - 软件触发 - Software trigger + Software trigger - 下降沿触发 - Falling edge trigger + Falling edge trigger - 上升沿触发 - Rising edge trigger + Rising edge trigger + + + + 识别定位一体系统 + @@ -1263,510 +1239,383 @@ p, li { white-space: pre-wrap; } QSystemSettingDlg - 相关设备配置 - Device Setting + Device Setting - - 检测图像设置 - Image Settings + Image Settings - - PLC相关设置 - PLC Settings + PLC Settings - - 报警灯测试 - Alarm Test + Alarm Test - 高级功能 - Developer + Developer - 属性 - Property + Property - 值 - Value + Value - 语言 - Language + Language - 检测背景更换 - Background + Background - - 抠图后 - After cutout + After cutout - - 原图 - SourceImage + SourceImage - 背景图 - Background + Background - 检测结果 - Result + Result - 图像保存路径 - Image Save Path + Image Save Path - - 设置保存路径 - Save path + Save path - - 打开图像路径 - Open Image Path + Open Image Path - 保存当前设置 - Save current settings + Save current settings - - 保存已匹配图 - Save matched Image + Save matched Image - - 保存无匹配图 - Save Unmatched Image + Save Unmatched Image - 使用背景图 - Use background + Use background - 轮毂全去A通道 - Hub All-to-A Channel + Hub All-to-A Channel - 查看检测背景 - Check Background + Check Background - 保存参数 - Save Parameters + Save Parameters - - 保存设置 - Save Settings + Save Settings - 传感器触发滤波(ms) - Sensor filtering (ms) + Sensor filtering (ms) - 相机触发延时(ms) - Sensor filtering (ms) + Sensor filtering (ms) - 相机触发脉宽(ms) - Camera width (ms) + Camera width (ms) - 光源熄灭延时时间(ms) - Light delay time (ms) + Light delay time (ms) - 传感器触发类型 - Sensor trigger type + Sensor trigger type - 保持结果时长(ms) - Result hold Times (ms) + Result hold Times (ms) - 连接超时次数 - Connection timeouts + Connection timeouts - 超时是否显示信息 - Display information + Display information - - 是否自动重启服务器 - Auto restart servering + Auto restart servering - 是否保存超时日志 - Save timeout log + Save timeout log - 发送并保存 - Send and save + Send and save - 超时提醒n次后自动重启服务 - Automatically restart service after n timeout reminders + Automatically restart service after n timeout reminders - 是否显示提示 - Display Warning + Display Warning - 勾选后通信超时时会显示提醒信息 - Reminder message will be displayed when communication timeout occurs after checking + Reminder message will be displayed when communication timeout occurs after checking - 勾选后通信超时次数达到后,系统将自动重启服务,PLC会自动重新连接 - After checking the number of communication timeouts reached, the system will automatically restart the service, and the PLC will automatically reconnect + After checking the number of communication timeouts reached, the system will automatically restart the service, and the PLC will automatically reconnect - 保存信息到系统日志 - Save information to system log + Save information to system log - 勾选后表示超时信息将自动保存到系统日志中,便于查询 - Check to indicate that the timeout information will be automatically saved to the system log for easy query + Check to indicate that the timeout information will be automatically saved to the system log for easy query - 红灯 - Red light + Red light - 绿灯 - Green light + Green light - 黄灯 - Yellow light + Yellow light - 蜂鸣 - Buzzing + Buzzing - 红灯闪一下 - Red light flashed + Red light flashed - 绿灯闪一下 - Green light flashed + Green light flashed - 黄灯闪一下 - Yellow light flashed + Yellow light flashed - 蜂鸣响一下 - Bee rings + Bee rings - 开发者使用 - Developers use + Developers use - 相机模式 - Camera mode + Camera mode - 虚拟相机触发时间 - Trigger times + Trigger times - 系统模式 - System mode + System mode - 相机触发模式 - Trigger mode + Trigger mode - - 串口发送心跳包 - Serial Port + Serial Port - - 网络发送心跳包 - Network + Network - - 串口发送通道结果 - Serial Port + Serial Port - - 网络发送检测结果 - Network + Network - - 网络发送通道结果 - Network + Network - 光栅使用标志 - Rester + Rester - 保存高度厚度数据 - Data + Data - 通道分配 - Channel allocate + Channel allocate - 启动时是否检测 - Whether to detect at startup + Whether to detect at startup - 显示厚度数据 - Display thickness data + Display thickness data - 显示厚度采样数据 - Display thickness sampling data + Display thickness sampling data - 使用光栅获取厚度 - Acquiring Thickness by Grating + Acquiring Thickness by Grating - 保存数据用于测试 - Save data for testing + Save data for testing - 是否使用通道分配 - Whether to use channel allocation or not + Whether to use channel allocation or not - 是否启动就开始检测 - Start checking if it's started + Start checking if it's started - - 是否显示 - Whether to display + Whether to display - 保存 - Save + Save - 请选择您的背景图 - Please select your background map + Please select your background map - 提示 Info - Warning + Warning - 背景图更新完成,请重启本软件. - Background image updated, please restart this software. + Background image updated, please restart this software. - 确认 - OK + OK - 打开文件夹 - Open folder + Open folder QSystemSettingUI - 系统设置 - System settings + System settings QTimeMgrDlg - 班次管理 - Classes management + Classes management - - - 未选中 - UnSelect + UnSelect - 添加时间 - Add + Add - 删除时间 - Delete + Delete - 修改时间 - Modify + Modify - 班次 - Classes + Classes - 起始时间 - Start + Start - 结束时间 - End + End - 设置参数 - Setting parameters + Setting parameters - - - - - - 当天 - Same day + Same day - - - - - - 隔天 - Next day + Next day - - - 提示 - Prompt + Prompt - - 未选择班次,请选择进行修改。 - No classes is selected, please select to modify. + No classes is selected, please select to modify. - - - 确认 - Ok + Ok - 您确定要删除 %1 班次? - Are you sure you want to delete the %1 classes? + Are you sure you want to delete the %1 classes? - 取消 - Canncel + Canncel @@ -1834,194 +1683,189 @@ p, li { white-space: pre-wrap; } Table List - + 添加任务单 Add Table - + 添加 Add - + 删除任务单 Delete Table List - + 删除 Del - + 修改任务单名称或备注信息 Modify Table List Name or Note Information - + 修改 Mod - + 使用任务单 Set Use - + 应用 Use - + 当前选择的任务表: Current Table: - - + + 数量 Num - + 添加型号到检测列表 Add model to table - + <<< <<< - + 从检测列表移除所选型号 Remove the selected model from the table - + >>> >>> - + 缩略图 Image - + 只看已选 Selected - + 只看未选 Unselected - + 显示全部 Show all - + 查找: Find: - 其他 - Others + Others - 按照直径检测 - By diameter + By diameter - 按照厚度检测 - By thickness + By thickness - 手动发送模板库 - Send Models + Send Models - + 检测模板管理 Detection Model Management - - + + 共 %1 个 Total of: %1 - + 当前使用的工单为 %1 The current Table is%1 - + 以下型号为重复添加: %1已被忽略. The models are added repeatedly:%1, And They have been ignored. - + 提醒 Warning - - - + + + 确定 OK - + 工单 %1 被设为应用 Table %1 is seted to Using - 发送模板库 - Send Template Library + Send Template Library - - + + 警告 Warning - + %1任务单正在使用不能被删除,请先切换到其他任务单,再删除该任务单? %1 Table is Using and cannot be deleted. Please switch to another Table before deleting the Table? - - + + 取消 Cancel - + 是否要删除 %1 模型? Do you want to delete the%1 model? - + 序号 Num - + 内容 About @@ -2029,18 +1873,18 @@ p, li { white-space: pre-wrap; } RoiImgViewer - - + + line item is not created line item is not created - + line item is already created line item is already created - + rect item is already created rect item is already created @@ -2048,56 +1892,150 @@ p, li { white-space: pre-wrap; } WheelCtrl - 加载通道模块 .... - Loading Channel Module.... + Loading Channel Module.... - 加载模板库 .... - Loading Template Library.... + Loading Template Library.... - 加载检测设置模块 .... - Load Detection Setup Module.... + Load Detection Setup Module.... - 加载数据库 .... - Load the database.... + Load the database.... - 加载班次管理模块 .... - Loading shift management module.... + Loading shift management module.... - 加载其他模块 .... - Loading other modules.... + Loading other modules.... - 创建子线程 .... - Create subthreads.... + Create subthreads.... - 加载光栅通讯模块 .... - Loading grating communication module.... + Loading grating communication module.... - 模块加载完成,启动线程 .... - Module loading is completed and thread is started.... + Module loading is completed and thread is started.... - + 未登录 None + + lpImageCaliUI + + + 相机视场标定 + + + + + 操作 + + + + + 选择标定图像 + + + + + P1_X: + + + + + P1_Y: + + + + + P2_Y: + + + + + + + + 1200 + 1200 + + + + P2_X: + + + + + 两点实际距离mm: + + + + + 两点像素距离px: + + + + + 像素比例值(mm/px): + + + + + 解锁 + + + + + 物理X方向偏移: + + + + + 物理Y方向偏移: + + + + + 应用 + Use + + + + 退出 + + + + + + + ���� + + + + + ѡ���궨ͼ + + + + + Image Files (*.png *.jpg *.bmp) + + + lpMainWin @@ -2116,474 +2054,709 @@ p, li { white-space: pre-wrap; } Status information - - + + 识别定位检测 + + + + + 开始检测 Start testing - + 检测结果 Results - 无匹配(个) - No match + No match - 已检测(个) - Detected + Detected - + 匹配值 Match value - 直径(mm) - Diameter (mm) + Diameter (mm) - 时间(s) - Time(s) + Time(s) - 通道 - Channel + 匹配值 + 通道 + Channel - - - - - - - + + + + + 0 0 - --------- - --------- + --------- - + None None - - + + 检测状态 Detection status - 厚度(mm) - Thickness(mm) + Thickness(mm) - + 统计结果 Statistical results - + modelID_detect modelID_detect - + count count - 交换班清零 - Exchange class reset + Exchange class reset - + 型号数量 Model number - - + 模板管理 Template management - + 数据查询 History - 模板勾选 - Template selection + Template selection + + + + 0.0 + 0.0 + + + + 角度 + + + + + (0.0) + + + + + 圆心坐标 + + + + + 定位结果 + + + + + 定位耗时 + + + + + 识别耗时 + + + + + 分数 + + + + + 型号管理 + + + + + 检测勾选 + - + 辅助工具 Auxiliary tools - + 班次设置 Classes setting - + 光栅标定 Raster calibration - + IP设置 IP settings - - + + 关于 About - + 登录 Login - + 用户管理 User Management - + 系统设置 System settings - - + + 相机配置 Camera configuration - + + 定位标定 + + + + + + 图像标定 + + + + + + 注册产品 + + + 加载必要模块..... - Load the necessary modules..... + Load the necessary modules..... - - + + 工具 Tool - + 系统时间 System time - 班次信息 - Classes information + Classes information - + 用户: User: - + 历史 History - 系统初始化完成... - System initialization complete... + System initialization complete... - + 显示识别结果 Display recognition results - 相机图像和背景图不一样,请更换检测背景! - The camera image is different from the background image, please change the detection background! + The camera image is different from the background image, please change the detection background! - 警告!!!连续出现%1个未识别型号 - Warning!!! %1 unidentified models appear continuously + Warning!!! %1 unidentified models appear continuously - ,未开启检测功能造成的 - , Caused by not opening the detection function + , Caused by not opening the detection function - + 获得图像,正在计算中... Get the image, is calculating... - + 注 销 Logout - + 登 录 Login - - + + 该功能未启用. The feature is not enabled. - - - + + + + + 确认 Ok - + 你确定要注销 Are you sure you want to log out - 班次管理 - Classes management + Classes management - + 调试工具 DebugTool - + 系统参数设置 System parameter setting - - + + 停止检测 Stop detecting - + + + 帮助 + + + + + + 本系统未注册激活 + + + + + + 请停止检测再使用该功能. + + + + + 注册 + + + + 按下了开始检测按钮,检测功能开启 Press the start detection button, the detection function is turned on - + 按下了停止检测按钮,检测功能关闭 Press the stop detection button, the detection function is closed - - - - + + 轮毂型号识别定位一体系统 + + + + + + 后台运行 + + + + + 退出 + + + + + 显示界面 + + + + + + + + + 提示 Prompt - + 将清空所有数据 All data will be cleared - + 确定 Ok - - + + 取消 Cancel - - - - 当前曝光时间未识别到轮毂! - The current exposure time does not recognize the hub! + The current exposure time does not recognize the hub! - - 调整5次曝光时间后依然未能识别到轮毂! - After adjusting the exposure time for 5 times, the wheel hub is still not recognized! + After adjusting the exposure time for 5 times, the wheel hub is still not recognized! - + 按下了清零按钮,数据全部清零 Press the reset button, all data are cleared - + 天 d - + 时 h - + 分 m - + 秒 s - 系统时间: - System time: + System time: - + 运行时长: Running time: - 检测状态: - Status: + Status: - + 检测中... Detecting... - 未检测... - Not detected... + Not detected... - 班次信息: - Classes info: + Classes info: - 该时间段未设置班次 - No classes + No classes - 当前用户: - Current user: + Current user: - 模板库发送完成 - Template library sending completed + 运行时长: + 模板库发送完成 + Template library sending completed - - + + 已停止检测... + + + + + 正在检测型号数 Number of models - 已连接 - Connected + Connected - 已断开 - Disconnected + Disconnected - + PLC已收到相关设置参数! The PLC has received the relevant setting parameters! - + 已打开 Opened - + 已关闭 Closed - 轮毂型号识别系统 - Wheel Type Identification System + Wheel Type Identification System - + 本软件由杭州利珀科技开发,用于轮毂型号识别和分类,可搭配流水线运输系统使用 This software is developed by Leaper in Hangzhou. It is used for hub type identification and classification. It can be used with pipeline transportation system - + 若需要进一步了解该产品的相关信息,请访问我们的网站 For more information about this product, please visit our website - + 软件版本 Software Version - + 算法版本 Algorithm version - + 最后更新时间 Last update time - + 版权 (c) 属 杭州利珀科技有限公司 所有 Copyright(C) belongs to Hangzhou Lipper Technology Co., Ltd. - + 关闭 Shut down - (默认) - (Default) + (Default) - 默认通道 值1000 - 1000 (Default) + 1000 (Default) + + + + lpSystemConfigUI + + + lpSystemConfigUI + + + + + 系统语言设置: + + + + + 语言 + Language + + + + 图像保存相关: + + + + + 是否保存识别NG抠图 + + + + + 是否保存识别OK抠图 + + + + + 是否保存识别NG原始图 + + + + + 是否保存识别OK原始图 + + + + + 是否保存定位NG原始图 + + + + + 是否保存定位OK原始图 + + + + + 图像存储路径: + + + + + 设置 + Setting + + + + 通讯配置: + + + + + TCP服务端口: + + + + + webSocket端口: + + + + + 其他: + + + + + 本系统标题: + + + + + 启动时默认后台运行 + + + + + 关闭主窗口时在后台运行 + + + + + 算法参数: + + + + + 过滤小于 + + + + + 的圆(单位:像素) + + + + + 是否使用图像增强 + + + + + 系统参数已保存且生效!!! + + + + + 应用 + Use + + + + 退出 + + + + + Chinese + + + + + English + diff --git a/tpvs17/tpMain/lpmain_zh.ts b/tpvs17/tpMain/lpmain_zh.ts index c3dff8b..b2fe83d 100644 --- a/tpvs17/tpMain/lpmain_zh.ts +++ b/tpvs17/tpMain/lpmain_zh.ts @@ -1,27 +1,6 @@ - - CChannelInfo - - - 开始读取json文件数据... - - - - - 数据读取完成... - - - - - CWheelNet - - - IP参数设置 - - - ModelsModel @@ -44,49 +23,6 @@ - - QAddChannelDlg - - - 新建通道 - - - - - 发送结果: - - - - - 通道名称: - - - - - 备注: - - - - - 确认 - - - - - 取消 - - - - - 警告 - - - - - 数据不能为空,请输入 - - - QAddModel @@ -147,62 +83,6 @@ - - QAddTimeDlg - - - 时间参数设置 - - - - - 确认 - - - - - 取消 - - - - - 时间参数: - - - - - 起始时间 - - - - - 班次名称: - - - - - - hh:mm - - - - - 结束时间 - - - - - - 当天 - - - - - - 隔天 - - - QCamSettingDlg @@ -328,144 +208,52 @@ - QChannelManager - - - 通道信息管理 - - - - - 所有通道数据 - - - - - 发送结果: - - - - - 通道名称: - - + QCryptokeyUI - - 备注: + + 注册 - - 是否设为默认(NG流向的通道) - - - - - 确认修改 - - - - + 退出 - - 编号 - - - - - 通道名 - - - - - 备注 - - - - - 发送结果 - - - - - 是否为默认 - - - - - 默认 - - - - - QChannelMgrDlg - - - QChannelMgrDlg - - - - - 所有型号及图像 - - - - - 型号: - - - - - 通道: - - - - - 查找: - - - - - - 隐藏 - - - - - 修改 + + 机器码: - - 0 + + 注册码: - - 通道分配: + + 激活 - - 删除通道 + + 请输入注册码 - - 增加通道 + + 激活状态: - - 刷新 + + 未激活 - - 通道管理 + + + + 提示 @@ -529,103 +317,6 @@ p, li { white-space: pre-wrap; } - - QDia2ThSetting - - - 直径标定 - - - - - K:表示斜率,B:基准点,直径=高度*K+B - - - - - 确认修改 - - - - - 退出 - - - - - B: - - - - - K: - - - - - 提示 - - - - - 修改完成,参数已生效! - - - - - 确定 - - - - - QIPConfigDlg - - - QIPConfigDlg - - - - - 本机服务器IP地址设置 - - - - - - IP 地址(I): - - - - - 关闭服务 - - - - - 开放端口: - - - - - 打开服务 - - - - - 目标客户端IP地址设置 - - - - - 源端口: - - - - - 确定 - - - QModNamedlg @@ -694,135 +385,135 @@ p, li { white-space: pre-wrap; } - + 轮毂信息: - + 型号 - + 0% - + 阈值调节 - + 严格 - + 旋转次数 - + 缩略图 - + 宽松 - + 厚度(mm) - + 直径(mm) - + 加入训练 - + 基本操作 - - + + 删除模板 - + 训练当前模板 - + 训练模板 - + 添加新的模板 - + 新建模板 - + 训练所有模板,消耗时间会较长 - + 训练全部 - + 确认修改,每次修改模板的参数后都要确认修改才有效 - + 修改确认 - + 修改型号名 - + 图片显示: - - + + 添加已裁剪的轮毂图片 - + 追加 - - + + 删除所有模板 @@ -842,25 +533,25 @@ p, li { white-space: pre-wrap; } - + modelID - - - - - - - - - - - - + + + + + + + + + + + + 提示 @@ -886,252 +577,252 @@ p, li { white-space: pre-wrap; } - + 加载完成 - - - + + + 请选择一个您要修改的型号! - + 修改了模板 - + 的参数 - + 修改成功! - - + + 请选择一个您要删除的型号 - + 按下了删除模板按钮 - + 是否删除型号 - + 产品模板 - + 删除了模板 - - - - - - - - + + + + + + + + 共 - - - - - + + + + + 个型号 - + 按下了添加模板按钮 - + 产品信息设置 - + 添加了一个新的模型 - + 请选择一个您要训练的型号! - - + + 训练模板线程未退出,请稍等 - + 将对所有型号模板进行重新训练,期间系统的检测功能将不能正常运行直到模板训练完成,全部重新训练模板将需要很长时间,期间将不能进行其他工作,是否继续执行? - + 确定删除该图像? - + 模板图片删除 - - - + + + 个图像 - + 警告 - + 即将删除模板库里的所有模板,是否继续? - + 再次确认,是否全部删除? - + 没有模板!!! - + 全部删除完成!!! - + 图像数量少于 - + 个,请及时补充训练样本 - - - - - - - + + + + + + + 模板更新进度 - + 正在初始化所有模板 共需要训练%1个模板,请稍后..... - + 正在训练%1的模板 已完成%2/%3,请稍后..... - + %1的模板获取特征 已完成%2/%3,请稍后..... - + %1的模板训练完成 已完成%2/%3,请稍后..... - + 全部模板更新完成!%1s - + 对全部模板进行了重新训练,共%1个模板 - + 模板正在准备请稍后..... - - - - - - - - - - - - + + + + + + + + + + + + 模板训练进度 - - + + %1型号没有图片不能训练! - + %1的模板 正在获取特征值,请稍后.... - + 训练完成!%1s - + 训练了模板:%1 - + 确认 - + 取消 @@ -1147,43 +838,8 @@ p, li { white-space: pre-wrap; } QObject - - 虚拟相机触发 - - - - - 硬件相机触发 - - - - - 调试免登陆 - - - - - 正常工作模式 - - - - - 传感器触发 - - - - - 软件触发 - - - - - 下降沿触发 - - - - - 上升沿触发 + + 识别定位一体系统 @@ -1224,1327 +880,975 @@ p, li { white-space: pre-wrap; } - QSystemSettingDlg + QWorkItemDlg - - 相关设备配置 + + 工单信息设置 - - - 检测图像设置 + + + 警告 - - - PLC相关设置 + + 名称不能为空. - - - 报警灯测试 + + 你输入的名称:%1 重复. + + + QWorkItemUI - - 高级功能 + + 信息设置 - - 属性 + + 确定 - - 值 + + 取消 - - 语言 + + 备注信息: - - 检测背景更换 - - - - - - 抠图后 - - - - - - 原图 - - - - - 背景图 - - - - - 检测结果 - - - - - 图像保存路径 - - - - - - 设置保存路径 - - - - - - 打开图像路径 - - - - - 保存当前设置 - - - - - - 保存已匹配图 - - - - - - 保存无匹配图 - - - - - 使用背景图 - - - - - 轮毂全去A通道 - - - - - 查看检测背景 - - - - - 保存参数 - - - - - - 保存设置 - - - - - 传感器触发滤波(ms) - - - - - 相机触发延时(ms) - - - - - 相机触发脉宽(ms) - - - - - 光源熄灭延时时间(ms) - - - - - 传感器触发类型 - - - - - 保持结果时长(ms) - - - - - 连接超时次数 - - - - - 超时是否显示信息 - - - - - - 是否自动重启服务器 - - - - - 是否保存超时日志 - - - - - 发送并保存 - - - - - 超时提醒n次后自动重启服务 - - - - - 是否显示提示 - - - - - 勾选后通信超时时会显示提醒信息 - - - - - 勾选后通信超时次数达到后,系统将自动重启服务,PLC会自动重新连接 - - - - - 保存信息到系统日志 - - - - - 勾选后表示超时信息将自动保存到系统日志中,便于查询 - - - - - 红灯 - - - - - 绿灯 + + 名称: + + + QWorkMgrUI - - 黄灯 + + QWorkMgrUI - - 蜂鸣 + + 工作任务表 - - 红灯闪一下 + + 添加任务单 - - 绿灯闪一下 + + 添加 - - 黄灯闪一下 + + 删除任务单 - - 蜂鸣响一下 + + 删除 - - 开发者使用 + + 修改任务单名称或备注信息 - - 相机模式 + + 修改 - - 虚拟相机触发时间 + + 使用任务单 - - 系统模式 + + 应用 - - 相机触发模式 + + 当前选择的任务表: - - - 串口发送心跳包 + + + 数量 - - - 网络发送心跳包 + + 添加型号到检测列表 - - - 串口发送通道结果 + + <<< - - - 网络发送检测结果 + + 从检测列表移除所选型号 - - - 网络发送通道结果 + + >>> - - 光栅使用标志 + + 缩略图 - - 保存高度厚度数据 + + 只看已选 - - 通道分配 + + 只看未选 - - 启动时是否检测 + + 显示全部 - - 显示厚度数据 + + 查找: - - 显示厚度采样数据 + + 检测模板管理 - - 使用光栅获取厚度 + + + 共 %1 个 - - 保存数据用于测试 + + 当前使用的工单为 %1 - - 是否使用通道分配 + + 以下型号为重复添加: +%1已被忽略. - - 是否启动就开始检测 + + 提醒 - - - 是否显示 + + + + 确定 - - 保存 + + 工单 %1 被设为应用 - - 请选择您的背景图 + + + 警告 - - 提示 + + %1任务单正在使用不能被删除,请先切换到其他任务单,再删除该任务单? - - 背景图更新完成,请重启本软件. + + + 取消 - - 确认 + + 是否要删除 %1 模型? - - 打开文件夹 + + 序号 - - - QSystemSettingUI - - 系统设置 + + 内容 - QTimeMgrDlg - - - 班次管理 - - - - - - - 未选中 - - - - - 添加时间 - - - - - 删除时间 - - - - - 修改时间 - - - - - 班次 - - - - - 起始时间 - - - - - 结束时间 - - - - - 设置参数 - - - - - - - - - - 当天 - - - - - - - - - - 隔天 - - - - - - - 提示 - - - - - - 未选择班次,请选择进行修改。 - - + RoiImgViewer - - - - 确认 + + + line item is not created - - 您确定要删除 %1 班次? + + line item is already created - - 取消 + + rect item is already created - QWorkItemDlg - - - 工单信息设置 - - - - - - 警告 - - - - - 名称不能为空. - - + WheelCtrl - - 你输入的名称:%1 重复. + + 未登录 - QWorkItemUI + lpImageCaliUI - - 信息设置 + + 相机视场标定 - - 确定 + + 操作 - - 取消 + + 选择标定图像 - - 备注信息: + + P1_X: - - 名称: + + P1_Y: - - - QWorkMgrUI - - QWorkMgrUI + + P2_Y: - - 工作任务表 + + + + + 1200 - - 添加任务单 + + P2_X: - - 添加 + + 两点实际距离mm: - - 删除任务单 + + 两点像素距离px: - - 删除 + + 像素比例值(mm/px): - - 修改任务单名称或备注信息 + + 解锁 - - 修改 + + 物理X方向偏移: - - 使用任务单 + + 物理Y方向偏移: - + 应用 - - 当前选择的任务表: - - - - - - 数量 - - - - - 添加型号到检测列表 - - - - - <<< - - - - - 从检测列表移除所选型号 - - - - - >>> - - - - - 缩略图 - - - - - 只看已选 - - - - - 只看未选 - - - - - 显示全部 - - - - - 查找: - - - - - 其他 - - - - - 按照直径检测 - - - - - 按照厚度检测 - - - - - 手动发送模板库 - - - - - 检测模板管理 + + 退出 - - - 共 %1 个 + + + + ���� - - 当前使用的工单为 %1 + + ѡ���궨ͼ - - 以下型号为重复添加: -%1已被忽略. + + Image Files (*.png *.jpg *.bmp) + + + lpMainWin - - 提醒 + + 轮毂型号识别 - - - - 确定 + + image_zoom.ui - - 工单 %1 被设为应用 + + 状态信息 - - 发送模板库 + + 识别定位检测 - - - 警告 + + + 开始检测 - - %1任务单正在使用不能被删除,请先切换到其他任务单,再删除该任务单? + + 检测结果 - - - 取消 + + 匹配值 - - 是否要删除 %1 模型? + + 匹配值 + 通道 - - 序号 + + + + + + 0 - - 内容 + + None - - - RoiImgViewer - - - line item is not created + + + 检测状态 - - line item is already created + + 统计结果 - - rect item is already created + + modelID_detect - - - WheelCtrl - - 加载通道模块 .... + + count - - 加载模板库 .... + + 型号数量 - - 加载检测设置模块 .... + + 模板管理 - - 加载数据库 .... + + 数据查询 - - 加载班次管理模块 .... + + 0.0 - - 加载其他模块 .... + + 角度 - - 创建子线程 .... + + (0.0) - - 加载光栅通讯模块 .... + + 圆心坐标 - - 模块加载完成,启动线程 .... + + 定位结果 - - 未登录 + + 定位耗时 - - - lpMainWin - - 轮毂型号识别 + + 识别耗时 - - image_zoom.ui + + 分数 - - 状态信息 + + 型号管理 - - - 开始检测 + + 检测勾选 - - 检测结果 + + 辅助工具 - - 无匹配(个) + + 班次设置 - - 已检测(个) + + 光栅标定 - - 匹配值 + + IP设置 - - 直径(mm) + + + 关于 - - 时间(s) + + 登录 - - 通道 + + 用户管理 - - - - - - - - 0 + + 系统设置 - - --------- + + + 相机配置 - - None + + 定位标定 - - - 检测状态 + + + 图像标定 - - 厚度(mm) + + + 注册产品 - - 统计结果 + + + 工具 - - modelID_detect + + + 帮助 - - count + + + 本系统未注册激活 - - 交换班清零 + + 系统时间 - - 型号数量 + + 用户: - - - 模板管理 + + 历史 - - 数据查询 + + + 停止检测 - - 模板勾选 + + 显示识别结果 - - 辅助工具 + + 获得图像,正在计算中... - - 班次设置 + + 注 销 - - 光栅标定 + + 登 录 - - IP设置 + + + + + + + 提示 - - - 关于 + + + 该功能未启用. - - 登录 + + + + + + 确认 - - 用户管理 + + 你确定要注销 - - 系统设置 + + + 取消 - - - 相机配置 + + 调试工具 - - 加载必要模块..... + + + 请停止检测再使用该功能. - - - 工具 + + 系统参数设置 - - 系统时间 + + 注册 - - 班次信息 + + 按下了开始检测按钮,检测功能开启 - - 用户: + + 按下了停止检测按钮,检测功能关闭 - - 历史 + + 将清空所有数据 - - 系统初始化完成... + + 确定 - - - 停止检测 + + 按下了清零按钮,数据全部清零 - - 显示识别结果 + + 天 - - - - - 当前曝光时间未识别到轮毂! + + 时 - - - 调整5次曝光时间后依然未能识别到轮毂! + + 分 - - 相机图像和背景图不一样,请更换检测背景! + + 秒 - - 警告!!!连续出现%1个未识别型号 + + 轮毂型号识别定位一体系统 - - ,未开启检测功能造成的 + + + 后台运行 - - 获得图像,正在计算中... + + 退出 - - 注 销 + + 显示界面 - - 登 录 + + 运行时长: - - - - - 提示 + + 检测中... - - - 该功能未启用. + + 运行时长: + 模板库发送完成 - - - - 确认 + + 已停止检测... - - 你确定要注销 + + + 正在检测型号数 - - - 取消 + + PLC已收到相关设置参数! - - 班次管理 + + 已打开 - - 调试工具 + + 已关闭 - - 系统参数设置 + + 本软件由杭州利珀科技开发,用于轮毂型号识别和分类,可搭配流水线运输系统使用 - - 按下了开始检测按钮,检测功能开启 + + 若需要进一步了解该产品的相关信息,请访问我们的网站 - - 按下了停止检测按钮,检测功能关闭 + + 软件版本 - - 将清空所有数据 + + 算法版本 - - 确定 + + 最后更新时间 - - 按下了清零按钮,数据全部清零 + + 版权 (c) 属 杭州利珀科技有限公司 所有 - - 天 + + 关闭 + + + lpSystemConfigUI - - 时 + + lpSystemConfigUI - - 分 + + 系统语言设置: - - 秒 + + 语言 - - 系统时间: + + 图像保存相关: - - 运行时长: + + 是否保存识别NG抠图 - - 检测状态: + + 是否保存识别OK抠图 - - 检测中... + + 是否保存识别NG原始图 - - 未检测... + + 是否保存识别OK原始图 - - 班次信息: + + 是否保存定位NG原始图 - - 该时间段未设置班次 + + 是否保存定位OK原始图 - - 当前用户: + + 图像存储路径: - - 模板库发送完成 + + 设置 - - - 正在检测型号数 + + 通讯配置: - - 已连接 + + TCP服务端口: - - 已断开 + + webSocket端口: - - PLC已收到相关设置参数! + + 其他: - - 已打开 + + 本系统标题: - - 已关闭 + + 启动时默认后台运行 - - 轮毂型号识别系统 + + 关闭主窗口时在后台运行 - - 本软件由杭州利珀科技开发,用于轮毂型号识别和分类,可搭配流水线运输系统使用 + + 算法参数: - - 若需要进一步了解该产品的相关信息,请访问我们的网站 + + 过滤小于 - - 软件版本 + + 的圆(单位:像素) - - 算法版本 + + 是否使用图像增强 - - 最后更新时间 + + 系统参数已保存且生效!!! - - 版权 (c) 属 杭州利珀科技有限公司 所有 + + 应用 - - 关闭 + + 退出 - - (默认) + + Chinese - - 默认通道 值1000 + + English diff --git a/tpvs17/valueMainUI/QTCPDebugUI.cpp b/tpvs17/valueMainUI/QTCPDebugUI.cpp index 87db74a..6778603 100644 --- a/tpvs17/valueMainUI/QTCPDebugUI.cpp +++ b/tpvs17/valueMainUI/QTCPDebugUI.cpp @@ -16,12 +16,16 @@ QTCPDebugUI::~QTCPDebugUI() void QTCPDebugUI::appendRecvData(QByteArray data) { QString msg = QString("recv %1->%2").arg(QDateTime::currentDateTime().toString("hh:mm:ss")).arg(QString(data)); + if (ui.plainTextEdit->toPlainText().size() > 10000) + ui.plainTextEdit->clear(); ui.plainTextEdit->appendPlainText(msg); } void QTCPDebugUI::appendSendData(QByteArray data) { QString msg = QString("send %1->%2").arg(QDateTime::currentDateTime().toString("hh:mm:ss")).arg(QString(data)); + if (ui.plainTextEdit->toPlainText().size() > 10000) + ui.plainTextEdit->clear(); ui.plainTextEdit->appendPlainText(msg); } @@ -38,6 +42,14 @@ void QTCPDebugUI::showEvent(QShowEvent *event) ui.checkBox_Send->setChecked(false); } +void QTCPDebugUI::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui.retranslateUi(this); + } +} + Q_SLOT void QTCPDebugUI::onStateChange(int state) { QString strObj = sender()->objectName(); diff --git a/tpvs17/valueMainUI/QTCPDebugUI.h b/tpvs17/valueMainUI/QTCPDebugUI.h index e55f2f8..67ebccb 100644 --- a/tpvs17/valueMainUI/QTCPDebugUI.h +++ b/tpvs17/valueMainUI/QTCPDebugUI.h @@ -17,6 +17,7 @@ public: protected: virtual void closeEvent(QCloseEvent *event); virtual void showEvent(QShowEvent *event); + virtual void changeEvent(QEvent *event); Q_SLOT void onStateChange(int state); private: diff --git a/tpvs17/valueMainUI/lpConfigUI.cpp b/tpvs17/valueMainUI/lpConfigUI.cpp index 1eafe63..24096e9 100644 --- a/tpvs17/valueMainUI/lpConfigUI.cpp +++ b/tpvs17/valueMainUI/lpConfigUI.cpp @@ -80,6 +80,14 @@ void lpConfigUI::timerEvent(QTimerEvent *event) } } +void lpConfigUI::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui.retranslateUi(this); + } +} + void lpConfigUI::onInitCheckBox() { bool bAutoRun = CheckAutoRunLink(); diff --git a/tpvs17/valueMainUI/lpConfigUI.h b/tpvs17/valueMainUI/lpConfigUI.h index f288490..06ecf54 100644 --- a/tpvs17/valueMainUI/lpConfigUI.h +++ b/tpvs17/valueMainUI/lpConfigUI.h @@ -12,17 +12,18 @@ public: lpConfigUI(QWidget *parent = Q_NULLPTR); ~lpConfigUI(); -protected: - Q_SLOT void onButtonClicked(); - - virtual void showEvent(QShowEvent *event); - virtual void timerEvent(QTimerEvent *event); private: void onInitCheckBox(); Q_SLOT void onCheckBoxChanged(int state); signals: void sgUpdateConfig(); +protected: + Q_SLOT void onButtonClicked(); + + virtual void showEvent(QShowEvent *event); + virtual void timerEvent(QTimerEvent *event); + virtual void changeEvent(QEvent *event); private: bool CheckDesktopLink(); void CreateDesktopLink(); diff --git a/tpvs17/valueMainUI/lpDebugUI.cpp b/tpvs17/valueMainUI/lpDebugUI.cpp index 5567105..f2c7386 100644 --- a/tpvs17/valueMainUI/lpDebugUI.cpp +++ b/tpvs17/valueMainUI/lpDebugUI.cpp @@ -34,3 +34,11 @@ Q_SLOT void lpDebugUI::onButtonClicked() emit sgButtonClicked(4); } } + +void lpDebugUI::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui.retranslateUi(this); + } +} \ No newline at end of file diff --git a/tpvs17/valueMainUI/lpDebugUI.h b/tpvs17/valueMainUI/lpDebugUI.h index 3060e8f..267596c 100644 --- a/tpvs17/valueMainUI/lpDebugUI.h +++ b/tpvs17/valueMainUI/lpDebugUI.h @@ -13,8 +13,11 @@ public: ~lpDebugUI(); Q_SLOT void onButtonClicked(); + signals: - void sgButtonClicked(int ID); + void sgButtonClicked(int ID); +protected: + virtual void changeEvent(QEvent *event); private: Ui::lpDebugUI ui; }; diff --git a/tpvs17/valueMainUI/valueMainUI.cpp b/tpvs17/valueMainUI/valueMainUI.cpp index d39c23e..d6e2ecc 100644 --- a/tpvs17/valueMainUI/valueMainUI.cpp +++ b/tpvs17/valueMainUI/valueMainUI.cpp @@ -9,6 +9,9 @@ #include #include #include +#include +#include + #include "lpGlobalData.h" #pragma execution_character_set("utf-8") @@ -116,7 +119,11 @@ valueMainUI::valueMainUI(QWidget *parent) connect(m_pPlcDevice, SIGNAL(sgSendDataCallBack(QByteArray)), this, SLOT(onShowSendTcpData(QByteArray))); connect(m_pPlcDevice, SIGNAL(sgRecvDataCallBack(QByteArray)), this, SLOT(onShowRecvTcpData(QByteArray))); } - + {//加载语言设置 + QSettings languageSetting("hubdetect.ini", QSettings::IniFormat); + QString strLanguage = languageSetting.value("language", "Chinese").toString(); + SetLanguage(strLanguage); + } { m_SysTimerID = startTimer(1000);//系统定时刷新定时器 m_timerStartID = startTimer(1000);//启动从机客户端 @@ -218,6 +225,8 @@ Q_SLOT void valueMainUI::onRecvDataStr_A(const QJsonObject& json) QString sMsg = QString("%1 : %2->%3 %4 (%5,%6)") .arg(QDateTime::currentDateTime().toString("hh:mm:ss")) .arg(strName).arg(score).arg(angle).arg(cnt_x).arg(cnt_y); + if (ui.textEdit->toPlainText().size() > 10000) + ui.textEdit->clear(); ui.textEdit->append(sMsg); switch (resultType) { @@ -306,6 +315,8 @@ Q_SLOT void valueMainUI::onRecvDataStr_B(const QJsonObject& json) QString sMsg = QString("%1 : %2->%3 %4 (%5,%6)") .arg(QDateTime::currentDateTime().toString("hh:mm:ss")) .arg(strName).arg(score).arg(angle).arg(cnt_x).arg(cnt_y); + if (ui.textEdit_2->toPlainText().size() > 10000) + ui.textEdit_2->clear(); ui.textEdit_2->append(sMsg); switch (resultType) @@ -546,7 +557,10 @@ void valueMainUI::timerEvent(QTimerEvent *event) onConnectA(); m_CoutA = 0; m_bServerA = false; + if (ui.textEdit->toPlainText().size() > 10000) + ui.textEdit->clear(); ui.textEdit->append(tr("连接超时,尝试重新连接检测软件")); + } if (m_CoutB > 15) @@ -554,6 +568,8 @@ void valueMainUI::timerEvent(QTimerEvent *event) m_bServerB = false; m_CoutB = 0; onConnectB(); + if (ui.textEdit_2->toPlainText().size() > 10000) + ui.textEdit_2->clear(); ui.textEdit_2->append(tr("连接超时,尝试重新连接检测软件")); } @@ -655,6 +671,14 @@ void valueMainUI::closeEvent(QCloseEvent *event) return event->accept(); } +void valueMainUI::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + ui.retranslateUi(this); + } +} + Q_SLOT void valueMainUI::onDebugClicked(int nID) {//调试测试页面按钮响应事件 自定义命令 if (nID == 1)//A侧相机单次触发 @@ -1018,3 +1042,87 @@ Q_SLOT void valueMainUI::onShowSendTcpData(QByteArray data) m_pTcpDebugUI->appendSendData(data); } } + +void valueMainUI::SetLanguage(QString strLangage) +{ + QString strDirPath = QString(QCoreApplication::applicationDirPath() + "/language/"); + QString translatorFileName = strLangage; + if (!translatorFileName.isEmpty()) + { + if (m_VecTranPtr.size() > 0) + { + while (m_VecTranPtr.size()) + { + QTranslator *pVa = m_VecTranPtr.takeFirst(); + qApp->removeTranslator(pVa); + delete pVa; + pVa = NULL; + } + } + QLocale::setDefault(QLocale(translatorFileName)); + QString transDir = strDirPath + translatorFileName; + SearchQmFile(transDir); + } +} + +void valueMainUI::SearchQmFile(const QString & strDir) +{ + QDir dir(strDir); + if (!dir.exists()) + { + return; + } + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); // 文件夹优先 + // 转换成一个List + QFileInfoList list = dir.entryInfoList(); + if (list.size() < 1) + { + return; + } + int i = 0; + do + { + QFileInfo fileInfo = list.at(i); + QString tt = fileInfo.fileName(); + // 如果是文件夹 + bool bisDir = fileInfo.isDir(); + if (bisDir) + { + SearchQmFile(fileInfo.filePath()); + } + else + { + bool bQm = fileInfo.fileName().endsWith(".qm"); + SetTranslator(fileInfo.filePath()); + } + i++; + } while (i < list.size()); +} + +void valueMainUI::SetTranslator(const QString strPath) +{ + if (strPath.isEmpty()) + { + return; + } + QTranslator *pTrans = new QTranslator; + if (pTrans->load(strPath)) // 如果加载成功 + { + qApp->installTranslator(pTrans); + m_VecTranPtr.append(pTrans); + } + else + { + delete pTrans; + pTrans = NULL; + } +} + +Q_SLOT void valueMainUI::onLanguageChange(QString strLanguage) +{ + QSettings languageSetting("hubdetect.ini", QSettings::IniFormat); + languageSetting.setValue("language", strLanguage); + SetLanguage(strLanguage); +} + diff --git a/tpvs17/valueMainUI/valueMainUI.h b/tpvs17/valueMainUI/valueMainUI.h index 87202eb..03f2567 100644 --- a/tpvs17/valueMainUI/valueMainUI.h +++ b/tpvs17/valueMainUI/valueMainUI.h @@ -13,6 +13,9 @@ #include "libTcpClient.h" #include "../QPLCDevice.h" #include "QTCPDebugUI.h" + +#include + class valueMainUI : public QMainWindow { Q_OBJECT @@ -64,9 +67,15 @@ private://trayIcon Q_SLOT void onShowRecvTcpData(QByteArray data); Q_SLOT void onShowSendTcpData(QByteArray data); + //language + void SetLanguage(QString strLangage); + void SearchQmFile(const QString & strDir); + void SetTranslator(const QString strPath); + Q_SLOT void onLanguageChange(QString strLanguage); protected: virtual void timerEvent(QTimerEvent *event); virtual void closeEvent(QCloseEvent *event); + virtual void changeEvent(QEvent *event); private: Ui::valueMainUIClass ui; @@ -77,11 +86,6 @@ private: QLabel* m_pLabelB{ nullptr }; QLabel* m_pLabelPLC{ nullptr }; QLabel* m_pLabelSystem{ nullptr }; - -// QLabel* m_pLabelRes_A{ nullptr }; -// QLabel* m_pLabelRes_B{ nullptr }; -// QLabel* m_pLabelState_A{ nullptr }; -// QLabel* m_pLabelState_B{ nullptr }; private: int m_timerA{ 0 }; int m_timerB{ 0 }; @@ -112,6 +116,8 @@ private: bool m_bExit{ false }; QPLCDevice* m_pPlcDevice{ nullptr }; + + QVector m_VecTranPtr;//¹ú¼ʻ¯ÓïÑ԰ü¹ÜÀí }; #endif diff --git a/tpvs17/valueMainUI/valueMainUI.vcxproj b/tpvs17/valueMainUI/valueMainUI.vcxproj index 2c32b30..e045b9c 100644 --- a/tpvs17/valueMainUI/valueMainUI.vcxproj +++ b/tpvs17/valueMainUI/valueMainUI.vcxproj @@ -213,6 +213,9 @@ + + + diff --git a/tpvs17/valueMainUI/valueMainUI.vcxproj.filters b/tpvs17/valueMainUI/valueMainUI.vcxproj.filters index f11c293..9ece126 100644 --- a/tpvs17/valueMainUI/valueMainUI.vcxproj.filters +++ b/tpvs17/valueMainUI/valueMainUI.vcxproj.filters @@ -34,6 +34,11 @@ {6b2afa7b-bb76-4d9e-9870-8a19fb08089a} + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + false + @@ -189,4 +194,9 @@ + + + Translation Files + + \ No newline at end of file diff --git a/tpvs17/valueMainUI/valuemainui_en.ts b/tpvs17/valueMainUI/valuemainui_en.ts new file mode 100644 index 0000000..a94963c --- /dev/null +++ b/tpvs17/valueMainUI/valuemainui_en.ts @@ -0,0 +1,449 @@ + + + + + QObject + + + + + 警告 + + + + + A侧检测程序未连接,请检查配置或通讯 + + + + + + + 关闭 + + + + + B侧检测程序未连接,请检查配置或通讯 + + + + + 本检测系统正在运行,您真的要关闭? + + + + + 后台运行 + + + + + QTCPDebugUI + + + QTCPDebugUI + + + + + 显示接收数据 + + + + + 显示发送数据 + + + + + RoiImgViewer + + + + line item is not created + + + + + line item is already created + + + + + rect item is already created + + + + + lpConfigUI + + + lpConfigUI + + + + + 工位配置: + + + + + A侧检测程序端口: + + + + + A侧检测所在路径: + + + + + + 设置 + + + + + B侧检测程序端口: + + + + + B侧检测所在路径: + + + + + 使用双工位 + + + + + 参数已保存!!! + + + + + 应用 + + + + + 退出 + + + + + 机台PLC通讯: + + + + + TCP服务端口: + + + + + 1000 + + + + + 系统相关: + + + + + 开机自启动 + + + + + 添加到桌面快捷方式 + + + + + 语言: + + + + + 中文 + + + + + English + + + + + lpDebugUI + + + lpDebugUI + + + + + A侧触发一次 + + + + + B侧触发一次 + + + + + A侧定时触发 + + + + + B侧定时触发 + + + + + valueMainUI + + + 识别定位一体检测系统 + + + + + A侧连接状态 + + + + + B侧连接状态 + + + + + PLC连接状态 + + + + + 时间 + + + + + + 工具 + + + + + 天 + + + + + 时 + + + + + 分 + + + + + 秒 + + + + + 型号 %1,定位角度 %2 ° + + + + + + 型号 %1,定位异常 + + + + + + 型号 %1,定位模板未标定 + + + + + + 型号 %1,没有相关定位模板 + + + + + + 型号识别失败 + + + + + 型号 %1,定位角度 %2° + + + + + 调试页面 + + + + + 系统参数配置页面 + + + + + 通讯调试页面 + + + + + + 连接超时,尝试重新连接检测软件 + + + + + A侧设备已连接(检测中) + + + + + A侧设备已连接(暂停中) + + + + + A侧设备未连接 + + + + + B侧设备已连接(检测中) + + + + + B侧设备已连接(暂停中) + + + + + B侧设备未连接 + + + + + PLC客户端 %1 + + + + + PLC客户端未连接 + + + + + 运行时长: + + + + + + 检测系统已离线!!! + + + + + + 检测系统已在线... + + + + + + 后台运行 + + + + + 退出 + + + + + 显示界面 + + + + + valueMainUIClass + + + valueMainUI + + + + + B侧检测工位 + + + + + + 检测结果 + + + + + A侧检测工位 + + + + + toolBar + + + + + A侧设置 + + + + + B侧设置 + + + + + + 系统设置 + + + + + + 调试 + + + + + + 通讯调试 + + + +