|
|
|
|
@ -87,13 +87,14 @@ CMainWin::CMainWin(QWidget *parent)
|
|
|
|
|
lpSysConfig::instance()->writeConfig();
|
|
|
|
|
lpGlobalConfig::instance()->readConfig();
|
|
|
|
|
|
|
|
|
|
SetLanguage(lpSysConfig::instance()->m_CurLanguage);//语言设置
|
|
|
|
|
setWindowIcon(QIcon(LEAPER_LOGO));
|
|
|
|
|
onInitCoreCtrl();
|
|
|
|
|
onInitSerial();
|
|
|
|
|
onInitUser();
|
|
|
|
|
onInitUI();
|
|
|
|
|
onInitStatus();
|
|
|
|
|
onInitDiskClean();
|
|
|
|
|
onInitCoreCtrl();//核心模块
|
|
|
|
|
onInitSerial();//串口通讯模块
|
|
|
|
|
onInitUser();//用户登录模块
|
|
|
|
|
onInitUI();//其他UI
|
|
|
|
|
onInitStatus();//状态栏
|
|
|
|
|
onInitDiskClean();//定期删除任务
|
|
|
|
|
|
|
|
|
|
SYSLOG_STATUS << "系统启动";
|
|
|
|
|
{
|
|
|
|
|
@ -108,7 +109,6 @@ CMainWin::CMainWin(QWidget *parent)
|
|
|
|
|
m_pCameraTrig = new AutoTrigger;
|
|
|
|
|
connect(m_pCameraTrig, SIGNAL(sgTrig()), this, SLOT(onTrigImage()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(&m_devMgrWid, SIGNAL(sgChangeLanguage(QString)), this, SLOT(onLanguageChange(QString)));
|
|
|
|
|
connect(&m_testWid, SIGNAL(sgTestMode(int)), this, SLOT(onTestMode(int)));
|
|
|
|
|
|
|
|
|
|
@ -122,26 +122,20 @@ CMainWin::CMainWin(QWidget *parent)
|
|
|
|
|
connect(pS, SIGNAL(sgShowModeName(QString, QString)), this, SLOT(onShowName(QString, QString)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// if (m_pDetectorEngine)
|
|
|
|
|
// {
|
|
|
|
|
// QStringList Names = m_pDetectorEngine->getSolutionMgr()->GetAllSolutions().keys();
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pWfCtrl->ISelModel(lpGlobalConfig::instance()->m_StationSolution_1, lpGlobalConfig::instance()->m_StationRunModel_1);
|
|
|
|
|
m_pWfCtrl->ISelModel(lpGlobalConfig::instance()->m_StationSolution_2, lpGlobalConfig::instance()->m_StationRunModel_2);
|
|
|
|
|
|
|
|
|
|
m_pImageCaliUI = new lpImageCaliUI();//图像标定页面
|
|
|
|
|
|
|
|
|
|
lpGlobalData::instance()->m_bCheckLinese = lpCheckKey::instance()->checkLinese();
|
|
|
|
|
m_pCheckLineseUI = new QCryptokeyUI();
|
|
|
|
|
connect(m_pCheckLineseUI, SIGNAL(sgRegisterFinish(bool)), this, SLOT(onLineseCheck(bool)));
|
|
|
|
|
|
|
|
|
|
onLineseCheck(lpGlobalData::instance()->m_bCheckLinese);
|
|
|
|
|
|
|
|
|
|
m_TimerID_Status = startTimer(1000);
|
|
|
|
|
|
|
|
|
|
ui.actionSystem->setDisabled(true);
|
|
|
|
|
ui.actionTest->setDisabled(true);
|
|
|
|
|
ui.actionStandard->setDisabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CMainWin::~CMainWin()
|
|
|
|
|
@ -189,6 +183,18 @@ CMainWin::~CMainWin()
|
|
|
|
|
delete m_pWfCtrl;
|
|
|
|
|
m_pWfCtrl = nullptr;
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
if (m_ImgViewer_A)
|
|
|
|
|
{
|
|
|
|
|
delete m_ImgViewer_A;
|
|
|
|
|
m_ImgViewer_A = nullptr;
|
|
|
|
|
}
|
|
|
|
|
if (m_ImgViewer_B)
|
|
|
|
|
{
|
|
|
|
|
delete m_ImgViewer_B;
|
|
|
|
|
m_ImgViewer_B = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (m_pLabelInfo)
|
|
|
|
|
{
|
|
|
|
|
delete m_pLabelInfo;
|
|
|
|
|
@ -570,8 +576,8 @@ Q_SLOT void CMainWin::onActionClicked()
|
|
|
|
|
else if ("actionTest" == strObj) {//测试
|
|
|
|
|
m_testWid.setParent(this);
|
|
|
|
|
m_testWid.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_testWid.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_testWid.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
//m_testWid.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
//m_testWid.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
m_testWid.show();
|
|
|
|
|
}
|
|
|
|
|
else if ("actionHelp" == strObj) {//帮助
|
|
|
|
|
@ -596,14 +602,12 @@ Q_SLOT void CMainWin::onActionClicked()
|
|
|
|
|
m_devMgrWid.setParent(this);
|
|
|
|
|
m_devMgrWid.setWindowIcon(QIcon(LEAPER_LOGO));
|
|
|
|
|
m_devMgrWid.setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
|
m_devMgrWid.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
m_devMgrWid.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
|
|
|
|
|
//m_devMgrWid.setWindowModality(Qt::ApplicationModal);
|
|
|
|
|
//m_devMgrWid.setAttribute(Qt::WA_ShowModal, true);
|
|
|
|
|
|
|
|
|
|
QStringList camkeys = m_pCoreCtrl->ICameraKeys();
|
|
|
|
|
QStringList solutions = m_pDetectorEngine->getSolutionMgr()->GetAllSolutions().keys();
|
|
|
|
|
m_devMgrWid.setSystemConfig(camkeys, solutions);
|
|
|
|
|
|
|
|
|
|
m_devMgrWid.show();
|
|
|
|
|
}
|
|
|
|
|
else if ("main_Login_action" == strObj) {//用户登陆
|
|
|
|
|
@ -904,6 +908,36 @@ void CMainWin::onInitSerial()
|
|
|
|
|
|
|
|
|
|
void CMainWin::onInitUI()
|
|
|
|
|
{
|
|
|
|
|
//检测结果图展示 UI初始化
|
|
|
|
|
{
|
|
|
|
|
QGridLayout *pLayout_A = new QGridLayout(ui.widget_A);//A侧相机结果图展示UI
|
|
|
|
|
m_ImgViewer_A = new RoiImgViewer(ui.widget_A);
|
|
|
|
|
m_ImgViewer_A->setObjectName("m_ImgViewer_A");
|
|
|
|
|
connect(m_ImgViewer_A, SIGNAL(sgImageScale(qreal)), this, SLOT(onImageScale(qreal)));
|
|
|
|
|
pLayout_A->addWidget(m_ImgViewer_A);
|
|
|
|
|
ui.widget_A->setLayout(pLayout_A);
|
|
|
|
|
|
|
|
|
|
QGridLayout *pLayout_B = new QGridLayout(ui.widget_B);//B侧相机结果图展示UI
|
|
|
|
|
m_ImgViewer_B = new RoiImgViewer(ui.widget_A);
|
|
|
|
|
m_ImgViewer_B->setObjectName("m_ImgViewer_B");
|
|
|
|
|
connect(m_ImgViewer_B, SIGNAL(sgImageScale(qreal)), this, SLOT(onImageScale(qreal)));
|
|
|
|
|
pLayout_B->addWidget(m_ImgViewer_B);
|
|
|
|
|
ui.widget_B->setLayout(pLayout_B);
|
|
|
|
|
|
|
|
|
|
QString strPath = QApplication::applicationDirPath() + "/showImg.ini";//图像展示比例的参数
|
|
|
|
|
QSettings setting(strPath, QSettings::IniFormat);
|
|
|
|
|
double nScale_A = setting.value("ShowImg/ScaleA", 0.53).toDouble();
|
|
|
|
|
double nScale_B = setting.value("ShowImg/ScaleB", 0.53).toDouble();
|
|
|
|
|
m_ImgViewer_A->setInitScale(nScale_A);
|
|
|
|
|
m_ImgViewer_B->setInitScale(nScale_B);
|
|
|
|
|
|
|
|
|
|
m_ImgViewer_A->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(m_ImgViewer_A, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
|
|
|
|
|
|
|
|
|
|
m_ImgViewer_B->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(m_ImgViewer_B, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QFont font;
|
|
|
|
|
//工具栏菜单
|
|
|
|
|
QMenu *pToolMenu = new QMenu(this);
|
|
|
|
|
@ -964,11 +998,11 @@ void CMainWin::onInitUI()
|
|
|
|
|
pDoc = ui.wf_text_edit_result_2->document();
|
|
|
|
|
pDoc->setMaximumBlockCount(200);
|
|
|
|
|
|
|
|
|
|
ui.wf_lb_image_show_1->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(ui.wf_lb_image_show_1, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
|
|
|
|
|
// ui.wf_lb_image_show_1->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
// connect(ui.wf_lb_image_show_1, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
|
|
|
|
|
|
|
|
|
|
ui.wf_lb_image_show_2->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
connect(ui.wf_lb_image_show_2, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
|
|
|
|
|
// ui.wf_lb_image_show_2->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
// connect(ui.wf_lb_image_show_2, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onPopMenu(const QPoint&)));
|
|
|
|
|
connect(this, SIGNAL(sgShowSrcImg(QString, QImage)), &m_camSetWid, SLOT(onShowImage(QString, QImage)));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1032,6 +1066,10 @@ Q_SLOT void CMainWin::onLanguageChange(QString strLanguage)
|
|
|
|
|
{
|
|
|
|
|
// QSettings languageSetting(lpSysConfig::instance()->getCfgPath(), QSettings::IniFormat);
|
|
|
|
|
// languageSetting.value("language/select", "Chinese").toString();
|
|
|
|
|
if (strLanguage == lpSysConfig::instance()->m_CurLanguage)
|
|
|
|
|
return;
|
|
|
|
|
lpSysConfig::instance()->m_CurLanguage = strLanguage;
|
|
|
|
|
lpSysConfig::instance()->writeConfig();
|
|
|
|
|
SetLanguage(strLanguage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1092,13 +1130,15 @@ Q_SLOT void CMainWin::onChangeUI(QString strUsr, int nLevel)
|
|
|
|
|
case 7:
|
|
|
|
|
case 6:
|
|
|
|
|
ui.main_action_userManager->setVisible(true);
|
|
|
|
|
ui.actionSystem->setEnabled(true);
|
|
|
|
|
ui.actionTest->setEnabled(true);
|
|
|
|
|
ui.actionSystem->setDisabled(false);
|
|
|
|
|
ui.actionTest->setDisabled(false);
|
|
|
|
|
ui.actionStandard->setDisabled(false);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
ui.main_action_userManager->setVisible(true);
|
|
|
|
|
ui.actionSystem->setEnabled(true);
|
|
|
|
|
ui.actionTest->setEnabled(true);
|
|
|
|
|
ui.actionSystem->setDisabled(false);
|
|
|
|
|
ui.actionTest->setDisabled(false);
|
|
|
|
|
ui.actionStandard->setDisabled(false);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
case 3:
|
|
|
|
|
@ -1106,8 +1146,9 @@ Q_SLOT void CMainWin::onChangeUI(QString strUsr, int nLevel)
|
|
|
|
|
case 1:
|
|
|
|
|
case 0:
|
|
|
|
|
ui.main_action_userManager->setVisible(false);
|
|
|
|
|
ui.actionSystem->setEnabled(false);
|
|
|
|
|
ui.actionTest->setEnabled(false);
|
|
|
|
|
ui.actionSystem->setDisabled(true);
|
|
|
|
|
ui.actionTest->setDisabled(true);
|
|
|
|
|
ui.actionStandard->setDisabled(true);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
@ -1171,11 +1212,15 @@ Q_SLOT void CMainWin::onShowImage(int ID, QImage img)
|
|
|
|
|
};
|
|
|
|
|
if (ID == 1)
|
|
|
|
|
{
|
|
|
|
|
ShowImg(ui.wf_lb_image_show_1,img);
|
|
|
|
|
if(m_ImgViewer_A)
|
|
|
|
|
m_ImgViewer_A->setImg(img);
|
|
|
|
|
//ShowImg(ui.wf_lb_image_show_1,img);
|
|
|
|
|
}
|
|
|
|
|
else if (ID == 2)
|
|
|
|
|
{
|
|
|
|
|
ShowImg(ui.wf_lb_image_show_2, img);
|
|
|
|
|
if (m_ImgViewer_B)
|
|
|
|
|
m_ImgViewer_B->setImg(img);
|
|
|
|
|
//ShowImg(ui.wf_lb_image_show_2, img);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//展示正在检测的型号名
|
|
|
|
|
@ -1207,12 +1252,14 @@ Q_SLOT void CMainWin::onPopMenu(const QPoint& pt)
|
|
|
|
|
{
|
|
|
|
|
/*根据UI名判断是哪个工位需要设置相机*/
|
|
|
|
|
QString strCamKey;
|
|
|
|
|
QString strObj = sender()->objectName();
|
|
|
|
|
if ("wf_lb_image_show_1" == strObj)
|
|
|
|
|
//QString strObj = sender()->objectName();
|
|
|
|
|
//if ("wf_lb_image_show_1" == strObj)
|
|
|
|
|
if(m_ImgViewer_A == sender())
|
|
|
|
|
{
|
|
|
|
|
strCamKey = lpGlobalConfig::instance()->m_StationCamKey_1;
|
|
|
|
|
}
|
|
|
|
|
else if ("wf_lb_image_show_2" == strObj)
|
|
|
|
|
//else if ("wf_lb_image_show_2" == strObj)
|
|
|
|
|
else if (m_ImgViewer_B == sender())
|
|
|
|
|
{
|
|
|
|
|
strCamKey = lpGlobalConfig::instance()->m_StationCamKey_2;
|
|
|
|
|
}
|
|
|
|
|
@ -1389,7 +1436,7 @@ void CMainWin::IEngineResult(QVariantMap vMap)
|
|
|
|
|
|
|
|
|
|
/********打印检测结果到ui上*********/
|
|
|
|
|
QString strResult = QTime::currentTime().toString("hh:mm:ss zzz:") + taskName;
|
|
|
|
|
strResult += " angle result : " + QString::number(dAngle, 'f', 3);
|
|
|
|
|
strResult += " angle : " + QString::number(dAngle, 'f', 3);
|
|
|
|
|
|
|
|
|
|
if (dAngle >= 361)
|
|
|
|
|
{
|
|
|
|
|
@ -1547,3 +1594,18 @@ void CMainWin::onInitDiskClean()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_SLOT void CMainWin::onImageScale(qreal value)
|
|
|
|
|
{
|
|
|
|
|
QString strPath = QApplication::applicationDirPath() + "/showImg.ini";
|
|
|
|
|
QSettings setting(strPath, QSettings::IniFormat);
|
|
|
|
|
QObject *obj = sender();
|
|
|
|
|
if (m_ImgViewer_A == obj)
|
|
|
|
|
{
|
|
|
|
|
setting.setValue("ShowImg/ScaleA", value);
|
|
|
|
|
}
|
|
|
|
|
else if (m_ImgViewer_B == obj)
|
|
|
|
|
{
|
|
|
|
|
setting.setValue("ShowImg/ScaleB", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|