2023-02-26 23:47:07 +08:00
|
|
|
|
#ifndef FLUAPP_H
|
|
|
|
|
#define FLUAPP_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QWindow>
|
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-02-27 23:04:52 +08:00
|
|
|
|
#include "FramelessView.h"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
|
|
|
|
class FluApp : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PROPERTY_AUTO(QString,initialRoute);
|
2023-02-27 18:46:39 +08:00
|
|
|
|
Q_PROPERTY_AUTO(bool,isDark);
|
2023-02-26 23:47:07 +08:00
|
|
|
|
Q_PROPERTY_AUTO(QJsonObject,routes);
|
2023-02-27 23:04:52 +08:00
|
|
|
|
|
2023-02-26 23:47:07 +08:00
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
static FluApp *getInstance();
|
|
|
|
|
|
2023-02-27 18:46:39 +08:00
|
|
|
|
explicit FluApp(QObject *parent = nullptr);
|
|
|
|
|
|
2023-02-26 23:47:07 +08:00
|
|
|
|
Q_INVOKABLE void run();
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE void navigate(const QString& route);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE void setAppWindow(QWindow *window);
|
|
|
|
|
|
2023-02-27 23:04:52 +08:00
|
|
|
|
Q_SIGNAL void windowReady(FramelessView *view);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE bool equalsWindow(FramelessView *view,QWindow *window);
|
2023-02-27 18:46:39 +08:00
|
|
|
|
|
2023-03-02 18:21:43 +08:00
|
|
|
|
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
2023-03-02 12:20:16 +08:00
|
|
|
|
|
|
|
|
|
Q_INVOKABLE void clipText(const QString& text);
|
|
|
|
|
|
2023-03-03 18:19:48 +08:00
|
|
|
|
Q_INVOKABLE void setContextProperty(const QString &name, QObject *data){
|
|
|
|
|
if(engine){
|
|
|
|
|
engine->rootContext()->setContextProperty(name,data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setEngine(QQmlEngine *engine){
|
|
|
|
|
this->engine = engine;
|
|
|
|
|
}
|
2023-03-02 12:20:16 +08:00
|
|
|
|
|
2023-02-26 23:47:07 +08:00
|
|
|
|
private:
|
2023-03-02 00:35:58 +08:00
|
|
|
|
|
2023-02-26 23:47:07 +08:00
|
|
|
|
static FluApp* m_instance;
|
2023-03-03 18:19:48 +08:00
|
|
|
|
QQmlEngine *engine;
|
2023-02-26 23:47:07 +08:00
|
|
|
|
QWindow *appWindow;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // FLUAPP_H
|