2
* GPS Navigation http://launchpad.net/unav
3
* Copyright (C) 2015-2016 Marcos Alvarez Costales https://launchpad.net/~costales
4
* Copyright (C) 2015-2016 JkB https://launchpad.net/~joergberroth
5
* Copyright (C) 2016 Dan Chapman https://launchpad.net/~dpniel
7
* GPS Navigation is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3 of the License, or
10
* (at your option) any later version.
12
* GPS Navigation is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
19
import QtQuick.Layouts 1.1
20
import Ubuntu.Components 1.3
21
import Ubuntu.Components.ListItems 1.3 as ListItems
22
import QtQuick.XmlListModel 2.0
28
property var routeList
30
title: i18n.tr("Route Info")
34
id: routeInfoListModel
36
function initializeList (){
38
for ( var i = 0; i < routeList.length; i++) {
40
"type": routeList[i].type,
41
"lng": routeList[i].coordinates[0],
42
"lat": routeList[i].coordinates[1],
43
"instruction": routeList[i].instruction,
44
"distance": routeList[i].distance,
45
"duration": routeList[i].duration,
46
"way_name": routeList[i].way_name,
47
"speaked": routeList[i].speaked,
49
routeInfoListModel.append(item);
53
// Note: No need for UbuntuListView here as no expanding animations
58
model: routeInfoListModel
65
height: routeInfoLayout.implicitHeight
70
title.text: instruction
71
title.color: !speaked ? UbuntuColors.darkGrey : UbuntuColors.lightGrey
72
title.textFormat: Text.RichText // Hack: Space character in translations
75
aspect: UbuntuShape.Flat
76
height: units.gu(6); width: height
77
sourceScale: Qt.vector2d(0.8, 0.8)
79
backgroundColor: "#292929"
81
source: Qt.resolvedUrl("../nav/img/steps/" + type + ".svg")
83
sourceFillMode: UbuntuShape.PreserveAspectFit
84
sourceHorizontalAlignment: UbuntuShape.AlignHCenter
86
// We want this on the left side of the main slot
87
SlotsLayout.position: SlotsLayout.Leading
93
height: inner_timeLabel.height + units.gu(1) + inner_distanceLabel.height
94
width: Math.max(inner_timeLabel.width, inner_distanceLabel.width + units.gu(1))
95
SlotsLayout.overrideVerticalPositioning: true
99
anchors.top: parent.top
100
anchors.topMargin: units.gu(1.5)
101
anchors.right: parent.right
102
text: duration !== 0 ? ( (duration/60).toFixed(1) + " min" ) : ""
107
id: inner_distanceLabel
108
anchors.right: parent.right
109
anchors.top: inner_timeLabel.bottom
110
anchors.topMargin: units.gu(2)
111
text: distance !== 0 ? ( (distance /1000).toFixed(2) + (navApp.settings.unit === 1 ? " mi" : " km") ) : ""
119
Component.onCompleted: {
120
routeInfoListModel.initializeList();
121
resultsListView.visible = true