2023-02-24 18:44:29 +08:00
|
|
|
|
#include <QGuiApplication>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
2023-03-03 18:19:48 +08:00
|
|
|
|
#include <QQmlContext>
|
2023-03-05 23:39:13 +08:00
|
|
|
|
#include <QDir>
|
2023-03-09 13:23:39 +08:00
|
|
|
|
#include <QQuickWindow>
|
2023-03-30 21:52:55 +08:00
|
|
|
|
#include <QQuickStyle>
|
2023-03-05 23:39:13 +08:00
|
|
|
|
#include <QProcess>
|
2023-04-14 17:07:54 +08:00
|
|
|
|
#include "lang/Lang.h"
|
2023-04-11 23:12:31 +08:00
|
|
|
|
#include "AppInfo.h"
|
2023-03-17 14:05:27 +08:00
|
|
|
|
#include "ChatController.h"
|
2023-02-26 23:47:07 +08:00
|
|
|
|
|
2023-02-24 18:44:29 +08:00
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2023-03-02 18:21:43 +08:00
|
|
|
|
QCoreApplication::setOrganizationName("ZhuZiChu");
|
|
|
|
|
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
|
|
|
|
QCoreApplication::setApplicationName("FluentUI");
|
2023-03-30 21:52:55 +08:00
|
|
|
|
QQuickStyle::setStyle("Basic");
|
2023-02-24 18:44:29 +08:00
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
QQmlApplicationEngine engine;
|
2023-03-17 14:05:27 +08:00
|
|
|
|
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
2023-04-14 17:07:54 +08:00
|
|
|
|
AppInfo* appInfo = new AppInfo();
|
|
|
|
|
QQmlContext * context = engine.rootContext();
|
|
|
|
|
Lang* lang = appInfo->lang();
|
|
|
|
|
context->setContextProperty("lang",lang);
|
|
|
|
|
QObject::connect(appInfo,&AppInfo::langChanged,&app,[context,appInfo]{
|
|
|
|
|
context->setContextProperty("lang",appInfo->lang());
|
|
|
|
|
});
|
|
|
|
|
context->setContextProperty("appInfo",appInfo);
|
2023-02-26 23:47:07 +08:00
|
|
|
|
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
|
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
|
|
|
if (!obj && url == objUrl)
|
|
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
|
}, Qt::QueuedConnection);
|
|
|
|
|
engine.load(url);
|
2023-02-24 18:44:29 +08:00
|
|
|
|
return app.exec();
|
|
|
|
|
}
|