C

Qt Quick Ultralite Automotive Cluster Demo

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt 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 http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
pragma Singleton import QtQuick 2.15 QtObject { id: mainmodel enum ClusterMode { ModeNormal, ModeSport, ModeEco } property int clusterMode: MainModel.ModeNormal property bool introSequenceStarted: false property bool introSequenceCompleted: false property int speedLimitWarning: SpeedLimitValues.Slow readonly property int initialOdo: 300 property int odo: initialOdo readonly property int fullRange: 895 property int range: fullRange - odo property real speed: 0 property real rpm: 0 property string gearShiftText: "P" property real temp: 0 readonly property real initialFuelLevel: range / fullRange readonly property real initialBatteryLevel: 0.2 property real fuelLevel: initialFuelLevel property real batteryLevel: initialBatteryLevel readonly property int maxSpeed: Units.longDistanceUnitToKilometers(Units.maximumSpeed) readonly property int maxRpm: 7000 property bool telltalesVisible: true property bool clusterVisible: true property real clusterOpacity: 0 property real gaugesOpacity: 0 readonly property int clusterOpacityChangeDuration: 750 readonly property int gaugesOpacityChangeDuration: 750; readonly property int gaugesValueChangeDurationNormal: 500 readonly property int gaugesValueChangeDurationSlow: 1250 property int gaugesValueChangeDuration: gaugesValueChangeDurationNormal property bool laneAssistCarMoving: false signal triggerLaneAssist(int side) signal triggerGuideArrow(int index) onClusterModeChanged : { if (MainModel.introSequenceCompleted) { if (clusterMode == MainModel.ModeNormal) { ConnectivityService.clusterMode = ConnectivityService.NormalMode } else { ConnectivityService.clusterMode = ConnectivityService.SportMode ConnectivityService.currentMenu = ConnectivityService.None } SettingsMenuModel.notifyConnectivityService() } } onIntroSequenceStartedChanged: { if (introSequenceStarted) { ConnectivityService.clusterMode = ConnectivityService.IntroMode; } } onIntroSequenceCompletedChanged: { if (introSequenceCompleted) { ConnectivityService.clusterMode = ConnectivityService.NormalMode; ConnectivityService.currentMenu = ConnectivityService.Media; } } }