You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
237 lines
7.5 KiB
C++
237 lines
7.5 KiB
C++
#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 "lpGlobalConfig.h"
|
|
#include "ModelTableView.h"
|
|
#include "QModelMgrDlg.h"
|
|
#include "Result2Ui.h"
|
|
#include "QDebugDlg.h"
|
|
#include "RoiImgViewer.h"
|
|
#include "InfoFile.h"
|
|
#include "qpixmapbar.h"
|
|
#include "QCamSettingDlg.h"
|
|
#include "lpbengine.h"
|
|
#include "CoreCtrl/CDllDetectorEngine.h"
|
|
#include "CoreCtrl/CDllDesigner.h"
|
|
#include "lpdesigner.h"
|
|
#include "lpImageCaliUI.h"
|
|
//#include "QPLCDevice.h"
|
|
#include "lpSystemConfigUI.h"
|
|
#include <QSystemTrayIcon>
|
|
#include "QCryptokeyUI.h"
|
|
#include "QAlgParamDlg.h"
|
|
#include <QSharedPointer>
|
|
#include "libTcpServer.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);
|
|
//定位算法结果回调
|
|
void IEngineResult(QVariantMap vmap);
|
|
void showWidget();//显示整个UI窗口
|
|
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 sgShowDetectLog(QString strLog);
|
|
private:
|
|
Q_SLOT void onLogInOut(QString strName, int level, int state);
|
|
Q_SLOT void onActionClicked();//工具栏按钮事件
|
|
Q_SLOT void onButtonClicked();//按钮事件
|
|
Q_SLOT void onAutoExposure();//自动曝光
|
|
Result2Ui *parseMap(const QVariantMap &vMap);
|
|
Q_SLOT void onSlotAddNewModel(QString strName);
|
|
Q_SLOT void onSlotDelOldModel(QString strName);
|
|
void onSaveValveResult(ValueResult &rlt);
|
|
protected:
|
|
bool onInitCoreCtrl();//核心模块ctrol初始化
|
|
bool onInitEngineCtrl();//定位检测模块engine初始化
|
|
void loadUserModel();//加载用户管理模块
|
|
|
|
//国际化 语言设置
|
|
void SearchQmFile(const QString & strDir);
|
|
void SetTranslator(const QString strPath);
|
|
void SetLanguage(QString strLangage);
|
|
void onSetModel();
|
|
QString SecondTimeString(quint64 value);//计算运行时常
|
|
Q_SLOT void onUpdateDefect();//勾选 更新界面显示窗口
|
|
//net slot
|
|
Q_SLOT void onTcpConnet(QString str, bool bConnect);
|
|
Q_SLOT void onDetectStateRecv(int nIndex, int value);
|
|
Q_SLOT void onRecvTrigPara();
|
|
Q_SLOT void onReadDetectState(int nIndex, QString strModel);
|
|
Q_SLOT void onReadDetectStateASK();
|
|
Q_SLOT void onTrigRecv(int m_value);
|
|
Q_SLOT void onServerState(QString Addr, int port, bool m_state);
|
|
Q_SLOT void onShutDownComputer();
|
|
Q_SLOT void onShowImgState(QString str);
|
|
Q_SLOT void onGetImg();
|
|
Q_SLOT void onShowMsg(QString str);
|
|
Q_SLOT void onTriggerCam();
|
|
void onInitAbout();
|
|
|
|
Q_SLOT void onLanguageChange(QString strLanguage);
|
|
Q_SLOT void modWorkMgr(QString str);
|
|
|
|
Q_SLOT void onPLCTrigerCam(int camID);
|
|
void onTcpHeartBit();//websocket 通讯心跳
|
|
void sendWebAlgRlt(const ValueResult& rlt);
|
|
QJsonObject byte2Json(QByteArray data);
|
|
QByteArray Json2byte(QJsonObject obj);
|
|
Q_SLOT void setWindowTitleInfo();
|
|
|
|
Q_SLOT void onShowDetectLog(QString strMsg);
|
|
Q_SLOT void onLineseCheck(bool bFlag);
|
|
void onStrongButton();//强烈提醒按钮 开始检测/停止检测按钮专用
|
|
private://trayIcon
|
|
void setupTrayIcon();
|
|
Q_SLOT void onActivated(QSystemTrayIcon::ActivationReason reason);
|
|
void setMainWindowVisibility(bool state);
|
|
Q_SLOT void onQuitApplication();
|
|
private:
|
|
void onShowResult(Result2Ui* pRlt);//展示识别结果
|
|
void saveValveImage(QImage image, QString strName = "NG");
|
|
|
|
void saveImage(Result2Ui* pRes);
|
|
void saveImage(const QPixmap& m_pixmap, QString m_path, QString filename);
|
|
void onUpdateByLevel(int nlevel);
|
|
|
|
void tcpServerInit();
|
|
Q_SLOT void on_client_connected(const QString &client_name);
|
|
Q_SLOT void on_client_disconnected(const QString &client_name);
|
|
Q_SLOT void on_message_received(const QString &client_name, QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
|
|
Q_SLOT void on_data_send_completed(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
|
|
Q_SLOT void on_data_recv_completed(const QString &client_name, QSharedPointer<TP_PROTOCOL_MESSAGE> msg_ptr, QSharedPointer<QByteArray> pData);
|
|
void paraJson(const QJsonObject& obj);
|
|
void onShowMainWindow();
|
|
void AckTriggerCam();
|
|
protected:
|
|
virtual void timerEvent(QTimerEvent *event);
|
|
virtual void closeEvent(QCloseEvent *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_pLbDetectState{ nullptr };//显示检测状态
|
|
class QLabel *m_pLbUser{ nullptr };//显示登陆用户信息
|
|
|
|
QSystemTrayIcon* m_trayIcon{ nullptr };
|
|
QMenu* m_trayIconMenu{ nullptr };
|
|
QAction* m_restoreAction{ nullptr };
|
|
QAction* m_quitAction{ nullptr };
|
|
bool m_bExit{ false };
|
|
|
|
QLabel *m_pLabelInfo{ nullptr };
|
|
private:
|
|
CDllCoreCtrl* m_pDllCoreCtrl{ nullptr };
|
|
ICoreCtrl* m_pCoreCtrl{ nullptr };
|
|
private:
|
|
class IWheelCtrl *m_pCtrl{ nullptr };
|
|
class QWorkMgrUI *m_pWorkUI{ nullptr };
|
|
class QWorkMgrCtrl *m_pWorkCtrl{ nullptr };
|
|
|
|
QTimer m_PulseTimer, m_ThicknessTimer;
|
|
QTimer m_wfPulseTimer;
|
|
QTimer m_timer;
|
|
QTimer m_ReadLibTimer;
|
|
QTimer m_timerDetect;
|
|
|
|
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;//关于
|
|
QPixmapListBar* m_pixMapList{ nullptr };//展示历史检测结果
|
|
lpSystemConfigUI* m_pSystemConfigUI{ nullptr };
|
|
QCamSettingDlg* m_CamSettingDlg{ nullptr };
|
|
lpImageCaliUI* m_pImageCaliUI{ nullptr };
|
|
// QPLCDevice* m_pPlcDevice{ nullptr };
|
|
|
|
QAlgParamDlg* m_pAlgParamDlg{ nullptr };//算法调参页面
|
|
private:
|
|
IUserCtrl *m_pUserCtrl{ nullptr };//用户管理模块
|
|
QVector<QTranslator* > m_VecTranPtr;//国际化语言包管理
|
|
|
|
int m_timerID{ 0 };//定时器 更新状态栏信息
|
|
quint64 m_runTimeCount{ 0 };
|
|
int m_timerID_btn{ 0 };
|
|
QString m_appRootPath;
|
|
private:
|
|
int m_exposureTimeCount{ 0 };
|
|
QString m_camKey;
|
|
std::vector<int> m_exposureTimeArray;
|
|
bool m_autoExposureSwitch{false};
|
|
|
|
bool readExposureTimeConfig(const QString& strPath);
|
|
int getCurExposureTime();
|
|
private:
|
|
CDllDetectorEngine* m_pDllEngineCtrl{ nullptr };
|
|
IDetectorEngine* m_pEngineCtrl{nullptr};
|
|
CDllDesigner* m_pDllDesigner{ nullptr };
|
|
IDetectorUI* m_pDesigner{ nullptr };
|
|
|
|
QSharedPointer<lpTcpServer> tcp_server_ptr_;
|
|
private:
|
|
int m_showMode{ 0 };// 0 隐藏UI 1显示UI
|
|
|
|
QCryptokeyUI *m_pCheckLineseUI{ nullptr };
|
|
};
|
|
|
|
#endif
|