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

85 lines
2.6 KiB
C++
Raw Normal View History

2018-08-12 20:51:57 +02:00
/*
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/>.
*/
2018-07-17 19:17:25 +02:00
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlEngine>
2018-07-22 16:47:55 +02:00
#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>
2020-10-01 02:27:00 +02:00
#include <QScreen>
#include <QRect>
#include <QtCore/QUrl>
#include <QtCore/QCommandLineOption>
#include <QtCore/QCommandLineParser>
#include <QGuiApplication>
#include <QStyleHints>
#include <QScreen>
#include <QQmlApplicationEngine>
#include <QtQml/QQmlContext>
2020-07-06 15:04:02 +02:00
#include "headers/scstwappsettings.h"
//#include "headers/speedtimer.h"
//#include "headers/climbingrace.h"
#include "headers/scstwappbackend.h"
#include <scstwlibraries.h>
#include <QTranslator>
2018-07-22 16:47:55 +02:00
2018-07-17 19:17:25 +02:00
int main(int argc, char *argv[])
{
2020-10-01 14:19:47 +02:00
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
2018-07-17 19:17:25 +02:00
QGuiApplication app(argc, argv);
// setup speed backend
qmlRegisterType<ScStwAppBackend>("de.itsblue.ScStwApp", 2, 0, "SpeedBackend");
2020-07-10 15:20:41 +02:00
qmlRegisterUncreatableType<ScStwAppSettings>("de.itsblue.ScStwApp", 2, 0, "ScStwAppSettings", "The ScStwAppSettings type is not creatable!");
qRegisterMetaType<ScStwAppSettings::AppInternalSetting>("ScStwAppSettings::BaseStationSetting");
2018-07-17 19:17:25 +02:00
QQmlApplicationEngine engine;
2020-10-01 14:19:47 +02:00
ScStwLibraries::init();
ScStwLibraries::initStyling(&engine);
2020-10-01 14:19:47 +02:00
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);
2018-07-17 19:17:25 +02:00
return app.exec();
2018-07-17 19:17:25 +02:00
}