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.

101 lines
2.8 KiB
C

#ifndef _VALUEMAINUI_H_
#define _VALUEMAINUI_H_
#include <QtWidgets/QMainWindow>
#include "ui_valueMainUI.h"
#include <QThread>
#include "RoiImgViewer.h"
#include "lpConfigUI.h"
#include "lpDebugUI.h"
#include <QSystemTrayIcon>
#include <QMenu>
#include <QAction>
#include "libTcpClient.h"
class valueMainUI : public QMainWindow
{
Q_OBJECT
public:
valueMainUI(QWidget *parent = Q_NULLPTR);
~valueMainUI();
QString SecondTimeString(quint64 value);
Q_SLOT void onRecvDataStr_A(const QJsonObject& json);
Q_SLOT void onRecvDataStr_B(const QJsonObject& json);
void onConnectA();
void onConnectB();
Q_SLOT void onButtonClicked();
QJsonObject byte2Json(QByteArray data);
QByteArray Json2byte(QJsonObject obj);
Q_SLOT void onDebugClicked(int nID);
Q_SLOT void onConnected_A(bool bFalg);
Q_SLOT void onConnected_B(bool bFalg);
void check();
void onRunApp(QString strPath);
Q_SLOT void onStartProcess();
Q_SLOT void onStopProcess();
private://trayIcon
void setupTrayIcon();
Q_SLOT void onActivated(QSystemTrayIcon::ActivationReason reason);
void setMainWindowVisibility(bool state);
Q_SLOT void onQuitApplication();
Q_SLOT void onImageScale(qreal real);
Q_SLOT void onShowUI(bool bDouble);
Q_SLOT void onUpdateConfig();
//A
Q_SLOT void on_message_receive_A(QSharedPointer<TP_PROTOCOL_MESSAGE> msg_ptr);
Q_SLOT void on_data_send_completed_A(QSharedPointer<TP_PROTOCOL_MESSAGE>);
Q_SLOT void on_data_recv_completed_A(QSharedPointer<TP_PROTOCOL_MESSAGE> msg_ptr, QSharedPointer<QByteArray> pData);
Q_SLOT void on_connected_A();
Q_SLOT void on_disconnected_A();
//B
Q_SLOT void on_message_receive_B(QSharedPointer<TP_PROTOCOL_MESSAGE> msg_ptr);
Q_SLOT void on_data_send_completed_B(QSharedPointer<TP_PROTOCOL_MESSAGE>);
Q_SLOT void on_data_recv_completed_B(QSharedPointer<TP_PROTOCOL_MESSAGE> msg_ptr, QSharedPointer<QByteArray> pData);
Q_SLOT void on_connected_B();
Q_SLOT void on_disconnected_B();
void onShowMainWindow();
protected:
virtual void timerEvent(QTimerEvent *event);
virtual void closeEvent(QCloseEvent *event);
private:
Ui::valueMainUIClass ui;
RoiImgViewer *m_ImgViewer_A{ nullptr };//չʾ<D5B9><CABE><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
RoiImgViewer *m_ImgViewer_B{ nullptr };//չʾ<D5B9><CABE><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
QLabel* m_pLabelA{ nullptr };
QLabel* m_pLabelB{ nullptr };
QLabel* m_pLabelSystem{ nullptr };
private:
int m_timerA{ 0 };
int m_timerB{ 0 };
int m_timerStartID{ 0 };
lpConfigUI *m_pConfigUI{ nullptr };
lpDebugUI *m_pDebugUI{ nullptr };
int m_CoutA{ 0 };
int m_CoutB{ 0 };
bool m_bServerA{ false };
bool m_bServerB{ false };
int m_SysTimerID{ 0 };
quint64 m_tickCount{ 0 };
QStringList m_appNames;//<2F>ӻ<EFBFBD>app<70><70>
lpTcpClient* tcp_client_ptr_A{ nullptr };
lpTcpClient* tcp_client_ptr_B{ nullptr };
private:
QSystemTrayIcon* m_trayIcon{ nullptr };
QMenu* m_trayIconMenu{ nullptr };
QAction* m_restoreAction{ nullptr };
QAction* m_quitAction{ nullptr };
bool m_bExit{ false };
};
#endif