126 lines
4.1 KiB
C
126 lines
4.1 KiB
C
|
|
#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 QComboBox;
|
||
|
|
class QLineEdit;
|
||
|
|
class QPushButton;
|
||
|
|
class QResizeEvent;
|
||
|
|
class QStackedWidget;
|
||
|
|
class QTabWidget;
|
||
|
|
class QTableWidget;
|
||
|
|
|
||
|
|
namespace APP {
|
||
|
|
|
||
|
|
class APP_KeyButton;
|
||
|
|
|
||
|
|
class App_UIWindow : public QWidget
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
explicit App_UIWindow(QWidget* parent = nullptr);
|
||
|
|
~App_UIWindow() override;
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void paintEvent(QPaintEvent* event) override;
|
||
|
|
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();
|
||
|
|
void App_Func_RefreshUi();
|
||
|
|
void App_Func_RefreshKeypadState();
|
||
|
|
void App_Func_RefreshKeypadButtons();
|
||
|
|
void App_Func_RefreshFeatureTable();
|
||
|
|
void App_Func_RefreshFunctionStatus();
|
||
|
|
void App_Func_RefreshDebugView();
|
||
|
|
void App_Func_RefreshAfterLogicChange();
|
||
|
|
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_AssignFeatureToUsage(quint16 Usage, int FeatureId);
|
||
|
|
void App_Func_HandleUiKeyPressed(quint16 Usage);
|
||
|
|
void App_Func_HandleUiKeyReleased(quint16 Usage);
|
||
|
|
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);
|
||
|
|
void App_Func_AppendRecordedSequenceToken(const QString& Token);
|
||
|
|
QString App_Func_GetKeyHintText(const QString& KeyId) const;
|
||
|
|
QString App_Func_GetFeatureNameById(int FeatureId) const;
|
||
|
|
QString App_Func_GetFeatureDescriptionById(int FeatureId) const;
|
||
|
|
QString App_Func_GetFeatureDescriptionForUsage(quint16 Usage) const;
|
||
|
|
QString App_Func_GetDefaultKeyDescription(quint16 Usage) const;
|
||
|
|
QString App_Func_GetFeatureBindingSummary(int FeatureId) const;
|
||
|
|
void App_Func_OnPollTimer();
|
||
|
|
|
||
|
|
|
||
|
|
#if APP_ENABLE_DEBUG_WINDOW
|
||
|
|
void App_Func_OnApplyDeviceConfigClicked();
|
||
|
|
void App_Func_OnRefreshDeviceClicked();
|
||
|
|
void App_Func_OnClearLogClicked();
|
||
|
|
void App_Func_OnSyncTimeClicked();
|
||
|
|
void App_Func_OnModeSwitchClicked();
|
||
|
|
void App_Func_RefreshDeviceConfigFromState();
|
||
|
|
#endif
|
||
|
|
|
||
|
|
QWidget* App_Func_CreatePadCard();
|
||
|
|
QWidget* App_Func_CreateFunctionConfigCard();
|
||
|
|
|
||
|
|
#if APP_ENABLE_DEBUG_WINDOW
|
||
|
|
QWidget* App_Func_CreateDebugCard();
|
||
|
|
#endif
|
||
|
|
|
||
|
|
APP_KeypadModel appKeypadModel;
|
||
|
|
QHash<QString, APP_KeyButton*> appKeypadButtonMap;
|
||
|
|
QTabWidget* appPageTab = nullptr;
|
||
|
|
int appFeaturePageIndex = 0;
|
||
|
|
|
||
|
|
QLabel* appFunctionLabelStatus = nullptr;
|
||
|
|
QTableWidget* appFeatureTable = nullptr;
|
||
|
|
QPushButton* appFeatureAddButton = nullptr;
|
||
|
|
QPushButton* appFeatureDeleteButton = nullptr;
|
||
|
|
QLabel* appFeatureParameterHintLabel = 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;
|
||
|
|
bool appIsUpdatingFeatureUi = false;
|
||
|
|
bool appIsSequenceRecording = false;
|
||
|
|
int appSelectedFeatureId = 0;
|
||
|
|
QSet<quint16> appUiPressedUsageSet;
|
||
|
|
QSet<QString> appSequenceRecordingPressedKeySet;
|
||
|
|
|
||
|
|
#if APP_ENABLE_DEBUG_WINDOW
|
||
|
|
DEBUG::Debug_Panel* appDebugPanel = nullptr;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
QTimer appTimerPoll;
|
||
|
|
QTimer appTimerAutoRefreshDevice;
|
||
|
|
Lgc_Core_Struct_State appLgcState;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace APP
|