2023-05-22 16:17:51 +08:00
|
|
|
#include "FluApp.h"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
|
|
#include <QQmlEngine>
|
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlContext>
|
2023-02-27 18:46:39 +08:00
|
|
|
#include <QQuickItem>
|
2023-02-27 23:04:52 +08:00
|
|
|
#include <QTimer>
|
2023-03-30 17:16:57 +08:00
|
|
|
#include <QUuid>
|
2023-04-27 09:38:57 +08:00
|
|
|
#include <QFontDatabase>
|
2023-03-02 12:20:16 +08:00
|
|
|
#include <QClipboard>
|
2024-03-13 17:54:11 +08:00
|
|
|
#include <QTranslator>
|
2023-04-27 17:29:39 +08:00
|
|
|
|
2023-09-13 15:11:22 +08:00
|
|
|
FluApp::FluApp(QObject *parent):QObject{parent}{
|
2023-11-23 19:58:54 +08:00
|
|
|
useSystemAppBar(false);
|
2023-04-27 17:29:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
FluApp::~FluApp(){
|
2023-02-27 18:46:39 +08:00
|
|
|
}
|
|
|
|
|
2024-03-13 17:54:11 +08:00
|
|
|
void FluApp::init(QObject *target,QLocale locale){
|
2024-03-15 00:04:15 +08:00
|
|
|
_locale = locale;
|
2024-02-27 12:23:24 +08:00
|
|
|
_engine = qmlEngine(target);
|
2024-03-13 17:54:11 +08:00
|
|
|
_translator = new QTranslator(this);
|
|
|
|
qApp->installTranslator(_translator);
|
2024-03-15 00:04:15 +08:00
|
|
|
const QStringList uiLanguages = _locale.uiLanguages();
|
2024-03-13 17:54:11 +08:00
|
|
|
for (const QString &name : uiLanguages) {
|
2024-03-24 10:27:16 +08:00
|
|
|
const QString baseName = "fluentui_" + QLocale(name).name();
|
2024-03-13 17:54:11 +08:00
|
|
|
if (_translator->load(":/qt/qml/FluentUI/i18n/"+ baseName)) {
|
|
|
|
_engine->retranslate();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-02-26 23:47:07 +08:00
|
|
|
}
|