diff options
Diffstat (limited to 'Cluster/qml')
25 files changed, 2777 insertions, 0 deletions
diff --git a/Cluster/qml/BottomPanel.qml b/Cluster/qml/BottomPanel.qml new file mode 100644 index 0000000..c6c5681 --- /dev/null +++ b/Cluster/qml/BottomPanel.qml @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 + +Item { + property int iconMargin: 10 + + anchors.horizontalCenter: parent.horizontalCenter + width: bottomPanelImage.width + height: bottomPanelImage.height + + Image { + id: bottomPanelImage + source: "../images/BottomPanel.png" + } + + TurnIndicator { + direction: Qt.LeftArrow + anchors.verticalCenter: textTime.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 250 + active: ValueSource.turnSignal & Qt.LeftArrow + } + + Image { + id: iconCoolant + source: ValueSource.engineTemperature >= 100.0 ? "../images/Icon_Coolant_ON.png" + : "../images/Icon_Coolant_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.right: iconBattery.left + } + + Image { + id: iconBattery + source: ValueSource.batteryLevel <= 25.0 ? "../images/Icon_Battery_ON.png" + : "../images/Icon_Battery_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.right: iconFuel.left + } + + Image { + id: iconFuel + source: ValueSource.fuelLevel <= 20.0 ? "../images/Icon_Fuel_ON.png" + : "../images/Icon_Fuel_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.right: iconParkingBrake.left + } + + Image { + id: iconParkingBrake + source: ValueSource.parkingBrake ? "../images/Icon_ParkingBrake_ON.png" + : "../images/Icon_ParkingBrake_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.right: textTime.left + anchors.rightMargin: 5 + } + + Text { + id: textTime + text: ValueSource.time + font.pixelSize: 24 //18 + color: "white" + anchors.centerIn: parent + } + + Image { + id: iconLowbeam + source: ValueSource.lowBeam ? "../images/Icon_LowBeam_ON.png" + : "../images/Icon_LowBeam_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.left: textTime.right + anchors.leftMargin: iconMargin + } + + Image { + id: iconTyre + source: ValueSource.flatTire ? "../images/Icon_TyreMalfunction_ON.png" + : "../images/Icon_TyreMalfunction_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.left: iconLowbeam.right + } + + Image { + id: iconLamp + source: ValueSource.lightFailure ? "../images/Icon_BulbFailure_ON.png" + : "../images/Icon_BulbFailure_OFF.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.left: iconTyre.right + } + + Image { + id: iconSeatbelt + //source: ValueSource.seatBelt ? "../images/Icon_SeatBelt_ON.png" + // : "../images/Icon_SeatBelt_OFF.png" + source: "../images/Icon_SeatBelt_ON.png" + anchors.verticalCenter: textTime.verticalCenter + anchors.left: iconLamp.right + } + + TurnIndicator { + direction: Qt.RightArrow + anchors.verticalCenter: textTime.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 250 + active: ValueSource.turnSignal & Qt.RightArrow + } +} diff --git a/Cluster/qml/CarModel.qml b/Cluster/qml/CarModel.qml new file mode 100644 index 0000000..b553461 --- /dev/null +++ b/Cluster/qml/CarModel.qml @@ -0,0 +1,551 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt3D.Core 2.0 +import Qt3D.Render 2.0 +import Qt3D.Extras 2.0 +import QtQuick 2.7 as Quick +import com.qtcompany.clusterscenehelper 1.0 + +Entity +{ + id: carModelEntity + + property bool isReady: false + property bool hidden: true + property int width + property int height + property real carRotation: -30.0 + property var previousComponent: undefined + property var previousMaterial + property vector3d defaultCameraPosition: Qt.vector3d(0.0, 5.0, 25.0) + property vector3d defaultLightPosition: Qt.vector3d(0.0, 20.0, 20.0) + property vector3d lightPosition: defaultLightPosition + property vector3d cameraPos: defaultCameraPosition + property vector3d lightPos: defaultLightPosition + + property vector3d welcomeEndPosition: Qt.vector3d(-5.0, 5.0, 25.0) + property vector3d lightEndPosition: Qt.vector3d(20.0, 40.0, -10.0) + property vector3d statusEndPosition: Qt.vector3d(0.0, 40.0, 1.0) + + property real lightPosMultiplier: 1.75 + + property int door_left: 1 + property int door_right: 2 + property int door_trunk: 4 + property int door_hood: 8 + + property bool highlighting: false + property bool doorAction: false + + property int highlightType: 0 + property int defaultHighlight: 99 + + // Preset camera positions for highlights + // Light positions can use the same vectors, but with a multiplier to move it further or closer + // Lamp highlights + property vector3d positionFrontLeftHigh: Qt.vector3d(5.0, 4.0, 15.0) // Left headlight + property vector3d positionFrontRightHigh: Qt.vector3d(-5.0, 4.0, 15.0) // Right headlight + property vector3d positionFrontLeftLow: Qt.vector3d(3.0, 2.0, 15.0) // Left day light + property vector3d positionFrontRightLow: Qt.vector3d(-3.0, 2.0, 15.0) // Right day light + property vector3d positionRearLeft: Qt.vector3d(5.0, 5.0, -15.0) // Left tail light + property vector3d positionRearRight: Qt.vector3d(-5.0, 5.0, -15.0) // Right tail light + // Tire highlights + property vector3d positionLeftRear: Qt.vector3d(10.0, 2.0, -12.5) + property vector3d positionLeftFront: Qt.vector3d(10.0, 2.0, 12.5) + property vector3d positionRightRear: Qt.vector3d(-10.0, 2.0, -12.5) + property vector3d positionRightFront: Qt.vector3d(-10.0, 2.0, 12.5) + // Door highlights + property vector3d positionLeft: Qt.vector3d(35.0, 10.0, 0.0) // Doors on the left + property vector3d positionRight: Qt.vector3d(-35.0, 10.0, 0.0) // Doors on the right + property vector3d positionTop: Qt.vector3d(0.0, 40.0, 1.0) // Doors on both sides + property vector3d positionBack: Qt.vector3d(0.0, 20.0, -20.0) // Trunk + property vector3d positionFront: Qt.vector3d(0.0, 20.0, 20.0) // Hood + + property color defaultBodyColor: "white"//Qt.rgba(0.5270588, 0.03137255, 0.03137255, 1.0) + + property int topViewAnimationDuration: 2500 + + Camera { + id: cameraCar + projectionType: CameraLens.PerspectiveProjection + fieldOfView: 45 + aspectRatio: carModelEntity.width / carModelEntity.height + nearPlane: 0.1 + farPlane: 100.0 + position: defaultCameraPosition + upVector: Qt.vector3d(0.0, 1.0, 0.0) + viewCenter: Qt.vector3d(0.0, 0.0, 0.0) + } + + Entity { + components: [ + Transform { + translation: lightPosition + }, + PointLight { + color: "white" + intensity: 1.0 + } + ] + } + + RenderSettings { + activeFrameGraph: TechniqueFilter { + matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ] + id: carFramegraph + + RenderSurfaceSelector { + id: surfaceSelector + Viewport { + normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0) + + CameraSelector { + camera: cameraCar + NoDraw { + enabled: hidden + } + FrustumCulling { + ClearBuffers { + clearColor: "transparent" + buffers : ClearBuffers.ColorDepthBuffer + } + } + } + } + } + } + } + + // Materials for the parts that need highlighting + PhongMaterial { + id: bodyMaterial + ambient: "black" + diffuse: defaultBodyColor + specular: Qt.rgba(0.7686275, 0.6196079, 0.3568628, 1.0) + shininess: 164 + } + + PhongMaterial { + id: bodyMaterialHighlight + ambient: "black" + diffuse: "orange" + shininess: 164 + } + + PhongMaterial { + id: tireMaterial + ambient: Qt.rgba(0.05, 0.05, 0.05, 1.0) + specular: Qt.rgba(0.594, 0.594, 0.594, 1.0) + diffuse: "black" + shininess: 51 + } + + PhongMaterial { + id: tireMaterialHighlight + ambient: "orange" + specular: Qt.rgba(0.594, 0.594, 0.594, 1.0) + diffuse: "black" + shininess: 51 + } + + DiffuseMapMaterial { + id: lampsMaterial + ambient: Qt.rgba(0.3, 0.3, 0.3, 1.0) + specular: Qt.rgba(0.279, 0.279, 0.279, 1.0) + diffuse: "models/Map11.jpg" + shininess: 31 + } + + // bodyMaterialHighlight is used for lamp highlight + + // Materials for the parts that do not otherwise work correctly + Material { + id: transparentGlassMaterial + + parameters: [ + Parameter { name: "alpha"; value: 0.95 }, + Parameter { name: "ka"; value: Qt.vector3d(0.0, 0.0, 0.0) }, + Parameter { name: "kd"; value: Qt.vector3d(0.1608937, 0.16512, 0.154057) }, + Parameter { name: "ks"; value: Qt.vector3d(1.0, 1.0, 1.0) }, + Parameter { name: "shininess"; value: 33 } + ] + + effect: DefaultAlphaEffect { + sourceRgbArg: BlendEquationArguments.SourceColor + destinationRgbArg: BlendEquationArguments.OneMinusSourceColor + } + } + +// PhongAlphaMaterial { +// id: transparentGlassMaterial +// diffuse: Qt.rgba(0.1608937, 0.16512, 0.154057, 1.0) +// specular: Qt.rgba(1.0, 1.0, 1.0, 1.0) +// alpha: 0.75 +// shininess: 33 +// } + + PhongMaterial { + id: interiorMaterial + ambient: "black" + diffuse: Qt.rgba(0.17, 0.17, 0.18, 1.0) + shininess: 10 + } + + SceneHelper { + id: sceneHelper + } + + Entity { + Transform { + id: scenePosition + matrix: { + var m = Qt.matrix4x4() + m.scale(1.15) + return m + } + } + + Entity { + id: carModel + + Transform { + id: carTransform + matrix: { + var m = Qt.matrix4x4() + m.rotate(carRotation, Qt.vector3d(0, 1, 0)) + m.rotate(-90, Qt.vector3d(1, 0, 0)) + return m + } + } + + SceneLoader { + id: modelLoader + source: "models/sportscar.qgltf" + property var lampParts: [ "headlight_right", "headlight_left", "daylight_right", + "daylight_left", "taillight_left", "taillight_right" ] + property var bodyParts: [ "body", "door_left", "door_right", + "trunk", "hood" ] + property var transparentGlassParts: [ "d_glass" ] + property var tireParts: [ "tire_front_left", "tire_front_right", + "tire_rear_left", "tire_rear_right" ] + property var interiorParts: [ "interior" ] + + // Note: If there are problems with transparent materials etc. check that you have + // exported the Collada file used to create the qgltf binary files using the following + // options in Blender (in Collada options category): + // - Triangulate (off) + // - Use Object Instances (on) + // - Sort by Object name (on) + // If just setting those is not enough, try changing the object names so that the + // object will be loaded in a different order. + // Use the following syntax for qgltf.exe: + // qgltf.exe file.dae -b -S + + onStatusChanged: { + if (status === SceneLoader.Ready) { + sceneHelper.addMaterials(modelLoader, bodyMaterial, bodyParts) + sceneHelper.addMaterials(modelLoader, transparentGlassMaterial, + transparentGlassParts) + sceneHelper.addMaterials(modelLoader, interiorMaterial, interiorParts) + // Comment out if running standalone.. + sceneHelper.addMaterial(modelLoader, lampsMaterial, lampParts[0]) + sceneHelper.addMaterial(modelLoader, lampsMaterial, lampParts[1]) + sceneHelper.addMaterial(modelLoader, lampsMaterial, lampParts[2]) + sceneHelper.addMaterial(modelLoader, lampsMaterial, lampParts[3]) + sceneHelper.addMaterial(modelLoader, lampsMaterial, lampParts[4]) + sceneHelper.addMaterial(modelLoader, lampsMaterial, lampParts[5]) + // ..Comment out if running standalone + sceneHelper.addMaterials(modelLoader, tireMaterial, tireParts) + //floorPlane.enabled = true // Disable floor for now + } + } + } + + components: [carTransform, modelLoader] + } + + Entity { + id: floorPlane + enabled: false + + DiffuseMapMaterial { + id: planeMaterial + ambient: Qt.rgba(0, 0, 0, 1.0) + specular: Qt.rgba(0, 0, 0, 1.0) + diffuse: "../images-optimized/SportCarFloorShadow.png" + } + + Transform { + id: planeRotation + matrix: { + var m = Qt.matrix4x4() + m.rotate(carRotation, Qt.vector3d(0, 1, 0)) + return m + } + } + + PlaneMesh { + id: planeMesh + width: 70 + height: 70 + } + + components: [planeMesh, planeMaterial, planeRotation] + } + + components: [ scenePosition ] + } + + function highlightItem(idx) { + carRotationAnimation.stop() + carResetRotationAnimation.start() + highlighting = true + var highlightComponent + var highlightMaterial + var originalMaterial + + switch (idx) { + case 1: + highlightComponent = "tire_front_left" + highlightMaterial = tireMaterialHighlight + originalMaterial = tireMaterial + lightPos = positionLeftFront.times(lightPosMultiplier) + cameraPos = positionLeftFront + break + case 2: + highlightComponent = "tire_front_right" + highlightMaterial = tireMaterialHighlight + originalMaterial = tireMaterial + lightPos = positionRightFront.times(lightPosMultiplier) + cameraPos = positionRightFront + break + case 3: + highlightComponent = "tire_rear_right" + highlightMaterial = tireMaterialHighlight + originalMaterial = tireMaterial + lightPos = positionRightRear.times(lightPosMultiplier) + cameraPos = positionRightRear + break + case 4: + highlightComponent = "tire_rear_left" + highlightMaterial = tireMaterialHighlight + originalMaterial = tireMaterial + lightPos = positionLeftRear.times(lightPosMultiplier) + cameraPos = positionLeftRear + break + case 5: + highlightComponent = "headlight_left" + highlightMaterial = bodyMaterialHighlight + originalMaterial = lampsMaterial + lightPos = positionFrontLeftHigh.times(lightPosMultiplier) + cameraPos = positionFrontLeftHigh + break + case 6: + highlightComponent = "headlight_right" + highlightMaterial = bodyMaterialHighlight + originalMaterial = lampsMaterial + lightPos = positionFrontRightHigh.times(lightPosMultiplier) + cameraPos = positionFrontRightHigh + break + case 7: + highlightComponent = "daylight_right" + highlightMaterial = bodyMaterialHighlight + originalMaterial = lampsMaterial + lightPos = positionFrontRightLow.times(lightPosMultiplier) + cameraPos = positionFrontRightLow + break + case 8: + highlightComponent = "daylight_left" + highlightMaterial = bodyMaterialHighlight + originalMaterial = lampsMaterial + lightPos = positionFrontLeftLow.times(lightPosMultiplier) + cameraPos = positionFrontLeftLow + break + case 9: + highlightComponent = "taillight_left" + highlightMaterial = bodyMaterialHighlight + originalMaterial = lampsMaterial + lightPos = positionRearLeft.times(lightPosMultiplier) + cameraPos = positionRearLeft + break + case 10: + highlightComponent = "taillight_right" + highlightMaterial = bodyMaterialHighlight + originalMaterial = lampsMaterial + lightPos = positionRearRight.times(lightPosMultiplier) + cameraPos = positionRearRight + break + default: + lightPos = defaultLightPosition + cameraPos = defaultCameraPosition + } + + if (previousComponent !== undefined) + sceneHelper.replaceMaterial(modelLoader, previousComponent, previousMaterial) + + if (highlightComponent !== undefined) + sceneHelper.replaceMaterial(modelLoader, highlightComponent, highlightMaterial) + + previousComponent = highlightComponent + previousMaterial = originalMaterial + } + + function highlightOpenDoors(openDoors) { + carRotationAnimation.stop() + carResetRotationAnimation.start() + highlighting = true + var openLeft = false + var openRight = false + var openBack = false + var openFront = false + + // Check with bitwise operators, as they can be open in any combination + if (openDoors & door_left) { + sceneHelper.replaceMaterial(modelLoader, "door_left", bodyMaterialHighlight) + openLeft = true + } else { + sceneHelper.replaceMaterial(modelLoader, "door_left", bodyMaterial) + } + + if (openDoors & door_right) { + sceneHelper.replaceMaterial(modelLoader, "door_right", bodyMaterialHighlight) + openRight = true + } else { + sceneHelper.replaceMaterial(modelLoader, "door_right", bodyMaterial) + } + + if (openDoors & door_trunk) { + sceneHelper.replaceMaterial(modelLoader, "trunk", bodyMaterialHighlight) + openBack = true + } else { + sceneHelper.replaceMaterial(modelLoader, "trunk", bodyMaterial) + } + + if (openDoors & door_hood) { + openFront = true + sceneHelper.replaceMaterial(modelLoader, "hood", bodyMaterialHighlight) + } else { + sceneHelper.replaceMaterial(modelLoader, "hood", bodyMaterial) + } + + if (openRight && openLeft || openBack && openFront) { + lightPos = positionTop.times(0.5) + cameraPos = positionTop + } else if (openRight) { + lightPos = positionRight.times(0.33) + lightPos.y += 15.0 + cameraPos = positionRight + } else if (openLeft) { + lightPos = positionLeft.times(0.33) + lightPos.y += 15.0 + cameraPos = positionLeft + } else if (openBack) { + lightPos = positionBack.times(0.75) + cameraPos = positionBack + } else if (openFront) { + lightPos = positionFront.times(1.0) + cameraPos = positionFront + } else { + lightPos = defaultLightPosition + cameraPos = defaultCameraPosition + } + } + + onCameraPosChanged: { + // Update both camera and light positions + cameraAnimation.to = cameraPos + lightAnimation.to = lightPos + cameraAnimation.restart() + lightAnimation.restart() + } + + Quick.PropertyAnimation { + running: false + id: cameraAnimation + target: cameraCar + property: "position" + duration: topViewAnimationDuration + easing.type: Easing.InOutQuad + } + + Quick.PropertyAnimation { + running: false + id: lightAnimation + target: carModelEntity + property: "lightPosition" + duration: topViewAnimationDuration * 4//1000 + easing.type: Easing.Linear + } + + Quick.RotationAnimation on carRotation { + id: carRotationAnimation + running: false + from: -30.0 + to: 180.0 + duration: topViewAnimationDuration + easing.type: Easing.InOutQuad + } + + function resetHighlight() { + if (doorAction) + highlightOpenDoors(0) + else + highlightItem(defaultHighlight) + doorAction = false + } + + function highlightLamp() { + highlightType = Math.floor(Math.random() * 6) + 5 + highlightItem(highlightType) + return highlightType + } + + function highlightTire() { + highlightType = Math.floor(Math.random() * 4) + 1 + highlightItem(highlightType) + return highlightType + } + + function startWelcomeAnimation() { + cameraAnimation.duration = 1000 + cameraPos = welcomeEndPosition + idleTimer.restart() + } + + Quick.Timer { + id: idleTimer + interval: 2000 + onTriggered: { + cameraAnimation.duration = topViewAnimationDuration + lightPos = lightEndPosition + cameraPos = statusEndPosition + carRotationAnimation.restart() + } + } +} diff --git a/Cluster/qml/CenterView.qml b/Cluster/qml/CenterView.qml new file mode 100644 index 0000000..0f4edda --- /dev/null +++ b/Cluster/qml/CenterView.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import models 1.0 +import controls 1.0 +import utils 1.0 + +Item { + anchors.fill: parent + property real defaultScale: 1.0 + property var previousView: initialView + + Image { + id: initialView + source: Style.symbol("john") + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 400 + } + + Item { + id: musicContainer + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 270 + width: 354 + height: 354 + default property alias content: musiccontainer.children + + Item { + id: musiccontainer + anchors.fill: parent + } + } + + Item { + id: contactContainer + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 350 + width: 136 + height: 250 + default property alias content: contactcontainer.children + + Item { + id: contactcontainer + anchors.fill: parent + } + } + + Item { + id: carinfoContainer + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 340 + width: 265 + height: 250 + default property alias content: carinfocontainer.children + + Item { + id: carinfocontainer + anchors.fill: parent + } + } + + Item { + id: calendarContainer + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 340 + width: 220 + height: 250 + default property alias content: calendarcontainer.children + + Item { + id: calendarcontainer + anchors.fill: parent + } + } + + Connections { + target: ApplicationManagerInterface + onClusterWidgetReady: { + handleWidgetChange(category, item) + } + onClusterWidgetActivated: { + handleWidgetChange(category, item) + } + } + + PropertyAnimation { + id: shrinkCenter + property: "scale" + to: 0.0 + running: false + duration: 500 + onStopped: { + target.visible = false + } + } + + function handleWidgetChange(category, item) { + var container + if (category === "media") + container = musicContainer + else if (category === "contacts") + container = contactContainer + else if (category === "carinfo") + container = carinfoContainer + else if (category === "calendar") + container = calendarContainer + if (previousView !== container) { + // TODO: Find out why these commented-out animations cause flashing on HW, and fix it + //container.scale = defaultScale + container.visible = true + previousView.visible = false + //shrinkCenter.target = previousView + previousView = container + //shrinkCenter.start() + item.parent = container + container.content = item + item.width = container.width + item.height = container.height + } + } +} diff --git a/Cluster/qml/Dashboard.qml b/Cluster/qml/Dashboard.qml new file mode 100644 index 0000000..260f989 --- /dev/null +++ b/Cluster/qml/Dashboard.qml @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.7 +import service.valuesource 1.0 +import "gauges" + +Image +{ + id: dashboardEntity + // for static dashboard + source: "../images/Cluster8Gauges.png" + // for 2.5D lighting effect + //source: "../images/Cluster8GaugesPlain.png" + anchors.fill: parent + + property bool parentVisible: parent.visible + + property real timeScaleMultiplier: 1.0 + property bool startupAnimationsFinished: false + + property alias bottomPanelY: bottompanel.y + property alias needleRotation: tachometer.tachometerNeedleRotation + + onNeedleRotationChanged: speedometer.speedometerNeedleRotation = needleRotation / 40. + + // + // Fuelmeter + // + FuelMeter {} + + // + // Batterymeter + // + BatteryMeter {} + + // + // Consumptionmeter + // + ConsumptionMeter {} + + // + // Temperaturemeter + // + TemperatureMeter {} + + // + // Turbometer + // + TurboMeter {} + + // + // Fpsmeter + // + FpsMeter {} + + // + // Bottom Panel + // + BottomPanel { + id: bottompanel + y: 720 + } + + // + // Gauge center pieces + // + Image { + // for static dashboard + source: "../images/ClusterGaugeCenters.png" + // for 2.5D lighting effect + // source: "../images/ClusterGaugeCentersPlain.png" + anchors.fill: parent + } + + // These two must be after center pieces, as they print text on top of the image + + // + // Speedometer + // + SpeedoMeter { + id: speedometer + } + + // + // Tachometer + // + TachoMeter { + id: tachometer + } + + // + // 2.5D illusion for the 2.5D dashboard + // + + // for speed-based effect + //property real speed: ValueSource.kph + //property int xlight: speed * 5 + // for animated effect +// property int xlight: -960 +// property int ylight: 0 +// property real angle: -10 + +// ShaderEffect { +// id: bumpShader +// anchors.fill: parent +// //property vector3d lightPos: Qt.vector3d(xlight, ylight, 0) // If using speed-based effect +// property vector3d lightPos: Qt.vector3d(xlight, ylight, 0) // If using the animations below +// property var source: ShaderEffectSource { +// sourceItem: dashboardEntity +// } +// property var bump: Image { +// source: "../images/Gauges_normal.png" +// } +// property real angle: dashboardEntity.angle * Math.PI / 180.0 +// fragmentShader: +// " +// uniform sampler2D source; +// uniform sampler2D bump; +// varying vec2 qt_TexCoord0; +// uniform float qt_Opacity; +// uniform vec3 lightPos; +// uniform float angle; + +// highp vec3 dbModel(const highp vec3 norm) +// { +// // Transform position, normal, and tangent to eye coords +// vec3 normal = vec3(0, 1, 0); +// vec3 tangent = vec3(1, 0, -1); +// vec3 position = vec3(960, -4000, 540); + +// // Calculate binormal vector +// vec3 binormal = normalize(cross(normal, tangent)); + +// // Construct matrix to transform from eye coords to tangent space +// mat3 tangentMatrix = mat3 ( +// tangent.x, binormal.x, normal.x, +// tangent.y, binormal.y, normal.y, +// tangent.z, binormal.z, normal.z); + +// // Transform light direction and view direction to tangent space +// vec3 s = lightPos - position; +// vec3 lightDir = normalize(tangentMatrix * s); + +// vec3 v = -position; +// vec3 viewDir = normalize(tangentMatrix * v); + +// float oldX = lightDir.x; +// lightDir.x = (lightDir.x * cos(angle) - lightDir.z * sin(angle)); +// lightDir.z = (oldX * sin(angle) + lightDir.z * cos(angle)); + +// vec3 ka = vec3(1.0, 1.0, 1.0); +// vec3 ks = vec3(0.25, 0.25, 0.25); +// float shininess = 50.0; + +// // Reflection of light direction about normal +// vec3 r = reflect(-lightDir, norm); + +// vec3 diffuseColor = texture2D(source, qt_TexCoord0).rgb; + +// // Calculate the ambient contribution +// vec3 ambient = ka * diffuseColor; + +// // Calculate the diffuse contribution +// float sDotN = max(dot(lightDir, norm), 0.0); +// vec3 diffuse = diffuseColor * sDotN; + +// // Calculate the specular highlight contribution +// vec3 specular = vec3(0.0); +// if (sDotN > 0.0) +// specular = ks * pow(max(dot(r, viewDir), 0.0), shininess); + +// //return specular; +// //return ambient; +// //return ambient + diffuse; +// return diffuse + specular; +// //return ambient + specular; +// //return ambient + diffuse + specular; +// } + +// void main() +// { +// vec4 normal = 2.0 * texture2D(bump, qt_TexCoord0) - vec4(1.0); +// vec3 result = dbModel(normalize(normal.xyz)); +// gl_FragColor = qt_Opacity * vec4(result, 1.0); +// } +// " +// } + +// SequentialAnimation { +// running: true +// loops: Animation.Infinite +// PropertyAnimation { +// target: dashboardEntity +// property: "xlight" +// from: -960 +// to: 1920 +// duration: 15000 +// easing.type: Easing.InOutQuad +// } +// PropertyAnimation { +// target: dashboardEntity +// property: "xlight" +// from: 1920 +// to: -960 +// duration: 15000 +// easing.type: Easing.InOutQuad +// } +// } + + // + // Startup animations + // + SequentialAnimation { + id: speedometerStartupAnimations + running: false + + SmoothedAnimation { + target: dashboardEntity + property: "bottomPanelY" + from: 720 + to: 603 + duration: 1000 * timeScaleMultiplier + easing.type: Easing.InCirc + } + + SmoothedAnimation { + target: dashboardEntity + property: "needleRotation" + from: 0.0 + to: -8000.0 + duration: 1000 * timeScaleMultiplier + easing.type: Easing.InCubic + } + + SmoothedAnimation { + target: dashboardEntity + property: "needleRotation" + from: -8000.0 + to: 0.0 + duration: 1000 * timeScaleMultiplier + easing.type: Easing.OutCubic + } + + ScriptAction { + script: { + startupAnimationsFinished = true + ValueSource.startAnimations = true + } + } + } + + // Just a hack for now; wait for the fader to finish + onParentVisibleChanged: { + if (visible) + initTimer.start() + } + + Timer { + id: initTimer + running: false + interval: 1000 + onTriggered: speedometerStartupAnimations.start() + } +} diff --git a/Cluster/qml/DashboardFrame.qml b/Cluster/qml/DashboardFrame.qml new file mode 100644 index 0000000..24fc94c --- /dev/null +++ b/Cluster/qml/DashboardFrame.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import Qt3D.Core 2.0 + +Item { + id: root + width: 1920 + height: 1080//720 + anchors.top: parent.top + + property real faderOpacity: 1.0 + + Loader { + id: welcomeLoader + source: "DashboardView.qml" + width: root.width + height: 720//root.height + onLoaded: { + initialFade.start() + } + } + + property bool welcomeReady: welcomeLoader.status === Loader.Ready && welcomeLoader.item.isReady + + onWelcomeReadyChanged: { + faderAnimation.start() + } + + Loader { + id: dashLoader + source: "DashboardView.qml" + visible: false + active: true + width: root.width + height: 720//root.height + } + + Rectangle { + id: fader + color: "black" + anchors.fill: root + opacity: faderOpacity + } + + PropertyAnimation { + id: initialFade + target: root + property: "faderOpacity" + from: 1.0 + to: 0.0 + duration: 1000 + } + + SequentialAnimation { + id: faderAnimation + running: false + + PropertyAnimation { + target: root + property: "faderOpacity" + from: 0.0 + to: 1.0 + duration: 500 + } + ScriptAction { + script: { + welcomeLoader.visible = false + dashLoader.visible = true + } + } + PropertyAnimation { + target: root + property: "faderOpacity" + from: 1.0 + to: 0.0 + duration: 500 + } + } + + // Note: Use if cluster is displayed on 1080p screen + Rectangle { + color: "black" + anchors.bottom: parent.bottom + height: 360 + width: 1920 + + Image { + source: "../images/Built_with_Qt_RGB_logo_white.png" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.margins: 30 + } + } +} diff --git a/Cluster/qml/DashboardView.qml b/Cluster/qml/DashboardView.qml new file mode 100644 index 0000000..ced2387 --- /dev/null +++ b/Cluster/qml/DashboardView.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import utils 1.0 + +Image +{ + id: dashboardEntity + source: "../images/BackgroundGradient.png" + width: 1920 + height: 720 + + Dashboard { + id: dash + anchors.fill: parent + } + + CenterView { + id: centerview + } + + Component.onCompleted: Style.clusterWidgetReady = true +} diff --git a/Cluster/qml/FpsCounter.qml b/Cluster/qml/FpsCounter.qml new file mode 100644 index 0000000..a98550e --- /dev/null +++ b/Cluster/qml/FpsCounter.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 + +Item { + id: fpscounter + property real fpsNow: 0 + property bool running: false + property alias fpsVisible: fpsLabel.visible + property int fpsInterval: 1000 + property alias color: fpsLabel.color + + Item { + id: swapTest + property real t + NumberAnimation on t { + running: fpscounter.running + from: 0 + to: 1 + duration: fpsInterval + loops: Animation.Infinite + } + onTChanged: { + ++fpsTimer.tick + } + } + + Timer { + id: fpsTimer + running: fpscounter.running + repeat: true + interval: fpsInterval + property var lastFrameTime: new Date() + property int tick + + onTriggered: { + var now = new Date() + var dt = now.getTime() - lastFrameTime.getTime() + lastFrameTime = now + var fps = (tick * fpsInterval) / dt + fpsNow = Math.round(fps * 10) / 10 + tick = 0 + + if (fpsVisible) + fpsLabel.updateYerself() + } + } + + Text { + id: fpsLabel + visible: false + + anchors.centerIn: parent + font.pixelSize: 10 + color: "white" + + function updateYerself() { + text = Math.round(fpsNow) + } + } +} diff --git a/Cluster/qml/TurnIndicator.qml b/Cluster/qml/TurnIndicator.qml new file mode 100644 index 0000000..71bba6d --- /dev/null +++ b/Cluster/qml/TurnIndicator.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.6 + +Item { + property int direction: Qt.NoArrow + property bool active: false + property bool flashing: false + + width: 47 + height: 52 + + Timer { + id: flashTimer + interval: 500 + running: (direction !== Qt.NoArrow) + repeat: true + onTriggered: flashing = !flashing + } + + Image { + id: turnIndicatorImage + source: "../images/Icon_TurnLeft_ON.png" + anchors.fill: parent + mirror: direction === Qt.RightArrow + visible: active && flashing + } + + Image { + source: "../images/Icon_TurnLeft_OFF.png" + anchors.fill: parent + mirror: direction === Qt.RightArrow + visible: !turnIndicatorImage.visible + } +} diff --git a/Cluster/qml/WelcomeDriver.qml b/Cluster/qml/WelcomeDriver.qml new file mode 100644 index 0000000..7a4d601 --- /dev/null +++ b/Cluster/qml/WelcomeDriver.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import controls 1.0 +import utils 1.0 + +Item { + anchors.fill: parent + + property string welcomeText: "GOOD MORNING" + + Column { + anchors.centerIn: parent + spacing: 10 + + Image { + id: driverImage + anchors.horizontalCenter: parent.horizontalCenter + source: Style.symbol("john") + opacity: 0.0 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + } + + Text { + id: driverText + anchors.horizontalCenter: parent.horizontalCenter + text: welcomeText + font.bold: true + font.pixelSize: 20 + color: "white" + horizontalAlignment: Text.AlignHCenter + opacity: 0.0 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + } + + Text { + id: driverSecondRowText + anchors.horizontalCenter: parent.horizontalCenter + text: "John" + font.pixelSize: 30 + color: "#EF2973" + horizontalAlignment: Text.AlignHCenter + opacity: 0.0 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + } + } + + Component.onCompleted: { + var currentDate = new Date() + var hours = currentDate.getHours() + if (hours > 0 && hours < 3) + welcomeText = "GOOD LATE EVENING" + else if (hours >= 3 && hours < 12) + welcomeText = "GOOD MORNING" + else if (hours >= 12 && hours < 18) + welcomeText = "GOOD AFTERNOON" + else if (hours >= 18 && hours < 24) + welcomeText = "GOOD EVENING" + + driverText.opacity = 1.0 + driverRecognition.start() + } + + Timer { + id: driverRecognition + running: false + interval: 1000 + onTriggered: { + driverImage.opacity = 1.0 + driverSecondRowText.opacity = 1.0 + } + } +} diff --git a/Cluster/qml/WelcomeInfoNote.qml b/Cluster/qml/WelcomeInfoNote.qml new file mode 100644 index 0000000..0d63b9b --- /dev/null +++ b/Cluster/qml/WelcomeInfoNote.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.7 + +Column { + property alias firstline: tripInfoAmount.text + property alias firstlineunit: tripInfoUnit.text + property alias secondline: tripInfoText.text + + spacing: 3 + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 3 + + Text { + id: tripInfoAmount + text: "9:40" + font.pixelSize: 18 + color: "white" + horizontalAlignment: Text.AlignHCenter + } + + Text { + id: tripInfoUnit + text: "km" + font.pixelSize: 12 + color: "white" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignTop + } + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + id: tripInfoText + text: "Start time" + font.pixelSize: 12 + color: "white" + horizontalAlignment: Text.AlignHCenter + } +} diff --git a/Cluster/qml/WelcomeStatus.qml b/Cluster/qml/WelcomeStatus.qml new file mode 100644 index 0000000..379387d --- /dev/null +++ b/Cluster/qml/WelcomeStatus.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 + +Item { + anchors.fill: parent + + Column { + anchors.centerIn: parent + spacing: 20 + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 10 + + Image { + id: statusImage + source: "../images/welcomeview_status_icon.png" + } + + Text { + id: statusText + anchors.verticalCenter: statusImage.verticalCenter + text: "READY FOR THE ROAD" + font.pixelSize: 18 + color: "white" + } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 20 + + Rectangle { + id: line + height: 2 + width: 205 + color: "gray" + } + + Text { + text: "Status" + font.pixelSize: 18 + color: "white" + anchors.verticalCenter: line.verticalCenter + } + + Rectangle { + height: 2 + width: 205 + color: "gray" + } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 50 + + WelcomeInfoNote { + firstline: ValueSource.totalDistance.toString() + firstlineunit: "KM" + secondline: "Total\ndistance" + } + + WelcomeInfoNote { + firstline: ValueSource.kmSinceCharge.toString() + firstlineunit: "KM" + secondline: "Since last\ncharge" + } + + WelcomeInfoNote { + firstline: ValueSource.avRangePerCharge.toString() + firstlineunit: "KM" + secondline: "Average\nrange/charge" + } + + WelcomeInfoNote { + firstline: ValueSource.energyPerKm.toString() + firstlineunit: "WH" + secondline: "energy/km" + } + } + + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + height: 2 + width: 500 + color: "gray" + } + } +} diff --git a/Cluster/qml/WelcomeStatusNote.qml b/Cluster/qml/WelcomeStatusNote.qml new file mode 100644 index 0000000..042f89b --- /dev/null +++ b/Cluster/qml/WelcomeStatusNote.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.7 + +Item { + property string position: "right" + property alias text: statusNoteText.text + property string icon + property string highlight + + Column { + spacing: 5 + + Row { + id: statusNoteRow + spacing: 5 + + Image { + id: statusNotePointerImage + height: 66 + fillMode: Image.Pad + source: position === "left" ? icon : highlight + anchors.verticalCenter: statusNoteImage.verticalCenter + } + + Rectangle { + id: statusNoteLineImage + height: 2 + width: 100 + color: "gray" + anchors.verticalCenter: statusNoteImage.verticalCenter + } + + Image { + id: statusNoteImage + height: 66 + fillMode: Image.Pad + source: position === "right" ? icon : highlight + } + } + + Text { + id: statusNoteText + anchors.right: position === "right" ? statusNoteRow.right : undefined + anchors.left: position === "left" ? statusNoteRow.left : undefined + style: Text.RichText + font.pixelSize: 14 + horizontalAlignment: Text.AlignHCenter + } + } +} diff --git a/Cluster/qml/WelcomeTripSummary.qml b/Cluster/qml/WelcomeTripSummary.qml new file mode 100644 index 0000000..b9bb647 --- /dev/null +++ b/Cluster/qml/WelcomeTripSummary.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 + +Item { + anchors.fill: parent + + Column { + anchors.centerIn: parent + spacing: 20 + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 10 + + Image { + id: tripSummaryImage + source: "../images/welcomeview_trip_info_icon.png" + } + + Text { + id: tripSummaryText + anchors.verticalCenter: tripSummaryImage.verticalCenter + text: "TRIP SUMMARY" + font.pixelSize: 18 + color: "white" + } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 50 + + WelcomeInfoNote { + firstline: "9:40" + secondline: "Start time" + } + + WelcomeInfoNote { + firstline: "0:38" + secondline: "Duration" + } + + WelcomeInfoNote { + firstline: "58" + firstlineunit: "KM" + secondline: "Distance" + } + } + + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + height: 2 + width: 400 + color: "gray" + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 50 + + WelcomeInfoNote { + firstline: "324" + firstlineunit: "WH" + secondline: "Average\nenergy/km" + } + + WelcomeInfoNote { + firstline: "18.7" + firstlineunit: "KWH" + secondline: "Total energy" + } + + WelcomeInfoNote { + firstline: "60" + firstlineunit: "KMH" + secondline: "Average\nspeed" + } + } + + Image { + // TODO: Image from route? + anchors.horizontalCenter: parent.horizontalCenter + source: "../images/welcomeview_trip_route.png" + } + } +} diff --git a/Cluster/qml/WelcomeView.qml b/Cluster/qml/WelcomeView.qml new file mode 100644 index 0000000..c1ade20 --- /dev/null +++ b/Cluster/qml/WelcomeView.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Scene3D 2.0 + +Image +{ + id: welcomeView + source: "../images/BackgroundGradient.png" + width: 1920 + height: 720 + + property alias hidden: carModel.hidden + property bool isReady: false + + Scene3D { + id: welcomeScene + width: welcomeView.width / 2 + height: welcomeView.height + multisample: true + + CarModel { + id: carModel + width: welcomeView.width + height: welcomeView.height + } + } + + Rectangle { + id: infoPane + anchors.top: welcomeView.top + anchors.bottom: welcomeView.bottom + anchors.right: welcomeView.right + anchors.left: welcomeScene.right + color: "transparent" + + Loader { + id: infoPaneLoader + anchors.fill: parent + source: "WelcomeDriver.qml" + active: true + } + } + + Image { + id: passengerDriver + source: "../images/welcomeview_passenger_icon.png" + opacity: 0.0 + scale: 2.0 + x: 410 + y: 330 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + Behavior on scale { + PropertyAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } + } + } + + Image { + id: passengerShotgun + source: "../images/welcomeview_passenger_icon.png" + opacity: 0.0 + scale: 2.0 + x: 500 + y: 330 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + Behavior on scale { + PropertyAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } + } + } + + Image { + id: passengerRearLeft + source: "../images/welcomeview_passenger_icon.png" + opacity: 0.0 + scale: 2.0 + x: 415 + y: 430 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + Behavior on scale { + PropertyAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } + } + } + + Image { + id: passengerRearRight + source: "../images/welcomeview_passenger_icon.png" + opacity: 0.0 + scale: 2.0 + x: 495 + y: 430 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + Behavior on scale { + PropertyAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } + } + } + + WelcomeStatusNote { + id: washerFluidNote + text: "<center><font color=\"#FFFFFF\">Washer fluid<br>Low <font color=\"#EF2973\">10%" + icon: "../images/status_washer_fluid_icon.png" + highlight: "../images/status_washer_fluid_highlight.png" + position: "right" + opacity: 0.0 + x: 535 + y: 200 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + } + + WelcomeStatusNote { + id: batteryLowNote + text: "<center><font color=\"#FFFFFF\">Battery low<br>Range <font color=\"#EF2973\">35KM" + icon: "../images/status_battery_icon.png" + highlight: "../images/status_battery_highlight.png" + position: "left" + opacity: 0.0 + x: 205 + y: 497 + Behavior on opacity { + PropertyAnimation { duration: 1000 } + } + } + + // Functions to control highlights from dashboard + function highlightLamp() { + var type = carModel.highlightLamp() + carModel.toggleIdleTimer(true) + resetModelTimer.restart() + return type + } + + function highlightDoors(doors) { + doorAction = true + carModel.doorAction = true + carModel.highlightOpenDoors(doors) + carModel.toggleIdleTimer(true) + resetModelTimer.restart() + } + + function highlightTire() { + var type = carModel.highlightTire() + carModel.toggleIdleTimer(true) + resetModelTimer.restart() + return type + } + + Timer { + running: true + interval: 6000 + onTriggered: { + infoPaneLoader.source = "WelcomeTripSummary.qml" + statusCheckTimer.start() + passengerDriver.opacity = 1.0 + passengerRearRight.opacity = 1.0 + passengerDriver.scale = 1.0 + passengerRearRight.scale = 1.0 + washerFluidNote.opacity = 1.0 + batteryLowNote.opacity = 1.0 + } + } + + Timer { + id: statusCheckTimer + running: false + interval: 5000 + onTriggered: { + infoPaneLoader.source = "WelcomeStatus.qml" + batteryLowNote.opacity = 0.0 + readyTimer.start() + } + } + + Component.onCompleted: { + carModel.startWelcomeAnimation() + } + + Timer { + id: readyTimer + running: false + interval: 5000 + onTriggered: { + isReady = true + } + } +} diff --git a/Cluster/qml/gauges/BatteryMeter.qml b/Cluster/qml/gauges/BatteryMeter.qml new file mode 100644 index 0000000..d6380a9 --- /dev/null +++ b/Cluster/qml/gauges/BatteryMeter.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 + +Item { + property real batterymeterNeedleRotation: -batteryValue * batteryDegreesPerValue + property real batteryValue: ValueSource.batteryLevel + property real maxValueAngle: 317 + property real minValueAngle: 225 + property real maximumValue: 100 + property real batteryDegreesPerValue: Math.abs((maxValueAngle - minValueAngle) / maximumValue) + + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin: 654 + anchors.topMargin: 140 + width: 162 + height: 10 + rotation: batterymeterNeedleRotation - 135 + + Image { + width: 54 + height: 5 + //opacity: 0.75 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } +} diff --git a/Cluster/qml/gauges/ConsumptionMeter.qml b/Cluster/qml/gauges/ConsumptionMeter.qml new file mode 100644 index 0000000..f2cbf39 --- /dev/null +++ b/Cluster/qml/gauges/ConsumptionMeter.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.7 +import service.valuesource 1.0 +import com.qtcompany.clustergaugefiller 1.0 + +Item { + property real consumptionValue: 2.0 + ValueSource.rpm / 444.45 + property real minValueAngle: 378 + property real maxValueAngle: 291 + property real minimumValue: 0 + property real maximumValue: 20 + + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: 365 + anchors.rightMargin: 413 + + GaugeFiller { + id: consumptionFiller + value: consumptionValue + anchors.fill: parent + numVertices: 64 + radius: 233 + fillWidth: 30 + color: "#EF2973" + opacity: 0.3 + minAngle: minValueAngle + maxAngle: maxValueAngle + minValue: minimumValue + maxValue: maximumValue + } + + Item { + width: 465 + height: 10 + rotation: consumptionFiller.angle - 72 + anchors.centerIn: parent + + Image { + width: 144 + height: 5 + //opacity: 0.75 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } + } +} diff --git a/Cluster/qml/gauges/FpsMeter.qml b/Cluster/qml/gauges/FpsMeter.qml new file mode 100644 index 0000000..b56739f --- /dev/null +++ b/Cluster/qml/gauges/FpsMeter.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 +import ".." + +Item { + id: fpsmeterNeedle + + property real fpsmeterNeedleRotation: fpsValue * fpsDegreesPerValue + property real fpsValue: Math.min(fpscounter.fpsNow, 60) // Limit to 60, as that's where the gauge ends + property real maxValueAngle: 314 + property real minValueAngle: 45 + property real maximumValue: 60 + property real fpsDegreesPerValue: Math.abs((maxValueAngle - minValueAngle) / maximumValue) + + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin: 887 + anchors.topMargin: 125 + width: 161 + height: 10 + rotation: fpsmeterNeedleRotation - 45 + + Image { + width: 56 + height: 5 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } + + FpsCounter { + id: fpscounter + rotation: fpsVisible ? -fpsmeterNeedle.rotation : 0 + anchors.top: parent.top + anchors.topMargin: 50 + anchors.horizontalCenter: parent.horizontalCenter + fpsVisible: false // Setting this to true prints fps on screen + running: startupAnimationsFinished + } + Behavior on fpsValue { + enabled: startupAnimationsFinished + PropertyAnimation { duration: fpscounter.fpsInterval } + } +} diff --git a/Cluster/qml/gauges/FuelMeter.qml b/Cluster/qml/gauges/FuelMeter.qml new file mode 100644 index 0000000..3393e4f --- /dev/null +++ b/Cluster/qml/gauges/FuelMeter.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 + +Item { + property real fuelmeterNeedleRotation: fuelValue * fuelDegreesPerValue + property real fuelValue: ValueSource.fuelLevel + property real maxValueAngle: 170 + property real minValueAngle: 10 + property real maximumValue: 100 + property real fuelDegreesPerValue: Math.abs((maxValueAngle - minValueAngle) / maximumValue) + + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin: 654 + anchors.topMargin: 140 + width: 158 + height: 10 + rotation: fuelmeterNeedleRotation - 80 + + Image { + width: 56 + height: 5 + //opacity: 0.75 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } +} diff --git a/Cluster/qml/gauges/SpeedoMeter.qml b/Cluster/qml/gauges/SpeedoMeter.qml new file mode 100644 index 0000000..67d43de --- /dev/null +++ b/Cluster/qml/gauges/SpeedoMeter.qml @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 +import com.qtcompany.clustergaugefiller 1.0 + +Item { + anchors.fill: parent + + property real speedometerNeedleRotation: 0.0 + property string speed: actualSpeed.toFixed().toString() + property real actualSpeed: startupAnimationsFinished + ? ValueSource.kph : -speedometerNeedleRotation + property real maxValueAngle: 305 + property real minValueAngle: 55 + property real minimumSpeed: 0 + property real maximumSpeed: 200 + + Item { + anchors.left: parent.left + anchors.leftMargin: 30 + width: 720 + height: 720 + + GaugeFiller { + id: speedFiller + value: actualSpeed + anchors.left: parent.left + anchors.top: parent.top + anchors.topMargin: 366 + anchors.leftMargin: 382 + radius: 232 + fillWidth: 8 + color: "#EF2973" + opacity: 0.6 + maxAngle: maxValueAngle + minAngle: minValueAngle + minValue: minimumSpeed + maxValue: maximumSpeed + } + } + + Item { + id: speedometerNeedle + width: 464 + height: 10 + rotation: speedFiller.angle - 35 + x: 180 + y: 361 + + Image { + opacity: 0.75 + width: 146 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } + } + + Row { + anchors.top: speedometerNeedle.bottom + anchors.topMargin: 120 + anchors.horizontalCenter: speedometerNeedle.horizontalCenter + spacing: 10 + + Text { + font.pixelSize: 24 + color:(ValueSource.gear === 0 && ValueSource.parkingBrake) ? "white" : "gray" + text: "P" + } + + Text { + font.pixelSize: 24 + //font.bold: ValueSource.gear === -1 + color: ValueSource.gear === -1 ? "white" : "gray" + text: "R" + } + + Text { + font.pixelSize: 24 + //font.bold: ValueSource.gear === 0 + color: (ValueSource.gear === 0 && !ValueSource.parkingBrake) ? "white" : "gray" + text: "N" + } + + Text { + font.pixelSize: 24 + //font.bold: ValueSource.gear === 1 + color: ValueSource.gear === 1 ? "white" : "gray" + text: "D" + } + } + + Text { + id: speedText + anchors.top: speedometerNeedle.top + anchors.topMargin: -40 + anchors.horizontalCenter: speedometerNeedle.horizontalCenter + font.pixelSize: 60 + color: "lightGray" + text: speed + } + + Text { + id: speedUnitText + anchors.top: speedText.bottom + anchors.horizontalCenter: speedometerNeedle.horizontalCenter + font.pixelSize: 24 + color: "lightGray" + text: "KM/H" + } +} diff --git a/Cluster/qml/gauges/TachoMeter.qml b/Cluster/qml/gauges/TachoMeter.qml new file mode 100644 index 0000000..3fbd2c1 --- /dev/null +++ b/Cluster/qml/gauges/TachoMeter.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 +import com.qtcompany.clustergaugefiller 1.0 + +Item { + anchors.fill: parent + + property real tachometerNeedleRotation: 0.0 + property string rpm: actualRPM.toFixed().toString() + property real actualRPM: startupAnimationsFinished + ? ValueSource.rpm : -tachometerNeedleRotation + property real minValueAngle: 55 + property real maxValueAngle: 255 + property real minimumRPM: 0 + property real maximumRPM: 8000 + + Item { + anchors.right: parent.right + anchors.rightMargin: 30 + width: 720 + height: 720 + + GaugeFiller { + id: rpmFiller + value: actualRPM + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: 369 + anchors.rightMargin: 380 + radius: 232 + fillWidth: 8 + color: "#EF2973" + opacity: 0.6 + minAngle: minValueAngle + maxAngle: maxValueAngle + minValue: minimumRPM + maxValue: maximumRPM + } + } + + Item { + id: tachometerNeedle + width: 468 + height: 10 + rotation: rpmFiller.angle - 35 + x: 1275 + y: 363 + + Image { + opacity: 0.75 + width: 147 + anchors.left: parent.left + anchors.leftMargin: 2 + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } + } + + Text { + id: textEco + anchors.top: tachometerNeedle.top + anchors.topMargin: -10 + anchors.horizontalCenter: tachometerNeedle.horizontalCenter + text: actualRPM > 4000 ? "POWER" : "ECO" + font.pixelSize: 24 + color: actualRPM <= 4000 ? "white" : "red" + } +} diff --git a/Cluster/qml/gauges/TemperatureMeter.qml b/Cluster/qml/gauges/TemperatureMeter.qml new file mode 100644 index 0000000..67c2a8a --- /dev/null +++ b/Cluster/qml/gauges/TemperatureMeter.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 +import com.qtcompany.clustergaugefiller 1.0 + +Item { + property real temperatureValue: ValueSource.engineTemperature + property real minValueAngle: 42.5 + property real maxValueAngle: -42.5 + property real minimumValue: 40 + property real maximumValue: 120 + + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin: 965 + anchors.topMargin: 90 + + GaugeFiller { + id: temperatureFiller + value: temperatureValue + anchors.fill: parent + numVertices: 64 + radius: 210 + fillWidth: 38 + color: "#EF2973" + opacity: 0.3 + minAngle: minValueAngle + maxAngle: maxValueAngle + minValue: minimumValue + maxValue: maximumValue + } + + Item { + width: 420 + height: 10 + rotation: temperatureFiller.angle - 47.5 + anchors.centerIn: parent + + Image { + width: 38 + height: 5 + //opacity: 0.75 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } + } +} diff --git a/Cluster/qml/gauges/TurboMeter.qml b/Cluster/qml/gauges/TurboMeter.qml new file mode 100644 index 0000000..c1a37cc --- /dev/null +++ b/Cluster/qml/gauges/TurboMeter.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import service.valuesource 1.0 + +Item { + property real turbometerNeedleRotation: turboValue * turboDegreesPerValue + property real turboValue: ValueSource.rpm / 2000. + property real maxValueAngle: 270 + property real minValueAngle: 0 + property real maximumValue: 4.0 + property real turboDegreesPerValue: Math.abs((maxValueAngle - minValueAngle) / maximumValue) + + anchors.left: parent.left + anchors.top: parent.top + anchors.leftMargin: 639 + anchors.topMargin: 140 + width: 164 + height: 10 + rotation: turbometerNeedleRotation - 90 + + Image { + width: 57 + height: 5 + //opacity: 0.75 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + source: "../../images/SpeedometerNeedle.png" + } +} diff --git a/Cluster/qml/models/Map11.jpg b/Cluster/qml/models/Map11.jpg Binary files differnew file mode 100644 index 0000000..5b81424 --- /dev/null +++ b/Cluster/qml/models/Map11.jpg diff --git a/Cluster/qml/models/sportscar.qgltf b/Cluster/qml/models/sportscar.qgltf Binary files differnew file mode 100644 index 0000000..7b30a0d --- /dev/null +++ b/Cluster/qml/models/sportscar.qgltf diff --git a/Cluster/qml/models/sportscar_1.bin b/Cluster/qml/models/sportscar_1.bin Binary files differnew file mode 100644 index 0000000..bf5f16d --- /dev/null +++ b/Cluster/qml/models/sportscar_1.bin |