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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
\hypertarget{main_8cpp}{}\section{app/main.cpp File Reference}
\label{main_8cpp}\index{app/main.\+cpp@{app/main.\+cpp}}
{\ttfamily \#include $<$Q\+Gui\+Application$>$}\newline
{\ttfamily \#include $<$Q\+Command\+Line\+Parser$>$}\newline
{\ttfamily \#include $<$Qt\+Gui/\+Q\+Bitmap$>$}\newline
{\ttfamily \#include $<$Qt\+Gui/\+Q\+Gui\+Application$>$}\newline
{\ttfamily \#include $<$Qt\+Qml/\+Q\+Qml\+Application\+Engine$>$}\newline
{\ttfamily \#include $<$Qt\+Qml/\+Q\+Qml\+Context$>$}\newline
{\ttfamily \#include $<$Qt\+Qml/qqml.\+h$>$}\newline
{\ttfamily \#include $<$Q\+Quick\+Window$>$}\newline
{\ttfamily \#include $<$Qt\+Quick\+Controls2/\+Q\+Quick\+Style$>$}\newline
{\ttfamily \#include $<$Q\+Pixmap$>$}\newline
{\ttfamily \#include $<$Q\+Bitmap$>$}\newline
{\ttfamily \#include \char`\"{}eventhandler.\+h\char`\"{}}\newline
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
int \hyperlink{main_8cpp_a0ddf1224851353fc92bfbff6f499fa97}{main} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]})
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item
static \hyperlink{class_event_handler}{Event\+Handler} $\ast$ \hyperlink{main_8cpp_a4f7f516f792f108e8e99e3e23419db13}{event\+Handler}
\end{DoxyCompactItemize}
\subsection{Function Documentation}
\mbox{\Hypertarget{main_8cpp_a0ddf1224851353fc92bfbff6f499fa97}\label{main_8cpp_a0ddf1224851353fc92bfbff6f499fa97}}
\index{main.\+cpp@{main.\+cpp}!main@{main}}
\index{main@{main}!main.\+cpp@{main.\+cpp}}
\subsubsection{\texorpdfstring{main()}{main()}}
{\footnotesize\ttfamily int main (\begin{DoxyParamCaption}\item[{int}]{argc, }\item[{char $\ast$}]{argv\mbox{[}$\,$\mbox{]} }\end{DoxyParamCaption})}
Definition at line 35 of file main.\+cpp.
\begin{DoxyCode}
36 \{
37 QGuiApplication app(argc, argv);
38
39 QCoreApplication::setOrganizationDomain(\textcolor{stringliteral}{"LinuxFoundation"});
40 QCoreApplication::setOrganizationName(\textcolor{stringliteral}{"AutomotiveGradeLinux"});
41 QCoreApplication::setApplicationName(\textcolor{stringliteral}{"OnScreenApp"});
42 QCoreApplication::setApplicationVersion(\textcolor{stringliteral}{"0.1.0"});
43
44 QQuickStyle::setStyle(\textcolor{stringliteral}{"AGL"});
45
46 QCommandLineParser parser;
47 parser.addPositionalArgument(\textcolor{stringliteral}{"port"}, app.translate(\textcolor{stringliteral}{"main"}, \textcolor{stringliteral}{"port for binding"}));
48 parser.addPositionalArgument(\textcolor{stringliteral}{"secret"}, app.translate(\textcolor{stringliteral}{"main"}, \textcolor{stringliteral}{"secret for binding"}));
49 parser.addHelpOption();
50 parser.addVersionOption();
51 parser.process(app);
52 QStringList positionalArguments = parser.positionalArguments();
53
54 \textcolor{keywordtype}{int} port = 1700;
55 QString token = \textcolor{stringliteral}{"wm"};
56
57 \textcolor{keywordflow}{if} (positionalArguments.length() == 2) \{
58 port = positionalArguments.takeFirst().toInt();
59 token = positionalArguments.takeFirst();
60 \}
61
62 \hyperlink{hmi-debug_8h_a0d26d8b8201011dade787236519711c0}{HMI\_DEBUG}(\textcolor{stringliteral}{"onscreenapp"}, \textcolor{stringliteral}{"port = %d, token = %s"}, port, token.toStdString().c\_str());
63
64 \hyperlink{main_8cpp_a4f7f516f792f108e8e99e3e23419db13}{eventHandler} = \textcolor{keyword}{new} \hyperlink{class_event_handler}{EventHandler}();
65 eventHandler->init(port, token.toStdString().c\_str());
66
67 QQmlApplicationEngine engine;
68 engine.rootContext()->setContextProperty(\textcolor{stringliteral}{"eventHandler"}, eventHandler);
69 engine.load(QUrl(QStringLiteral(\textcolor{stringliteral}{"qrc:/main.qml"})));
70 \textcolor{keywordflow}{if} (engine.rootObjects().isEmpty()) \{
71 \textcolor{keywordflow}{return} -1;
72 \}
73
74 QObject *root = engine.rootObjects().first();
75 QQuickWindow *window = qobject\_cast<QQuickWindow *>(root);
76
77 eventHandler->setQuickWindow(window);
78
79 \textcolor{comment}{// QBitmap bitmap = QPixmap(":/images/HMI\_Phone\_Back.svg").createHeuristicMask();}
80 \textcolor{comment}{// window->setMask(QRegion(bitmap));}
81
82 \textcolor{comment}{// QImage img(":/images/star.png");}
83 \textcolor{comment}{// QPixmap pixmap = QPixmap::fromImage(img);}
84 \textcolor{comment}{// QBitmap mask = pixmap.createHeuristicMask();}
85
86 \textcolor{comment}{// if (mask.hasAlphaChannel()) \{}
87 \textcolor{comment}{// qDebug("has alpha");}
88 \textcolor{comment}{// \}}
89
90 \textcolor{comment}{// window->setMask(QRegion(mask));}
91
92 \textcolor{comment}{// QBitmap bitmap = QPixmap(":/images/HMI\_Phone\_Back\_Heart.svg").createHeuristicMask();}
93 \textcolor{comment}{// window->setMask(QRegion(bitmap));}
94
95 QObject::connect(eventHandler, SIGNAL(signalOnScreenMessage(QVariant)), window, SLOT(qmlOnScreenMessage
(QVariant)));
96 QObject::connect(eventHandler, SIGNAL(signalLoader(QVariant)), window, SLOT(qmlLoader(QVariant)));
97 QObject::connect(eventHandler, SIGNAL(signalSetClearBackgroud()), window, SLOT(qmlSetClearBackgroud()))
;
98 QObject::connect(eventHandler, SIGNAL(signalSetDefaultBackgroud(QVariant)), window, SLOT(
qmlSetDefaultBackground(QVariant)));
99
100 \textcolor{preprocessor}{#if USE\_TEST\_DISPLAY}
101 QObject::connect(window, SIGNAL(frameSwapped()), eventHandler, SLOT(slotActivateSurface()));
102 \textcolor{preprocessor}{#endif}
103 \hyperlink{hmi-debug_8h_a0d26d8b8201011dade787236519711c0}{HMI\_DEBUG}(\textcolor{stringliteral}{"onscreenapp"}, \textcolor{stringliteral}{"Launched!"});
104
105 \textcolor{keywordflow}{return} app.exec();
106 \}
\end{DoxyCode}
\subsection{Variable Documentation}
\mbox{\Hypertarget{main_8cpp_a4f7f516f792f108e8e99e3e23419db13}\label{main_8cpp_a4f7f516f792f108e8e99e3e23419db13}}
\index{main.\+cpp@{main.\+cpp}!event\+Handler@{event\+Handler}}
\index{event\+Handler@{event\+Handler}!main.\+cpp@{main.\+cpp}}
\subsubsection{\texorpdfstring{event\+Handler}{eventHandler}}
{\footnotesize\ttfamily \hyperlink{class_event_handler}{Event\+Handler}$\ast$ event\+Handler\hspace{0.3cm}{\ttfamily [static]}}
Definition at line 33 of file main.\+cpp.
|