|
|
#ifndef _H_LPMAINWIN_H_
|
|
|
#define _H_LPMAINWIN_H_
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
#include "ui_lpMainWin.h"
|
|
|
#include "iCoreCtrl.h"
|
|
|
#include "CoreCtrl/CDllCoreCtrl.h"
|
|
|
#include "QUserBase.h"
|
|
|
#include "QTranslator"
|
|
|
#include "QTimer"
|
|
|
#include "qmythread.h"
|
|
|
#include "DetectState.h"
|
|
|
#include "WheelNet.h"
|
|
|
#include "ModelTableView.h"
|
|
|
#include "QModelMgrDlg.h"
|
|
|
#include "Result2Ui.h"
|
|
|
#include "QDebugDlg.h"
|
|
|
#include "QTimeMgrDlg.h"
|
|
|
#include "RoiImgViewer.h"
|
|
|
#include "InfoFile.h"
|
|
|
#include "qpixmapbar.h"
|
|
|
#include "QSystemSettingDlg.h"
|
|
|
#include "QCamSettingDlg.h"
|
|
|
#include "QAlgParamDlg.h"
|
|
|
#include "QCryptokeyUI.h"
|
|
|
|
|
|
class lpMainWin : public QMainWindow
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
lpMainWin(QWidget *parent = Q_NULLPTR);
|
|
|
~lpMainWin();
|
|
|
|
|
|
//接收图像回调函数
|
|
|
void INewCameraImage(const QString& camKey, QImage img);
|
|
|
//接收算法检测结果回调函数
|
|
|
void IVariantMapToUI(const QString& camKey, const QVariantMap& vMap);
|
|
|
//传输算法参数回调函数
|
|
|
QVariant IGetVariantById(int id);
|
|
|
signals:
|
|
|
void sgTaskSendModels(int nIndex, QString strModel, double dDiameter, double dHeight);
|
|
|
void sgTskSendDetectState(int nIndex, QString strModel, int IsDetect);
|
|
|
void sgShowMsg(QString, bool); //show2ui
|
|
|
void sgCheckEnd();
|
|
|
void sgTskSendCheck(int, int, QString);
|
|
|
void sgModelStateChanged(QString);
|
|
|
void sgModelLibSendInitDone();
|
|
|
void sgStartDetect();
|
|
|
|
|
|
void sgSendClearDislib();
|
|
|
void sgSendDisLib(int nIndex, QString strModel);
|
|
|
void sgSendDisLibDone();
|
|
|
void sgSendReadOnlineLib();
|
|
|
|
|
|
void sgShowChannelRes(QString);
|
|
|
void sgShowImgState(QString);
|
|
|
void sgGetImg();
|
|
|
void sgShowMsgdlg(QString);
|
|
|
|
|
|
void sgTickTsk();
|
|
|
void sgFinish();
|
|
|
|
|
|
void operate();
|
|
|
void sgNetData(int, QVariantMap);
|
|
|
void sgAutoExposure();
|
|
|
void sgShowRatioVal(double val);
|
|
|
private:
|
|
|
Q_SLOT void onLogInOut(QString strName, int level, int state);
|
|
|
Q_SLOT void onActionClicked();
|
|
|
Q_SLOT void onButtonClicked();
|
|
|
Q_SLOT void onAutoExposure();
|
|
|
Q_SLOT void onUpdateUI();//修改参数应用时,刷新UI显示内容
|
|
|
Q_SLOT void onShowRatioVal(double val);
|
|
|
Q_SLOT void onLineseCheck(bool bFlag);
|
|
|
protected:
|
|
|
bool onInitCoreCtrl();
|
|
|
|
|
|
void loadUserModel();//加载用户管理模块
|
|
|
|
|
|
//国际化
|
|
|
void SearchQmFile(const QString & strDir);
|
|
|
void SetTranslator(const QString strPath);
|
|
|
void SetLanguage(QString strLangage);
|
|
|
|
|
|
void SendModelKuTskFun();
|
|
|
void SendTickTskFun();
|
|
|
void onSetModel();
|
|
|
QString SecondTimeString(quint64 value);//计算运行时常
|
|
|
Q_SLOT void onUpdateDefect();//勾选 更新界面显示窗口
|
|
|
//net slot
|
|
|
Q_SLOT void onTcpConnet(QString str, bool bConnect);
|
|
|
Q_SLOT void onSendClearLib2PLC();
|
|
|
Q_SLOT void onClientConnect(QString addr, bool bConnect);
|
|
|
Q_SLOT void onThickness(double dValue);
|
|
|
Q_SLOT void onDetectStateRecv(int nIndex, int value);
|
|
|
Q_SLOT void onClearLibRev(bool state);
|
|
|
Q_SLOT void onPulseRev();
|
|
|
Q_SLOT void onRecvTrigPara();
|
|
|
Q_SLOT void onReadDetectState(int nIndex, QString strModel);
|
|
|
Q_SLOT void onReadDetectStateASK();
|
|
|
Q_SLOT void onTrigRecv(int m_value, double dRatio);
|
|
|
Q_SLOT void onServerState(QString Addr, int port, bool m_state);
|
|
|
Q_SLOT void onShutDownComputer();
|
|
|
//timer slot
|
|
|
Q_SLOT void onPulseTimer();
|
|
|
Q_SLOT void onTaskSendModels(int nIndex, QString strModel, double dDiameter, double dHeight);
|
|
|
Q_SLOT void onTaskSendDetectState(int nIndex, QString strModel, int IsState);
|
|
|
Q_SLOT void onTaskCheck(int nIndex, int IsState, QString strModel);
|
|
|
Q_SLOT void onShowImgState(QString str);
|
|
|
Q_SLOT void onGetImg();
|
|
|
Q_SLOT void onShowMsg(QString str);
|
|
|
Q_SLOT void onSendDisLib(int nIndex, QString strModel);
|
|
|
Q_SLOT void onSendDisLibDone();
|
|
|
Q_SLOT void onShowChannel(QString str);
|
|
|
Q_SLOT void onTriggerCam();
|
|
|
Q_SLOT void onChangePLCParam();
|
|
|
void onInitAbout();
|
|
|
|
|
|
Q_SLOT void onLanguageChange(QString strLanguage);
|
|
|
|
|
|
Q_SLOT void onSendReadOnlineLib();
|
|
|
Q_SLOT void onThicknessTimer();
|
|
|
Q_SLOT void onwfPulseTimer();
|
|
|
Q_SLOT void modWorkMgr(QString str);
|
|
|
private:
|
|
|
void onShowResult(Result2Ui* pRlt);//展示识别结果
|
|
|
|
|
|
void SendResultBee(emTypeBee m_Type, int num);
|
|
|
void SendResultStr2PLC(Result2Ui* m_Res);
|
|
|
void SendResultChannel2PLC(Result2Ui* m_Res);
|
|
|
void SendResultChannelCOM(Result2Ui* m_Res);
|
|
|
void saveImage(Result2Ui* pRes);
|
|
|
void saveImage(const QPixmap& m_pixmap, QString m_path, QString filename);
|
|
|
void onUpdateByLevel(int nlevel);
|
|
|
|
|
|
protected:
|
|
|
virtual void timerEvent(QTimerEvent *event);
|
|
|
virtual void closeEvent(QCloseEvent *event);
|
|
|
virtual void changeEvent(QEvent *event);
|
|
|
private:
|
|
|
Ui::lpMainWin ui;
|
|
|
|
|
|
class QLabel* main_lb_res_Channle{ nullptr };
|
|
|
class QLabel* main_lb_res_Channle_Show{ nullptr };
|
|
|
class QLabel* main_label_state{ nullptr };
|
|
|
class QLabel* main_showWorkLabel{ nullptr };
|
|
|
class ModelsView *m_pTableCheck{ nullptr };
|
|
|
|
|
|
RoiImgViewer *m_ImgViewer{ nullptr };//展示检测图像
|
|
|
/*status 状态栏*/
|
|
|
class QLabel* m_pLbCurrentTime{ nullptr };//显示系统时间
|
|
|
class QLabel* m_pLbBanci{ nullptr };//显示班次
|
|
|
class QLabel* m_pLbDetectState{ nullptr };//显示检测状态
|
|
|
class QLabel* m_pLbUser{ nullptr };//显示登陆用户信息
|
|
|
class QLabel* m_pLbPLCConnect{ nullptr };//PLC连接状态
|
|
|
private:
|
|
|
CDllCoreCtrl* m_pDllCoreCtrl{ nullptr };
|
|
|
ICoreCtrl* m_pCoreCtrl{ nullptr };
|
|
|
|
|
|
private:
|
|
|
class IWheelCtrl *m_pCtrl{ nullptr };
|
|
|
class CWheelNet *m_pNet{ nullptr };
|
|
|
class QWorkMgrUI *m_pworkUI{ nullptr };
|
|
|
class QWorkMgrCtlr *pWorkCtrl{ nullptr };
|
|
|
|
|
|
QTimer m_PulseTimer, m_ThicknessTimer;
|
|
|
QTimer m_wfPulseTimer;
|
|
|
QTimer m_timer;
|
|
|
QTimer m_ReadLibTimer;
|
|
|
QTimer m_timerDetect;
|
|
|
|
|
|
QMyThread *SendModelLibTask{ nullptr };
|
|
|
QMyThread *SendTiskTsk{ nullptr };
|
|
|
QThread *pTickThread{ nullptr };
|
|
|
|
|
|
int m_nWfThress{ 0 };
|
|
|
int m_TimerID{ 0 };//心跳包定时器 用于记录超时
|
|
|
int m_TimerOutCount{ 0 };
|
|
|
int m_RestartServerCount{ 0 };
|
|
|
|
|
|
QStringList forDefectList;
|
|
|
int m_nDiffTrigNum{ 0 };//触发次数 用于判断相机是否正常打开
|
|
|
|
|
|
//模板管理页面
|
|
|
QModelMgrDlg *m_pModelMgrDlg{ nullptr };
|
|
|
QDebugDlg* m_pDebugDlg{ nullptr };
|
|
|
QWidget m_aboutDlg;//关于
|
|
|
QTimeMgrDlg* m_pTimerMgrDlg{ nullptr };
|
|
|
QPixmapListBar* m_pixMapList{ nullptr };//展示历史检测结果
|
|
|
QSystemSettingDlg* m_pSystemSettingDlg{ nullptr };
|
|
|
QCamSettingDlg* m_CamSettingDlg{ nullptr };
|
|
|
QAlgParamDlg* m_pAlgParamDlg{ nullptr };//算法调参页面
|
|
|
QCryptokeyUI *m_pCheckLineseUI{ nullptr };
|
|
|
QLabel *m_pLabelInfo{ nullptr };
|
|
|
private:
|
|
|
IUserCtrl *m_pUserCtrl{ nullptr };//用户管理模块
|
|
|
|
|
|
QVector<QTranslator* > m_VecTranPtr;//国际化语言包管理
|
|
|
|
|
|
int m_timerID{ 0 };//定时器 更新状态栏信息
|
|
|
quint64 m_runTimeCount{ 0 };
|
|
|
|
|
|
private:
|
|
|
int m_exposureTimeCount{ 0 };
|
|
|
QString m_camKey;
|
|
|
std::vector<int> m_exposureTimeArray;
|
|
|
bool m_autoExposureSwitch{false};
|
|
|
|
|
|
bool readExposureTimeConfig(const QString& strPath);
|
|
|
int getCurExposureTime();
|
|
|
double m_glbalRatio{ 0.0 };//偏距系数
|
|
|
};
|
|
|
|
|
|
#endif
|