FluentUI/src/FluApp.h

135 lines
2.5 KiB
C
Raw Normal View History

2023-02-26 23:47:07 +08:00
#ifndef FLUAPP_H
#define FLUAPP_H
#include <QObject>
#include <QWindow>
2023-04-27 09:38:57 +08:00
#include <QtQml/qqml.h>
2023-03-02 12:20:16 +08:00
#include <QJsonArray>
2023-03-03 18:19:48 +08:00
#include <QQmlContext>
2023-02-26 23:47:07 +08:00
#include <QJsonObject>
2023-03-03 18:19:48 +08:00
#include <QQmlEngine>
2023-04-27 09:38:57 +08:00
#include "FluTheme.h"
2023-04-27 17:29:39 +08:00
#include "FluTools.h"
2023-04-27 09:38:57 +08:00
#include "FluColors.h"
#include "NativeEventFilter.h"
2023-03-13 21:18:51 +08:00
#include "FluRegister.h"
2023-02-26 23:47:07 +08:00
#include "stdafx.h"
2023-04-27 17:29:39 +08:00
/**
* @brief The FluApp class
*/
2023-02-26 23:47:07 +08:00
class FluApp : public QObject
{
Q_OBJECT
2023-04-27 17:29:39 +08:00
/**
* @brief initialRoute
*/
2023-02-26 23:47:07 +08:00
Q_PROPERTY_AUTO(QString,initialRoute);
2023-04-27 17:29:39 +08:00
/**
* @brief routes
*/
2023-02-26 23:47:07 +08:00
Q_PROPERTY_AUTO(QJsonObject,routes);
2023-04-27 17:29:39 +08:00
2023-04-27 09:38:57 +08:00
QML_NAMED_ELEMENT(FluApp)
QML_SINGLETON
2023-04-27 17:29:39 +08:00
2023-02-26 23:47:07 +08:00
public:
2023-02-27 18:46:39 +08:00
explicit FluApp(QObject *parent = nullptr);
2023-04-27 17:29:39 +08:00
~FluApp();
/**
* @brief run
*/
2023-02-26 23:47:07 +08:00
Q_INVOKABLE void run();
2023-04-27 17:29:39 +08:00
/**
* @brief navigate
* @param route
* @param argument
* @param fluRegister
*/
2023-03-13 21:18:51 +08:00
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
2023-04-27 17:29:39 +08:00
/**
* @brief init
* @param window
*/
2023-04-11 23:12:31 +08:00
Q_INVOKABLE void init(QQuickWindow *window);
2023-04-27 17:29:39 +08:00
/**
* @brief awesomelist
* @param keyword
* @return
*/
2023-03-02 18:21:43 +08:00
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
2023-04-27 17:29:39 +08:00
/**
* @brief closeApp
*/
2023-04-19 09:41:08 +08:00
Q_INVOKABLE void closeApp();
2023-04-27 17:29:39 +08:00
/**
* @brief setFluApp FluSingleton.qml调用QML中FluApp的单例
* @param val
*/
2023-04-27 09:38:57 +08:00
Q_INVOKABLE void setFluApp(FluApp* val);
2023-04-27 17:29:39 +08:00
/**
* @brief setFluTheme FluSingleton.qml调用QML中FluTheme的单例
* @param val
*/
2023-04-27 09:38:57 +08:00
Q_INVOKABLE void setFluTheme(FluTheme* val);
2023-04-27 17:29:39 +08:00
/**
* @brief setFluColors FluSingleton.qml调用QML中FluColors的单例
* @param val
*/
2023-04-27 09:38:57 +08:00
Q_INVOKABLE void setFluColors(FluColors* val);
2023-04-27 17:29:39 +08:00
/**
* @brief setFluColors FluSingleton.qml调用QML中FluTools的单例
* @param val
*/
Q_INVOKABLE void setFluTools(FluTools* val);
2023-04-11 23:12:31 +08:00
public:
2023-04-27 17:29:39 +08:00
/**
* @brief wnds
*/
2023-04-11 23:12:31 +08:00
QMap<quint64, QQuickWindow*> wnds;
2023-04-27 17:29:39 +08:00
/**
* @brief fluApp
*/
2023-04-27 09:38:57 +08:00
static FluApp* fluApp;
2023-04-27 17:29:39 +08:00
/**
* @brief fluTheme
*/
2023-04-27 09:38:57 +08:00
static FluTheme* fluTheme;
2023-04-27 17:29:39 +08:00
/**
* @brief fluColors
*/
static FluColors* fluColors;
/**
* @brief fluTools
*/
static FluTools* fluTools;
2023-02-26 23:47:07 +08:00
private:
2023-04-27 17:29:39 +08:00
/**
* @brief nativeEvent
*/
2023-04-27 09:38:57 +08:00
NativeEventFilter *nativeEvent = Q_NULLPTR;
2023-04-27 17:29:39 +08:00
/**
* @brief appWindow
*/
2023-02-26 23:47:07 +08:00
QWindow *appWindow;
};
#endif // FLUAPP_H