2025-06-23 10:41:33 +08:00
|
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include "EventModule.h"
|
|
|
|
|
#include "WebEngineView.h"
|
|
|
|
|
#include "QFramelessHelper.h"
|
|
|
|
|
|
|
|
|
|
class WebEngineView;
|
|
|
|
|
class DataManager;
|
|
|
|
|
class SettingDialog;
|
|
|
|
|
/**
|
2025-06-23 18:01:09 +08:00
|
|
|
|
* @brief 主窗体控件
|
2025-06-23 10:41:33 +08:00
|
|
|
|
*/
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MainWindow(QWidget* parent = nullptr);
|
|
|
|
|
~MainWindow();
|
|
|
|
|
/**
|
2025-06-23 18:01:09 +08:00
|
|
|
|
* @brief 设置当前鼠标所在区域是否为为标题栏
|
|
|
|
|
* @param beOn true为标题栏,false表示离开了标题栏
|
2025-06-23 10:41:33 +08:00
|
|
|
|
*/
|
|
|
|
|
void changeMaximize();
|
|
|
|
|
/**
|
|
|
|
|
*/
|
|
|
|
|
void openSettingDialog();
|
|
|
|
|
/**
|
2025-06-23 18:01:09 +08:00
|
|
|
|
* @brief 通知WEB端当前主窗口的最大化状态
|
|
|
|
|
* @param beMax true为已经最大化 false当前为正常窗口。
|
2025-06-23 10:41:33 +08:00
|
|
|
|
*/
|
|
|
|
|
/**
|
2025-06-23 18:01:09 +08:00
|
|
|
|
* @brief 在主窗口上方显示用户消息
|
|
|
|
|
* @param message 消息内容
|
|
|
|
|
* @param type 消息类型,0为成功消息、1为警告消息、2为错误消息、3为一般消息
|
2025-06-23 10:41:33 +08:00
|
|
|
|
*/
|
|
|
|
|
void message(const QString& message, int type = 0);
|
|
|
|
|
/**
|
2025-06-23 18:01:09 +08:00
|
|
|
|
* @brief 初始程序,在页面加载完成后调用。
|
2025-06-23 10:41:33 +08:00
|
|
|
|
*/
|
|
|
|
|
void initalApplication();
|
|
|
|
|
/**
|
2025-06-23 18:01:09 +08:00
|
|
|
|
* @brief 切换功能模块
|
|
|
|
|
* @param moduleName 切换功能模块的名称
|
2025-06-23 10:41:33 +08:00
|
|
|
|
*/
|
|
|
|
|
void changeModule(const std::string& moduleName);
|
|
|
|
|
bool DBConnect(json& parameter);
|
|
|
|
|
void Close();
|
|
|
|
|
// DataManager* getDataRoot() { return _pDataRoot; }
|
|
|
|
|
protected:
|
|
|
|
|
bool onMessage(const std::string& eventName, json& parameter);
|
|
|
|
|
void changeEvent(QEvent* event);
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
|
|
|
|
bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result);
|
|
|
|
|
#else
|
|
|
|
|
bool nativeEvent(const QByteArray& eventType, void* message, long* result);
|
|
|
|
|
#endif
|
|
|
|
|
public slots:
|
|
|
|
|
private:
|
|
|
|
|
WebEngineView* _webView;
|
|
|
|
|
std::unique_ptr<SettingDialog> _settingDialog;
|
|
|
|
|
std::unique_ptr<QFramelessHelper> _frameless;
|
|
|
|
|
SignalEventModule* _eventModule;
|
|
|
|
|
// DataManager* _pDataRoot;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|