LedDisplay/LedDisplayController/main.cpp

52 lines
1.5 KiB
C++
Raw Normal View History

2020-10-08 20:06:57 +02:00
#include <QGuiApplication>
#include <QQmlApplicationEngine>
2020-10-11 15:50:13 +02:00
#include <QQuickStyle>
#include <qbluetoothleuartclient.h>
#include <QTranslator>
#include <QFontDatabase>
2022-08-03 09:09:31 +02:00
#include <QQmlContext>
2020-10-08 20:06:57 +02:00
#ifdef Q_OS_ANDROID
#include <QtAndroidExtras>
#endif
2020-10-18 15:08:12 +02:00
#include "leddisplaybackend.h"
2020-10-08 20:06:57 +02:00
/*void permissionCallback(const QtAndroid::PermissionResultMap& results) {
for(QtAndroid::PermissionResult result : results) {
qWarning() << "Permission Callback Result:" << (result == QtAndroid::PermissionResult::Granted);
}
}*/
2020-10-08 20:06:57 +02:00
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setOrganizationName("Itsblue");
QCoreApplication::setOrganizationDomain("itsblue.de");
QCoreApplication::setApplicationName("Itsblue smart display");
2020-10-08 20:06:57 +02:00
QGuiApplication app(argc, argv);
QTranslator translator;
translator.load(":/" + QLocale::system().name() + ".qm");
app.installTranslator(&translator);
2020-10-18 15:08:12 +02:00
LedDisplayBackend::init();
QBluetoothLeUartClient::init();
2020-10-08 20:06:57 +02:00
2020-10-11 15:50:13 +02:00
QQuickStyle::setStyle("Material");
2020-10-08 20:06:57 +02:00
QQmlApplicationEngine engine;
2022-08-03 09:09:31 +02:00
engine.rootContext()->setContextProperty("APP_VERSION", APP_VERSION);
2020-10-08 20:06:57 +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);
2020-10-09 00:03:50 +02:00
2020-10-08 20:06:57 +02:00
return app.exec();
}