2020-05-23 02:31:12 +03:00
|
|
|
/*
|
2021-01-31 20:01:20 +03:00
|
|
|
* Copyright (C) 2018-2021 QuasarApp.
|
2020-05-23 02:31:12 +03:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2020-04-01 09:36:17 +03:00
|
|
|
#include <QGuiApplication>
|
2018-05-13 23:11:35 +03:00
|
|
|
#include <QFont>
|
|
|
|
#include <QFontDatabase>
|
2018-05-12 17:24:40 +03:00
|
|
|
#include <iostream>
|
2018-01-20 17:44:28 +03:00
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQmlComponent>
|
2019-10-07 18:16:54 +03:00
|
|
|
#include <QQmlContext>
|
2021-05-07 17:53:34 +03:00
|
|
|
#include "activityhandler.h"
|
2021-05-04 12:36:43 +03:00
|
|
|
#include "hanoitowers.h"
|
2018-04-11 23:10:52 +03:00
|
|
|
#include <QTranslator>
|
2019-11-19 18:09:30 +03:00
|
|
|
#include <qmlnotifyservice.h>
|
2021-03-19 22:02:37 +03:00
|
|
|
#include <credits.h>
|
2021-05-07 22:43:47 +03:00
|
|
|
#ifdef Q_OS_ANDROID
|
2022-02-21 00:06:06 +03:00
|
|
|
#ifdef HANOI_ADMOD
|
2021-05-07 22:36:47 +03:00
|
|
|
#include <QtAndroidTools.h>
|
2021-05-07 22:43:47 +03:00
|
|
|
#endif
|
2022-02-21 00:06:06 +03:00
|
|
|
#endif
|
2018-05-12 17:24:40 +03:00
|
|
|
|
2018-01-20 17:44:28 +03:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2022-02-22 22:45:22 +03:00
|
|
|
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <--
|
|
|
|
#endif
|
|
|
|
|
2020-05-05 09:43:18 +03:00
|
|
|
QGuiApplication::setApplicationName("HanoiTowers"); // <--
|
|
|
|
QGuiApplication::setOrganizationName("QuasarApp"); // <--
|
|
|
|
QGuiApplication::setOrganizationDomain("https://github.com/QuasarApp"); // <--
|
2018-07-15 12:18:30 +03:00
|
|
|
|
2020-04-01 09:36:17 +03:00
|
|
|
QGuiApplication app(argc, argv);
|
2018-04-11 23:10:52 +03:00
|
|
|
|
2021-05-05 16:17:35 +03:00
|
|
|
QLocale locale = QLocale::system();
|
2018-05-12 17:24:40 +03:00
|
|
|
|
|
|
|
if(argc > 1) {
|
2021-05-07 09:22:47 +03:00
|
|
|
locale = QLocale(QString::fromLatin1(argv[1]));
|
2018-05-12 17:24:40 +03:00
|
|
|
}
|
2018-04-11 23:10:52 +03:00
|
|
|
|
2021-05-05 16:17:35 +03:00
|
|
|
if(!QuasarAppUtils::Locales::init(locale, {":/languages/languages/",
|
|
|
|
":/credits_languages/",
|
|
|
|
":/qmlNotify_languages/",
|
|
|
|
":/lv_languages/"})){
|
|
|
|
QuasarAppUtils::Params::log("Error load language : " , QuasarAppUtils::Error);
|
2018-05-12 17:24:40 +03:00
|
|
|
}
|
2018-04-11 23:10:52 +03:00
|
|
|
|
2018-01-20 17:44:28 +03:00
|
|
|
QQmlApplicationEngine engine;
|
2021-05-04 12:36:43 +03:00
|
|
|
HanoiTowers back(&engine);
|
2019-10-07 18:16:54 +03:00
|
|
|
auto root = engine.rootContext();
|
2019-11-19 18:09:30 +03:00
|
|
|
|
|
|
|
if (!QmlNotificationService::init(&engine)) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-03-19 22:02:37 +03:00
|
|
|
if (!QuasarAppCredits::init(&engine)) {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2021-05-07 22:43:47 +03:00
|
|
|
#ifdef Q_OS_ANDROID
|
2022-02-21 00:06:06 +03:00
|
|
|
#ifdef HANOI_ADMOD
|
2021-05-07 22:36:47 +03:00
|
|
|
QtAndroidTools::initializeQmlTools();
|
2022-02-21 00:06:06 +03:00
|
|
|
#endif
|
2021-05-07 17:53:34 +03:00
|
|
|
ActivityHandler *activityHandler = new ActivityHandler(&app);
|
|
|
|
engine.rootContext()->setContextProperty(QLatin1String("activityHandler"), activityHandler);
|
|
|
|
#endif
|
|
|
|
|
2019-10-07 18:16:54 +03:00
|
|
|
root->setContextProperty("backEnd", &back);
|
2021-01-31 20:01:20 +03:00
|
|
|
root->setContextProperty("OnlineStatusQml", QVariant::fromValue(OnlineStatusQml{}));
|
2019-09-30 18:02:01 +03:00
|
|
|
|
2018-01-20 17:44:28 +03:00
|
|
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|