2023-05-22 16:17:51 +08:00
|
|
|
#ifndef FLUAPP_H
|
2023-02-26 23:47:07 +08:00
|
|
|
#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-03-13 21:18:51 +08:00
|
|
|
#include "FluRegister.h"
|
2023-02-26 23:47:07 +08:00
|
|
|
#include "stdafx.h"
|
2023-09-13 15:11:22 +08:00
|
|
|
#include "singleton.h"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
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-10-15 17:24:33 +08:00
|
|
|
Q_PROPERTY_AUTO(bool,vsync)
|
2023-02-26 23:47:07 +08:00
|
|
|
Q_PROPERTY_AUTO(QString,initialRoute);
|
|
|
|
Q_PROPERTY_AUTO(QJsonObject,routes);
|
2023-11-23 19:58:54 +08:00
|
|
|
Q_PROPERTY_AUTO(bool,useSystemAppBar);
|
2023-12-13 18:13:35 +08:00
|
|
|
Q_PROPERTY_AUTO(QString,windowIcon);
|
2023-04-27 09:38:57 +08:00
|
|
|
QML_NAMED_ELEMENT(FluApp)
|
|
|
|
QML_SINGLETON
|
2023-05-11 18:24:58 +08:00
|
|
|
private:
|
2023-02-27 18:46:39 +08:00
|
|
|
explicit FluApp(QObject *parent = nullptr);
|
2023-04-27 17:29:39 +08:00
|
|
|
~FluApp();
|
2023-09-13 15:11:22 +08:00
|
|
|
public:
|
|
|
|
SINGLETONG(FluApp)
|
|
|
|
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
|
2023-02-26 23:47:07 +08:00
|
|
|
Q_INVOKABLE void run();
|
2023-03-13 21:18:51 +08:00
|
|
|
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
2023-10-17 15:17:05 +08:00
|
|
|
Q_INVOKABLE void init(QObject *window);
|
2023-09-27 15:18:10 +08:00
|
|
|
Q_INVOKABLE void exit(int retCode = 0);
|
|
|
|
void addWindow(QQuickWindow* window);
|
|
|
|
void removeWindow(QQuickWindow* window);
|
2023-02-26 23:47:07 +08:00
|
|
|
private:
|
2023-09-27 15:18:10 +08:00
|
|
|
QMap<quint64, QQuickWindow*> _windows;
|
2023-10-17 15:17:05 +08:00
|
|
|
QObject* _application;
|
2023-02-26 23:47:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FLUAPP_H
|