|
|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
#include "lpMainWin.h"
|
|
|
|
|
#include "lpMainWin.h"
|
|
|
|
|
#include "quserinfo_global.h"
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
@ -25,7 +25,7 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
QMySplashScreen m_screen;
|
|
|
|
|
m_screen.show();
|
|
|
|
|
qRegisterMetaType<TimeStruct>("TimeStruct");
|
|
|
|
|
m_screen.ShowMsg(tr("加载必要模块....."));
|
|
|
|
|
m_screen.ShowMsg(tr("加载必要模块....."));
|
|
|
|
|
onInitCoreCtrl();
|
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
onInitAbout();
|
|
|
|
|
@ -69,23 +69,23 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
QToolButton* pbutton = new QToolButton(this);
|
|
|
|
|
pbutton->setMenu(pToolMenu);
|
|
|
|
|
pbutton->setIcon(QIcon(":/ToolBarPic/ToolButon"));
|
|
|
|
|
pbutton->setText(tr("工具"));
|
|
|
|
|
pbutton->setToolTip(tr("工具"));
|
|
|
|
|
pbutton->setText(tr("工具"));
|
|
|
|
|
pbutton->setToolTip(tr("工具"));
|
|
|
|
|
pbutton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
|
|
|
|
pbutton->setPopupMode(QToolButton::InstantPopup);
|
|
|
|
|
ui.mainToolBar->addWidget(pbutton);
|
|
|
|
|
ui.mainToolBar->addAction(ui.action_about);
|
|
|
|
|
}
|
|
|
|
|
{//加载语言设置
|
|
|
|
|
{//加载语言设置
|
|
|
|
|
QSettings languageSetting("hubdetect.ini", QSettings::IniFormat);
|
|
|
|
|
QString strLangeage = languageSetting.value("language", "Chinese").toString();
|
|
|
|
|
SetLanguage(strLangeage);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
m_pLbCurrentTime = new QLabel(tr("系统时间"));
|
|
|
|
|
m_pLbBanci = new QLabel(tr("班次信息"));
|
|
|
|
|
m_pLbDetectState = new QLabel(tr("检测状态"));
|
|
|
|
|
m_pLbUser = new QLabel(tr("用户:"));
|
|
|
|
|
m_pLbCurrentTime = new QLabel(tr("系统时间"));
|
|
|
|
|
m_pLbBanci = new QLabel(tr("班次信息"));
|
|
|
|
|
m_pLbDetectState = new QLabel(tr("检测状态"));
|
|
|
|
|
m_pLbUser = new QLabel(tr("用户:"));
|
|
|
|
|
|
|
|
|
|
QFont m_font;
|
|
|
|
|
m_font.setBold(true);
|
|
|
|
|
@ -104,7 +104,7 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
m_pLbDetectState->setFont(m_font);
|
|
|
|
|
m_pLbDetectState->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
|
|
|
|
|
|
//m_pLbOnLine = new class QLabel("模式:");
|
|
|
|
|
//m_pLbOnLine = new class QLabel("模式:");
|
|
|
|
|
//m_pLbOnLine->setMinimumWidth(c_nWidth);
|
|
|
|
|
|
|
|
|
|
m_pLbUser->setFont(m_font);
|
|
|
|
|
@ -115,9 +115,9 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
ui.statusBar->addWidget(m_pLbBanci);
|
|
|
|
|
ui.statusBar->addPermanentWidget(m_pLbCurrentTime);
|
|
|
|
|
}
|
|
|
|
|
//加载用户管理模块
|
|
|
|
|
//加载用户管理模块
|
|
|
|
|
loadUserModel();
|
|
|
|
|
//初始化模型管理模块
|
|
|
|
|
//初始化模型管理模块
|
|
|
|
|
{
|
|
|
|
|
m_pCtrl = new WheelCtrl(QCoreApplication::applicationDirPath(), &m_screen);
|
|
|
|
|
pWorkCtrl = new QWorkMgrCtlr(m_pCtrl);
|
|
|
|
|
@ -126,26 +126,26 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
m_pworkUI->InitUI();
|
|
|
|
|
connect(m_pworkUI, SIGNAL(sgUpdatedefect()), this, SLOT(onUpdateDefect()));
|
|
|
|
|
|
|
|
|
|
m_pModelMgrDlg = new QModelMgrDlg(m_pCtrl);//模板管理
|
|
|
|
|
m_pModelMgrDlg = new QModelMgrDlg(m_pCtrl);//模板管理
|
|
|
|
|
|
|
|
|
|
m_pDebugDlg = new QDebugDlg();//调试界面
|
|
|
|
|
m_pDebugDlg = new QDebugDlg();//调试界面
|
|
|
|
|
connect(m_pDebugDlg, SIGNAL(sgTriggerCam()), this, SLOT(onTriggerCam()));
|
|
|
|
|
m_pDebugDlg->onSetCtrl(m_pCtrl);
|
|
|
|
|
|
|
|
|
|
m_pTimerMgrDlg = new QTimeMgrDlg();//班次管理
|
|
|
|
|
m_pTimerMgrDlg = new QTimeMgrDlg();//班次管理
|
|
|
|
|
m_pTimerMgrDlg->onSetCtrlPtr(m_pCtrl);
|
|
|
|
|
|
|
|
|
|
m_pSystemSettingDlg = new QSystemSettingDlg();//系统设置
|
|
|
|
|
m_pSystemSettingDlg = new QSystemSettingDlg();//系统设置
|
|
|
|
|
m_CamSettingDlg = new QCamSettingDlg();
|
|
|
|
|
m_CamSettingDlg->setCoreCtrlPtr(m_pCoreCtrl);
|
|
|
|
|
|
|
|
|
|
m_pixMapList = new QPixmapListBar(ui.tp_main_tabWidget);
|
|
|
|
|
ui.tp_main_tabWidget->insertTab(0, m_pixMapList, tr("历史"));
|
|
|
|
|
ui.tp_main_tabWidget->insertTab(0, m_pixMapList, tr("历史"));
|
|
|
|
|
ui.tp_main_tabWidget->setCurrentIndex(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
/*发送模板库线程*/
|
|
|
|
|
/*发送模板库线程*/
|
|
|
|
|
SendModelLibTask = new QMyThread();
|
|
|
|
|
SendModelLibTask->setUser(true);
|
|
|
|
|
TaskFunc KuTaskFunc = std::bind(&lpMainWin::SendModelKuTskFun,this);
|
|
|
|
|
@ -155,16 +155,16 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
TaskFunc TickFunc = std::bind(&lpMainWin::SendTickTskFun, this);
|
|
|
|
|
SendTiskTsk->loadfunc(TickFunc);
|
|
|
|
|
|
|
|
|
|
m_screen.ShowMsg(tr("系统初始化完成..."));
|
|
|
|
|
m_screen.ShowMsg(tr("系统初始化完成..."));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
onSetModel();
|
|
|
|
|
/*网络通信加载*/
|
|
|
|
|
/*网络通信加载*/
|
|
|
|
|
m_pNet = ((WheelCtrl*)m_pCtrl)->getNet();
|
|
|
|
|
connect(m_pNet, SIGNAL(sgShow2UI(QString, bool)), this, SLOT(onTcpConnet(QString, bool)));//net
|
|
|
|
|
connect(m_pNet, SIGNAL(sgClientConnect(QString, bool)), this, SLOT(onClientConnect(QString, bool)));//net
|
|
|
|
|
//connect(m_pNet, SIGNAL(sgRecv(const QString &)), this, SLOT(onTcpRecv(const QString &)));// net显示
|
|
|
|
|
//connect(m_pNet, SIGNAL(sgRecv(const QString &)), this, SLOT(onTcpRecv(const QString &)));// net显示
|
|
|
|
|
connect(m_pNet, SIGNAL(sgThickness(double)), this, SLOT(onThickness(double)));//xy height
|
|
|
|
|
connect(m_pNet, SIGNAL(sgRecvDetectState(int, int)), this, SLOT(onDetectStateRecv(int, int)));//xy check
|
|
|
|
|
connect(m_pNet, SIGNAL(sgClearRev(bool)), this, SLOT(onClearLibRev(bool)));//xy clearlib
|
|
|
|
|
@ -178,21 +178,21 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
connect(m_pNet, SIGNAL(sgShutDownComputer()), this, SLOT(onShutDownComputer()));
|
|
|
|
|
connect(m_pNet, SIGNAL(sgLibRev(bool)), SendModelLibTask, SLOT(WaitSingleIn(bool)));//xy lib
|
|
|
|
|
|
|
|
|
|
// connect(m_pNet, SIGNAL(sgChangeOnlineState(int)), m_pUi, SLOT(onSwitchOnlineModel(int)));//强制在线 离线
|
|
|
|
|
// connect(m_pNet, SIGNAL(sgChangeOnlineState(int)), m_pUi, SLOT(onSwitchOnlineModel(int)));//强制在线 离线
|
|
|
|
|
|
|
|
|
|
QTimer::singleShot(500, m_pNet, SLOT(onOpenServer()));//延迟2s打开网络TCP服务
|
|
|
|
|
QTimer::singleShot(500, m_pNet, SLOT(onOpenServer()));//延迟2s打开网络TCP服务
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
connect(&m_PulseTimer, SIGNAL(timeout()), this, SLOT(onPulseTimer()));//心跳包
|
|
|
|
|
connect(&m_wfPulseTimer, SIGNAL(timeout()), this, SLOT(onwfPulseTimer()));//心跳包
|
|
|
|
|
connect(&m_ThicknessTimer, SIGNAL(timeout()), this, SLOT(onThicknessTimer()));// 厚度查询
|
|
|
|
|
connect(&m_PulseTimer, SIGNAL(timeout()), this, SLOT(onPulseTimer()));//心跳包
|
|
|
|
|
connect(&m_wfPulseTimer, SIGNAL(timeout()), this, SLOT(onwfPulseTimer()));//心跳包
|
|
|
|
|
connect(&m_ThicknessTimer, SIGNAL(timeout()), this, SLOT(onThicknessTimer()));// 厚度查询
|
|
|
|
|
connect(&m_ReadLibTimer, SIGNAL(timeout()), this, SLOT(onSendReadOnlineLib()));
|
|
|
|
|
|
|
|
|
|
connect(this, SIGNAL(sgTickTsk()), this, SLOT(onPulseTimer()));
|
|
|
|
|
connect(this, SIGNAL(sgShowMsg(QString, bool)), this, SLOT(onTcpConnet(QString, bool)));
|
|
|
|
|
connect(this, SIGNAL(sgTaskSendModels(int, QString, double, double)), this, SLOT(onTaskSendModels(int, QString, double, double)));//用于发送莫板库
|
|
|
|
|
connect(this, SIGNAL(sgTskSendDetectState(int, QString, int)), this, SLOT(onTaskSendDetectState(int, QString, int)));//离线检测发送 用于发送检测状态
|
|
|
|
|
connect(this, SIGNAL(sgTskSendCheck(int, int, QString)), this, SLOT(onTaskCheck(int, int, QString)));//在线检测状态查询 用于查询线程
|
|
|
|
|
connect(this, SIGNAL(sgTaskSendModels(int, QString, double, double)), this, SLOT(onTaskSendModels(int, QString, double, double)));//用于发送莫板库
|
|
|
|
|
connect(this, SIGNAL(sgTskSendDetectState(int, QString, int)), this, SLOT(onTaskSendDetectState(int, QString, int)));//离线检测发送 用于发送检测状态
|
|
|
|
|
connect(this, SIGNAL(sgTskSendCheck(int, int, QString)), this, SLOT(onTaskCheck(int, int, QString)));//在线检测状态查询 用于查询线程
|
|
|
|
|
// connect(this, SIGNAL(sgCheckEnd()), this, SLOT(onCheckEnd()));
|
|
|
|
|
connect(this, SIGNAL(sgShowImgState(QString)), this, SLOT(onShowImgState(QString)));
|
|
|
|
|
connect(this, SIGNAL(sgGetImg()), this, SLOT(onGetImg()));
|
|
|
|
|
@ -202,14 +202,14 @@ lpMainWin::lpMainWin(QWidget *parent)
|
|
|
|
|
connect(this, SIGNAL(sgShowChannelRes(QString)), this, SLOT(onShowChannel(QString)));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
/*启动之后就一直发送心跳包和厚度查询*/
|
|
|
|
|
/*启动之后就一直发送心跳包和厚度查询*/
|
|
|
|
|
if (DetectState::instance()->m_AutoSendTick2Net)
|
|
|
|
|
{
|
|
|
|
|
SendTiskTsk->setSleepTime(1000);
|
|
|
|
|
SendTiskTsk->start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DetectState::instance()->m_StartAndDetect == 1)//m_sysType 表示万丰科技的
|
|
|
|
|
if (DetectState::instance()->m_StartAndDetect == 1)//m_sysType 表示万丰科技的
|
|
|
|
|
{
|
|
|
|
|
// m_timerDetect.setSingleShot(true);
|
|
|
|
|
// connect(&m_timerDetect, SIGNAL(timeout()), m_pUi, SLOT(onStartDetect()));
|
|
|
|
|
@ -417,8 +417,8 @@ void lpMainWin::SearchQmFile(const QString & strDir)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
|
|
|
|
dir.setSorting(QDir::DirsFirst); // 文件夹优先
|
|
|
|
|
// 转换成一个List
|
|
|
|
|
dir.setSorting(QDir::DirsFirst); // 文件夹优先
|
|
|
|
|
// 转换成一个List
|
|
|
|
|
QFileInfoList list = dir.entryInfoList();
|
|
|
|
|
if (list.size() < 1)
|
|
|
|
|
{
|
|
|
|
|
@ -429,7 +429,7 @@ void lpMainWin::SearchQmFile(const QString & strDir)
|
|
|
|
|
{
|
|
|
|
|
QFileInfo fileInfo = list.at(i);
|
|
|
|
|
QString tt = fileInfo.fileName();
|
|
|
|
|
// 如果是文件夹
|
|
|
|
|
// 如果是文件夹
|
|
|
|
|
bool bisDir = fileInfo.isDir();
|
|
|
|
|
if (bisDir)
|
|
|
|
|
{
|
|
|
|
|
@ -451,7 +451,7 @@ void lpMainWin::SetTranslator(const QString strPath)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QTranslator *pTrans = new QTranslator;
|
|
|
|
|
if (pTrans->load(strPath)) // 如果加载成功
|
|
|
|
|
if (pTrans->load(strPath)) // 如果加载成功
|
|
|
|
|
{
|
|
|
|
|
qApp->installTranslator(pTrans);
|
|
|
|
|
m_VecTranPtr.append(pTrans);
|
|
|
|
|
@ -487,7 +487,7 @@ void lpMainWin::SetLanguage(QString strLangage)
|
|
|
|
|
SearchQmFile(transDir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*主线程接收图像*/
|
|
|
|
|
/*主线程接收图像*/
|
|
|
|
|
void lpMainWin::INewCameraImage(const QString& camKey, QImage img)
|
|
|
|
|
{
|
|
|
|
|
if (m_ImgViewer)
|
|
|
|
|
@ -507,13 +507,13 @@ void lpMainWin::INewCameraImage(const QString& camKey, QImage img)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*多线程发送算法结果*/
|
|
|
|
|
/*多线程发送算法结果*/
|
|
|
|
|
void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
|
{
|
|
|
|
|
emit(sgShowImgState(tr("显示识别结果")));
|
|
|
|
|
emit(sgShowImgState(tr("显示识别结果")));
|
|
|
|
|
if (vMap.contains("error"))
|
|
|
|
|
{
|
|
|
|
|
emit(sgShowMsgdlg(tr("相机图像和背景图不一样,请更换检测背景!")));
|
|
|
|
|
emit(sgShowMsgdlg(tr("相机图像和背景图不一样,请更换检测背景!")));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Result2Ui *pResult = (Result2Ui*)vMap.value("result").toLongLong();
|
|
|
|
|
@ -525,7 +525,7 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
|
static int ErrorNum = 0;
|
|
|
|
|
if (m_pNet) {
|
|
|
|
|
if (pResult->m_strModel == "NG") {
|
|
|
|
|
//m_pNet->sendLight(0, 1, 1000, 10);//红灯
|
|
|
|
|
//m_pNet->sendLight(0, 1, 1000, 10);//红灯
|
|
|
|
|
|
|
|
|
|
SendResultBee(LIGHT_REDBEE, 1);
|
|
|
|
|
SendResultBee(LIGHT_BEE, 1);
|
|
|
|
|
@ -537,9 +537,9 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
|
ErrorNum = 0;
|
|
|
|
|
}
|
|
|
|
|
if (ErrorNum >= 3) {
|
|
|
|
|
QString str = tr("警告!!!连续出现%1个未识别型号").arg(ErrorNum);
|
|
|
|
|
QString str = tr("警告!!!连续出现%1个未识别型号").arg(ErrorNum);
|
|
|
|
|
if (DetectState::instance()->IsDetect == false)
|
|
|
|
|
str += tr(",未开启检测功能造成的");
|
|
|
|
|
str += tr(",未开启检测功能造成的");
|
|
|
|
|
m_pCtrl->addLog(str, emTypeWaring);
|
|
|
|
|
//m_pNet->sendLight(0, 1, 2000, 100);
|
|
|
|
|
//m_pNet->sendLight(3, 1, 3000, 100);
|
|
|
|
|
@ -548,11 +548,11 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (DetectState::instance()->m_SendDetectStr2Net)
|
|
|
|
|
SendResultStr2PLC(pResult);//发送检测结果字符到PLC
|
|
|
|
|
SendResultStr2PLC(pResult);//发送检测结果字符到PLC
|
|
|
|
|
if (DetectState::instance()->m_SendChannelRes2COM)
|
|
|
|
|
SendResultChannelCOM(pResult);//发送检测结果通道到串口
|
|
|
|
|
SendResultChannelCOM(pResult);//发送检测结果通道到串口
|
|
|
|
|
if (DetectState::instance()->m_SendChannelRes2Net)
|
|
|
|
|
SendResultChannel2PLC(pResult);//发送检测结果通道到PLC
|
|
|
|
|
SendResultChannel2PLC(pResult);//发送检测结果通道到PLC
|
|
|
|
|
|
|
|
|
|
m_pCtrl->saveResult(pResult);
|
|
|
|
|
saveImage(pResult);
|
|
|
|
|
@ -569,13 +569,13 @@ void lpMainWin::IVariantMapToUI(const QString& camKey, const QVariantMap& vMap)
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*多线程获取算法参数*/
|
|
|
|
|
/*多线程获取算法参数*/
|
|
|
|
|
QVariant lpMainWin::IGetVariantById(int id)
|
|
|
|
|
{
|
|
|
|
|
m_nDiffTrigNum--;//进入到这里 表示获取到了图片
|
|
|
|
|
m_nDiffTrigNum--;//进入到这里 表示获取到了图片
|
|
|
|
|
|
|
|
|
|
qWarning() << "Alg get An Image:" << "(" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss zzz") << ")";
|
|
|
|
|
emit(sgShowImgState(tr("获得图像,正在计算中...")));
|
|
|
|
|
emit(sgShowImgState(tr("获得图像,正在计算中...")));
|
|
|
|
|
emit(sgGetImg());
|
|
|
|
|
qDebug() << "get one Pic ,id=" << id;
|
|
|
|
|
if (DetectState::instance()->m_showThressList == 1) {
|
|
|
|
|
@ -621,12 +621,12 @@ Q_SLOT void lpMainWin::onLogInOut(QString strName, int level, int state)
|
|
|
|
|
lpGlobalData::instance()->m_level = level;
|
|
|
|
|
if (state == 0) {
|
|
|
|
|
m_pCtrl->setUser(strName, level);
|
|
|
|
|
ui.action_Login->setText(tr("注 销"));
|
|
|
|
|
ui.action_Login->setText(tr("注 销"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pCtrl->setUser(strName, level);
|
|
|
|
|
ui.action_Login->setText(tr("登 录"));
|
|
|
|
|
ui.action_Login->setText(tr("登 录"));
|
|
|
|
|
}
|
|
|
|
|
onUpdateByLevel(level);
|
|
|
|
|
}
|
|
|
|
|
@ -635,14 +635,14 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
{
|
|
|
|
|
QString strObj = sender()->objectName();
|
|
|
|
|
if ("action_userManager" == strObj) {
|
|
|
|
|
/*用户管理*/
|
|
|
|
|
/*用户管理*/
|
|
|
|
|
if (m_pUserCtrl)
|
|
|
|
|
{
|
|
|
|
|
m_pUserCtrl->ShowUserMgrDlg(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ("action_Login" == strObj) {
|
|
|
|
|
/*用户登陆*/
|
|
|
|
|
/*用户登陆*/
|
|
|
|
|
if (m_pUserCtrl)
|
|
|
|
|
{
|
|
|
|
|
m_pUserCtrl->CheckLogin(this);
|
|
|
|
|
@ -650,7 +650,7 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
}
|
|
|
|
|
else if ("action_about" == strObj) {
|
|
|
|
|
m_aboutDlg.setParent(this);
|
|
|
|
|
m_aboutDlg.setWindowTitle(tr("关于"));
|
|
|
|
|
m_aboutDlg.setWindowTitle(tr("关于"));
|
|
|
|
|
m_aboutDlg.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_aboutDlg.setWindowIcon(QIcon(":/resource/logo-8.png"));
|
|
|
|
|
m_aboutDlg.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
@ -667,7 +667,7 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
else if ("action_setting_ban" == strObj) {
|
|
|
|
|
if (m_pTimerMgrDlg) {
|
|
|
|
|
m_pTimerMgrDlg->setParent(this);
|
|
|
|
|
m_pTimerMgrDlg->setWindowTitle(tr("班次管理"));
|
|
|
|
|
m_pTimerMgrDlg->setWindowTitle(tr("班次管理"));
|
|
|
|
|
m_pTimerMgrDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_pTimerMgrDlg->setWindowIcon(QIcon(":/resource/logo-8.png"));
|
|
|
|
|
m_pTimerMgrDlg->setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
@ -678,7 +678,7 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
else if ("action_debug" == strObj) {
|
|
|
|
|
if (m_pDebugDlg) {
|
|
|
|
|
m_pDebugDlg->setParent(this);
|
|
|
|
|
m_pDebugDlg->setWindowTitle(tr("调试工具"));
|
|
|
|
|
m_pDebugDlg->setWindowTitle(tr("调试工具"));
|
|
|
|
|
m_pDebugDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_pDebugDlg->setWindowIcon(QIcon(":/resource/logo-8.png"));
|
|
|
|
|
m_pDebugDlg->setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
@ -686,7 +686,7 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
m_pDebugDlg->show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ("action_connect_mode" == strObj) {//检测模板勾选
|
|
|
|
|
else if ("action_connect_mode" == strObj) {//检测模板勾选
|
|
|
|
|
if (m_pworkUI)
|
|
|
|
|
{
|
|
|
|
|
m_pworkUI->setParent(this);
|
|
|
|
|
@ -700,11 +700,11 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
else if ("action_checkdata" == strObj) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if ("action_modelmgr" == strObj) {//模板管理
|
|
|
|
|
else if ("action_modelmgr" == strObj) {//模板管理
|
|
|
|
|
if (m_pModelMgrDlg)
|
|
|
|
|
{
|
|
|
|
|
m_pModelMgrDlg->setParent(this);
|
|
|
|
|
m_pModelMgrDlg->setWindowTitle(tr("模板管理"));
|
|
|
|
|
m_pModelMgrDlg->setWindowTitle(tr("模板管理"));
|
|
|
|
|
m_pModelMgrDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_pModelMgrDlg->setWindowIcon(QIcon(":/resource/logo-8.png"));
|
|
|
|
|
m_pModelMgrDlg->setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
@ -717,7 +717,7 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
{
|
|
|
|
|
m_pSystemSettingDlg->setParent(this);
|
|
|
|
|
m_pSystemSettingDlg->onShowWidget(lpGlobalData::instance()->m_level);
|
|
|
|
|
m_pSystemSettingDlg->setWindowTitle(tr("系统参数设置"));
|
|
|
|
|
m_pSystemSettingDlg->setWindowTitle(tr("系统参数设置"));
|
|
|
|
|
m_pSystemSettingDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_pSystemSettingDlg->setWindowIcon(QIcon(":/resource/logo-8.png"));
|
|
|
|
|
m_pSystemSettingDlg->setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
@ -730,7 +730,7 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
{
|
|
|
|
|
m_CamSettingDlg->setParent(this);
|
|
|
|
|
//m_CamSettingDlg->onShowWidget(lpGlobalData::instance()->m_level);
|
|
|
|
|
m_CamSettingDlg->setWindowTitle(tr("相机配置"));
|
|
|
|
|
m_CamSettingDlg->setWindowTitle(tr("相机配置"));
|
|
|
|
|
m_CamSettingDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_CamSettingDlg->setWindowIcon(QIcon(":/resource/logo-8.png"));
|
|
|
|
|
m_CamSettingDlg->setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
@ -743,13 +743,13 @@ Q_SLOT void lpMainWin::onActionClicked()
|
|
|
|
|
Q_SLOT void lpMainWin::onButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
QString strObj = sender()->objectName();
|
|
|
|
|
if ("btn_start_detect" == strObj)//开始
|
|
|
|
|
if ("btn_start_detect" == strObj)//开始
|
|
|
|
|
{
|
|
|
|
|
//开始检测按钮
|
|
|
|
|
//开始检测按钮
|
|
|
|
|
if (DetectState::instance()->IsDetect == false) {
|
|
|
|
|
ui.btn_start_detect->setText(tr("停止检测"));
|
|
|
|
|
ui.btn_start_detect->setText(tr("停止检测"));
|
|
|
|
|
m_pCtrl->onStart();
|
|
|
|
|
QString str = tr("按下了开始检测按钮,检测功能开启");
|
|
|
|
|
QString str = tr("按下了开始检测按钮,检测功能开启");
|
|
|
|
|
m_pCtrl->addLog(str, emTypeRunState);
|
|
|
|
|
|
|
|
|
|
//QTimer::singleShot(3000, [&](){m_pState->bLockDetect = true; });
|
|
|
|
|
@ -757,23 +757,23 @@ Q_SLOT void lpMainWin::onButtonClicked()
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
m_pCtrl->onFinish();
|
|
|
|
|
ui.btn_start_detect->setText(tr("开始检测"));
|
|
|
|
|
QString str = tr("按下了停止检测按钮,检测功能关闭");
|
|
|
|
|
ui.btn_start_detect->setText(tr("开始检测"));
|
|
|
|
|
QString str = tr("按下了停止检测按钮,检测功能关闭");
|
|
|
|
|
m_pCtrl->addLog(str, emTypeRunState);
|
|
|
|
|
DetectState::instance()->bLockDetect = false;
|
|
|
|
|
}
|
|
|
|
|
DetectState::instance()->IsDetect = !DetectState::instance()->IsDetect;
|
|
|
|
|
}
|
|
|
|
|
else if ("btn_clear_data" == strObj) {//交班清零
|
|
|
|
|
QMessageBox infobox(QMessageBox::Warning, tr("提示"), tr("将清空所有数据"), QMessageBox::Yes | QMessageBox::Cancel, this);
|
|
|
|
|
infobox.setButtonText(QMessageBox::Yes, tr("确定"));
|
|
|
|
|
infobox.setButtonText(QMessageBox::Cancel, tr("取消"));
|
|
|
|
|
else if ("btn_clear_data" == strObj) {//交班清零
|
|
|
|
|
QMessageBox infobox(QMessageBox::Warning, tr("提示"), tr("将清空所有数据"), QMessageBox::Yes | QMessageBox::Cancel, this);
|
|
|
|
|
infobox.setButtonText(QMessageBox::Yes, tr("确定"));
|
|
|
|
|
infobox.setButtonText(QMessageBox::Cancel, tr("取消"));
|
|
|
|
|
infobox.setWindowIcon(QIcon(":/image/leaper"));
|
|
|
|
|
if (QMessageBox::Cancel != infobox.exec()) {
|
|
|
|
|
m_pCtrl->onClear();
|
|
|
|
|
ui.main_lb_res_ok_num->setText(QString::number(0));
|
|
|
|
|
ui.main_lb_res_ng_num->setText(QString::number(0));
|
|
|
|
|
QString str = m_pCtrl->getUserName() + ":" + tr("按下了清零按钮,数据全部清零");
|
|
|
|
|
QString str = m_pCtrl->getUserName() + ":" + tr("按下了清零按钮,数据全部清零");
|
|
|
|
|
m_pCtrl->addLog(str, emTypeUseState);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -782,8 +782,8 @@ Q_SLOT void lpMainWin::onButtonClicked()
|
|
|
|
|
void lpMainWin::timerEvent(QTimerEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->timerId() == m_timerID) {
|
|
|
|
|
QString str = tr("系统时间: ");
|
|
|
|
|
QString strDetectState = tr("检测状态:") + (DetectState::instance()->IsDetect == true ? tr("检测中...") : tr("未检测..."));
|
|
|
|
|
QString str = tr("系统时间: ");
|
|
|
|
|
QString strDetectState = tr("检测状态:") + (DetectState::instance()->IsDetect == true ? tr("检测中...") : tr("未检测..."));
|
|
|
|
|
// if (strLanguage != "Chinese")
|
|
|
|
|
// {
|
|
|
|
|
// str = "Time:";
|
|
|
|
|
@ -813,7 +813,7 @@ void lpMainWin::timerEvent(QTimerEvent *event)
|
|
|
|
|
if (m_pCtrl)
|
|
|
|
|
show_label = m_pCtrl->getCurrentBan();
|
|
|
|
|
|
|
|
|
|
QString strMsg = tr("班次信息:") + (show_label.isEmpty() == true ? tr("该时间段未设置班次") : show_label);
|
|
|
|
|
QString strMsg = tr("班次信息:") + (show_label.isEmpty() == true ? tr("该时间段未设置班次") : show_label);
|
|
|
|
|
// if (strLanguage != "Chinese")
|
|
|
|
|
// {
|
|
|
|
|
// strMsg = tr("Classes:")
|
|
|
|
|
@ -827,7 +827,7 @@ void lpMainWin::timerEvent(QTimerEvent *event)
|
|
|
|
|
// if (strLanguage != "Chinese")
|
|
|
|
|
// m_pLbUser->setText(tr("User:") + show_label);
|
|
|
|
|
// else
|
|
|
|
|
m_pLbUser->setText(tr("当前用户:") + show_label);
|
|
|
|
|
m_pLbUser->setText(tr("当前用户:") + show_label);
|
|
|
|
|
m_pLbUser->setStyleSheet("font: 14px;");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -840,8 +840,8 @@ void lpMainWin::closeEvent(QCloseEvent *event)
|
|
|
|
|
void lpMainWin::SendModelKuTskFun()
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
发送模板库线程
|
|
|
|
|
把已有的所有模板库全部发送至PLC中
|
|
|
|
|
发送模板库线程
|
|
|
|
|
把已有的所有模板库全部发送至PLC中
|
|
|
|
|
*/
|
|
|
|
|
DetectState::instance()->m_ThreadWaitTime = 100;
|
|
|
|
|
const int c_nErrorTime = 3;
|
|
|
|
|
@ -877,13 +877,13 @@ void lpMainWin::SendModelKuTskFun()
|
|
|
|
|
} while (nIndex < lst.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit(sgShowMsgdlg(tr("模板库发送完成")));
|
|
|
|
|
emit(sgShowMsgdlg(tr("模板库发送完成")));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lpMainWin::SendTickTskFun()
|
|
|
|
|
{
|
|
|
|
|
//心跳包发送
|
|
|
|
|
//心跳包发送
|
|
|
|
|
if (m_pNet)
|
|
|
|
|
{
|
|
|
|
|
m_pNet->sendPulse(6000, DetectState::instance()->IsDetect, DetectState::instance()->IsOnline);
|
|
|
|
|
@ -894,8 +894,8 @@ void lpMainWin::SendTickTskFun()
|
|
|
|
|
void lpMainWin::onSetModel()
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
重新加载模板
|
|
|
|
|
重新设置模板到算法中使用
|
|
|
|
|
重新加载模板
|
|
|
|
|
重新设置模板到算法中使用
|
|
|
|
|
*/
|
|
|
|
|
forDefectList = pWorkCtrl->getDefectList();
|
|
|
|
|
if (m_pTableCheck) {
|
|
|
|
|
@ -904,7 +904,7 @@ void lpMainWin::onSetModel()
|
|
|
|
|
strList.append("NG");
|
|
|
|
|
m_pTableCheck->setModelList(strList);
|
|
|
|
|
}
|
|
|
|
|
QString str = QString("%1:%2(%3)").arg(tr("正在检测型号数")).arg(forDefectList.size()).arg(m_pCtrl->getAllModelName().size() - 1);
|
|
|
|
|
QString str = QString("%1:%2(%3)").arg(tr("正在检测型号数")).arg(forDefectList.size()).arg(m_pCtrl->getAllModelName().size() - 1);
|
|
|
|
|
ui.main_showWorkLabel->setText(str);
|
|
|
|
|
|
|
|
|
|
// IWheelUi *pMainWidget = m_pUi->getItemWidget(WHEEL_UI_MAINWINDOW);
|
|
|
|
|
@ -929,7 +929,7 @@ Q_SLOT void lpMainWin::onUpdateDefect() {
|
|
|
|
|
strList.append("NG");
|
|
|
|
|
m_pTableCheck->setModelList(strList);
|
|
|
|
|
}
|
|
|
|
|
QString str = QString("%1:%2(%3)").arg(tr("正在检测型号数")).arg(forDefectList.size()).arg(m_pCtrl->getAllModelName().size() - 1);
|
|
|
|
|
QString str = QString("%1:%2(%3)").arg(tr("正在检测型号数")).arg(forDefectList.size()).arg(m_pCtrl->getAllModelName().size() - 1);
|
|
|
|
|
ui.main_showWorkLabel->setText(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -961,7 +961,7 @@ Q_SLOT void lpMainWin::onTcpConnet(QString str, bool bConnect)
|
|
|
|
|
|
|
|
|
|
Q_SLOT void lpMainWin::onClientConnect(QString addr, bool bConnect)
|
|
|
|
|
{
|
|
|
|
|
/*判断连接的机器IP地址是不是本地设置好的IP,并检测他的连接状态,如果是 默认将发送模板库给他*/
|
|
|
|
|
/*判断连接的机器IP地址是不是本地设置好的IP,并检测他的连接状态,如果是 默认将发送模板库给他*/
|
|
|
|
|
QString m_addr = NetProtocol::genAddressPort(m_pNet->getIp(emNetClient), m_pNet->getPort(emNetClient));
|
|
|
|
|
if (m_addr == addr && bConnect)
|
|
|
|
|
{
|
|
|
|
|
@ -969,16 +969,16 @@ Q_SLOT void lpMainWin::onClientConnect(QString addr, bool bConnect)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (bConnect == true && 1 == DetectState::instance()->IsOnline) {
|
|
|
|
|
//m_pUi->onSwitchOnlineModel(m_pState->IsOnline);//在线模式 离线模式切换
|
|
|
|
|
//m_pUi->onSwitchOnlineModel(m_pState->IsOnline);//在线模式 离线模式切换
|
|
|
|
|
}
|
|
|
|
|
QString strMsg;
|
|
|
|
|
if (bConnect)
|
|
|
|
|
{
|
|
|
|
|
strMsg += QString("IP:%1 %2").arg(addr).arg(tr("已连接"));
|
|
|
|
|
strMsg += QString("IP:%1 %2").arg(addr).arg(tr("已连接"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strMsg += QString("IP:%1 %2").arg(addr).arg(tr("已断开"));
|
|
|
|
|
strMsg += QString("IP:%1 %2").arg(addr).arg(tr("已断开"));
|
|
|
|
|
}
|
|
|
|
|
m_pCtrl->addLog(strMsg, emTypeRunState);
|
|
|
|
|
ui.main_textBrowser->append(strMsg);
|
|
|
|
|
@ -1008,7 +1008,7 @@ Q_SLOT void lpMainWin::onDetectStateRecv(int nIndex, int value)
|
|
|
|
|
|
|
|
|
|
Q_SLOT void lpMainWin::onClearLibRev(bool state)
|
|
|
|
|
{
|
|
|
|
|
/*接收到库清空应答*/
|
|
|
|
|
/*接收到库清空应答*/
|
|
|
|
|
if (SendModelLibTask) {
|
|
|
|
|
if (SendModelLibTask->isRunning())
|
|
|
|
|
SendModelLibTask->stop();
|
|
|
|
|
@ -1018,7 +1018,7 @@ Q_SLOT void lpMainWin::onClearLibRev(bool state)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//接收到心跳包 关闭定时器
|
|
|
|
|
//接收到心跳包 关闭定时器
|
|
|
|
|
Q_SLOT void lpMainWin::onPulseRev()
|
|
|
|
|
{
|
|
|
|
|
if (m_TimerID != 0)
|
|
|
|
|
@ -1031,7 +1031,7 @@ Q_SLOT void lpMainWin::onPulseRev()
|
|
|
|
|
|
|
|
|
|
Q_SLOT void lpMainWin::onRecvTrigPara()
|
|
|
|
|
{
|
|
|
|
|
emit(sgShowMsgdlg(tr("PLC已收到相关设置参数!")));
|
|
|
|
|
emit(sgShowMsgdlg(tr("PLC已收到相关设置参数!")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void lpMainWin::onReadDetectState(int nIndex, QString strModel)
|
|
|
|
|
@ -1065,12 +1065,12 @@ Q_SLOT void lpMainWin::onReadDetectStateASK()
|
|
|
|
|
|
|
|
|
|
Q_SLOT void lpMainWin::onTrigRecv(int m_value)
|
|
|
|
|
{
|
|
|
|
|
/*用于接收PLC触发相机的信号 自检是否收到图像 */
|
|
|
|
|
/*用于接收PLC触发相机的信号 自检是否收到图像 */
|
|
|
|
|
qDebug() << "recv a camera trig :" << QString::number(m_value);
|
|
|
|
|
qWarning() << "recv a Triger signal from PLC:" << "(" << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss zzz") << ")";
|
|
|
|
|
//if (m_pState)//如果是使用软件触发相机拍照
|
|
|
|
|
//if (m_pState)//如果是使用软件触发相机拍照
|
|
|
|
|
{
|
|
|
|
|
if (DetectState::instance()->m_CameraTrigeType == 0)//软件触发模式
|
|
|
|
|
if (DetectState::instance()->m_CameraTrigeType == 0)//软件触发模式
|
|
|
|
|
{
|
|
|
|
|
if (DetectState::instance()->bLockDetect == true) {
|
|
|
|
|
//CC_Action(CC_AC_NEXT);
|
|
|
|
|
@ -1085,9 +1085,9 @@ Q_SLOT void lpMainWin::onServerState(QString Addr, int port, bool m_state)
|
|
|
|
|
{
|
|
|
|
|
QString str;
|
|
|
|
|
if (m_state == true)
|
|
|
|
|
str = QString(tr("已打开"));
|
|
|
|
|
str = QString(tr("已打开"));
|
|
|
|
|
else
|
|
|
|
|
str = QString(tr("已关闭"));
|
|
|
|
|
str = QString(tr("已关闭"));
|
|
|
|
|
QString strMsg = QString("serverIP %1 port %2 %3.").arg(Addr).arg(port).arg(str);
|
|
|
|
|
m_pCtrl->addLog(m_pCtrl->getUserName() + ":" + strMsg, emTypeRunState);
|
|
|
|
|
}
|
|
|
|
|
@ -1118,7 +1118,7 @@ Q_SLOT void lpMainWin::onShutDownComputer()
|
|
|
|
|
//***********************************************************************
|
|
|
|
|
Q_SLOT void lpMainWin::onPulseTimer()
|
|
|
|
|
{
|
|
|
|
|
//心跳包发送
|
|
|
|
|
//心跳包发送
|
|
|
|
|
if (m_pNet)
|
|
|
|
|
{
|
|
|
|
|
m_pNet->sendPulse(6000, DetectState::instance()->IsDetect, DetectState::instance()->IsOnline);
|
|
|
|
|
@ -1150,7 +1150,7 @@ Q_SLOT void lpMainWin::onGetImg()
|
|
|
|
|
{
|
|
|
|
|
ui.main_lb_res_model_pic->setStyleSheet(QString("QLabel{border: 1px solid rgb(0,0,0,250);background-color: rgb(200, 200, 200);}"));
|
|
|
|
|
}
|
|
|
|
|
//展示信息
|
|
|
|
|
//展示信息
|
|
|
|
|
Q_SLOT void lpMainWin::onShowMsg(QString str)
|
|
|
|
|
{
|
|
|
|
|
// QPulpewidget *pw = new QPulpewidget();
|
|
|
|
|
@ -1193,16 +1193,16 @@ void lpMainWin::onInitAbout()
|
|
|
|
|
"<p>%3:www.hzleaper.com</p>"
|
|
|
|
|
"<p>%4:%5</p>"
|
|
|
|
|
"<p>%6:%7</p>"
|
|
|
|
|
"<p>%8:%9</p>"
|
|
|
|
|
"<p>%8:%9</p>"
|
|
|
|
|
"<p> </p>"
|
|
|
|
|
).arg(tr("轮毂型号识别系统"))
|
|
|
|
|
.arg(tr("本软件由杭州利珀科技开发,用于轮毂型号识别和分类,可搭配流水线运输系统使用"))
|
|
|
|
|
.arg(tr("若需要进一步了解该产品的相关信息,请访问我们的网站"))
|
|
|
|
|
.arg(tr("软件版本")).arg(111)
|
|
|
|
|
//.arg(tr("算法版本")).arg(strWhelAlgoType)
|
|
|
|
|
.arg(tr("算法版本")).arg(111)
|
|
|
|
|
.arg(tr("最后更新时间")).arg(111)
|
|
|
|
|
.arg(tr("版权 (c) 属 杭州利珀科技有限公司 所有"));
|
|
|
|
|
).arg(tr("轮毂型号识别系统"))
|
|
|
|
|
.arg(tr("本软件由杭州利珀科技开发,用于轮毂型号识别和分类,可搭配流水线运输系统使用"))
|
|
|
|
|
.arg(tr("若需要进一步了解该产品的相关信息,请访问我们的网站"))
|
|
|
|
|
.arg(tr("软件版本")).arg(111)
|
|
|
|
|
//.arg(tr("算法版本")).arg(strWhelAlgoType)
|
|
|
|
|
.arg(tr("算法版本")).arg(111)
|
|
|
|
|
.arg(tr("最后更新时间")).arg(111)
|
|
|
|
|
.arg(tr("版权 (c) 属 杭州利珀科技有限公司 所有"));
|
|
|
|
|
m_aboutDlg.setFixedSize(500, 300);
|
|
|
|
|
//QLabel* lbTitle = new QLabel(m_lightBox);
|
|
|
|
|
//QLabel* lbTitle = new QLabel(&m_mainWidget);
|
|
|
|
|
@ -1219,7 +1219,7 @@ void lpMainWin::onInitAbout()
|
|
|
|
|
QPalette pl = pEdit->palette();
|
|
|
|
|
pl.setBrush(QPalette::Base, QBrush(QColor(255, 0, 0, 0)));
|
|
|
|
|
pEdit->setPalette(pl);
|
|
|
|
|
QPushButton* lbClose = new QPushButton(tr("关闭"));
|
|
|
|
|
QPushButton* lbClose = new QPushButton(tr("关闭"));
|
|
|
|
|
//QGridLayout* lbLayout = new QGridLayout(m_lightBox);
|
|
|
|
|
QGridLayout* lbLayout = new QGridLayout(&m_aboutDlg);
|
|
|
|
|
//lbLayout->addWidget(lbTitle, 1, 1);
|
|
|
|
|
@ -1237,15 +1237,15 @@ void lpMainWin::onShowResult(Result2Ui* pRlt)
|
|
|
|
|
if (!pRlt)
|
|
|
|
|
return;
|
|
|
|
|
/*
|
|
|
|
|
ui.main_lb_res_model_pic;//匹配结果图
|
|
|
|
|
ui.main_lb_res_okng;//匹配结果 OK NG
|
|
|
|
|
ui.main_lb_res_model_id;//匹配型号
|
|
|
|
|
ui.main_lb_res_model_score;//匹配分数
|
|
|
|
|
ui.main_lb_res_model_thickness;//厚度
|
|
|
|
|
ui.main_lb_res_model_diameter;//直径
|
|
|
|
|
ui.main_lb_res_model_time;//识别耗时时间
|
|
|
|
|
ui.main_lb_res_ok_num;//识别总数
|
|
|
|
|
ui.main_lb_res_ng_num;//NG 数量
|
|
|
|
|
ui.main_lb_res_model_pic;//匹配结果图
|
|
|
|
|
ui.main_lb_res_okng;//匹配结果 OK NG
|
|
|
|
|
ui.main_lb_res_model_id;//匹配型号
|
|
|
|
|
ui.main_lb_res_model_score;//匹配分数
|
|
|
|
|
ui.main_lb_res_model_thickness;//厚度
|
|
|
|
|
ui.main_lb_res_model_diameter;//直径
|
|
|
|
|
ui.main_lb_res_model_time;//识别耗时时间
|
|
|
|
|
ui.main_lb_res_ok_num;//识别总数
|
|
|
|
|
ui.main_lb_res_ng_num;//NG 数量
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int scareh = ui.main_lb_res_model_pic->height();
|
|
|
|
|
@ -1336,7 +1336,7 @@ void lpMainWin::SendResultBee(emTypeBee m_Type, int num)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
if (m_Type == LIGHT_REDBEE) {
|
|
|
|
|
m_pNet->sendLight(0, 1, 500, 500);//红灯
|
|
|
|
|
m_pNet->sendLight(0, 1, 500, 500);//红灯
|
|
|
|
|
}
|
|
|
|
|
else if (m_Type == LIGHT_GREENBEE) {
|
|
|
|
|
m_pNet->sendLight(2, 1, 500, 500);
|
|
|
|
|
@ -1375,12 +1375,12 @@ void lpMainWin::SendResultChannel2PLC(Result2Ui* m_Res)
|
|
|
|
|
if (defaultInfo)
|
|
|
|
|
{
|
|
|
|
|
nResultChannel = defaultInfo->m_value;
|
|
|
|
|
emit(sgShowChannelRes(defaultInfo->m_ChannelName + tr("(默认)")));
|
|
|
|
|
emit(sgShowChannelRes(defaultInfo->m_ChannelName + tr("(默认)")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nResultChannel = 1000;
|
|
|
|
|
emit(sgShowChannelRes(tr("默认通道 值1000")));
|
|
|
|
|
emit(sgShowChannelRes(tr("默认通道 值1000")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_pNet)
|
|
|
|
|
@ -1406,12 +1406,12 @@ void lpMainWin::SendResultChannelCOM(Result2Ui* m_Res)
|
|
|
|
|
// if (defaultInfo)
|
|
|
|
|
// {
|
|
|
|
|
// frame.data1 = defaultInfo->m_value;
|
|
|
|
|
// emit(sgShowChannelRes(defaultInfo->m_ChannelName + QString(tr("(默认)"))));
|
|
|
|
|
// emit(sgShowChannelRes(defaultInfo->m_ChannelName + QString(tr("(默认)"))));
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// frame.data1 = 1000;
|
|
|
|
|
// emit(sgShowChannelRes(tr("默认通道 值1000")));
|
|
|
|
|
// emit(sgShowChannelRes(tr("默认通道 值1000")));
|
|
|
|
|
// }
|
|
|
|
|
// SendDataToCom(0x47, frame);
|
|
|
|
|
//}
|
|
|
|
|
@ -1476,7 +1476,7 @@ void lpMainWin::saveImage(Result2Ui* pRes)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lpMainWin::saveImage(const QPixmap& m_pixmap, QString m_path, QString filename)
|
|
|
|
|
{//启动多线程保存图像
|
|
|
|
|
{//启动多线程保存图像
|
|
|
|
|
SaveImgThread *workTread = new SaveImgThread(this);
|
|
|
|
|
workTread->setPixmap(m_pixmap, m_path, filename);
|
|
|
|
|
connect(workTread, &SaveImgThread::finished, workTread, &QObject::deleteLater);
|
|
|
|
|
|