summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/qtcluster/qtiviclusterdata.cpp
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2017-06-20 17:25:47 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2017-06-21 05:51:52 +0000
commit4b98aa3e37e460eda6cfb7b78a374422870ce0c1 (patch)
treedd39abc1c3d9416ba99d0dd4ed134a4ad6c8b33b /doc/src/snippets/qtcluster/qtiviclusterdata.cpp
parente70bc6d3f052d3f0343f38964a33f6805bc354a8 (diff)
Add Qt Cluster Demo
This a a demo of s simple digital instrument cluster. The demo comes with two skins. By default the demo will use the so called hybrid skin. If the argument "sports" is provided the application will use the sports skin instead. To be able to preview the custom components in the Qt Quick Designer the option: Tools > Options > Qt Quick > Qt Quick Designer > Use QML emulation layer which is built by the selected has to be enabled in Qt Creator. Change-Id: I7d06220062e1fffd6c6849c962bd4f6592d051de Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'doc/src/snippets/qtcluster/qtiviclusterdata.cpp')
-rw-r--r--doc/src/snippets/qtcluster/qtiviclusterdata.cpp344
1 files changed, 344 insertions, 0 deletions
diff --git a/doc/src/snippets/qtcluster/qtiviclusterdata.cpp b/doc/src/snippets/qtcluster/qtiviclusterdata.cpp
new file mode 100644
index 000000000..8c78326db
--- /dev/null
+++ b/doc/src/snippets/qtcluster/qtiviclusterdata.cpp
@@ -0,0 +1,344 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Pelagicore AG
+** Contact: http://www.qt.io/ or http://www.pelagicore.com/
+**
+** This file is part of the QtIVI module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3-PELAGICORE$
+** Commercial License Usage
+** Licensees holding valid commercial Qt IVI 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 Pelagicore. For licensing terms
+** and conditions, contact us at http://www.pelagicore.com.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: LGPL-3.0
+**
+****************************************************************************/
+
+#include "qtiviclusterdata.h"
+
+QtIVIClusterData::QtIVIClusterData(QObject* parent)
+ : QObject(parent),
+ m_vehicleSpeed(0),
+ m_latitude(0),
+ m_longitude(0),
+ m_direction(0),
+ m_flatTire(false),
+ m_doorOpen(false),
+ m_lightFailure(false),
+ m_reverse(false),
+ m_leftTurnLight(false),
+ m_rightTurnLight(false),
+ m_headLight(false),
+ m_parkLight(false),
+ m_carId(1),
+ m_brake(false),
+ m_engineTemp(60),
+ m_oilTemp(0.0),
+ m_oilPressure(0),
+ m_batteryPotential(80.0),
+ m_gasLevel(67.0),
+ m_rpm(4000),
+ m_gear(1)
+{
+ connectToServiceObject();
+}
+
+void QtIVIClusterData::connectToServiceObject()
+{
+ initializeZones();
+}
+
+ZonedProperties *QtIVIClusterData::zoneAt(const QString &zone) const
+{
+ foreach (ZonedProperties *f, m_zoneFeatures)
+ if (f->zone() == zone)
+ return f;
+ return 0;
+}
+
+void QtIVIClusterData::initializeZones()
+{
+
+}
+
+QVariantMap QtIVIClusterData::zoneFeatureMap() const
+{
+ return m_zoneFeatureMap;
+
+}
+
+double QtIVIClusterData::vehicleSpeed() const
+{
+ return m_vehicleSpeed;
+}
+
+double QtIVIClusterData::latitude() const
+{
+ return m_latitude;
+}
+
+double QtIVIClusterData::longitude() const
+{
+ return m_longitude;
+}
+
+double QtIVIClusterData::direction() const
+{
+ return m_direction;
+}
+
+bool QtIVIClusterData::flatTire() const
+{
+ return m_flatTire;
+}
+
+bool QtIVIClusterData::doorOpen() const
+{
+ return m_doorOpen;
+}
+
+bool QtIVIClusterData::lightFailure() const
+{
+ return m_lightFailure;
+}
+
+bool QtIVIClusterData::reverse() const
+{
+ return m_reverse;
+}
+
+bool QtIVIClusterData::leftTurnLight() const
+{
+ return m_leftTurnLight;
+}
+
+bool QtIVIClusterData::rightTurnLight() const
+{
+ return m_rightTurnLight;
+}
+
+bool QtIVIClusterData::headLight() const
+{
+ return m_headLight;
+}
+
+bool QtIVIClusterData::parkLight() const
+{
+ return m_parkLight;
+}
+
+int QtIVIClusterData::carId() const
+{
+ return m_carId;
+}
+
+bool QtIVIClusterData::brake() const
+{
+ return m_brake;
+}
+
+int QtIVIClusterData::engineTemp() const
+{
+ return m_engineTemp;
+}
+
+double QtIVIClusterData::oilTemp() const
+{
+ return m_oilTemp;
+}
+
+int QtIVIClusterData::oilPressure() const
+{
+ return m_oilPressure;
+}
+
+double QtIVIClusterData::batteryPotential() const
+{
+ return m_batteryPotential;
+}
+
+double QtIVIClusterData::gasLevel() const
+{
+ return m_gasLevel;
+}
+
+int QtIVIClusterData::rpm() const
+{
+ return m_rpm;
+}
+
+int QtIVIClusterData::gear() const
+{
+ return m_gear;
+}
+
+void QtIVIClusterData::classBegin()
+{
+
+}
+
+void QtIVIClusterData::componentComplete()
+{
+
+}
+
+void QtIVIClusterData::onVehicleSpeedChanged(double vehicleSpeed, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_vehicleSpeed = vehicleSpeed;
+ emit vehicleSpeedChanged(vehicleSpeed);
+}
+
+void QtIVIClusterData::onLatitudeChanged(double latitude, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_latitude = latitude;
+ emit latitudeChanged(latitude);
+}
+
+void QtIVIClusterData::onLongitudeChanged(double longitude, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_longitude = longitude;
+ emit longitudeChanged(longitude);
+}
+
+void QtIVIClusterData::onDirectionChanged(double direction, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_direction = direction;
+ emit directionChanged(direction);
+}
+
+void QtIVIClusterData::onFlatTireChanged(bool flatTire, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_flatTire = flatTire;
+ emit flatTireChanged(flatTire);
+}
+
+void QtIVIClusterData::onDoorOpenChanged(bool doorOpen, const QString &zone)
+{
+ ZonedProperties *z = zoneAt(zone);
+ if (z) {
+ z->setDoorOpen(doorOpen);
+ }
+}
+
+void QtIVIClusterData::onLightFailureChanged(bool lightFailure, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_lightFailure = lightFailure;
+ emit lightFailureChanged(lightFailure);
+}
+
+void QtIVIClusterData::onReverseChanged(bool reverse, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_reverse = reverse;
+ emit reverseChanged(reverse);
+}
+
+void QtIVIClusterData::onLeftTurnLightChanged(bool leftTurnLight, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_leftTurnLight = leftTurnLight;
+ emit leftTurnLightChanged(leftTurnLight);
+}
+
+void QtIVIClusterData::onRightTurnLightChanged(bool rightTurnLight, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_rightTurnLight = rightTurnLight;
+ emit rightTurnLightChanged(rightTurnLight);
+}
+
+void QtIVIClusterData::onHeadLightChanged(bool headLight, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_headLight = headLight;
+ emit headLightChanged(headLight);
+}
+
+void QtIVIClusterData::onParkLightChanged(bool parkLight, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_parkLight = parkLight;
+ emit parkLightChanged(parkLight);
+}
+
+void QtIVIClusterData::onCarIdChanged(int carId, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_carId = carId;
+ emit carIdChanged(carId);
+}
+
+void QtIVIClusterData::onBrakeChanged(bool brakeOn, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_brake = brakeOn;
+ emit brakeChanged(brakeOn);
+}
+
+void QtIVIClusterData::onEngineTempChanged(int engineTemp, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_engineTemp = engineTemp;
+ emit engineTempChanged(engineTemp);
+}
+
+void QtIVIClusterData::onOilTempChanged(double oilTemp, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_oilTemp = oilTemp;
+ emit oilTempChanged(oilTemp);
+}
+
+void QtIVIClusterData::onOilPressureChanged(int oilPressure, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_oilPressure = oilPressure;
+ emit oilPressureChanged(oilPressure);
+}
+
+void QtIVIClusterData::onBatteryPotentialChanged(double batteryPotential, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_batteryPotential = batteryPotential;
+ emit batteryPotentialChanged(batteryPotential);
+}
+
+void QtIVIClusterData::onGasLevelChanged(double gasLevel, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_gasLevel = gasLevel;
+ emit gasLevelChanged(gasLevel);
+}
+
+void QtIVIClusterData::onRpmChanged(int rpm, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_rpm = rpm;
+ emit rpmChanged(rpm);
+}
+
+void QtIVIClusterData::onGearChanged(int gear, const QString &zone)
+{
+ Q_UNUSED(zone);
+ m_gear = gear;
+ emit gearChanged(gear);
+}