/*
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 .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
//#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
//#include
#ifdef Q_OS_ANDROID
#include
#endif
#include "headers/appsettings.h"
//#include "headers/speedtimer.h"
//#include "headers/climbingrace.h"
#include "headers/apptheme.h"
#include "headers/scstwappbackend.h"
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
#ifdef Q_OS_ANDROID
//set the standard volume to media
QAndroidJniObject jactivity=QtAndroid::androidActivity();
if(jactivity.isValid())
jactivity.callMethod("setVolumeControlStream","(I)V",3);
//set statusbar color
QtAndroid::runOnAndroidThread([=]()
{
QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;");
window.callMethod("addFlags", "(I)V", 0x80000000);
window.callMethod("clearFlags", "(I)V", 0x04000000);
//window.callMethod("setStatusBarColor", "(I)V", 0x202227); // Desired statusbar color
//QAndroidJniObject decorView = window.callObjectMethod("getDecorView", "()Landroid/view/View;");
//decorView.callMethod("setSystemUiVisibility", "(I)V", 0x00002000);
});
#endif
AppSettings * pAppSettings = new AppSettings();
// setup speed backend and App themes
qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "SpeedBackend");
qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "ScStwRace");
qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "ScStwTimer");
qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "AppTheme");
//qmlRegisterUncreatableType("com.itsblue.speedclimbingstopwatch", 2, 0, "ScStw", "This is a static class and therefore not instantiable");
qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "ScStw");
qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "ScStwClient");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QQmlContext *context = engine.rootContext();
// stup app settings
context->setContextProperty("_cppAppSettings", pAppSettings);
if (engine.rootObjects().isEmpty())
return -1;
int iRet = 0;
iRet = app.exec();
return iRet;
}