Push layered Qt host source files
This commit is contained in:
@@ -1,130 +1,117 @@
|
||||
#pragma once
|
||||
|
||||
#include "APP/APP_KeypadModel.h"
|
||||
#include "DEBUG/Debug_Config.h"
|
||||
#include "LOGIC/Lgc_Core.h"
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
#if APP_ENABLE_DEBUG_WINDOW
|
||||
#include "DEBUG/Debug_Panel.h"
|
||||
#endif
|
||||
|
||||
class QLabel;
|
||||
class QButtonGroup;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QPlainTextEdit;
|
||||
class QPushButton;
|
||||
class QResizeEvent;
|
||||
class QSpinBox;
|
||||
class QStackedWidget;
|
||||
class QTabWidget;
|
||||
class QTableWidget;
|
||||
|
||||
namespace APP {
|
||||
|
||||
class APP_KeyButton;
|
||||
|
||||
/*
|
||||
* APP 主窗口负责把界面搭起来,并把 UI 事件转交给逻辑层。
|
||||
* 它只做三件事:
|
||||
* 1. 创建界面
|
||||
* 2. 周期性刷新 UI
|
||||
* 3. 把 Windows 原生消息转给 LGC / DRI
|
||||
*/
|
||||
class App_UIWindow : public QWidget
|
||||
{
|
||||
public:
|
||||
// 构造主窗口并完成 UI、信号和逻辑初始化。
|
||||
explicit App_UIWindow(QWidget* parent = nullptr);
|
||||
// 析构时负责收尾逻辑层资源。
|
||||
~App_UIWindow() override;
|
||||
|
||||
protected:
|
||||
// 自绘主窗口背景和简单装饰。
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
// 接收 Windows 原生消息,再转给 LGC / DRI 处理。
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
bool nativeEvent(const QByteArray& EventType, void* p_Message, long* p_Result) override;
|
||||
|
||||
private:
|
||||
// 设置窗口标题、大小和基础属性。
|
||||
void App_Func_InitWindow();
|
||||
// 创建主界面控件和布局。
|
||||
void App_Func_InitUi();
|
||||
// 连接按钮、定时器等信号。
|
||||
void App_Func_InitConnect();
|
||||
// 初始化逻辑层状态和设备配置。
|
||||
void App_Func_InitLogic();
|
||||
// 执行一轮完整 UI 刷新。
|
||||
void App_Func_RefreshUi();
|
||||
// 刷新主键盘区状态摘要。
|
||||
|
||||
void App_Func_RefreshKeypadState();
|
||||
// 刷新主键盘按钮显示。
|
||||
void App_Func_RefreshKeypadButtons();
|
||||
// 刷新功能键按钮显示。
|
||||
void App_Func_RefreshFunctionButtons();
|
||||
// 刷新功能配置区状态文字。
|
||||
void App_Func_RefreshFeatureTable();
|
||||
void App_Func_RefreshFunctionStatus();
|
||||
// 刷新调试页显示内容。
|
||||
void App_Func_RefreshDebugView();
|
||||
// 逻辑状态改变后集中刷新必要区域。
|
||||
void App_Func_RefreshPacketTestPanel();
|
||||
void App_Func_RefreshPacketTestTable();
|
||||
void App_Func_RefreshUi();
|
||||
void App_Func_RefreshAfterLogicChange();
|
||||
// 把界面里的功能配置回写到逻辑层。
|
||||
void App_Func_UpdateFunctionConfigFromUi();
|
||||
// 处理功能键区按钮点击。
|
||||
void App_Func_OnFunctionKeyClicked(quint16 Usage);
|
||||
// 定时轮询设备输入与状态。
|
||||
void App_Func_OnPollTimer();
|
||||
|
||||
#if APP_ENABLE_DEBUG_WINDOW
|
||||
/*
|
||||
* 如果后续要整体删除调试功能,
|
||||
* 可以优先从这些入口和 APP_ENABLE_DEBUG_WINDOW 宏开始删。
|
||||
*/
|
||||
// 处理“应用 VID/PID”按钮点击。
|
||||
void App_Func_OnApplyDeviceConfigClicked();
|
||||
// 处理“刷新设备”按钮点击。
|
||||
void App_Func_OnRefreshDeviceClicked();
|
||||
// 处理“清空日志”按钮点击。
|
||||
void App_Func_OnClearLogClicked();
|
||||
// 用逻辑层当前状态刷新调试页输入框。
|
||||
void App_Func_RefreshDeviceConfigFromState();
|
||||
#endif
|
||||
void App_Func_SelectFeature(int FeatureId, bool SwitchToFeaturePage = false);
|
||||
void App_Func_SaveFeatureFromUi();
|
||||
void App_Func_UpdateFeatureEditorState();
|
||||
void App_Func_UpdateFeatureEditorHeight();
|
||||
void App_Func_AddFeature();
|
||||
void App_Func_DeleteFeature();
|
||||
void App_Func_ShowKeyMenu(quint16 Usage, const QPoint& GlobalPos);
|
||||
void App_Func_StartSequenceRecording();
|
||||
void App_Func_StopSequenceRecording();
|
||||
void App_Func_UpdateSequenceRecordingUi();
|
||||
bool App_Func_HandleSequenceRecordMessage(void* p_Message);
|
||||
|
||||
// 创建左侧主键盘卡片。
|
||||
QWidget* App_Func_CreatePadCard();
|
||||
// 创建右侧功能键配置卡片。
|
||||
QWidget* App_Func_CreateFunctionRegisterCard();
|
||||
QWidget* App_Func_CreateFunctionConfigCard();
|
||||
QWidget* App_Func_CreatePacketTestCard();
|
||||
|
||||
#if APP_ENABLE_DEBUG_WINDOW
|
||||
// 创建调试卡片。
|
||||
QWidget* App_Func_CreateDebugCard();
|
||||
#endif
|
||||
|
||||
// 键盘布局模型,负责提供按键元数据。
|
||||
APP_KeypadModel appKeypadModel;
|
||||
// 主键盘按钮映射表:键名 -> 按钮对象。
|
||||
QHash<QString, APP_KeyButton*> appKeypadButtonMap;
|
||||
// 功能键按钮映射表:键名 -> 按钮对象。
|
||||
QHash<QString, APP_KeyButton*> appFunctionButtonMap;
|
||||
// 功能键按钮组,用来统一处理点击。
|
||||
QButtonGroup* appFunctionButtonGroup = nullptr;
|
||||
QTabWidget* appPageTab = nullptr;
|
||||
int appFeaturePageIndex = 0;
|
||||
int appPacketTestPageIndex = 0;
|
||||
|
||||
// 功能区状态说明标签。
|
||||
QLabel* appFunctionLabelStatus = nullptr;
|
||||
// 功能键 0 的文本宏输入框。
|
||||
QLineEdit* appFunctionEditMacroText = nullptr;
|
||||
// 功能键 1 左侧交换键选择框。
|
||||
QComboBox* appFunctionComboSwapLeft = nullptr;
|
||||
// 功能键 1 右侧交换键选择框。
|
||||
QComboBox* appFunctionComboSwapRight = nullptr;
|
||||
// 功能键 2 的网址输入框。
|
||||
QLineEdit* appFunctionEditWebsite = nullptr;
|
||||
QTableWidget* appFeatureTable = nullptr;
|
||||
QPushButton* appFeatureAddButton = nullptr;
|
||||
QPushButton* appFeatureDeleteButton = nullptr;
|
||||
QPushButton* appFeatureTimeSyncButton = nullptr;
|
||||
QPushButton* appFeatureThemeSwitchButton = nullptr;
|
||||
QLabel* appFeatureBindingSummaryLabel = nullptr;
|
||||
QLineEdit* appFeatureNameEdit = nullptr;
|
||||
QLineEdit* appFeatureDescriptionEdit = nullptr;
|
||||
QComboBox* appFeatureTypeCombo = nullptr;
|
||||
QStackedWidget* appFeatureEditorStack = nullptr;
|
||||
QLineEdit* appFeatureSequenceEdit = nullptr;
|
||||
QLineEdit* appFeatureWebsiteEdit = nullptr;
|
||||
QPushButton* appFeatureSequenceRecordStartButton = nullptr;
|
||||
QPushButton* appFeatureSequenceRecordStopButton = nullptr;
|
||||
QLabel* appPacketTestTransportLabel = nullptr;
|
||||
QLabel* appPacketTestProtocolLabel = nullptr;
|
||||
QLabel* appPacketTestHelloLabel = nullptr;
|
||||
QLabel* appPacketTestAckLabel = nullptr;
|
||||
QLabel* appPacketTestErrorLabel = nullptr;
|
||||
QLabel* appPacketTestBitmapLabel = nullptr;
|
||||
QTableWidget* appPacketTestTable = nullptr;
|
||||
QPlainTextEdit* appPacketTestLogEdit = nullptr;
|
||||
QPushButton* appPacketTestRefreshButton = nullptr;
|
||||
QComboBox* appPacketTestTargetCombo = nullptr;
|
||||
QPushButton* appPacketTestSendHelloButton = nullptr;
|
||||
QPushButton* appPacketTestSendBitmapCurrentButton = nullptr;
|
||||
QPushButton* appPacketTestSendBitmapAllOnButton = nullptr;
|
||||
QPushButton* appPacketTestSendBitmapAllOffButton = nullptr;
|
||||
QPushButton* appPacketTestSendTimeSyncButton = nullptr;
|
||||
QSpinBox* appPacketTestThemeRedSpin = nullptr;
|
||||
QSpinBox* appPacketTestThemeGreenSpin = nullptr;
|
||||
QSpinBox* appPacketTestThemeBlueSpin = nullptr;
|
||||
QPushButton* appPacketTestSendThemeButton = nullptr;
|
||||
QPushButton* appPacketTestClearLogButton = nullptr;
|
||||
bool appIsUpdatingFeatureUi = false;
|
||||
bool appIsSequenceRecording = false;
|
||||
int appSelectedFeatureId = 0;
|
||||
QSet<QString> appSequenceRecordingPressedKeySet;
|
||||
|
||||
#if APP_ENABLE_DEBUG_WINDOW
|
||||
// 调试面板实例。
|
||||
DEBUG::Debug_Panel* appDebugPanel = nullptr;
|
||||
#endif
|
||||
|
||||
// 周期轮询逻辑层的定时器。
|
||||
QTimer appTimerPoll;
|
||||
// APP 层持有的逻辑总状态。
|
||||
QTimer appTimerAutoRefreshDevice;
|
||||
Lgc_Core_Struct_State appLgcState;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user