Warning, /education/marble/src/apps/marble-maps/RouteEditor.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 // SPDX-FileCopyrightText: 2015 Dennis Nienhüser <nienhueser@kde.org> 0005 // 0006 0007 import QtQuick 2.3 0008 import QtQuick.Controls 1.3 0009 import QtQuick.Window 2.2 0010 import QtQuick.Layouts 1.1 0011 0012 import org.kde.marble 0.20 0013 0014 Item { 0015 id: root 0016 0017 property alias routingProfile: profileSelector.selectedProfile 0018 property alias currentProfileIcon: profileSelector.profileIcon 0019 property int currentIndex: 0 0020 property var routingManager 0021 0022 height: visible ? Screen.pixelDensity * 4 + column.height : 0 0023 0024 SystemPalette{ 0025 id: palette 0026 colorGroup: SystemPalette.Active 0027 } 0028 0029 Rectangle { 0030 anchors.fill: parent 0031 color: palette.base 0032 } 0033 0034 Column { 0035 id: column 0036 spacing: Screen.pixelDensity * 2 0037 anchors { 0038 top: parent.top 0039 left: parent.left 0040 right: parent.right 0041 margins: Screen.pixelDensity * 2 0042 } 0043 0044 Item { 0045 anchors { 0046 left: parent.left 0047 right: parent.right 0048 } 0049 0050 height: profileSelector.height 0051 0052 ProfileSelectorMenu { 0053 id: profileSelector 0054 anchors.left: parent.left 0055 } 0056 } 0057 0058 Text { 0059 id: helpText 0060 visible: waypointList.count < 2 0061 color: "gray" 0062 text: qsTr("Search for places to integrate them into a route.") 0063 } 0064 0065 ListView { 0066 id: waypointList 0067 anchors { 0068 left: parent.left 0069 right: parent.right 0070 } 0071 0072 height: Math.min(0.4 * Screen.height, contentHeight) 0073 clip: true 0074 model: routingManager.routeRequestModel 0075 0076 currentIndex: root.currentIndex 0077 0078 delegate: Rectangle { 0079 width: parent.width 0080 height: Screen.pixelDensity * 2 + Math.max(text.height, image.height) 0081 color: touchArea.pressed || root.currentIndex === index ? palette.highlight : palette.base 0082 0083 WaypointImage { 0084 id: image 0085 anchors { 0086 left: parent.left 0087 verticalCenter: parent.verticalCenter 0088 } 0089 0090 type: index === 0 ? "departure" : (index === waypointList.count-1 ? "destination" : "waypoint") 0091 } 0092 0093 Text { 0094 id: text 0095 anchors { 0096 left: image.right 0097 right: buttonsRow.left 0098 leftMargin: parent.width * 0.05 0099 verticalCenter: parent.verticalCenter 0100 } 0101 elide: Text.ElideMiddle 0102 text: name 0103 font.pointSize: 18 0104 color: palette.text 0105 } 0106 0107 MouseArea { 0108 id: touchArea 0109 anchors.fill: parent 0110 onClicked: { 0111 if (index === root.currentIndex) { 0112 root.currentIndex = -1 0113 } else { 0114 root.currentIndex = index 0115 marbleMaps.centerOn(longitude, latitude) 0116 } 0117 } 0118 } 0119 0120 Row { 0121 id: buttonsRow 0122 anchors.right: parent.right 0123 anchors.verticalCenter: parent.verticalCenter 0124 0125 ImageButton { 0126 id: upButton 0127 anchors.verticalCenter: parent.verticalCenter 0128 visible: index > 0 && index === root.currentIndex 0129 imageSource: "qrc:///up.png" 0130 onClicked: { 0131 routingManager.swapVias(index, index-1); 0132 root.currentIndex--; 0133 } 0134 } 0135 0136 ImageButton { 0137 id: downButton 0138 anchors.verticalCenter: parent.verticalCenter 0139 visible: index+1 < routingManager.routeRequestModel.count && index === root.currentIndex 0140 imageSource: "qrc:///down.png" 0141 onClicked: { 0142 routingManager.swapVias(index, index+1); 0143 root.currentIndex++; 0144 } 0145 } 0146 0147 ImageButton { 0148 id: deleteButton 0149 anchors.verticalCenter: parent.verticalCenter 0150 visible: index === root.currentIndex 0151 imageSource: "qrc:///delete.png" 0152 onClicked: { 0153 routingManager.removeVia(index); 0154 root.currentIndex = Math.max(0, root.currentIndex-1); 0155 } 0156 } 0157 } 0158 } 0159 0160 MarbleScrollBar { 0161 id: scrollBar 0162 flickableItem: waypointList 0163 } 0164 } 0165 } 0166 }