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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2016 Dennis Nienhüser <nienhueser@kde.org>
0004 //
0005 
0006 import QtQuick 2.3
0007 import QtQuick.Controls 1.3
0008 import QtQuick.Window 2.2
0009 import QtQuick.Layouts 1.1
0010 
0011 import org.kde.marble 0.20
0012 
0013 Item {
0014     id: root
0015 
0016     property var map
0017     property var navigationManager
0018 
0019     onNavigationManagerChanged: navigationModeSwitch.checked = navigationManager ? navigationManager.guidanceModeEnabled : false
0020 
0021     height: visible ? Screen.pixelDensity * 4 + column.height : 0
0022 
0023     SystemPalette {
0024         id: palette
0025         colorGroup: SystemPalette.Active
0026     }
0027 
0028     Rectangle {
0029         anchors.fill: parent
0030         color: palette.base
0031     }
0032 
0033     Column {
0034         id: column
0035         anchors.left: parent.left
0036         anchors.right: parent.right
0037         anchors.bottom: parent.bottom
0038         anchors.margins: Screen.pixelDensity * 2
0039         spacing: Screen.pixelDensity * 2
0040 
0041         Text {
0042             font.pointSize: 18
0043             text: root.map ? (root.map.speed * 3.6).toFixed(1) + " km/h – " + root.map.currentPosition.coordinates : ""
0044         }
0045 
0046         Row {
0047             id: row
0048             width: root.width
0049             spacing: Screen.pixelDensity * 2
0050 
0051             Switch {
0052                 id: navigationModeSwitch
0053                 anchors.verticalCenter: parent.verticalCenter
0054                 onClicked: {
0055                     if (root.navigationManager) {
0056                         root.navigationManager.guidanceModeEnabled = checked
0057                     }
0058                 }
0059             }
0060 
0061             Text {
0062                 width: row.width - row.spacing - navigationModeSwitch.width
0063                 height: navigationModeSwitch.height
0064                 verticalAlignment: Text.AlignVCenter
0065                 text: qsTr("Follow Current Position")
0066                 font.pointSize: 18
0067             }
0068         }
0069     }
0070 }