mirror of
https://github.com/QuasarApp/Hanoi-Towers.git
synced 2025-04-27 02:04:32 +00:00
79 lines
2.2 KiB
C++
79 lines
2.2 KiB
C++
/*
|
|
* Copyright (C) 2018-2021 QuasarApp.
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
#include <QGuiApplication>
|
|
#include <QFont>
|
|
#include <QFontDatabase>
|
|
#include <iostream>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQmlComponent>
|
|
#include <QQmlContext>
|
|
#include "activityhandler.h"
|
|
#include "hanoitowers.h"
|
|
#include <QTranslator>
|
|
#include <qmlnotifyservice.h>
|
|
#include <credits.h>
|
|
#ifdef Q_OS_ANDROID
|
|
#ifdef HANOI_ADMOD
|
|
#include <QtAndroidTools.h>
|
|
#endif
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <--
|
|
#endif
|
|
|
|
QGuiApplication::setApplicationName("HanoiTowers"); // <--
|
|
QGuiApplication::setOrganizationName("QuasarApp"); // <--
|
|
QGuiApplication::setOrganizationDomain("https://github.com/QuasarApp"); // <--
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QLocale locale = QLocale::system();
|
|
|
|
if(argc > 1) {
|
|
locale = QLocale(QString::fromLatin1(argv[1]));
|
|
}
|
|
|
|
if(!QuasarAppUtils::Locales::init(locale, {":/languages/languages/",
|
|
":/credits_languages/",
|
|
":/qmlNotify_languages/",
|
|
":/lv_languages/"})){
|
|
QuasarAppUtils::Params::log("Error load language : " , QuasarAppUtils::Error);
|
|
}
|
|
|
|
QQmlApplicationEngine engine;
|
|
HanoiTowers back(&engine);
|
|
auto root = engine.rootContext();
|
|
|
|
if (!QmlNotificationService::init(&engine)) {
|
|
return 1;
|
|
}
|
|
|
|
if (!QuasarAppCredits::init(&engine)) {
|
|
return 2;
|
|
}
|
|
|
|
#ifdef Q_OS_ANDROID
|
|
#ifdef HANOI_ADMOD
|
|
QtAndroidTools::initializeQmlTools();
|
|
#endif
|
|
ActivityHandler *activityHandler = new ActivityHandler(&app);
|
|
engine.rootContext()->setContextProperty(QLatin1String("activityHandler"), activityHandler);
|
|
#endif
|
|
|
|
root->setContextProperty("backEnd", &back);
|
|
root->setContextProperty("OnlineStatusQml", QVariant::fromValue(OnlineStatusQml{}));
|
|
|
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
|
return app.exec();
|
|
}
|