107 lines
3.0 KiB
C++
107 lines
3.0 KiB
C++
#ifndef P00_PUBLICPAGE_H
|
|
#define P00_PUBLICPAGE_H
|
|
|
|
#include <QWidget>
|
|
#include <QVariant>
|
|
#include <QMap>
|
|
#include <QTextToSpeech>
|
|
#include <QLocale>
|
|
#include <QTimer>
|
|
#include <QLabel>
|
|
#include <QScrollBar>
|
|
#include <QPropertyAnimation>
|
|
#include <QParallelAnimationGroup>
|
|
|
|
#include "DataCenter/DataCenter.h"
|
|
#include "DataCenter/OpcUaManager.h"
|
|
|
|
|
|
// 前向声明
|
|
class DataCenter;
|
|
class OpcUaManager;
|
|
class CursorController;
|
|
class QKeyEvent;
|
|
|
|
namespace Ui {
|
|
class P00_PublicPage;
|
|
}
|
|
|
|
|
|
|
|
class P00_PublicPage : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(QRect voiceGeometry READ voiceGeometry WRITE setVoiceGeometry)
|
|
public:
|
|
explicit P00_PublicPage(QWidget *parent = nullptr);
|
|
~P00_PublicPage() override;
|
|
void smoothScrollTo(int targetX);
|
|
void WinInit();
|
|
void CursorInit();
|
|
void SignalSlotInit();
|
|
void ChangePage(uint16_t PageIndex,uint16_t PageNum,QString PageNames);
|
|
void VoiceWin(const QString &Info, bool shouldShow);
|
|
protected:
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
private slots:
|
|
void UIRefreshTimeOut();
|
|
void CursorScanTimerOut();
|
|
void onOpcStateChanged(QOpcUaClient::ClientState state);
|
|
|
|
|
|
// 页面切换槽函数
|
|
void on_But_Close_clicked();
|
|
|
|
void on_ButToPage_1_clicked();
|
|
void on_ButToPage_2_clicked();
|
|
void on_ButToPage_3_clicked();
|
|
void on_ButToPage_4_clicked();
|
|
void on_ButToPage_5_clicked();
|
|
void on_ButToPage_6_clicked();
|
|
void on_ButToPage_7_clicked();
|
|
void on_ButToPage_8_clicked();
|
|
void on_ButToPage_9_clicked();
|
|
void on_ButToPage_10_clicked();
|
|
void on_ButToPage_11_clicked();
|
|
void on_ButToPage_12_clicked();
|
|
void on_ButToPage_13_clicked();
|
|
void on_ButToPage_14_clicked();
|
|
void on_ButToPage_15_clicked();
|
|
void on_ButToPage_16_clicked();
|
|
private:
|
|
// 光标移动处理
|
|
void onCursorMoved(const QPoint &global);
|
|
QRect voiceGeometry() const;
|
|
void setVoiceGeometry(const QRect &g);
|
|
void startGeometryAnim(const QRect &start, const QRect &end, int dur);
|
|
bool m_realShow = false;
|
|
|
|
Ui::P00_PublicPage *ui;
|
|
|
|
QScrollBar* hScroll;
|
|
QLabel *m_cursorLabel = nullptr; // 自绘光标
|
|
OpcUaManager *m_opcManager; // OPC通信实例
|
|
DataCenter *m_dataCenter; // 数据中心
|
|
QString m_currentNodeId; // 当前操作节点ID
|
|
|
|
QTimer *UIRefresh_Timer; // UI刷新定时器
|
|
QTimer *CursorScan_Timer; // 光标扫描定时器
|
|
bool PLC_Started; // PLC运行状态标志
|
|
|
|
QMap<uint16_t, QWidget*> m_widgetCache; // 页面缓存
|
|
QList<QString> slMotorCurColor; // 电机电流颜色列表
|
|
QList<QString> slMotorTempColor; // 电机温度颜色列表
|
|
|
|
// 光标状态变量(静态化避免重复定义)
|
|
static bool OldUp;
|
|
static bool OldDown;
|
|
static bool OldLeft;
|
|
static bool OldRight;
|
|
static bool OldConfirm;
|
|
bool OldShowVoice = false;
|
|
};
|
|
|
|
|
|
#endif // P00_PUBLICPAGE_H
|