File indexing completed on 2024-04-21 05:50:56

0001 /*
0002  *   Copyright 2016 Marco Martin <mart@kde.org>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU Library General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 #include <QtGlobal>
0021 
0022 #ifdef Q_OS_ANDROID
0023 #include <QGuiApplication>
0024 #else
0025 #include <QApplication>
0026 #endif
0027 #include <QQmlApplicationEngine>
0028 #include <QtQml>
0029 #include <QUrl>
0030 #include <QQuickStyle>
0031 
0032 #include "data.h"
0033 #include "availablegradesmodel.h"
0034 
0035 Q_DECL_EXPORT int main(int argc, char *argv[])
0036 {
0037 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0038     QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
0039 #endif
0040 
0041 #ifdef Q_OS_ANDROID
0042     QGuiApplication app(argc, argv);
0043     QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
0044 #else
0045     QApplication app(argc, argv);
0046 #endif
0047 
0048     QCoreApplication::setOrganizationName("KDE");
0049     QCoreApplication::setOrganizationDomain("kde.org");
0050     QCoreApplication::setApplicationName("Climbing Grades");
0051 
0052     //qputenv("QML_IMPORT_TRACE", "1");
0053     qRegisterMetaType<AvailableGradesModel*>();
0054     QQmlApplicationEngine engine;
0055 
0056     Data data;
0057 
0058     engine.rootContext()->setContextProperty(QLatin1String("dataStore"), &data);
0059     engine.load(QUrl(QStringLiteral("qrc:///Main.qml")));
0060 
0061     if (engine.rootObjects().isEmpty()) {
0062         return -1;
0063     }
0064 
0065     return app.exec();
0066 }