Warning, /education/marble/src/apps/marble-maps/NavigationInfoBar.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2015 Gábor Péterffy <peterffy95@gmail.com>
0004 //
0005 
0006 
0007 import QtQuick 2.3
0008 import QtQuick.Controls 1.3
0009 import QtQuick.Window 2.2
0010 
0011 Item {
0012     id: root
0013 
0014     property real distance: 0
0015     property real destinationDistance: 0
0016     property alias instructionIcon: instructionImage.source
0017 
0018     function formatDistance(distance)
0019     {
0020         if (distance > 1000) {
0021             return qsTr("%1 km").arg((0.001 * distance).toFixed(1))
0022         } else if (distance > 100) {
0023             return qsTr("%1 m").arg((distance*0.01).toFixed(0)*100)
0024         } else {
0025             return qsTr("%1 m").arg((distance*0.1).toFixed(0)*10)
0026         }
0027     }
0028 
0029     height: instructionImage.height
0030 
0031     SystemPalette {
0032         id: palette
0033         colorGroup: SystemPalette.Active
0034     }
0035 
0036     Rectangle {
0037         anchors.fill: parent
0038         color: palette.window
0039     }
0040 
0041     Item {
0042         id: nextInstructionItem
0043         anchors.verticalCenter: parent.verticalCenter
0044 
0045         Image {
0046             id: instructionImage
0047             anchors.verticalCenter: parent.verticalCenter
0048             width: Screen.pixelDensity * 15
0049             height: width
0050             sourceSize.height: height
0051             sourceSize.width: width
0052         }
0053 
0054         Text {
0055             id: distanceUntilInstruction
0056             anchors.left: instructionImage.right
0057             anchors.verticalCenter: parent.verticalCenter
0058             font.pointSize: 24
0059             text: root.formatDistance(root.distance)
0060         }
0061     }
0062 
0063     Item {
0064         id: targetItem
0065         anchors.right: parent.right
0066         anchors.verticalCenter: parent.verticalCenter
0067 
0068         Text {
0069             id: targetText
0070             anchors.right: targetImage.left
0071             anchors.verticalCenter: parent.verticalCenter
0072             font.pointSize: 16
0073             text: root.formatDistance(root.destinationDistance)
0074         }
0075 
0076         Image {
0077             id: targetImage
0078             anchors.right: parent.right
0079             anchors.verticalCenter: parent.verticalCenter
0080             width: Screen.pixelDensity * 10
0081             height: width
0082             source: "qrc:///ic_place_arrival.png"
0083         }
0084     }
0085 }