diff options
author | Janne Virranmäki <janne.virranmaki@siili.com> | 2017-12-04 11:14:38 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2017-12-12 10:04:14 +0000 |
commit | d3e5e853b4c1d05f9b2c16fef959ff1fdad9eff5 (patch) | |
tree | dff64f6f0579d84ce66d2271ee9bc2fe7dbdac82 /qml/2D | |
parent | 737e167f0cd9012ed88246a7e3a85458dad47388 (diff) |
Change-Id: I9d01217933c28c334193c5b8ec1d00f89ac4d3da
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'qml/2D')
-rw-r--r-- | qml/2D/CarContainer.qml | 120 | ||||
-rw-r--r-- | qml/2D/ClusterGradient.qml | 207 | ||||
-rw-r--r-- | qml/2D/Gauges.qml | 444 | ||||
-rw-r--r-- | qml/2D/GaugesForm.ui.qml | 237 | ||||
-rw-r--r-- | qml/2D/Navigation.qml | 89 | ||||
-rw-r--r-- | qml/2D/SpeedNeedle.qml | 75 | ||||
-rw-r--r-- | qml/2D/TachoNeedle.qml | 75 |
7 files changed, 1247 insertions, 0 deletions
diff --git a/qml/2D/CarContainer.qml b/qml/2D/CarContainer.qml new file mode 100644 index 0000000..d3f1130 --- /dev/null +++ b/qml/2D/CarContainer.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtMultimedia 5.9 + +Item { + id: carContainer + width: 680 + height: width + + property string videoSrc: redTheme ? "qrc:/videos/car.avi" : "qrc:/videos/carblue.avi" + property string imageSrc: redTheme ? "qrc:/icons/2D/CarOverview.png" : + "qrc:/icons/2D/CarOverviewBlue.png" + + Component.onCompleted: { + videOutput.start(); + } + + Image { + id: carImage + width: 700; + height: width + anchors.centerIn: parent + fillMode: Image.PreserveAspectFit + source: imageSrc + opacity: 0.0 + + Behavior on opacity { + NumberAnimation { duration: 200 } + } + } + + VideoOutput { + id: videOutput + anchors.fill: parent + source: mediaPlayer + + MediaPlayer { + id: mediaPlayer + source: videoSrc + autoLoad: false + loops: 1 + + property int passess: 0 + + onStopped: carImage.opacity = 1.0; + onPositionChanged: { + if (passess === 4) { + curtain.opacity = 0.0; + } else { + passess++; + } + } + } + + function start() { mediaPlayer.play() } + function stop() { mediaPlayer.stop() } + function seek(position) { mediaPlayer.seek(position); } + } + + Rectangle { + id: curtain + anchors.fill: parent + color: "black" + opacity: 1.0 + + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + } + +} diff --git a/qml/2D/ClusterGradient.qml b/qml/2D/ClusterGradient.qml new file mode 100644 index 0000000..0e3d209 --- /dev/null +++ b/qml/2D/ClusterGradient.qml @@ -0,0 +1,207 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtGraphicalEffects 1.0 + +Item { + id: root + + width: 100 + height: 100 + + property double topAndBottomCurtainHeight: 100 + property double leftAndRightCurtainWidth: 100 + + property double topGradientHeight: 200 + property double leftGradientWidth: 700 + property double rightGradientWidth: 300 + property double bottomGradientHeight: 100 + + property string curtainColor: "black" + property string gradientStartColor: "black" + property string gradientStopColor: "transparent" + + property double gradientTopStopPoint: 0.5 + property double gradientLeftStopPoint: 0.6 + property double gradientRightStopPoint: 0.8 + property double gradientBottomStopPoint: 0.8 + + function fadeIn() { + fadeInAnimation.start(); + } + function fadeOut() { + fadeOutAnimation.start(); + } + + // Top gradient + Rectangle { + id: top + anchors.top: parent.top + width: parent.width + height: topAndBottomCurtainHeight + color: curtainColor + + LinearGradient { + width: parent.width + height: topGradientHeight + anchors.top: parent.bottom + start: Qt.point(0, 0) + end: Qt.point(0, height) + gradient: Gradient { + GradientStop { position: 0.0; color: gradientStartColor } + GradientStop { position: gradientTopStopPoint; color: gradientStopColor } + } + } + } + + // Left gradient + Rectangle { + id: left + width: leftAndRightCurtainWidth + height: parent.height + anchors.left: parent.left + color: curtainColor + + LinearGradient { + width: leftGradientWidth + height: parent.height + anchors.left: parent.right + start: Qt.point(0, 0) + end: Qt.point(width, 0) + gradient: Gradient { + GradientStop { position: 0.0; color: gradientStartColor } + GradientStop { position: gradientLeftStopPoint; color: gradientStopColor } + } + } + } + + // Right gradient + Rectangle { + id: right + width: leftAndRightCurtainWidth + height: parent.height + anchors.right: parent.right + color: curtainColor + + LinearGradient { + width: rightGradientWidth + height: parent.height + anchors.right: parent.left + start: Qt.point(0, 0) + end: Qt.point(width, 0) + gradient: Gradient { + GradientStop { position: 0.0; color: gradientStopColor } + GradientStop { position: gradientRightStopPoint; color: gradientStartColor } + } + } + } + + // Bottom gradient + Rectangle { + id: bottom + width: parent.width + height: topAndBottomCurtainHeight + anchors.bottom: parent.bottom + color: curtainColor + + LinearGradient { + width: parent.width + height: bottomGradientHeight + anchors.bottom: parent.top + start: Qt.point(0, 0) + end: Qt.point(0, height) + gradient: Gradient { + GradientStop { position: 0.0; color: gradientStopColor } + GradientStop { position: gradientBottomStopPoint; color: gradientStartColor } + } + } + } + + Rectangle { + id: viewFiller + anchors.fill: parent + opacity: 1.0 + color: "black" + } + + SequentialAnimation { + id: fadeInAnimation + running: false + loops: 1 + + PauseAnimation { duration: 300 } + ParallelAnimation { + PropertyAnimation { + target: viewFiller + properties: "opacity" + from: 1.0 + to: 0.0 + duration: 300 + } + } + } + SequentialAnimation { + id: fadeOutAnimation + running: false + loops: 1 + + PauseAnimation { duration: 300 } + ParallelAnimation { + PropertyAnimation { + target: viewFiller + properties: "opacity" + from: 0.0 + to: 1.0 + duration: 300 + } + } + } +} diff --git a/qml/2D/Gauges.qml b/qml/2D/Gauges.qml new file mode 100644 index 0000000..4000ef3 --- /dev/null +++ b/qml/2D/Gauges.qml @@ -0,0 +1,444 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtGraphicalEffects 1.0 + +GaugesForm { + id: root + + property string tachoUnit: "rpm" + property string tachoUnitSpec: " x 1000" + property string speedUnit: useMetric ? "kph" : "mph" + property string needleSrc: "qrc:/icons/2D/NeedleBg.png" + property string tachoImageSrc: redTheme ? "qrc:/icons/2D/TachoMeterBg.png" : + "qrc:/icons/2D/TachoMeterBgBlue.png" + property string kphSpeedImageSrc: redTheme ? "qrc:/icons/2D/SpeedMeterBg.png" : + "qrc:/icons/2D/SpeedMeterBgBlue.png" + property string mphSpeedImageSrc: redTheme ? "qrc:/icons/2D/MphSpeedMeterBg.png" : + "qrc:/icons/2D/MphSpeedMeterBgBlue.png" + property string speedImageSrc: useMetric ? kphSpeedImageSrc : mphSpeedImageSrc + + property int vehicleSpeed: 0 + property int vehicleRpm: 0 + + property int slowDuration: 500 + property int fastDuration: 100 + + signal gaugeClicked() + + Component.onCompleted: { + speedNeedleSpeed = vehicleSpeed; + tachoText = vehicleSpeed; + speedText = vehicleSpeed; + } + + Behavior on speedUnit { + SequentialAnimation { + NumberAnimation { + target: speedImage + properties: "scale" + to: 0.3 + duration: fastDuration + } + NumberAnimation { + target: speedImage + properties: "scale" + to: 1.0 + duration: slowDuration + } + } + } + + MouseArea { + id: tachoMouse + anchors.fill: tachoNumRect + onClicked: { root.gaugeClicked(); } + } + + MouseArea { + id: speedMouse + anchors.fill: speedNumRect + onClicked: { root.gaugeClicked(); } + } + + states: [ + State { + name: "Driving"; + + AnchorChanges { + target: tachoMeter + anchors.left: root.left + anchors.verticalCenter: root.verticalCenter + } + PropertyChanges { + target: tachoMeter + anchors.verticalCenterOffset: 0 + anchors.rightMargin: 0 + } + AnchorChanges { + target: speedMeter + anchors.right: root.right + anchors.verticalCenter: root.verticalCenter + } + PropertyChanges { + target: speedMeter + anchors.verticalCenterOffset: 0 + anchors.leftMargin: 0 + } + }, + State { + name: "Navigation"; + + AnchorChanges { + target: tachoMeter + anchors.left: root.left + anchors.verticalCenter: root.verticalCenter + } + PropertyChanges { + target: tachoMeter + anchors.verticalCenterOffset: 253 + anchors.leftMargin: -100 + } + AnchorChanges { + target: speedMeter + anchors.right: root.right + anchors.verticalCenter: root.verticalCenter + } + PropertyChanges { + target: speedMeter + anchors.verticalCenterOffset: 253 + anchors.rightMargin: -100 + } + } + ] + + transitions: [ + Transition { + from:"Driving" + to: "Navigation" + SequentialAnimation { + ParallelAnimation { + PropertyAnimation { + target: tachoNeedle + properties: "opacity" + from: 1.0 + to: 0.0 + duration: fastDuration + } + PropertyAnimation { + target: speedNeedle + properties: "opacity" + from: 1.0 + to: 0.0 + duration: fastDuration + } + } + ParallelAnimation { + PropertyAnimation { + target: tachoCorner + properties: "opacity" + from: 0.0 + to: 1.0 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "opacity" + from: 0.0 + to: 1.0 + duration: slowDuration + } + PropertyAnimation { + target: tachoMeter + properties: "scale" + from: 1.0 + to: 0.3 + duration: slowDuration + } + PropertyAnimation { + target: speedMeter + properties: "scale" + from: 1.0 + to: 0.3 + duration: slowDuration + } + PropertyAnimation { + target: tachoCorner + properties: "scale" + from: 3.0 + to: 1.0 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "scale" + from: 3.0 + to: 1.0 + duration: slowDuration + } + } + ParallelAnimation { + PropertyAnimation { + target: tachoNumRect + properties: "x" + from: 216 + to: 116 + duration: slowDuration + } + PropertyAnimation { + target: tachoNumRect + properties: "y" + from: 270 + to: 520 + duration: slowDuration + } + PropertyAnimation { + target: speedNumRect + properties: "x" + from: 1524 + to: 1624 + duration: slowDuration + } + PropertyAnimation { + target: speedNumRect + properties: "y" + from: 270 + to: 520 + duration: slowDuration + } + // Corners + PropertyAnimation { + target: tachoCorner + properties: "x" + from: 212 + to: 112 + duration: slowDuration + } + PropertyAnimation { + target: tachoCorner + properties: "y" + from: 266 + to: 516 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "x" + from: 1520 + to: 1620 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "y" + from: 266 + to: 516 + duration: slowDuration + } + AnchorAnimation { duration: slowDuration } + PropertyAnimation { + target: tachoMeter + properties: "scale" + from: 0.3 + to: 0.0 + duration: 2*slowDuration + } + PropertyAnimation { + target: speedMeter + properties: "scale" + from: 0.3 + to: 0.0 + duration: 2*slowDuration + } + } + } + }, + Transition { + from: "Navigation" + to: "Driving" + SequentialAnimation { + ParallelAnimation { + PropertyAnimation { + target: tachoNumRect + properties: "x" + from: 116 + to: 216 + duration: slowDuration + } + PropertyAnimation { + target: tachoNumRect + properties: "y" + from: 520 + to: 270 + duration: slowDuration + } + PropertyAnimation { + target: speedNumRect + properties: "x" + from: 1624 + to: 1524 + duration: slowDuration + } + PropertyAnimation { + target: speedNumRect + properties: "y" + from: 520 + to: 270 + duration:slowDuration + } + // Corners + PropertyAnimation { + target: tachoCorner + properties: "x" + from: 112 + to: 212 + duration: slowDuration + } + PropertyAnimation { + target: tachoCorner + properties: "y" + from: 516 + to: 266 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "x" + from: 1620 + to: 1520 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "y" + from: 516 + to: 266 + duration: slowDuration + } + AnchorAnimation { duration: slowDuration } + PropertyAnimation { + target: tachoMeter + properties: "scale" + from: 0.0 + to:0.3 + duration: slowDuration + } + PropertyAnimation { + target: speedMeter + properties: "scale" + from: 0.0 + to: 0.3 + duration: slowDuration + } + } + ParallelAnimation { + PropertyAnimation { + target: tachoMeter + properties: "scale" + from: 0.3 + to: 1.0 + duration: slowDuration + } + PropertyAnimation { + target: speedMeter + properties: "scale" + from: 0.3 + to: 1.0 + duration: slowDuration + } + PropertyAnimation { + target: tachoCorner + properties: "scale" + from: 1.0 + to: 3.0 + duration: slowDuration + } + PropertyAnimation { + target: speedCorner + properties: "scale" + from: 1.0 + to: 3.0 + duration: slowDuration + } + } + ParallelAnimation { + PropertyAnimation { + target: tachoNeedle + properties: "opacity" + from: 0.0 + to: 1.0 + duration: fastDuration + } + PropertyAnimation { target: speedNeedle + properties: "opacity" + from: 0.0 + to: 1.0 + duration: fastDuration + } + PropertyAnimation { + target: tachoCorner + properties: "opacity" + from: 1.0 + to: 0.0 + duration: fastDuration + } + PropertyAnimation { + target: speedCorner + properties: "opacity" + from: 1.0 + to: 0.0 + duration: fastDuration + } + } + } + } + ] +} diff --git a/qml/2D/GaugesForm.ui.qml b/qml/2D/GaugesForm.ui.qml new file mode 100644 index 0000000..fe9727f --- /dev/null +++ b/qml/2D/GaugesForm.ui.qml @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.7 + +Item { + id: root + + property alias tachoMeter: tachoMeter + property alias speedMeter: speedMeter + + property alias tachoText: tachoText.text + property alias speedText: speedText.text + + property alias tachoNeedleRpm: tachoNeedle.vehicleRpm + property alias speedNeedleSpeed: speedNeedle.vehicleSpeed + + property alias tachoNumRect: tachoNumRect + property alias speedNumRect: speedNumRect + property alias tachoCorner: tachoCorner + property alias speedCorner: speedCorner + property alias tachoNeedle: tachoNeedle + property alias speedNeedle: speedNeedle + property alias speedImage: speedImage + + width: 1920 + height: 720 + + Item { + id: tachoMeter + width: 612 + height: width + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + + Image { + id: tachoImage + x: 0 + y: 0 + width: parent.width + height: width + source: tachoImageSrc + visible: true + } + } // tachoMeter + + Rectangle { + id: tachoNumRect + x: 216 + y: 270 + width: 180 + height: width + color: "#000000" + radius: width + + Text { + id: tachoText + color: "#ffffff" + anchors.horizontalCenterOffset: 0 + verticalAlignment: Text.AlignBottom + horizontalAlignment: Text.AlignHCenter + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 60 + } + Text { + id: tachoUnitText + color: "#ffffff" + text: root.tachoUnit + anchors.horizontalCenterOffset: -35 + verticalAlignment: Text.AlignBottom + horizontalAlignment: Text.AlignHCenter + anchors.top: tachoText.bottom + anchors.topMargin: -5 + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20 + } + Text { + id: tachoUnitSpecText + color: "#ffffff" + text: root.tachoUnitSpec + verticalAlignment: Text.AlignBottom + horizontalAlignment: Text.AlignHCenter + anchors.verticalCenter: tachoUnitText.verticalCenter + anchors.left: tachoUnitText.right + anchors.rightMargin: 2 + font.pixelSize: 20 + } + z: 1000 + } + TachoNeedle { + id: tachoNeedle + x: 0 + y: 25 + width: 612 + height: width + z: tachoNumRect.z - 1 + } + Rectangle { + id: tachoCorner + scale: 3.0 + opacity: 0.0 + x: 212 + y: 266 + width: tachoNumRect.width + 8 + height: width + radius: width + color: "transparent" + border.color: "white" + border.width: 7 + } + + Item { + id: speedMeter + x: 1440 + width: 612 + height: width + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + + Image { + id: speedImage + x: 0 + y: 0 + width: parent.width + height: width + source: speedImageSrc + visible: true + } + } // speedMeter + + Rectangle { + id: speedNumRect + x: 1524 + y: 270 + width: 180 + height: width + radius: width + color: "#000000" + + Text { + id: speedText + x: 150 + color: "#ffffff" + anchors.horizontalCenterOffset: 0 + verticalAlignment: Text.AlignBottom + horizontalAlignment: Text.AlignHCenter + anchors.top: parent.top + anchors.topMargin: 40 + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 60 + } + Text { + id: speedUnitText + x: 150 + color: "#ffffff" + text: root.speedUnit + anchors.horizontalCenterOffset: 0 + verticalAlignment: Text.AlignBottom + horizontalAlignment: Text.AlignHCenter + anchors.top: speedText.bottom + anchors.topMargin: -5 + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20 + } + + z: 1000 + } + SpeedNeedle { + id: speedNeedle + x: 654 + y: 25 + width: 612 + height: width + z: speedNumRect.z - 1 + } + Rectangle { + id: speedCorner + scale: 3.0 + opacity: 0.0 + x: 1520 + y: 266 + width: speedNumRect.width + 8 + height: width + radius: width + color: "transparent" + border.color: "white" + border.width: 7 + } +} diff --git a/qml/2D/Navigation.qml b/qml/2D/Navigation.qml new file mode 100644 index 0000000..c1a9edb --- /dev/null +++ b/qml/2D/Navigation.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 + +Item { + id: root + + width: 2560; height: 960 + + function fadeIn() { + clusterGradient.fadeIn(); + } + function fadeOut() { + clusterGradient.fadeOut(); + } + + Image { + id: fakeMap + source: "qrc:/icons/Map.png" + y: -580 + width: 2560 + height: 1540 + } + ClusterGradient { + id: clusterGradient + y: -580 + width: fakeMap.width + height: fakeMap.height + 580 + topAndBottomCurtainHeight: 680 + } + + PropertyAnimation { + target: fakeMap + property: "y" + loops: Animation.Infinite + duration: 60000 + running: startupAnimation + from: -580 + to: 0 + } +} diff --git a/qml/2D/SpeedNeedle.qml b/qml/2D/SpeedNeedle.qml new file mode 100644 index 0000000..88b31f3 --- /dev/null +++ b/qml/2D/SpeedNeedle.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 + +Item { + id: root + + property alias speedNeedle: speedNeedle + property int vehicleSpeed: 0 + property int offset: -135 + + x: 0 + y: 0 + width: 5 + height: 188 + + Image { + id: speedNeedle + x: parent.x + y: parent.y + width: parent.width + height: parent.height + source: needleSrc + transformOrigin: Item.Center + rotation: offset + } +} diff --git a/qml/2D/TachoNeedle.qml b/qml/2D/TachoNeedle.qml new file mode 100644 index 0000000..db58851 --- /dev/null +++ b/qml/2D/TachoNeedle.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Kria Cluster 2D Demo. +** +** $QT_BEGIN_LICENSE:BSD$ +** 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. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.7 + +Item { + id: root + + property alias tachoNeedle: tachoNeedle + property int vehicleRpm: 0 + property int offset: -135 + + x: 0 + y: 0 + width: 5 + height: 188 + + Image { + id: tachoNeedle + x: parent.x + y: parent.y + width: parent.width + height: parent.height + source: needleSrc + transformOrigin: Item.Center + rotation: offset + } +} |