2024-04-11 14:51:43 +08:00
|
|
|
#pragma once
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QWindow>
|
2023-04-27 09:38:57 +08:00
|
|
|
#include <QtQml/qqml.h>
|
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>
|
2024-03-13 17:54:11 +08:00
|
|
|
#include <QTranslator>
|
2024-03-24 22:12:20 +08:00
|
|
|
#include <QQuickWindow>
|
2024-04-17 21:39:55 +08:00
|
|
|
#include <QJsonArray>
|
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
|
|
|
|
*/
|
2024-04-11 14:51:43 +08:00
|
|
|
class FluApp : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY_AUTO(bool, useSystemAppBar)
|
|
|
|
Q_PROPERTY_AUTO(QString, windowIcon)
|
|
|
|
Q_PROPERTY_AUTO(QLocale, locale)
|
2024-05-16 00:35:04 +08:00
|
|
|
Q_PROPERTY_AUTO_P(QObject*,launcher)
|
2023-04-27 09:38:57 +08:00
|
|
|
QML_NAMED_ELEMENT(FluApp)
|
|
|
|
QML_SINGLETON
|
2024-04-11 14:51:43 +08:00
|
|
|
|
2023-05-11 18:24:58 +08:00
|
|
|
private:
|
2023-02-27 18:46:39 +08:00
|
|
|
explicit FluApp(QObject *parent = nullptr);
|
2024-04-11 14:51:43 +08:00
|
|
|
|
|
|
|
~FluApp() override;
|
|
|
|
|
2023-09-13 15:11:22 +08:00
|
|
|
public:
|
2024-04-11 14:51:43 +08:00
|
|
|
SINGLETON(FluApp)
|
|
|
|
|
|
|
|
static FluApp *create(QQmlEngine *, QJSEngine *) { return getInstance(); }
|
2023-02-26 23:47:07 +08:00
|
|
|
|
2024-05-16 00:35:04 +08:00
|
|
|
Q_INVOKABLE void init(QObject *launcher, QLocale locale = QLocale::system());
|
2024-04-11 14:51:43 +08:00
|
|
|
|
2024-04-28 20:22:05 +08:00
|
|
|
[[maybe_unused]] Q_INVOKABLE static QJsonArray iconData(const QString &keyword = "");
|
2024-04-17 21:39:55 +08:00
|
|
|
|
2024-04-11 14:51:43 +08:00
|
|
|
private:
|
|
|
|
QQmlEngine *_engine{};
|
|
|
|
QTranslator *_translator = nullptr;
|
2024-04-17 21:39:55 +08:00
|
|
|
};
|