/*
* Copyright (C) 2016 The Qt Company Ltd.
+ * Copyright (C) 2022 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <QtCore/QDebug>
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlApplicationEngine>
-#include <QtQuickControls2/QQuickStyle>
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QDebug>
+#include <hvac.h>
+#include <vehiclesignals.h>
+#include "homescreenhandler.h"
-#ifdef HAVE_LIBHOMESCREEN
-#include <libhomescreen.hpp>
-#endif
+
+#include "translator.h"
int main(int argc, char *argv[])
{
-#ifdef HAVE_LIBHOMESCREEN
- LibHomeScreen libHomeScreen;
+ setenv("QT_QUICK_CONTROLS_STYLE", "AGL", 1);
- if (!libHomeScreen.renderAppToAreaAllowed(0, 1)) {
- qWarning() << "renderAppToAreaAllowed is denied";
- return -1;
- }
-#endif
+ HomescreenHandler* homescreenHandler = new HomescreenHandler();
+ if (argc > 1) {
+ int orientation = strtoul(argv[1], NULL, 10);
- QGuiApplication app(argc, argv);
+ fprintf(stderr, "Starting HVAC in tiled orientation %d\n",
+ orientation);
+ homescreenHandler->setOrientation("hvac", orientation);
+ }
- QQuickStyle::setStyle("AGL");
+ QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/HVAC.qml")));
- return app.exec();
-}
+ QQmlApplicationEngine engine;
+ VehicleSignalsConfig vsConfig("hvac");
+ engine.rootContext()->setContextProperty("hvac", new HVAC(new VehicleSignals(vsConfig)));
+ engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler);
+ qmlRegisterType<Translator>("Translator", 1, 0, "Translator");
+ engine.load(QUrl(QStringLiteral("qrc:/HVAC.qml")));
+ return app.exec();
+}