diff options
-rw-r--r-- | .gitreview | 5 | ||||
-rw-r--r-- | Controls.pro | 19 | ||||
-rw-r--r-- | Controls.qml | 63 | ||||
-rw-r--r-- | config.tests/libhomescreen.cpp | 7 | ||||
-rw-r--r-- | config.tests/libhomescreen.pro | 5 | ||||
-rw-r--r-- | controls.qrc | 5 | ||||
-rw-r--r-- | images/HMI_HVAC_AC_Active.svg | 90 | ||||
-rw-r--r-- | images/HMI_HVAC_AC_Inactive.svg | 78 | ||||
-rw-r--r-- | images/images.qrc | 6 | ||||
-rw-r--r-- | main.cpp | 46 |
10 files changed, 324 insertions, 0 deletions
diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..e9ae5cb --- /dev/null +++ b/.gitreview @@ -0,0 +1,5 @@ +[gerrit] +host=gerrit.automotivelinux.org +port=29418 +project=apps/controls +defaultbranch=master
\ No newline at end of file diff --git a/Controls.pro b/Controls.pro new file mode 100644 index 0000000..9d1674d --- /dev/null +++ b/Controls.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +TARGET = controls +QT = quick quickcontrols2 + +load(configure) +qtCompileTest(libhomescreen) + +config_libhomescreen { + CONFIG += link_pkgconfig + PKGCONFIG += homescreen + DEFINES += HAVE_LIBHOMESCREEN +} + +SOURCES = main.cpp + +RESOURCES += \ + controls.qrc \ + images/images.qrc + diff --git a/Controls.qml b/Controls.qml new file mode 100644 index 0000000..87a6abb --- /dev/null +++ b/Controls.qml @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import QtQuick 2.6 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.0 +import AGL.Demo.Controls 1.0 + +ApplicationWindow { + id: root + + GridLayout { + anchors.fill: parent + anchors.margins: root.width / 10 + columns: 2 + + Label { text: 'Label:' } + Label { + text: 'This is a label' + } + + Label { text: 'Button:' } + Button { + text: 'This is a button' + } + + Label { text: 'Switch:' } + Switch {} + + Label { text: 'Progress Bar:' } + ProgressBar { + NumberAnimation on value { + from: 0 + to: 1 + duration: 5000 + loops: Animation.Infinite + easing.type: Easing.SineCurve + } + } + + Label { text: 'Slider:' } + Slider {} + + Label { text: 'ToogleButton:' } + ToggleButton { + onImage: './images/HMI_HVAC_AC_Active.svg' + offImage: './images/HMI_HVAC_AC_Inactive.svg' + } + } +} diff --git a/config.tests/libhomescreen.cpp b/config.tests/libhomescreen.cpp new file mode 100644 index 0000000..e0fd460 --- /dev/null +++ b/config.tests/libhomescreen.cpp @@ -0,0 +1,7 @@ +#include <libhomescreen.hpp> + +int main(int argc,char **argv) +{ + LibHomeScreen libHomeScreen; + return 0; +} diff --git a/config.tests/libhomescreen.pro b/config.tests/libhomescreen.pro new file mode 100644 index 0000000..eb4e8f3 --- /dev/null +++ b/config.tests/libhomescreen.pro @@ -0,0 +1,5 @@ +SOURCES = libhomescreen.cpp + +CONFIG -= qt +CONFIG += link_pkgconfig +PKGCONFIG += homescreen diff --git a/controls.qrc b/controls.qrc new file mode 100644 index 0000000..7554259 --- /dev/null +++ b/controls.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>Controls.qml</file> + </qresource> +</RCC> diff --git a/images/HMI_HVAC_AC_Active.svg b/images/HMI_HVAC_AC_Active.svg new file mode 100644 index 0000000..67efdb3 --- /dev/null +++ b/images/HMI_HVAC_AC_Active.svg @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> + +<svg + xmlns:i="&ns_ai;" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="Layer_2" + x="0px" + y="0px" + viewBox="0 0 318 219" + style="enable-background:new 0 0 318 219;" + xml:space="preserve" + inkscape:version="0.91 r13725" + sodipodi:docname="HMI_HVAC_AC_Active.svg"><metadata + id="metadata30"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs28" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="2560" + inkscape:window-height="1464" + id="namedview26" + showgrid="false" + inkscape:zoom="1.0776256" + inkscape:cx="-271.57627" + inkscape:cy="109.5" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="Layer_2" /><style + type="text/css" + id="style3"> + .st0{fill:#66FF99;} + .st1{font-family:'Roboto-Light';} + .st2{font-size:88.6888px;} + .st3{letter-spacing:3;} + .st4{letter-spacing:-3;} + .st5{fill:none;stroke:url(#SVGID_1_);stroke-miterlimit:10;} +</style><switch + id="switch5"><g + i:extraneous="self" + id="g7"><g + id="g9"><text + transform="matrix(1 5.460000e-03 -5.460000e-03 1 90.8639 132.3301)" + id="text11"><tspan + x="0" + y="0" + class="st0 st1 st2 st3" + id="tspan13">a</tspan><tspan + x="54.5" + y="0" + class="st0 st1 st2 st4" + id="tspan15">/</tspan><tspan + x="86.2" + y="0" + class="st0 st1 st2" + id="tspan17">c</tspan></text> +<linearGradient + id="SVGID_1_" + gradientUnits="userSpaceOnUse" + x1="20.6039" + y1="240.7292" + x2="297.3961" + y2="-21.7292"><stop + offset="0" + style="stop-color:#59FF7F" + id="stop20" /><stop + offset="1" + style="stop-color:#6BFBFF" + id="stop22" /></linearGradient><rect + x="0.5" + y="0.5" + class="st5" + width="317" + height="218" + id="rect24" /></g></g></switch></svg>
\ No newline at end of file diff --git a/images/HMI_HVAC_AC_Inactive.svg b/images/HMI_HVAC_AC_Inactive.svg new file mode 100644 index 0000000..1120747 --- /dev/null +++ b/images/HMI_HVAC_AC_Inactive.svg @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> + +<svg + xmlns:i="&ns_ai;" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="Layer_2" + x="0px" + y="0px" + viewBox="0 0 318 219" + style="enable-background:new 0 0 318 219;" + xml:space="preserve" + inkscape:version="0.91 r13725" + sodipodi:docname="HMI_HVAC_AC_Inactive.svg"><metadata + id="metadata25"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs23" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="2560" + inkscape:window-height="1464" + id="namedview21" + showgrid="false" + inkscape:zoom="1.0776256" + inkscape:cx="-264.15254" + inkscape:cy="109.5" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="Layer_2" /><style + type="text/css" + id="style3"> + .st0{fill:#848286;} + .st1{font-family:'Roboto-Light';} + .st2{font-size:88.6888px;} + .st3{letter-spacing:3;} + .st4{letter-spacing:-3;} + .st5{fill:none;stroke:#848286;stroke-miterlimit:10;} +</style><switch + id="switch5"><g + i:extraneous="self" + id="g7"><g + id="g9"><text + transform="matrix(1 5.460000e-03 -5.460000e-03 1 90.8639 132.3301)" + id="text11"><tspan + x="0" + y="0" + class="st0 st1 st2 st3" + id="tspan13">a</tspan><tspan + x="54.5" + y="0" + class="st0 st1 st2 st4" + id="tspan15">/</tspan><tspan + x="86.2" + y="0" + class="st0 st1 st2" + id="tspan17">c</tspan></text> +<rect + x="0.5" + y="0.5" + class="st5" + width="317" + height="218" + id="rect19" /></g></g></switch></svg>
\ No newline at end of file diff --git a/images/images.qrc b/images/images.qrc new file mode 100644 index 0000000..5c3c803 --- /dev/null +++ b/images/images.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/images"> + <file>HMI_HVAC_AC_Active.svg</file> + <file>HMI_HVAC_AC_Inactive.svg</file> + </qresource> +</RCC> diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..2adca37 --- /dev/null +++ b/main.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2016 The Qt Company Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <QtCore/QDebug> +#include <QtGui/QGuiApplication> +#include <QtQml/QQmlApplicationEngine> +#include <QtQuickControls2/QQuickStyle> + +#ifdef HAVE_LIBHOMESCREEN +#include <libhomescreen.hpp> +#endif + +int main(int argc, char *argv[]) +{ +#ifdef HAVE_LIBHOMESCREEN + LibHomeScreen libHomeScreen; + + if (!libHomeScreen.renderAppToAreaAllowed(0, 1)) { + qWarning() << "renderAppToAreaAllowed is denied"; + return -1; + } +#endif + + QGuiApplication app(argc, argv); + + QQuickStyle::setStyle("AGL"); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/Controls.qml"))); + + return app.exec(); +} + |