This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/sources/main.cpp
2021-01-15 20:19:49 +01:00

87 lines
2.6 KiB
C++

/*
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
Copyright (C) 2018 Itsblue Development - Dorian Zeder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlEngine>
#include <QSqlDatabase>
#include <QSqlError>
#include <QDebug>
#include <QFile>
#include <QDir>
#include <QStandardPaths>
//#include <QtWebView/QtWebView>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QGuiApplication>
#include <QQuickView>
#include <QStandardPaths>
#include <QtQml>
#include <QtNetwork>
#include <QQmlApplicationEngine>
#include <QFile>
#include <QDesktopServices>
#include <QScreen>
#include <QRect>
#include <QtCore/QUrl>
#include <QtCore/QCommandLineOption>
#include <QtCore/QCommandLineParser>
#include <QGuiApplication>
#include <QStyleHints>
#include <QScreen>
#include <QQmlApplicationEngine>
#include <QtQml/QQmlContext>
#include "headers/scstwappsettings.h"
//#include "headers/speedtimer.h"
//#include "headers/climbingrace.h"
#include "headers/scstwappbackend.h"
#include <scstwlibraries.h>
#include <QTranslator>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
// setup speed backend
qmlRegisterType<ScStwAppBackend>("de.itsblue.ScStwApp", 2, 0, "SpeedBackend");
qmlRegisterType<ScStwAppSettings>("de.itsblue.ScStwApp", 2, 0, "ScStwAppSettings");
qRegisterMetaType<ScStwAppSettings::AppInternalSetting>("ScStwAppSettings::BaseStationSetting");
QQmlApplicationEngine engine;
// pass app version to qml
engine.rootContext()->setContextProperty("APP_VERSION", APP_VERSION);
ScStwLibraries::init();
ScStwLibraries::initStyling(&engine);
const QUrl url(QStringLiteral("qrc:/main.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);
return app.exec();
}