15
10
property real margins: units.gu(2)
16
property string coreUrl: "http://journeyplanner.tfl.gov.uk/user/XML_TRIP_REQUEST2"
20
ItemStyle.class: "title"
21
text: i18n.tr("Journey Planner")
50
KeyNavigation.tab: destinationInput
53
id: originPopoverTrigger
55
enabled: originModel.count > 1
58
PopupUtils.open(originPopover)
67
KeyNavigation.backtab: originInput
70
id: destinationPopoverTrigger
72
enabled: destinationModel.count > 1
75
PopupUtils.open(destinationPopover)
85
text: i18n.tr("Search")
88
property bool busy: false
91
searchButton.busy = true
94
var doc = new XMLHttpRequest();
95
doc.onreadystatechange = function() {
96
if (doc.readyState == XMLHttpRequest.DONE) {
97
//console.log(doc.responseText)
98
tripModel.xml = doc.responseText
100
searchButton.busy = false
103
doc.open("GET", root.coreUrl +
104
'?language=en&sessionID=0&type_origin=' +
105
Util.inferInputType(originInput.text) +
108
'&type_destination=' +
109
Util.inferInputType(destinationInput.text) +
110
'&name_destination=' +
111
destinationInput.text +
112
'&itdDate=' + Datetime.iso8601DateString(now) +
113
'&itdTime=' + Datetime.iso8601TimeString(now))
119
running: searchButton.busy === true || tripModel.status === XmlListModel.Loading ||
120
originModel.status === XmlListModel.Loading || destinationModel.status === XmlListModel.Loading
132
top: searchQuery.bottom
136
topMargin: root.margins
143
Component.onCompleted: push(tripPage)
153
delegate: tripDelegate
165
delegate: journeyDelegate
174
query: "/itdRequest/itdTripRequest/itdItinerary/itdRouteList/itdRoute"
178
query: "@changes/string()"
182
query: "@publicDuration/string()"
186
query: "itdPartialRouteList/itdPartialRoute[1]/itdPoint[1]/itdDateTime/itdTime/@hour/string()"
190
query: "itdPartialRouteList/itdPartialRoute[1]/itdPoint[1]/itdDateTime/itdTime/@minute/string()"
193
name: "routeTripIndex"
194
query: "@routeTripIndex/string()"
198
if (status === XmlListModel.Loading) {
200
destinationModel.reload()
213
text: Datetime.displayTimeString(departHour, departMinute)
235
searchResults.push(journeyPage)
236
journeyModel.pageIndex = routeTripIndex
237
journeyModel.reload()
245
property int pageIndex
246
query: "/itdRequest/itdTripRequest/itdItinerary/itdRouteList/itdRoute["+pageIndex+"]/itdPartialRouteList/itdPartialRoute"
249
name: "departLocation"
250
query: "itdPoint[1]/@name/string()"
254
query: "itdPoint[1]/itdDateTime/itdTime/@hour/string()"
258
query: "itdPoint[1]/itdDateTime/itdTime/@minute/string()"
261
name: "arriveLocation"
262
query: "itdPoint[2]/@name/string()"
266
query: "itdPoint[2]/itdDateTime/itdTime/@hour/string()"
270
query: "itdPoint[2]/itdDateTime/itdTime/@minute/string()"
274
query: "itdMeansOfTransport/@productName/string()"
278
query: "itdMeansOfTransport/@shortname/string()"
286
height: journeyLegData.height + root.margins
295
text: Datetime.displayTimeString(departHour, departMinute)
299
text: Datetime.displayTimeString(arriveHour, arriveMinute)
310
text: i18n.tr("From")
325
text: transport + " (" + line + ")"
335
query: "/itdRequest/itdTripRequest/itdOdv[@usage='origin']/itdOdvName/odvNameElem"
339
query: "@stopID/string()"
348
if (status === XmlListModel.Ready) {
350
originInput.text = get(0).stopName
371
delegate: ListItem.Standard {
374
originInput.text = stopName
375
PopupUtils.close(popover)
386
query: "/itdRequest/itdTripRequest/itdOdv[@usage='destination']/itdOdvName/odvNameElem"
390
query: "@stopID/string()"
399
if (status === XmlListModel.Ready) {
401
destinationInput.text = get(0).stopName
408
id: destinationPopover
420
model: destinationModel
422
delegate: ListItem.Standard {
425
destinationInput.text = stopName
426
PopupUtils.close(popover)
12
// Tabs using "new-tabs" Look and Feel (scrolling tab-bar and flickable tabs).
14
ItemStyle.class: "new-tabs"
19
title: i18n.tr("Journey Planner")
22
source: "PlannerTab.qml"
23
property real margins: root.margins
27
// Under construction tab
29
title: i18n.tr("Under Construction")
32
text: "This is the next tab currently under construction"