summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2016-04-28 14:55:53 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2016-05-10 08:52:04 +0000
commit9e0e4f2a4ec83c961b6927c0e4ff8e266788e1bf (patch)
treefb46aa736b017862e2fbb2d25bd549ea285c9d50 /examples
parent4fc9c6ddf3c43ef46c3dfa9ed5bdc157ed0d64b3 (diff)
downloadqtivi-9e0e4f2a4ec83c961b6927c0e4ff8e266788e1bf.tar.gz
Added a WindowControl class
This class is intended to control all available physical windows(glass) in the car. It supports to open and close the windows as well as controlling the window heating system and controlling the sun blends Change-Id: I7083f0b3263e62a1c8ec7b7d18a98cb12e2f99c6 Task-number: QTAUTO-108 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/vehiclefunctions/vehiclefunctions.pro3
-rw-r--r--examples/vehiclefunctions/window_qml/WindowItem.qml211
-rw-r--r--examples/vehiclefunctions/window_qml/main.cpp64
-rw-r--r--examples/vehiclefunctions/window_qml/main.qml117
-rw-r--r--examples/vehiclefunctions/window_qml/qml.qrc6
-rw-r--r--examples/vehiclefunctions/window_qml/window_qml.pro10
6 files changed, 410 insertions, 1 deletions
diff --git a/examples/vehiclefunctions/vehiclefunctions.pro b/examples/vehiclefunctions/vehiclefunctions.pro
index 461c914..121e7e3 100644
--- a/examples/vehiclefunctions/vehiclefunctions.pro
+++ b/examples/vehiclefunctions/vehiclefunctions.pro
@@ -2,4 +2,5 @@ TEMPLATE = subdirs
SUBDIRS += \
climate_widget \
- climate_qml
+ climate_qml \
+ window_qml
diff --git a/examples/vehiclefunctions/window_qml/WindowItem.qml b/examples/vehiclefunctions/window_qml/WindowItem.qml
new file mode 100644
index 0000000..b289ac5
--- /dev/null
+++ b/examples/vehiclefunctions/window_qml/WindowItem.qml
@@ -0,0 +1,211 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtIVI module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Dialogs 1.2
+
+import QtIVIVehicleFunctions 1.0
+
+GroupBox {
+ property WindowControl zone
+
+ function stateToString(state) {
+ if (state === WindowControl.FullyOpen)
+ return "Fully Open";
+ else if (state === WindowControl.Open)
+ return "Open";
+ else
+ return "Closed";
+ }
+
+ ColumnLayout {
+ RowLayout {
+
+ enabled: zone.state.available
+ Label {
+ text: "Window state: "
+ }
+
+ Label {
+ text: stateToString(zone.state.value)
+ }
+ }
+
+ Button {
+ text: "open"
+ enabled: zone.state.available
+ onClicked: zone.open()
+ }
+
+ Button {
+ text: "close"
+ enabled: zone.state.available
+ onClicked: zone.close()
+ }
+
+ RowLayout {
+ GroupBox {
+ title: "Window blind"
+
+ ColumnLayout {
+ RowLayout {
+ enabled: zone.blindState.available
+
+ Label {
+ text: "State: "
+ }
+
+ Label {
+ text: stateToString(zone.blindState.value)
+ }
+ }
+
+ ExclusiveGroup {
+ id: blindGroup
+ }
+
+ RadioButton {
+ text: "Open"
+ exclusiveGroup: blindGroup
+ enabled: zone.blindMode.availableValues.indexOf(WindowControl.BlindOpen) !== -1
+ checked: zone.blindMode.value === WindowControl.BlindOpen
+ onCheckedChanged: {
+ if (checked)
+ zone.blindMode.value = WindowControl.BlindOpen
+ }
+ }
+
+ RadioButton {
+ text: "Closed"
+ exclusiveGroup: blindGroup
+ enabled: zone.blindMode.availableValues.indexOf(WindowControl.BlindClosed) !== -1
+ checked: zone.blindMode.value === WindowControl.BlindClosed
+ onCheckedChanged: {
+ if (checked)
+ zone.blindMode.value = WindowControl.BlindClosed
+ }
+ }
+
+ RadioButton {
+ text: "Automatic"
+ exclusiveGroup: blindGroup
+ enabled: zone.blindMode.availableValues.indexOf(WindowControl.AutoBlind) !== -1
+ checked: zone.blindMode.value === WindowControl.AutoBlind
+ onCheckedChanged: {
+ if (checked)
+ zone.blindMode.value = WindowControl.AutoBlind
+ }
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Heater"
+
+ ColumnLayout {
+
+ RowLayout {
+ enabled: zone.heater.available
+
+ Label {
+ text: "Running: "
+ }
+
+ Label {
+ text: zone.heater.value
+ }
+ }
+
+ ExclusiveGroup {
+ id: heaterGroup
+ }
+
+ RadioButton {
+ text: "On"
+ exclusiveGroup: heaterGroup
+ enabled: zone.heaterMode.availableValues.indexOf(WindowControl.HeaterOn) !== -1
+ checked: zone.heaterMode.value === WindowControl.HeaterOn
+ onCheckedChanged: {
+ if (checked)
+ zone.heaterMode.value = WindowControl.HeaterOn
+ }
+ }
+
+ RadioButton {
+ text: "Off"
+ exclusiveGroup: heaterGroup
+ enabled: zone.heaterMode.availableValues.indexOf(WindowControl.HeaterOff) !== -1
+ checked: zone.heaterMode.value === WindowControl.HeaterOff
+ onCheckedChanged: {
+ if (checked)
+ zone.heaterMode.value = WindowControl.HeaterOff
+ }
+ }
+
+ RadioButton {
+ text: "Automatic"
+ exclusiveGroup: heaterGroup
+ enabled: zone.heaterMode.availableValues.indexOf(WindowControl.AutoHeater) !== -1
+ checked: zone.heaterMode.value === WindowControl.AutoHeater
+ onCheckedChanged: {
+ if (checked)
+ zone.heaterMode.value = WindowControl.AutoHeater
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/vehiclefunctions/window_qml/main.cpp b/examples/vehiclefunctions/window_qml/main.cpp
new file mode 100644
index 0000000..422d692
--- /dev/null
+++ b/examples/vehiclefunctions/window_qml/main.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtIVI module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/examples/vehiclefunctions/window_qml/main.qml b/examples/vehiclefunctions/window_qml/main.qml
new file mode 100644
index 0000000..5831d70
--- /dev/null
+++ b/examples/vehiclefunctions/window_qml/main.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtIVI module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.1
+import QtQuick.Dialogs 1.2
+
+import QtIVIVehicleFunctions 1.0
+
+ApplicationWindow {
+ title: "Window Control"
+ visible: true
+
+ WindowControl {
+ id: windowControl
+ discoveryMode: WindowControl.AutoDiscovery
+ }
+
+ ColumnLayout {
+ WindowItem {
+ title: "Roof"
+ anchors.horizontalCenter: parent.horizontalCenter
+ zone: windowControl.zoneAt.Roof
+ }
+
+ Grid {
+ id: grid
+ columns: 2
+ rows: 2
+ WindowItem {
+ title: "Front Left Zone"
+ zone: windowControl.zoneAt.FrontLeft
+ }
+ WindowItem {
+ title: "Front Right Zone"
+ zone: windowControl.zoneAt.FrontRight
+ }
+ WindowItem {
+ title: "Rear Left Zone"
+ zone: windowControl.zoneAt.RearLeft
+ }
+ WindowItem {
+ title: "Rear Right Zone"
+ zone: windowControl.zoneAt.RearRight
+ }
+ }
+
+ WindowItem {
+ title: "Rear"
+ anchors.horizontalCenter: parent.horizontalCenter
+ zone: windowControl.zoneAt.Rear
+ }
+ }
+
+ MessageDialog {
+ id: messageDialog
+ title: "Auto Discovery Failed !"
+ text: "No WindowControl Backend available"
+ icon: StandardIcon.Critical
+ }
+
+ Component.onCompleted: {
+ if (!windowControl.isValid)
+ messageDialog.open()
+ }
+}
diff --git a/examples/vehiclefunctions/window_qml/qml.qrc b/examples/vehiclefunctions/window_qml/qml.qrc
new file mode 100644
index 0000000..4bb0efb
--- /dev/null
+++ b/examples/vehiclefunctions/window_qml/qml.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>WindowItem.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/vehiclefunctions/window_qml/window_qml.pro b/examples/vehiclefunctions/window_qml/window_qml.pro
new file mode 100644
index 0000000..370208f
--- /dev/null
+++ b/examples/vehiclefunctions/window_qml/window_qml.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += qml quick widgets
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =