-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeadUnit.cpp
57 lines (41 loc) · 1.69 KB
/
HeadUnit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QCursor>
#include "HeadUnitQtClass.hpp"
#include "Infotainment/control/hvachandler.h"
#include "Infotainment/control/audiocontroller.h"
#include "Infotainment/control/system.h"
#include "youtubesearch.h"
int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QtWebEngine::initialize();
QCursor cursor(Qt::BlankCursor);
app.setOverrideCursor(cursor);
QQmlApplicationEngine engine;
HeadUnitQtClass carinfo;
engine.rootContext()->setContextProperty("carinfo", &carinfo);
qmlRegisterType<HeadUnitQtClass>("DataModule", 1, 0, "HeadUnitQtClass");
qmlRegisterType<YouTubeSearch>("YouTubeSearch", 1, 0, "YouTubeSearch");
System m_system_handler;
HVACHandler m_driverHVACHandler;
HVACHandler m_passengerHVACHandler;
AudioController m_audioController;
const QUrl url(QStringLiteral("qrc:/qml/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);
QQmlContext *context (engine.rootContext());
context->setContextProperty( "systemHandler" , &m_system_handler);
context->setContextProperty( "driverHVAC" , &m_driverHVACHandler);
context->setContextProperty( "passengerHVAC" , &m_passengerHVACHandler);
context->setContextProperty( "audioController" , &m_audioController);
return app.exec();
}