Merge lp:~nik90/unav/unav-convergence-part-1 into lp:unav

Proposed by Nekhelesh Ramananthan
Status: Merged
Merged at revision: 66
Proposed branch: lp:~nik90/unav/unav-convergence-part-1
Merge into: lp:unav
Diff against target: 2127 lines (+892/-770)
15 files modified
qml/AboutPage.qml (+0/-12)
qml/Coordinate.qml (+4/-2)
qml/Favorites.qml (+6/-3)
qml/Location.qml (+11/-7)
qml/Main.qml (+704/-625)
qml/PoiDetailsPage.qml (+31/-16)
qml/PoiListPage.qml (+13/-19)
qml/PoiPage.qml (+29/-14)
qml/RouteInfoListPage.qml (+7/-12)
qml/SearchPage.qml (+21/-28)
qml/SettingsPage.qml (+15/-17)
qml/Share.qml (+22/-12)
qml/components/CloseHeaderAction.qml (+27/-0)
qml/components/ZoomButtons.qml (+1/-2)
qml/tuto/WelcomeWizard.qml (+1/-1)
To merge this branch: bzr merge lp:~nik90/unav/unav-convergence-part-1
Reviewer Review Type Date Requested Status
JkB Approve
Review via email: mp+292850@code.launchpad.net

Commit message

Phase 1 Convergence of uNav on the tablet

Description of the change

This branches implements the first stage of convergence. What you can expect in this branch are the following,

- Basic level of convergence which includes a right-side column for showing search, settings, nearby and share features.

- No behavioral changes in the phone behavior due to implementation of convergence

- Tablet portrait behaves like a phone since the width is not enough to show a ride-side column. We can brainstorm more about this in the next stage.

- No fancy gimmicks like slide-in animations for the column etc.

I would like Marcos & Joerg to test this frequently and report bugs in a clear fashion (include steps to reproduce bug). I will fix them one by one and push those fixes to the branch. Once we think it is good enough, we can merge to trunk.

In this first phase, please do not make requests for any fancy stuff. We need to patiently implement convergence as it is a big undertaking.

Thanks. Enjoy!

To post a comment you must log in.
70. By Nekhelesh Ramananthan

Don't show search page in the side bar by default. Added ability to open/close sidebar as Joerg wanted

71. By Nekhelesh Ramananthan

Fixed add favorites by clicking on map button

72. By Nekhelesh Ramananthan

Don't show white column when switching between mobile and tablet interfaces

73. By Nekhelesh Ramananthan

Tiny fix to the component on destruction code

74. By Nekhelesh Ramananthan

some more fixes

75. By Nekhelesh Ramananthan

Convert Close header button into a generic component to reuse it everywhere

Revision history for this message
JkB (joergberroth) wrote :

Great work Nik! Awesome!!

I could not find any bugs so far; I think we should merge it and take it as the new base.
Tested on tablet and phone.

Thanks a lot Nik!

Best Joerg

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/AboutPage.qml'
2--- qml/AboutPage.qml 2016-04-18 20:39:34 +0000
3+++ qml/AboutPage.qml 2016-04-28 16:10:40 +0000
4@@ -26,18 +26,6 @@
5 header: UNavHeader {
6 title: i18n.tr("About")
7 flickable: creditsListView
8-
9- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
10- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
11- // at which point this back button can be removed.
12- leadingActionBar.actions: Action {
13- iconName: "back"
14- text: i18n.tr("Back")
15- shortcut: "Escape"
16- onTriggered: {
17- mainPageStack.pop()
18- }
19- }
20 }
21
22 ListModel {
23
24=== modified file 'qml/Coordinate.qml'
25--- qml/Coordinate.qml 2016-04-20 17:36:04 +0000
26+++ qml/Coordinate.qml 2016-04-28 16:10:40 +0000
27@@ -121,7 +121,8 @@
28 if (!isNaN(aux_lat) && aux_lat.toString().indexOf('.') != -1 && !isNaN(aux_lng) && aux_lng.toString().indexOf('.') != -1 && aux_lat >= -90 && aux_lat <= 90 && aux_lng >= -180 && aux_lng <= 180) { // It's a float
29 mainPageStack.clickedLat = parseFloat(aux_lat).toFixed(5);
30 mainPageStack.clickedLng = parseFloat(aux_lng).toFixed(5);
31- mainPageStack.clear();
32+ if (mainPageStack.columns === 1)
33+ mainPageStack.removePages(mainPageStack.primaryPage)
34 if (mainPageStack.center_onpos === 2)
35 mainPageStack.center_onpos = 1;
36 mainPageStack.executeJavaScript("ui.markers_POI_set([{title: '', lat: " + mainPageStack.clickedLat + ", lng: " + mainPageStack.clickedLng + "}])");
37@@ -341,7 +342,8 @@
38 if (aux_lat >= -90 && aux_lat <= 90 && aux_lng >= -180 && aux_lng <= 180) {
39 mainPageStack.clickedLat = parseFloat(aux_lat).toFixed(5);
40 mainPageStack.clickedLng = parseFloat(aux_lng).toFixed(5);
41- mainPageStack.clear();
42+ if (mainPageStack.columns === 1)
43+ mainPageStack.removePages(mainPageStack.primaryPage)
44 if (mainPageStack.center_onpos === 2)
45 mainPageStack.center_onpos = 1;
46 mainPageStack.executeJavaScript("ui.markers_POI_set([{title: '', lat: " + mainPageStack.clickedLat + ", lng: " + mainPageStack.clickedLng + "}])");
47
48=== modified file 'qml/Favorites.qml'
49--- qml/Favorites.qml 2016-04-20 17:36:04 +0000
50+++ qml/Favorites.qml 2016-04-28 16:10:40 +0000
51@@ -83,6 +83,7 @@
52
53 model: favoritesModel
54 anchors.fill: parent
55+ clip: true
56
57 displaced: Transition {
58 UbuntuNumberAnimation { property: "y"; duration: UbuntuAnimation.BriskDuration }
59@@ -109,7 +110,8 @@
60 Action {
61 iconName: "send"
62 onTriggered: {
63- mainPageStack.clear();
64+ if (mainPageStack.columns === 1)
65+ mainPageStack.removePages(mainPageStack.primaryPage)
66 mainPageStack.center_onpos = 2;
67 mainPageStack.routeState = 'yes';
68 mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");
69@@ -118,7 +120,7 @@
70 Action {
71 iconName: "share"
72 onTriggered: {
73- mainPageStack.push(Qt.resolvedUrl("Share.qml"), {"lat": model.lat, "lon": model.lng});
74+ mainPageStack.addPageToCurrentColumn(searchPage, Qt.resolvedUrl("Share.qml"), {"lat": model.lat, "lon": model.lng});
75 }
76 },
77 Action {
78@@ -150,7 +152,8 @@
79 }
80
81 onClicked: {
82- mainPageStack.clear();
83+ if (mainPageStack.columns === 1)
84+ mainPageStack.removePages(searchPage)
85 if (navApp.settings.saveHistory) {
86 UnavDB.saveTofavHistory(model.name, model.lat, model.lng);
87 }
88
89=== modified file 'qml/Location.qml'
90--- qml/Location.qml 2016-04-20 17:36:04 +0000
91+++ qml/Location.qml 2016-04-28 16:10:40 +0000
92@@ -251,7 +251,8 @@
93 if (navApp.settings.saveHistory) {
94 UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)
95 }
96- mainPageStack.clear();
97+ if (mainPageStack.columns === 1)
98+ mainPageStack.removePages(mainPageStack.primaryPage)
99 mainPageStack.center_onpos = 2;
100 mainPageStack.routeState = 'yes'
101 mainPageStack.executeJavaScript("calc2coord(" + model.lat + "," + model.lng + ");")
102@@ -260,7 +261,7 @@
103 Action {
104 iconName: "share"
105 onTriggered: {
106- mainPageStack.push(Qt.resolvedUrl("Share.qml"), {"lat": model.lat, "lon": model.lng})
107+ mainPageStack.addPageToCurrentColumn(searchPage, Qt.resolvedUrl("Share.qml"), {"lat": model.lat, "lon": model.lng})
108 }
109 },
110 Action {
111@@ -276,7 +277,8 @@
112 if (navApp.settings.saveHistory) {
113 UnavDB.saveToSearchHistory(model.name, model.lat, model.lng);
114 }
115- mainPageStack.clear();
116+ if (mainPageStack.columns === 1)
117+ mainPageStack.removePages(mainPageStack.primaryPage)
118 if (mainPageStack.center_onpos === 2)
119 mainPageStack.center_onpos = 1;
120 mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + model.name + "\", lat: " + model.lat + ", lng: " + model.lng + "}])");
121@@ -334,7 +336,8 @@
122 iconName: "send"
123 visible: model.title !== i18n.tr("Nearby history")
124 onTriggered: {
125- mainPageStack.clear();
126+ if (mainPageStack.columns === 1)
127+ mainPageStack.removePages(mainPageStack.primaryPage)
128 mainPageStack.center_onpos = 2;
129 mainPageStack.routeState = 'yes';
130 mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");
131@@ -344,7 +347,7 @@
132 iconName: "share"
133 visible: model.title !== i18n.tr("Nearby history")
134 onTriggered: {
135- mainPageStack.push(Qt.resolvedUrl("Share.qml"), {"lat": model.lat, "lon": model.lng});
136+ mainPageStack.addPageToCurrentColumn(searchPage, Qt.resolvedUrl("Share.qml"), {"lat": model.lat, "lon": model.lng});
137 }
138 }
139 ]
140@@ -402,7 +405,7 @@
141
142 onClicked: {
143 if (model.title === i18n.tr("Nearby history")) {
144- mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"),
145+ mainPageStack.addPageToCurrentColumn(searchPage, Qt.resolvedUrl("PoiListPage.qml"),
146 {
147 lat: mainPageStack.currentLat,
148 lng: mainPageStack.currentLng,
149@@ -411,7 +414,8 @@
150 geoDistFactor: 5
151 })
152 } else {
153- mainPageStack.clear();
154+ if (mainPageStack.columns === 1)
155+ mainPageStack.removePages(mainPageStack.primaryPage)
156 if (mainPageStack.center_onpos === 2)
157 mainPageStack.center_onpos = 1;
158 mainPageStack.executeJavaScript("ui.markers_POI_set([{ title: \"" +
159
160=== modified file 'qml/Main.qml'
161--- qml/Main.qml 2016-04-24 16:31:47 +0000
162+++ qml/Main.qml 2016-04-28 16:10:40 +0000
163@@ -8,7 +8,7 @@
164 * it under the terms of the GNU General Public License as published by
165 * the Free Software Foundation; either version 3 of the License, or
166 * (at your option) any later version.
167- *
168+ *
169 * uNav is distributed in the hope that it will be useful,
170 * but WITHOUT ANY WARRANTY; without even the implied warranty of
171 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
172@@ -29,156 +29,216 @@
173 import QtQuick.XmlListModel 2.0
174 import "components"
175 import "js/utils.js" as QmlJs
176-
177-MainView {
178- id: navApp
179-
180- objectName: "navApp"
181- applicationName: "navigator.costales"
182-
183- Component.onCompleted: {
184- // Translations
185- i18n.domain = "unav";
186- i18n.bindtextdomain("unav", "nav/locales/mo");
187- }
188-
189- anchorToKeyboard: true
190-
191+import QtQuick.Window 2.2
192+
193+Window {
194+ id: unavWindow
195+
196+ title: "uNav"
197 width: units.gu(150)
198 height: units.gu(100)
199-
200- property string applicationVersion: "0.59"
201- property string mapUrl: "../nav/index.html"
202- property string appUA: "Mozilla/5.0 (Linux; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36"
203-
204- // persistent app settings:
205- property var settings: Settings {
206- property int soundIndications: 0 // 0 voice 1 notification 2 none
207- property int unit: 0
208- property int routingMode: 0 // 0 car, 1 walk, 2 bicycle
209- property bool avoidTolls: false
210- property bool alertRadars: false
211- property bool legalRadarShow: true
212- property string prevLat: ''
213- property string prevLng: ''
214- property int prevZoom: 9999
215- property bool uiShowSpeed: false
216- property bool saveHistory: true
217- property bool headerVisible: true
218- property bool showTuto: true
219- property int defaultDistancePOI: 1
220- }
221-
222- ScreenSaver {
223- id: screenSaver
224- screenSaverEnabled: !Qt.application.active
225- }
226-
227- PageStack {
228- id: mainPageStack
229-
230- Component.onCompleted: if (navApp.settings.showTuto) mainPageStack.push(Qt.resolvedUrl("tuto/WelcomeWizard.qml"))
231-
232- property string currentLat: "null"
233- property string currentLng: "null"
234- property string endLat: "null"
235- property string endLng: "null"
236- property string clickedLat: "null"
237- property string clickedLng: "null"
238- property string ptFromLat: "null"
239- property string ptFromLng: "null"
240- property string routeState: "no"
241- property int center_onpos: 0 // 0 GPS off, 1 GPS on + not center, 2 GPS on + center
242- property bool favPopup: false
243- property bool onLoadingExecuted: false
244-
245-
246- property string usContext: "messaging://"
247- // Workaround: as long as map keeps a webcontainer this function handles js events to the webview.
248- function executeJavaScript(code) {
249- var req = webview.rootFrame.sendMessage(mainPageStack.usContext, "EXECUTE", {code: code});
250- //req.onreply = function (msg) {
251- //console.log(msg.str);
252- //}
253- req.onerror = function (code, explanation) {
254- console.log("Error " + code + ": " + explanation)
255- }
256- }
257-
258- Page {
259- id: navigationPage
260-
261- visible: mainPageStack.depth === 0
262-
263- property bool buttonsEnabled: false
264-
265+ minimumWidth: units.gu(60)
266+ minimumHeight: units.gu(80)
267+
268+ MainView {
269+ id: navApp
270+
271+ objectName: "navApp"
272+ applicationName: "navigator.costales"
273+
274+ Component.onCompleted: {
275+ // Translations
276+ i18n.domain = "unav";
277+ i18n.bindtextdomain("unav", "nav/locales/mo");
278+ }
279+
280+ anchorToKeyboard: true
281+
282+ width: unavWindow.width
283+ height: unavWindow.height
284+
285+ property string applicationVersion: "0.59"
286+ property string mapUrl: "../nav/index.html"
287+ property string appUA: "Mozilla/5.0 (Linux; Android 5.0; Nexus 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36"
288+
289+ // persistent app settings:
290+ property var settings: Settings {
291+ property int soundIndications: 0 // 0 voice 1 notification 2 none
292+ property int unit: 0
293+ property int routingMode: 0 // 0 car, 1 walk, 2 bicycle
294+ property bool avoidTolls: false
295+ property bool alertRadars: false
296+ property bool legalRadarShow: true
297+ property string prevLat: ''
298+ property string prevLng: ''
299+ property int prevZoom: 9999
300+ property bool uiShowSpeed: false
301+ property bool saveHistory: true
302+ property bool headerVisible: true
303+ property bool showTuto: true
304+ property int defaultDistancePOI: 1
305+ }
306+
307+ ScreenSaver {
308+ id: screenSaver
309+ screenSaverEnabled: !Qt.application.active
310+ }
311+
312+ AdaptivePageLayout {
313+ id: mainPageStack
314+
315+ property int maxWidth: units.gu(125)
316+ property bool childPageOpened: false
317+
318+ function showSideBar() {
319+ childPageOpened = true
320+ }
321+
322+ function hideSideBar() {
323+ childPageOpened = false
324+ }
325+
326 anchors.fill: parent
327-
328- header: UNavHeader {
329- id: header
330-
331- title: "uNav"
332- visible: navApp.settings.headerVisible
333-
334- leadingActionBar {
335- width: 0
336- visible: false
337- }
338-
339- trailingActionBar {
340- numberOfSlots: 4
341- actions: [
342- Action {
343- id: actionSettings
344- iconName: "settings"
345- text: i18n.tr("Settings")
346- enabled: navigationPage.buttonsEnabled
347- onTriggered: {
348- goThereActionPopover.hide();
349- mainPageStack.push(Qt.resolvedUrl("SettingsPage.qml"));
350- }
351- },
352-
353- Action {
354- id: centerPosAction
355- iconName: mainPageStack.center_onpos ? "media-optical-symbolic" : "gps"
356- text: i18n.tr("Center on Position")
357- enabled: navigationPage.buttonsEnabled && mainPageStack.center_onpos !== 2
358- onTriggered: {
359- mainPageStack.center_onpos = 2;
360- goThereActionPopover.hide();
361- mainPageStack.executeJavaScript("center_pos()");
362- }
363- },
364-
365- Action {
366- id: searchAction
367- iconName: "find"
368- text: i18n.tr("Search")
369- enabled: navigationPage.buttonsEnabled
370- onTriggered: {
371- goThereActionPopover.hide();
372- mainPageStack.push(Qt.resolvedUrl("SearchPage.qml"))
373- }
374- },
375-
376- Action {
377- id: cancelAction
378- iconSource: Qt.resolvedUrl("../nav/img/header/nav-actions.svg")
379- text: i18n.tr("Destination")
380- visible: mainPageStack.routeState !== 'no'
381- enabled: navigationPage.buttonsEnabled
382- onTriggered: {
383- goThereActionPopover.hide();
384- goThereActionPopover.showMenu = true;
385- goThereActionPopover.show();
386- }
387- }
388- ]
389- }
390- }
391-
392- /**
393+ primaryPage: navigationPage
394+
395+ layouts:[
396+ PageColumnsLayout {
397+ id: standardlayout
398+
399+ when: navApp.settings.showTuto
400+
401+ PageColumn {
402+ fillWidth: true
403+ }
404+ },
405+
406+ PageColumnsLayout {
407+ id: nonstandardlayout
408+ when: !navApp.settings.showTuto && width >= mainPageStack.maxWidth && mainPageStack.childPageOpened
409+
410+ // column #0
411+ PageColumn {
412+ fillWidth: true
413+ }
414+
415+ // column #1
416+ PageColumn {
417+ minimumWidth: units.gu(30)
418+ maximumWidth: mainPageStack.maxWidth
419+ preferredWidth: units.gu(50)
420+ }
421+ }
422+ ]
423+
424+ Component.onCompleted: {
425+ // If uNav is being opened for the first time, show the welcome tutorial in just one column
426+ if (navApp.settings.showTuto) {
427+ mainPageStack.addPageToCurrentColumn(mainPageStack.primaryPage, Qt.resolvedUrl("tuto/WelcomeWizard.qml"))
428+ }
429+ }
430+
431+ property string currentLat: "null"
432+ property string currentLng: "null"
433+ property string endLat: "null"
434+ property string endLng: "null"
435+ property string clickedLat: "null"
436+ property string clickedLng: "null"
437+ property string ptFromLat: "null"
438+ property string ptFromLng: "null"
439+ property string routeState: "no"
440+ property int center_onpos: 0 // 0 GPS off, 1 GPS on + not center, 2 GPS on + center
441+ property bool favPopup: false
442+ property bool onLoadingExecuted: false
443+
444+ onCurrentLatChanged: console.log("CURRENT Lat changed: " + mainPageStack.currentLat)
445+
446+
447+ property string usContext: "messaging://"
448+ // Workaround: as long as map keeps a webcontainer this function handles js events to the webview.
449+ function executeJavaScript(code) {
450+ var req = webview.rootFrame.sendMessage(mainPageStack.usContext, "EXECUTE", {code: code});
451+ //req.onreply = function (msg) {
452+ //console.log(msg.str);
453+ //}
454+ req.onerror = function (code, explanation) {
455+ console.log("Error " + code + ": " + explanation)
456+ }
457+ }
458+
459+ Page {
460+ id: navigationPage
461+
462+ property bool buttonsEnabled: false
463+
464+ anchors.fill: parent
465+
466+ header: UNavHeader {
467+ id: header
468+
469+ title: "uNav"
470+ visible: navApp.settings.headerVisible
471+
472+ leadingActionBar {
473+ width: 0
474+ visible: false
475+ }
476+
477+ trailingActionBar {
478+ numberOfSlots: 4
479+ actions: [
480+ Action {
481+ id: actionSettings
482+ iconName: "settings"
483+ text: i18n.tr("Settings")
484+ enabled: navigationPage.buttonsEnabled
485+ onTriggered: {
486+ goThereActionPopover.hide();
487+ mainPageStack.showSideBar()
488+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("SettingsPage.qml"))
489+ }
490+ },
491+
492+ Action {
493+ id: centerPosAction
494+ iconName: mainPageStack.center_onpos ? "media-optical-symbolic" : "gps"
495+ text: i18n.tr("Center on Position")
496+ enabled: navigationPage.buttonsEnabled && mainPageStack.center_onpos !== 2
497+ onTriggered: {
498+ mainPageStack.center_onpos = 2;
499+ goThereActionPopover.hide();
500+ mainPageStack.executeJavaScript("center_pos()");
501+ }
502+ },
503+
504+ Action {
505+ id: searchAction
506+ iconName: "find"
507+ text: i18n.tr("Search")
508+ enabled: navigationPage.buttonsEnabled
509+ onTriggered: {
510+ goThereActionPopover.hide();
511+ mainPageStack.showSideBar()
512+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("SearchPage.qml"))
513+ }
514+ },
515+
516+ Action {
517+ id: cancelAction
518+ iconSource: Qt.resolvedUrl("../nav/img/header/nav-actions.svg")
519+ text: i18n.tr("Destination")
520+ visible: mainPageStack.routeState !== 'no'
521+ enabled: navigationPage.buttonsEnabled
522+ onTriggered: {
523+ goThereActionPopover.hide();
524+ goThereActionPopover.showMenu = true;
525+ goThereActionPopover.show();
526+ }
527+ }
528+ ]
529+ }
530+ }
531+
532+ /**
533 Workaround:
534 QML Map Element currently does not support flicking. This makes it unusable to this app so far.
535 As long as this is to supported, the map view falls back to a html5 container that renders the navigation.
536@@ -186,49 +246,49 @@
537 The panel stays in html5, too, for ease of integration.
538 **/
539
540- WebContext {
541- id: webcontext
542- userAgent: appUA
543- userScripts: [
544- Oxide.UserScript {
545- context: mainPageStack.usContext
546- url: Qt.resolvedUrl("js/oxide.js")
547- }
548- ]
549- }
550-
551- WebView {
552- id: webview
553- anchors.fill: parent
554- z: -6
555- context: webcontext
556- url: mapUrl
557- preferences.allowFileAccessFromFileUrls: true
558- preferences.allowUniversalAccessFromFileUrls: true
559- preferences.appCacheEnabled: true
560- preferences.javascriptCanAccessClipboard: true
561- preferences.javascriptEnabled: true
562- //not used right now:
563- //filePicker: filePickerLoader.item
564-
565- // get in-webcontainer click events (e.g. click on map)
566- // and coordinates to handle them in qml ui:
567- onNavigationRequested:{
568- // We could start to clean this up a bit by writing functions on that...
569- var url = request.url.toString().split("?");
570- var params = url[1].split("/");
571- switch (url[0]) {
572+ WebContext {
573+ id: webcontext
574+ userAgent: navApp.appUA
575+ userScripts: [
576+ Oxide.UserScript {
577+ context: mainPageStack.usContext
578+ url: Qt.resolvedUrl("js/oxide.js")
579+ }
580+ ]
581+ }
582+
583+ WebView {
584+ id: webview
585+ anchors.fill: parent
586+ z: -6
587+ context: webcontext
588+ url: navApp.mapUrl
589+ preferences.allowFileAccessFromFileUrls: true
590+ preferences.allowUniversalAccessFromFileUrls: true
591+ preferences.appCacheEnabled: true
592+ preferences.javascriptCanAccessClipboard: true
593+ preferences.javascriptEnabled: true
594+ //not used right now:
595+ //filePicker: filePickerLoader.item
596+
597+ // get in-webcontainer click events (e.g. click on map)
598+ // and coordinates to handle them in qml ui:
599+ onNavigationRequested:{
600+ // We could start to clean this up a bit by writing functions on that...
601+ var url = request.url.toString().split("?");
602+ var params = url[1].split("/");
603+ switch (url[0]) {
604 case "http://go/":
605 Qt.openUrlExternally(url[1]);
606 break;
607-
608+
609 case "http://get_routeinfo_list/":
610 goThereActionPopover.hide();
611 var dec_routeList = decodeURIComponent(url[1]);
612- mainPageStack.push(Qt.resolvedUrl("RouteInfoListPage.qml"), { routeList: JSON.parse(dec_routeList) });
613+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("RouteInfoListPage.qml"), { routeList: JSON.parse(dec_routeList) });
614 navApp.settings.headerVisible = true;
615 break;
616-
617+
618 case "http://route_status/":
619 mainPageStack.currentLat = params[0];
620 mainPageStack.currentLng = params[1];
621@@ -236,7 +296,7 @@
622 mainPageStack.endLng = params[3];
623 mainPageStack.routeState = params[4];
624 break;
625-
626+
627 case "http://clicked_on_map/":
628 goThereActionPopover.hide();
629 goThereActionPopover.osm_type = 'none';
630@@ -261,7 +321,7 @@
631
632 if (params[6] !== "none")
633 goThereActionPopover.poiName = params[6].replace(/¿¿¿/g, "\/");
634-
635+
636 mainPageStack.favPopup = false;
637 goThereActionPopover.show();
638
639@@ -270,23 +330,23 @@
640 reverseXmlModel.reverseSearch(mainPageStack.clickedLat, mainPageStack.clickedLng);
641 }
642 break;
643-
644+
645 case "http://hide_popup/":
646 goThereActionPopover.hide();
647 break;
648
649 case "http://set_center_onpos/":
650 switch (params[0]) {
651- case '0': // GPS Denied (special)
652- mainPageStack.routeState = 'no';
653- mainPageStack.center_onpos = 0;
654- break;
655- case '1':
656- mainPageStack.center_onpos = 1;
657- break;
658- case '2':
659- mainPageStack.center_onpos = 2;
660- break;
661+ case '0': // GPS Denied (special)
662+ mainPageStack.routeState = 'no';
663+ mainPageStack.center_onpos = 0;
664+ break;
665+ case '1':
666+ mainPageStack.center_onpos = 1;
667+ break;
668+ case '2':
669+ mainPageStack.center_onpos = 2;
670+ break;
671 }
672 break;
673
674@@ -300,43 +360,69 @@
675 case "http://cancel_route/":
676 mainPageStack.routeState = 'no';
677 break;
678-
679+
680 case "http://save_pos/":
681 navApp.settings.prevLat = params[0];
682 navApp.settings.prevLng = params[1];
683 navApp.settings.prevZoom = params[2];
684 break;
685- }
686-
687- request.action = Oxide.NavigationRequest.ActionReject;
688- }
689-
690- Component.onCompleted: {
691- preferences.localStorageEnabled = true
692- }
693-
694- onLoadingStateChanged: {
695- if (!loading && !mainPageStack.onLoadingExecuted) {
696- mainPageStack.onLoadingExecuted = true;
697- //send saved Setting states:
698- mainPageStack.executeJavaScript("settings.set_sound(" + navApp.settings.soundIndications + ");");
699- mainPageStack.executeJavaScript("settings.set_unit(\'" + ( navApp.settings.unit === 0 ? "km" : "mi" ) +"\');");
700- mainPageStack.executeJavaScript("ui.set_scale_unit(\'" + ( navApp.settings.unit === 0 ? "km" : "mi" ) +"\');");
701- mainPageStack.executeJavaScript("settings.set_routing_mode(" + navApp.settings.routingMode + ");");
702- mainPageStack.executeJavaScript("settings.set_avoid_tolls(" + navApp.settings.avoidTolls + ");");
703- mainPageStack.executeJavaScript("settings.set_alert_radars(" + navApp.settings.alertRadars + ");");
704- mainPageStack.executeJavaScript("settings.set_ui_speed(" + navApp.settings.uiShowSpeed + ");");
705-
706- // Center map in last position
707- if (navApp.settings.prevLat !== '' && navApp.settings.prevLng !== '' && navApp.settings.prevLat !== null && navApp.settings.prevLng !== null && navApp.settings.prevZoom !== 9999) {
708- mainPageStack.executeJavaScript("map.getView().setCenter(ol.proj.transform([" + navApp.settings.prevLng + "," + navApp.settings.prevLat + "], 'EPSG:4326', 'EPSG:3857')); map.getView().setZoom(" + navApp.settings.prevZoom + ");");
709- }
710-
711- // Hack: If user click so fast in buttons, app breaks sometimes
712- navigationPage.buttonsEnabled = true;
713-
714+ }
715+
716+ request.action = Oxide.NavigationRequest.ActionReject;
717+ }
718+
719+ Component.onCompleted: {
720+ preferences.localStorageEnabled = true
721+ }
722+
723+ onLoadingStateChanged: {
724+ if (!loading && !mainPageStack.onLoadingExecuted) {
725+ mainPageStack.onLoadingExecuted = true;
726+ //send saved Setting states:
727+ mainPageStack.executeJavaScript("settings.set_sound(" + navApp.settings.soundIndications + ");");
728+ mainPageStack.executeJavaScript("settings.set_unit(\'" + ( navApp.settings.unit === 0 ? "km" : "mi" ) +"\');");
729+ mainPageStack.executeJavaScript("ui.set_scale_unit(\'" + ( navApp.settings.unit === 0 ? "km" : "mi" ) +"\');");
730+ mainPageStack.executeJavaScript("settings.set_routing_mode(" + navApp.settings.routingMode + ");");
731+ mainPageStack.executeJavaScript("settings.set_avoid_tolls(" + navApp.settings.avoidTolls + ");");
732+ mainPageStack.executeJavaScript("settings.set_alert_radars(" + navApp.settings.alertRadars + ");");
733+ mainPageStack.executeJavaScript("settings.set_ui_speed(" + navApp.settings.uiShowSpeed + ");");
734+
735+ // Center map in last position
736+ if (navApp.settings.prevLat !== '' && navApp.settings.prevLng !== '' && navApp.settings.prevLat !== null && navApp.settings.prevLng !== null && navApp.settings.prevZoom !== 9999) {
737+ mainPageStack.executeJavaScript("map.getView().setCenter(ol.proj.transform([" + navApp.settings.prevLng + "," + navApp.settings.prevLat + "], 'EPSG:4326', 'EPSG:3857')); map.getView().setZoom(" + navApp.settings.prevZoom + ");");
738+ }
739+
740+ // Hack: If user click so fast in buttons, app breaks sometimes
741+ navigationPage.buttonsEnabled = true;
742+
743+ // Catching urls
744+ var url_dispatcher = Qt.application.arguments[1];
745+ if (QmlJs.is_url_dispatcher(url_dispatcher)['is_dispatcher']) {
746+ var coord = QmlJs.get_url_coord(url_dispatcher);
747+ if (coord['lat'] !== null && coord['lng'] !== null) {
748+ mainPageStack.clickedLat = coord['lat'];
749+ mainPageStack.clickedLng = coord['lng'];
750+ if (mainPageStack.center_onpos === 2)
751+ mainPageStack.center_onpos = 1;
752+ mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + i18n.tr("Shared Position") + "\", lat: " + mainPageStack.clickedLat + ", lng: " + mainPageStack.clickedLng + "}])");
753+ mainPageStack.favPopup = false;
754+ goThereActionPopover.show();
755+ }
756+ }
757+ }
758+ }
759+
760+ onGeolocationPermissionRequested: { request.allow() }
761+ }
762+
763+ Connections {
764+ target: UriHandler
765+ onOpened: {
766+ if (uris.length === 0 ) {
767+ return;
768+ }
769 // Catching urls
770- var url_dispatcher = Qt.application.arguments[1];
771+ var url_dispatcher = uris[0];
772 if (QmlJs.is_url_dispatcher(url_dispatcher)['is_dispatcher']) {
773 var coord = QmlJs.get_url_coord(url_dispatcher);
774 if (coord['lat'] !== null && coord['lng'] !== null) {
775@@ -352,406 +438,399 @@
776 }
777 }
778
779- onGeolocationPermissionRequested: { request.allow() }
780- }
781-
782- Connections {
783- target: UriHandler
784- onOpened: {
785- if (uris.length === 0 ) {
786- return;
787- }
788- // Catching urls
789- var url_dispatcher = uris[0];
790- if (QmlJs.is_url_dispatcher(url_dispatcher)['is_dispatcher']) {
791- var coord = QmlJs.get_url_coord(url_dispatcher);
792- if (coord['lat'] !== null && coord['lng'] !== null) {
793- mainPageStack.clickedLat = coord['lat'];
794- mainPageStack.clickedLng = coord['lng'];
795- if (mainPageStack.center_onpos === 2)
796- mainPageStack.center_onpos = 1;
797- mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + i18n.tr("Shared Position") + "\", lat: " + mainPageStack.clickedLat + ", lng: " + mainPageStack.clickedLng + "}])");
798- mainPageStack.favPopup = false;
799- goThereActionPopover.show();
800- }
801- }
802- }
803- }
804-
805- Loader {
806- id: actionButtonRowLoader
807- sourceComponent: !header.visible ? actionButtonRowComponent : undefined
808- anchors { right: parent.right; top: parent.top; margins: units.gu(1) }
809- }
810-
811- Component {
812- id: actionButtonRowComponent
813- Row {
814- id: actionButtonRow
815-
816- opacity: navigationPage.buttonsEnabled ? 1.0 : 0.2
817-
818- ActionIcon {
819- icon.source: Qt.resolvedUrl("../nav/img/header/nav-actions-transparent.svg")
820- enabled: navigationPage.buttonsEnabled
821- visible: mainPageStack.routeState !== 'no'
822- onClicked: {
823- goThereActionPopover.hide();
824- goThereActionPopover.showMenu = true;
825- goThereActionPopover.show();
826- }
827- }
828-
829- ActionIcon {
830- icon.name: "find"
831- enabled: navigationPage.buttonsEnabled
832- onClicked: {
833- goThereActionPopover.hide();
834- mainPageStack.push(Qt.resolvedUrl("SearchPage.qml"))
835- }
836- }
837-
838- ActionIcon {
839- icon.name: mainPageStack.center_onpos ? "media-optical-symbolic" : "gps"
840- enabled: navigationPage.buttonsEnabled && mainPageStack.center_onpos !== 2
841- onClicked: {
842- mainPageStack.center_onpos = 2;
843- goThereActionPopover.hide();
844- mainPageStack.executeJavaScript("center_pos()");
845- }
846- }
847-
848- ActionIcon {
849- icon.name: "settings"
850- enabled: navigationPage.buttonsEnabled
851- onClicked: {
852- goThereActionPopover.hide();
853- mainPageStack.push(Qt.resolvedUrl("SettingsPage.qml"));
854- }
855- }
856- }
857- }
858-
859- ZoomButtons {
860- id: zoomButtons
861- visible: navigationPage.buttonsEnabled
862- onZoomedIn: mainPageStack.executeJavaScript("custom_zoom(1)")
863- onZoomedOut: mainPageStack.executeJavaScript("custom_zoom(-1)")
864- }
865-
866- XmlListModel {
867- id: reverseXmlModel
868-
869- readonly property string baseUrl: "https://nominatim.openstreetmap.org/reverse?format=xml&email=costales.marcos@gmail.com&addressdetails=0&extratags=1&zoom=18&namedetails=1&"
870-
871- function reverseSearch(lat, lon) {
872- source = (baseUrl + "lat=" + lat + "&lon=" + lon) ;
873- }
874-
875- function clear() {
876- goThereActionPopover.reverseGeoString = "";
877- source = "";
878- }
879-
880- onStatusChanged: {
881- if (status === XmlListModel.Error || (status === XmlListModel.Ready && count === 0)) {
882- goThereActionPopover.reverseGeoString = ""
883- console.log("Error reverse geocoding the location!")
884- }
885-
886- else if (status === XmlListModel.Ready && count > 0) {
887- // Check if the location returned by reverse geocoding is a POI by looking for the existence of certain parameters
888- // like cuisine, phone, opening_hours, internet_access, wheelchair etc that do not apply to a generic address.
889- if (reverseXmlModel.get(0).description || reverseXmlModel.get(0).cuisine || reverseXmlModel.get(0).phone || reverseXmlModel.get(0).opening_hours
890- || reverseXmlModel.get(0).website && reverseXmlModel.get(0).wheelchair || reverseXmlModel.get(0).internet_access) {
891-
892- // Check if the name, osm_id and osm_type are valid, otherwise the POI popup will break.
893- if (reverseXmlModel.get(0).name && reverseXmlModel.get(0).osm_id && reverseXmlModel.get(0).osm_type) {
894- goThereActionPopover.poiName = reverseXmlModel.get(0).name
895- goThereActionPopover.osm_id = reverseXmlModel.get(0).osm_id
896- goThereActionPopover.osm_type = reverseXmlModel.get(0).osm_type.charAt(0).toUpperCase()
897- goThereActionPopover.phone = reverseXmlModel.get(0).phone
898- } else {
899+ Loader {
900+ id: actionButtonRowLoader
901+ sourceComponent: !header.visible ? actionButtonRowComponent : undefined
902+ anchors { right: parent.right; top: parent.top; margins: units.gu(1) }
903+ }
904+
905+ Component {
906+ id: actionButtonRowComponent
907+ Row {
908+ id: actionButtonRow
909+
910+ opacity: navigationPage.buttonsEnabled ? 1.0 : 0.2
911+
912+ ActionIcon {
913+ icon.source: Qt.resolvedUrl("../nav/img/header/nav-actions-transparent.svg")
914+ enabled: navigationPage.buttonsEnabled
915+ visible: mainPageStack.routeState !== 'no'
916+ onClicked: {
917+ goThereActionPopover.hide();
918+ goThereActionPopover.showMenu = true;
919+ goThereActionPopover.show();
920+ }
921+ }
922+
923+ ActionIcon {
924+ icon.name: "find"
925+ enabled: navigationPage.buttonsEnabled
926+ onClicked: {
927+ goThereActionPopover.hide();
928+ mainPageStack.showSideBar()
929+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("SearchPage.qml"))
930+ }
931+ }
932+
933+ ActionIcon {
934+ icon.name: mainPageStack.center_onpos ? "media-optical-symbolic" : "gps"
935+ enabled: navigationPage.buttonsEnabled && mainPageStack.center_onpos !== 2
936+ onClicked: {
937+ mainPageStack.center_onpos = 2;
938+ goThereActionPopover.hide();
939+ mainPageStack.executeJavaScript("center_pos()");
940+ }
941+ }
942+
943+ ActionIcon {
944+ icon.name: "settings"
945+ enabled: navigationPage.buttonsEnabled
946+ onClicked: {
947+ goThereActionPopover.hide();
948+ mainPageStack.showSideBar()
949+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("SettingsPage.qml"))
950+ }
951+ }
952+ }
953+ }
954+
955+ Item {
956+ clip: true
957+ width: zoomButtons.width + units.gu(2)
958+ height: zoomButtons.height + units.gu(6)
959+ anchors { right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: units.gu(-3) }
960+ ZoomButtons {
961+ id: zoomButtons
962+ visible: navigationPage.buttonsEnabled
963+ onZoomedIn: mainPageStack.executeJavaScript("custom_zoom(1)")
964+ onZoomedOut: mainPageStack.executeJavaScript("custom_zoom(-1)")
965+ }
966+ }
967+
968+ XmlListModel {
969+ id: reverseXmlModel
970+
971+ readonly property string baseUrl: "https://nominatim.openstreetmap.org/reverse?format=xml&email=costales.marcos@gmail.com&addressdetails=0&extratags=1&zoom=18&namedetails=1&"
972+
973+ function reverseSearch(lat, lon) {
974+ source = (baseUrl + "lat=" + lat + "&lon=" + lon) ;
975+ }
976+
977+ function clear() {
978+ goThereActionPopover.reverseGeoString = "";
979+ source = "";
980+ }
981+
982+ onStatusChanged: {
983+ if (status === XmlListModel.Error || (status === XmlListModel.Ready && count === 0)) {
984+ goThereActionPopover.reverseGeoString = ""
985+ console.log("Error reverse geocoding the location!")
986+ }
987+
988+ else if (status === XmlListModel.Ready && count > 0) {
989+ // Check if the location returned by reverse geocoding is a POI by looking for the existence of certain parameters
990+ // like cuisine, phone, opening_hours, internet_access, wheelchair etc that do not apply to a generic address.
991+ if (reverseXmlModel.get(0).description || reverseXmlModel.get(0).cuisine || reverseXmlModel.get(0).phone || reverseXmlModel.get(0).opening_hours
992+ || reverseXmlModel.get(0).website && reverseXmlModel.get(0).wheelchair || reverseXmlModel.get(0).internet_access) {
993+
994+ // Check if the name, osm_id and osm_type are valid, otherwise the POI popup will break.
995+ if (reverseXmlModel.get(0).name && reverseXmlModel.get(0).osm_id && reverseXmlModel.get(0).osm_type) {
996+ goThereActionPopover.poiName = reverseXmlModel.get(0).name
997+ goThereActionPopover.osm_id = reverseXmlModel.get(0).osm_id
998+ goThereActionPopover.osm_type = reverseXmlModel.get(0).osm_type.charAt(0).toUpperCase()
999+ goThereActionPopover.phone = reverseXmlModel.get(0).phone
1000+ } else {
1001+ goThereActionPopover.reverseGeoString = reverseXmlModel.get(0).result
1002+ }
1003+ }
1004+
1005+ // If nothing works, fall back to just showing the address in a generic popup
1006+ else {
1007 goThereActionPopover.reverseGeoString = reverseXmlModel.get(0).result
1008 }
1009 }
1010-
1011- // If nothing works, fall back to just showing the address in a generic popup
1012- else {
1013- goThereActionPopover.reverseGeoString = reverseXmlModel.get(0).result
1014- }
1015- }
1016- }
1017-
1018- source: ""
1019- query: "/reversegeocode"
1020-
1021- XmlRole { name: "osm_type"; query: "result/@osm_type/string()" }
1022- XmlRole { name: "osm_id"; query: "result/@osm_id/string()" }
1023- XmlRole { name: "result"; query: "result/string()" }
1024- XmlRole { name: "name"; query: "namedetails/name/string()" }
1025- XmlRole { name: "description"; query: "extratags/tag[@key='description']/@value/string()" }
1026- XmlRole { name: "cuisine"; query: "extratags/tag[@key='cuisine']/@value/string()" }
1027- XmlRole { name: "phone"; query: "extratags/tag[@key='phone']/@value/string()" }
1028- XmlRole { name: "opening_hours"; query: "extratags/tag[@key='opening_hours']/@value/string()" }
1029- XmlRole { name: "website"; query: "extratags/tag[@key='website']/@value/string()" }
1030- XmlRole { name: "internet_access"; query: "extratags/tag[@key='internet_access']/@value/string()" }
1031- XmlRole { name: "wheelchair"; query: "extratags/tag[@key='wheelchair']/@value/string()" }
1032- }
1033-
1034- PoiPopup {
1035- id: goThereActionPopover
1036-
1037- // Dragons be here! Don't change these values
1038- hidePosition: -3*height
1039- showPosition: navApp.settings.headerVisible ? 0 : -navigationPage.header.height
1040- anchors { top: navigationPage.header.bottom }
1041-
1042- height: mainContentLoader.height + 2*mainContentLoader.anchors.margins
1043-
1044- property string reverseGeoString: ""
1045- property string poiName
1046- property string osm_type
1047- property string osm_id
1048- property string phone
1049- property bool showMenu: false
1050-
1051- onIsShownChanged: {
1052- if (!goThereActionPopover.isShown) {
1053- reverseXmlModel.clear()
1054- goThereActionPopover.showMenu = false
1055- }
1056- }
1057-
1058- Loader {
1059- id: mainContentLoader
1060-
1061- sourceComponent: {
1062- if (goThereActionPopover.isShown) {
1063- if (goThereActionPopover.showMenu) {
1064- return routeMenu
1065- }
1066-
1067- if (goThereActionPopover.osm_id === 'none') {
1068- return genericPopupComponent
1069- } else {
1070- return poiPopupComponent
1071- }
1072- }
1073-
1074- else {
1075- return undefined
1076- }
1077- }
1078-
1079- anchors { top: parent.top; left: parent.left; right: parent.right; margins: units.gu(2) }
1080- }
1081-
1082- Component {
1083- id: routeMenu
1084- Item {
1085- width: parent.width
1086- height: routePageGrid.height
1087-
1088- Component.onCompleted: {
1089- mainPageStack.executeJavaScript("qml_set_route_status();")
1090- }
1091-
1092- CustomGridView {
1093- id: routePageGrid
1094-
1095- ListModel {
1096- id: routePageModel
1097- Component.onCompleted: initialize()
1098-
1099- function initialize() {
1100- routePageModel.append({mode: "DESTINATION", text: i18n.tr("NearBy Destination"), iconName: "location"})
1101- routePageModel.append({mode: "CANCEL", text: i18n.tr("Cancel Route"), iconName: "dialog-error-symbolic"})
1102- }
1103- }
1104-
1105- itemWidth: units.gu(9)
1106- model: routePageModel
1107- anchors.horizontalCenter: parent.horizontalCenter
1108-
1109- delegate: GridDelegate {
1110- id: delegate
1111-
1112- width: units.gu(9)
1113- title: model.text
1114- icon.name: model.iconName
1115-
1116- onClicked: {
1117- if (model.mode === "DESTINATION") {
1118- mainPageStack.push(Qt.resolvedUrl("PoiPage.qml"), {"lat": mainPageStack.endLat, "lng": mainPageStack.endLng})
1119- } else if (model.mode === "CANCEL") {
1120- mainPageStack.routeState = 'no';
1121- mainPageStack.executeJavaScript("click_cancel_route();");
1122- mainPageStack.pop();
1123- }
1124- goThereActionPopover.showMenu = false
1125- goThereActionPopover.hide()
1126- }
1127- }
1128- }
1129- }
1130- }
1131-
1132- Component {
1133- id: genericPopupComponent
1134- Column {
1135- spacing: units.gu(2)
1136-
1137- Label {
1138- id: geoCodeLabel
1139- maximumLineCount: 3
1140- width: parent.width
1141- wrapMode: Text.WordWrap
1142- color: UbuntuColors.slate
1143- horizontalAlignment: Text.AlignHCenter
1144- textSize: !truncated ? Label.Large : Label.Medium
1145- text: goThereActionPopover.reverseGeoString ? goThereActionPopover.reverseGeoString
1146- : i18n.tr("Coord: %1, %2").arg(parseFloat(mainPageStack.clickedLat).toFixed(5)).arg(parseFloat(mainPageStack.clickedLng).toFixed(5));
1147- }
1148-
1149- Row {
1150- spacing: units.gu(0.5)
1151- anchors.horizontalCenter: parent.horizontalCenter
1152-
1153- GridIconDelegate {
1154- icon.name: "send"
1155- icon.height: units.gu(3)
1156- highlightSize: units.gu(-1)
1157- visible: goThereActionPopover.poiName !== i18n.tr("Current Position") ? true : false
1158- onClicked: {
1159- goThereActionPopover.hide();
1160- mainPageStack.center_onpos = 2;
1161- mainPageStack.routeState = 'yes';
1162- mainPageStack.executeJavaScript("calc2coord(" + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1163- }
1164- }
1165-
1166- GridIconDelegate {
1167- icon.name: mainPageStack.favPopup ? "starred" : "non-starred"
1168- icon.height: units.gu(3)
1169- highlightSize: units.gu(-1)
1170- onClicked: {
1171- mainPageStack.favPopup = !mainPageStack.favPopup;
1172- mainPageStack.push(Qt.resolvedUrl("SearchPage.qml"), {addFavoriteFromMap: true, favLat: mainPageStack.clickedLat, favLng: mainPageStack.clickedLng, favName: ""});
1173- }
1174- }
1175-
1176- GridIconDelegate {
1177- icon.name: "location"
1178- icon.height: units.gu(3)
1179- highlightSize: units.gu(-1)
1180- onClicked: {
1181- mainPageStack.push(Qt.resolvedUrl("PoiPage.qml"), {"lat": mainPageStack.clickedLat, "lng": mainPageStack.clickedLng})
1182- }
1183- }
1184-
1185- GridIconDelegate {
1186- icon.name: "share"
1187- icon.height: units.gu(3)
1188- highlightSize: units.gu(-1)
1189- onClicked: {
1190- mainPageStack.push(Qt.resolvedUrl("Share.qml"), {"lat": mainPageStack.clickedLat, "lon": mainPageStack.clickedLng})
1191- }
1192- }
1193-
1194- GridIconDelegate {
1195- icon.name: "transfer-progress-upload"
1196- visible: mainPageStack.ptFromLat === "null"
1197- icon.height: units.gu(3)
1198- highlightSize: units.gu(-1)
1199- onClicked: {
1200- goThereActionPopover.hide();
1201- mainPageStack.ptFromLat = mainPageStack.clickedLat;
1202- mainPageStack.ptFromLng = mainPageStack.clickedLng;
1203- }
1204- }
1205-
1206- GridIconDelegate {
1207- icon.name: "transfer-progress-download"
1208- visible: mainPageStack.ptFromLat !== "null"
1209- icon.height: units.gu(3)
1210- highlightSize: units.gu(-1)
1211- onClicked: {
1212- goThereActionPopover.hide();
1213- mainPageStack.routeState = 'simulate_calculating';
1214- mainPageStack.executeJavaScript("simulate2coord(" + mainPageStack.ptFromLat + ", " + mainPageStack.ptFromLng + ", " + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1215- mainPageStack.ptFromLat = "null";
1216- }
1217- }
1218- }
1219- }
1220- }
1221-
1222- Component {
1223- id: poiPopupComponent
1224- Column {
1225- spacing: units.gu(2)
1226-
1227- Label {
1228- text: goThereActionPopover.poiName
1229- visible: goThereActionPopover.poiName !== ""
1230- maximumLineCount: 2
1231- width: parent.width
1232- horizontalAlignment: Text.AlignHCenter
1233- textSize: Label.Large
1234- elide: Text.ElideRight
1235- wrapMode: Text.WordWrap
1236- color: UbuntuColors.slate
1237- }
1238-
1239- Row {
1240- spacing: units.gu(2)
1241- anchors.horizontalCenter: parent.horizontalCenter
1242-
1243- GridIconDelegate {
1244- icon.name: "send"
1245- icon.height: units.gu(3)
1246- highlightSize: units.gu(-1)
1247- onClicked: {
1248- goThereActionPopover.hide();
1249- mainPageStack.center_onpos = 2;
1250- mainPageStack.routeState = 'yes';
1251- mainPageStack.executeJavaScript("calc2coord(" + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1252- }
1253- }
1254-
1255- GridIconDelegate {
1256- icon.name: "call-start"
1257- icon.height: units.gu(3)
1258- highlightSize: units.gu(-1)
1259- visible: goThereActionPopover.phone !== ""
1260- onClicked: {
1261- Qt.openUrlExternally("tel:///" + goThereActionPopover.phone)
1262- }
1263- }
1264-
1265- GridIconDelegate {
1266- icon.name: "info"
1267- icon.height: units.gu(3)
1268- highlightSize: units.gu(-1)
1269- onClicked: {
1270- goThereActionPopover.hide();
1271- mainPageStack.push(Qt.resolvedUrl("PoiDetailsPage.qml"), {osm_id: goThereActionPopover.osm_id, osm_type: goThereActionPopover.osm_type, poiName: goThereActionPopover.poiName})
1272- }
1273- }
1274- }
1275- }
1276- }
1277- }
1278- }
1279- }
1280-
1281- Connections {
1282- target: Qt.application
1283- onStateChanged:
1284- if(Qt.application.state !== Qt.ApplicationActive) {
1285- goThereActionPopover.hide();
1286- mainPageStack.executeJavaScript("qml_save_pos();");
1287- }
1288+ }
1289+
1290+ source: ""
1291+ query: "/reversegeocode"
1292+
1293+ XmlRole { name: "osm_type"; query: "result/@osm_type/string()" }
1294+ XmlRole { name: "osm_id"; query: "result/@osm_id/string()" }
1295+ XmlRole { name: "result"; query: "result/string()" }
1296+ XmlRole { name: "name"; query: "namedetails/name/string()" }
1297+ XmlRole { name: "description"; query: "extratags/tag[@key='description']/@value/string()" }
1298+ XmlRole { name: "cuisine"; query: "extratags/tag[@key='cuisine']/@value/string()" }
1299+ XmlRole { name: "phone"; query: "extratags/tag[@key='phone']/@value/string()" }
1300+ XmlRole { name: "opening_hours"; query: "extratags/tag[@key='opening_hours']/@value/string()" }
1301+ XmlRole { name: "website"; query: "extratags/tag[@key='website']/@value/string()" }
1302+ XmlRole { name: "internet_access"; query: "extratags/tag[@key='internet_access']/@value/string()" }
1303+ XmlRole { name: "wheelchair"; query: "extratags/tag[@key='wheelchair']/@value/string()" }
1304+ }
1305+
1306+ PoiPopup {
1307+ id: goThereActionPopover
1308+
1309+ // Dragons be here! Don't change these values
1310+ hidePosition: -3*height
1311+ showPosition: navApp.settings.headerVisible ? 0 : -navigationPage.header.height
1312+ anchors { top: navigationPage.header.bottom }
1313+
1314+ height: mainContentLoader.height + 2*mainContentLoader.anchors.margins
1315+
1316+ property string reverseGeoString: ""
1317+ property string poiName
1318+ property string osm_type
1319+ property string osm_id
1320+ property string phone
1321+ property bool showMenu: false
1322+
1323+ onIsShownChanged: {
1324+ if (!goThereActionPopover.isShown) {
1325+ reverseXmlModel.clear()
1326+ goThereActionPopover.showMenu = false
1327+ }
1328+ }
1329+
1330+ Loader {
1331+ id: mainContentLoader
1332+
1333+ sourceComponent: {
1334+ if (goThereActionPopover.isShown) {
1335+ if (goThereActionPopover.showMenu) {
1336+ return routeMenu
1337+ }
1338+
1339+ if (goThereActionPopover.osm_id === 'none') {
1340+ return genericPopupComponent
1341+ } else {
1342+ return poiPopupComponent
1343+ }
1344+ }
1345+
1346+ else {
1347+ return undefined
1348+ }
1349+ }
1350+
1351+ anchors { top: parent.top; left: parent.left; right: parent.right; margins: units.gu(2) }
1352+ }
1353+
1354+ Component {
1355+ id: routeMenu
1356+ Item {
1357+ width: parent.width
1358+ height: routePageGrid.height
1359+
1360+ Component.onCompleted: {
1361+ mainPageStack.executeJavaScript("qml_set_route_status();")
1362+ }
1363+
1364+ CustomGridView {
1365+ id: routePageGrid
1366+
1367+ ListModel {
1368+ id: routePageModel
1369+ Component.onCompleted: initialize()
1370+
1371+ function initialize() {
1372+ routePageModel.append({mode: "DESTINATION", text: i18n.tr("NearBy Destination"), iconName: "location"})
1373+ routePageModel.append({mode: "CANCEL", text: i18n.tr("Cancel Route"), iconName: "dialog-error-symbolic"})
1374+ }
1375+ }
1376+
1377+ itemWidth: units.gu(9)
1378+ model: routePageModel
1379+ anchors.horizontalCenter: parent.horizontalCenter
1380+
1381+ delegate: GridDelegate {
1382+ id: delegate
1383+
1384+ width: units.gu(9)
1385+ title: model.text
1386+ icon.name: model.iconName
1387+
1388+ onClicked: {
1389+ if (model.mode === "DESTINATION") {
1390+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("PoiPage.qml"), {"lat": mainPageStack.endLat, "lng": mainPageStack.endLng})
1391+ } else if (model.mode === "CANCEL") {
1392+ mainPageStack.routeState = 'no';
1393+ mainPageStack.executeJavaScript("click_cancel_route();");
1394+ }
1395+ goThereActionPopover.showMenu = false
1396+ goThereActionPopover.hide()
1397+ }
1398+ }
1399+ }
1400+ }
1401+ }
1402+
1403+ Component {
1404+ id: genericPopupComponent
1405+ Column {
1406+ spacing: units.gu(2)
1407+
1408+ Label {
1409+ id: geoCodeLabel
1410+ maximumLineCount: 3
1411+ width: parent.width
1412+ wrapMode: Text.WordWrap
1413+ color: UbuntuColors.slate
1414+ horizontalAlignment: Text.AlignHCenter
1415+ textSize: !truncated ? Label.Large : Label.Medium
1416+ text: goThereActionPopover.reverseGeoString ? goThereActionPopover.reverseGeoString
1417+ : i18n.tr("Coord: %1, %2").arg(parseFloat(mainPageStack.clickedLat).toFixed(5)).arg(parseFloat(mainPageStack.clickedLng).toFixed(5));
1418+ }
1419+
1420+ Row {
1421+ spacing: units.gu(0.5)
1422+ anchors.horizontalCenter: parent.horizontalCenter
1423+
1424+ GridIconDelegate {
1425+ icon.name: "send"
1426+ icon.height: units.gu(3)
1427+ highlightSize: units.gu(-1)
1428+ visible: goThereActionPopover.poiName !== i18n.tr("Current Position") ? true : false
1429+ onClicked: {
1430+ goThereActionPopover.hide();
1431+ mainPageStack.center_onpos = 2;
1432+ mainPageStack.routeState = 'yes';
1433+ mainPageStack.executeJavaScript("calc2coord(" + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1434+ }
1435+ }
1436+
1437+ GridIconDelegate {
1438+ icon.name: mainPageStack.favPopup ? "starred" : "non-starred"
1439+ icon.height: units.gu(3)
1440+ highlightSize: units.gu(-1)
1441+ onClicked: {
1442+ mainPageStack.favPopup = !mainPageStack.favPopup;
1443+ mainPageStack.showSideBar()
1444+ var incubator = mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("SearchPage.qml"), {favLat: mainPageStack.clickedLat, favLng: mainPageStack.clickedLng, favName: ""});
1445+ if (incubator && incubator.status == Component.Loading) {
1446+ incubator.onStatusChanged = function(status) {
1447+ if (status == Component.Ready) {
1448+ incubator.object.addFavorite()
1449+ }
1450+ }
1451+ }
1452+ }
1453+ }
1454+
1455+ GridIconDelegate {
1456+ icon.name: "location"
1457+ icon.height: units.gu(3)
1458+ highlightSize: units.gu(-1)
1459+ onClicked: {
1460+ mainPageStack.showSideBar()
1461+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("PoiPage.qml"), {"lat": mainPageStack.clickedLat, "lng": mainPageStack.clickedLng})
1462+ }
1463+ }
1464+
1465+ GridIconDelegate {
1466+ icon.name: "share"
1467+ icon.height: units.gu(3)
1468+ highlightSize: units.gu(-1)
1469+ onClicked: {
1470+ mainPageStack.showSideBar()
1471+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("Share.qml"), {"lat": mainPageStack.clickedLat, "lon": mainPageStack.clickedLng, "isParentPage": true})
1472+ }
1473+ }
1474+
1475+ GridIconDelegate {
1476+ icon.name: "transfer-progress-upload"
1477+ visible: mainPageStack.ptFromLat === "null"
1478+ icon.height: units.gu(3)
1479+ highlightSize: units.gu(-1)
1480+ onClicked: {
1481+ goThereActionPopover.hide();
1482+ mainPageStack.ptFromLat = mainPageStack.clickedLat;
1483+ mainPageStack.ptFromLng = mainPageStack.clickedLng;
1484+ }
1485+ }
1486+
1487+ GridIconDelegate {
1488+ icon.name: "transfer-progress-download"
1489+ visible: mainPageStack.ptFromLat !== "null"
1490+ icon.height: units.gu(3)
1491+ highlightSize: units.gu(-1)
1492+ onClicked: {
1493+ goThereActionPopover.hide();
1494+ mainPageStack.routeState = 'simulate_calculating';
1495+ mainPageStack.executeJavaScript("simulate2coord(" + mainPageStack.ptFromLat + ", " + mainPageStack.ptFromLng + ", " + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1496+ mainPageStack.ptFromLat = "null";
1497+ }
1498+ }
1499+ }
1500+ }
1501+ }
1502+
1503+ Component {
1504+ id: poiPopupComponent
1505+ Column {
1506+ spacing: units.gu(2)
1507+
1508+ Label {
1509+ text: goThereActionPopover.poiName
1510+ visible: goThereActionPopover.poiName !== ""
1511+ maximumLineCount: 2
1512+ width: parent.width
1513+ horizontalAlignment: Text.AlignHCenter
1514+ textSize: Label.Large
1515+ elide: Text.ElideRight
1516+ wrapMode: Text.WordWrap
1517+ color: UbuntuColors.slate
1518+ }
1519+
1520+ Row {
1521+ spacing: units.gu(2)
1522+ anchors.horizontalCenter: parent.horizontalCenter
1523+
1524+ GridIconDelegate {
1525+ icon.name: "send"
1526+ icon.height: units.gu(3)
1527+ highlightSize: units.gu(-1)
1528+ onClicked: {
1529+ goThereActionPopover.hide();
1530+ mainPageStack.center_onpos = 2;
1531+ mainPageStack.routeState = 'yes';
1532+ mainPageStack.executeJavaScript("calc2coord(" + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1533+ }
1534+ }
1535+
1536+ GridIconDelegate {
1537+ icon.name: "call-start"
1538+ icon.height: units.gu(3)
1539+ highlightSize: units.gu(-1)
1540+ visible: goThereActionPopover.phone !== ""
1541+ onClicked: {
1542+ Qt.openUrlExternally("tel:///" + goThereActionPopover.phone)
1543+ }
1544+ }
1545+
1546+ GridIconDelegate {
1547+ icon.name: "info"
1548+ icon.height: units.gu(3)
1549+ highlightSize: units.gu(-1)
1550+ onClicked: {
1551+ goThereActionPopover.hide();
1552+ mainPageStack.showSideBar()
1553+ mainPageStack.addPageToNextColumn(mainPageStack.primaryPage, Qt.resolvedUrl("PoiDetailsPage.qml"), {osm_id: goThereActionPopover.osm_id, osm_type: goThereActionPopover.osm_type, poiName: goThereActionPopover.poiName, isParentPage: true})
1554+ }
1555+ }
1556+ }
1557+ }
1558+ }
1559+ }
1560+ }
1561+ }
1562+
1563+ Connections {
1564+ target: Qt.application
1565+ onStateChanged:
1566+ if(Qt.application.state !== Qt.ApplicationActive) {
1567+ goThereActionPopover.hide();
1568+ mainPageStack.executeJavaScript("qml_save_pos();");
1569+ }
1570+ }
1571 }
1572 }
1573
1574=== modified file 'qml/PoiDetailsPage.qml'
1575--- qml/PoiDetailsPage.qml 2016-04-24 16:38:17 +0000
1576+++ qml/PoiDetailsPage.qml 2016-04-28 16:10:40 +0000
1577@@ -27,19 +27,15 @@
1578 property string osm_id
1579 property string poiName
1580
1581+ // Property to indicate if the poi details page was opened directly (from a popup)
1582+ // or as a child (from the search page)
1583+ property bool isParentPage: false
1584+
1585 header: UNavHeader {
1586 title: poiName
1587 flickable: flickable
1588- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
1589- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
1590- // at which point this back button can be removed.
1591- leadingActionBar.actions: Action {
1592- iconName: "back"
1593- text: i18n.tr("Back")
1594- shortcut: "Escape"
1595- onTriggered: {
1596- mainPageStack.pop()
1597- }
1598+ trailingActionBar.actions: CloseHeaderAction {
1599+ visible: mainPageStack.columns !== 1 && isParentPage
1600 }
1601 }
1602
1603@@ -47,6 +43,12 @@
1604
1605 Component.onCompleted: mainPageStack.executeJavaScript("qml_set_route_status()")
1606
1607+ Component.onDestruction: {
1608+ // Hide 2nd column when returning to the map to avoid an empty white column
1609+ if (mainPageStack.columns === 1 && isParentPage)
1610+ mainPageStack.hideSideBar()
1611+ }
1612+
1613 XmlListModel {
1614 id: poiDetailsModel
1615
1616@@ -192,22 +194,35 @@
1617
1618 onClicked: {
1619 if (model.mode === "ROUTE") {
1620- mainPageStack.clear()
1621+ if (mainPageStack.columns === 1) {
1622+ mainPageStack.removePages(mainPageStack.primaryPage)
1623+ }
1624 mainPageStack.center_onpos = 2;
1625 mainPageStack.routeState = 'yes'
1626 mainPageStack.executeJavaScript("calc2coord("+ poiDetailsModel.lat + "," + poiDetailsModel.lng + ");");
1627 } else if (model.mode === "SAVE") {
1628- mainPageStack.push(Qt.resolvedUrl("SearchPage.qml"), {addFavoriteFromMap: true, favLat: poiDetailsModel.lat, favLng: poiDetailsModel.lng, favName: poiName});
1629+ var incubator = mainPageStack.addPageToCurrentColumn(poiDetailsPage, Qt.resolvedUrl("SearchPage.qml"), {favLat: poiDetailsModel.lat, favLng: poiDetailsModel.lng, favName: poiName});
1630+ if (incubator && incubator.status == Component.Loading) {
1631+ incubator.onStatusChanged = function(status) {
1632+ if (status == Component.Ready) {
1633+ incubator.object.addFavorite()
1634+ }
1635+ }
1636+ }
1637 } else if (model.mode === "SHARE") {
1638- mainPageStack.push(Qt.resolvedUrl("Share.qml"), {"lat": poiDetailsModel.lat, "lon": poiDetailsModel.lng})
1639+ mainPageStack.addPageToCurrentColumn(poiDetailsPage, Qt.resolvedUrl("Share.qml"), {"lat": poiDetailsModel.lat, "lon": poiDetailsModel.lng})
1640 } else if (model.mode === "NEARBY") {
1641- mainPageStack.push(Qt.resolvedUrl("PoiPage.qml"), {"lat": poiDetailsModel.lat, "lng": poiDetailsModel.lng})
1642+ mainPageStack.addPageToCurrentColumn(poiDetailsPage, Qt.resolvedUrl("PoiPage.qml"), {"lat": poiDetailsModel.lat, "lng": poiDetailsModel.lng})
1643 } else if (model.mode === "PTFROM") {
1644- mainPageStack.clear()
1645+ if (mainPageStack.columns === 1) {
1646+ mainPageStack.removePages(mainPageStack.primaryPage)
1647+ }
1648 mainPageStack.ptFromLat = mainPageStack.clickedLat;
1649 mainPageStack.ptFromLng = mainPageStack.clickedLng;
1650 } else if (model.mode === "PTTO") {
1651- mainPageStack.clear()
1652+ if (mainPageStack.columns === 1) {
1653+ mainPageStack.removePages(mainPageStack.primaryPage)
1654+ }
1655 mainPageStack.routeState = 'simulate_calculating';
1656 mainPageStack.executeJavaScript("simulate2coord(" + mainPageStack.ptFromLat + ", " + mainPageStack.ptFromLng + ", " + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");");
1657 mainPageStack.ptFromLat = "null";
1658
1659=== modified file 'qml/PoiListPage.qml'
1660--- qml/PoiListPage.qml 2016-04-23 20:54:55 +0000
1661+++ qml/PoiListPage.qml 2016-04-28 16:10:40 +0000
1662@@ -36,25 +36,15 @@
1663 title: poiType
1664 flickable: resultsListView
1665
1666- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
1667- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
1668- // at which point this back button can be removed.
1669- leadingActionBar.actions: Action {
1670- iconName: "back"
1671- text: i18n.tr("Back")
1672- shortcut: "Escape"
1673- onTriggered: {
1674- mainPageStack.pop()
1675- }
1676- }
1677-
1678 trailingActionBar.actions: Action {
1679 id: routeAction
1680 iconSource: "../nav/img/header/poimap.svg"
1681 text: i18n.tr("Show POIs on map")
1682 visible: sortedPoiModel.count !== 0
1683 onTriggered: {
1684- mainPageStack.clear();
1685+ if (mainPageStack.columns === 1) {
1686+ mainPageStack.removePages(mainPageStack.primaryPage)
1687+ }
1688 if (mainPageStack.center_onpos === 2)
1689 mainPageStack.center_onpos = 1;
1690 mainPageStack.executeJavaScript("ui.markers_POI_set(" + JSON.stringify(sortedPoiModel.allPOI()) + ")");
1691@@ -123,11 +113,12 @@
1692 id: distButton
1693 visible: false
1694 z: 500
1695- width: parent.width*5/8
1696 anchors {
1697+ left: parent.left
1698+ right: parent.right
1699+ margins: units.gu(2)
1700 top: distSlider.bottom
1701 topMargin: units.gu (3)
1702- horizontalCenter: parent.horizontalCenter
1703 }
1704 iconName: "reload"
1705 onClicked: {
1706@@ -262,12 +253,13 @@
1707 }
1708 }
1709
1710- ListView {
1711+ UbuntuListView {
1712 id: resultsListView
1713
1714 model: sortedPoiModel
1715 anchors.fill: parent
1716 visible: false
1717+ clip: true
1718
1719 delegate: ListItem {
1720 height: poiListItemLayout.height + divider.height
1721@@ -276,7 +268,8 @@
1722 Action {
1723 iconName: "send"
1724 onTriggered: {
1725- mainPageStack.clear()
1726+ if (mainPageStack.columns === 1)
1727+ mainPageStack.removePages(mainPageStack.primaryPage)
1728 mainPageStack.center_onpos = 2;
1729 mainPageStack.routeState = 'yes'
1730 mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");
1731@@ -292,14 +285,15 @@
1732 Action {
1733 iconName: "info"
1734 onTriggered: {
1735- mainPageStack.push(Qt.resolvedUrl("PoiDetailsPage.qml"), {osm_id: model.osm_id, osm_type: model.osm_type, poiName: model.name !== "" ? model.name : poiListPage.poiType})
1736+ mainPageStack.addPageToCurrentColumn(poiListPage, Qt.resolvedUrl("PoiDetailsPage.qml"), {osm_id: model.osm_id, osm_type: model.osm_type, poiName: model.name !== "" ? model.name : poiListPage.poiType})
1737 }
1738 }
1739 ]
1740 }
1741
1742 onClicked: {
1743- mainPageStack.clear();
1744+ if (mainPageStack.columns === 1)
1745+ mainPageStack.removePages(mainPageStack.primaryPage)
1746 if (mainPageStack.center_onpos === 2)
1747 mainPageStack.center_onpos = 1;
1748 mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + model.name + "\", lat: " + model.lat + ", lng: " + model.lng + ", osm_type: '" + model.osm_type + "', osm_id: " + model.osm_id + ", phone: \"" + model.phone + "\"}])");
1749
1750=== modified file 'qml/PoiPage.qml'
1751--- qml/PoiPage.qml 2016-04-17 22:32:48 +0000
1752+++ qml/PoiPage.qml 2016-04-28 16:10:40 +0000
1753@@ -37,12 +37,18 @@
1754 }
1755
1756 function goBackStandardMode() {
1757- mainPageStack.pop()
1758+ mainPageStack.removePages(poiPage)
1759 }
1760
1761 Keys.onEscapePressed: {
1762 !poiHeader.isSearchMode ? goBackStandardMode()
1763- : goBackSearchMode()
1764+ : goBackSearchMode()
1765+ }
1766+
1767+ Component.onDestruction: {
1768+ // Hide 2nd column when returning to the map to avoid an empty white column
1769+ if (mainPageStack.columns === 1)
1770+ mainPageStack.hideSideBar()
1771 }
1772
1773 header: UNavHeader {
1774@@ -56,6 +62,7 @@
1775 leadingActionBar.actions: Action {
1776 iconName: "back"
1777 text: i18n.tr("Back")
1778+ visible: poiHeader.isSearchMode || mainPageStack.columns === 1
1779 onTriggered: {
1780 if (poiHeader.isSearchMode) {
1781 goBackSearchMode()
1782@@ -65,17 +72,23 @@
1783 }
1784 }
1785
1786- trailingActionBar.actions: Action {
1787- id: searchAction
1788- iconName: "find"
1789- text: i18n.tr("Search")
1790- shortcut: "Ctrl+F"
1791- visible: !poiHeader.isSearchMode
1792- onTriggered: {
1793- poiHeader.isSearchMode = true
1794- poiHeader.searchField.forceActiveFocus()
1795+ trailingActionBar.actions: [
1796+ CloseHeaderAction {
1797+ visible: mainPageStack.columns !== 1 && !poiHeader.isSearchMode
1798+ },
1799+
1800+ Action {
1801+ id: searchAction
1802+ iconName: "find"
1803+ text: i18n.tr("Search")
1804+ shortcut: "Ctrl+F"
1805+ visible: !poiHeader.isSearchMode
1806+ onTriggered: {
1807+ poiHeader.isSearchMode = true
1808+ poiHeader.searchField.forceActiveFocus()
1809+ }
1810 }
1811- }
1812+ ]
1813
1814 contents: Loader {
1815 id: contentLoader
1816@@ -189,8 +202,10 @@
1817 ProgressionSlot{}
1818 }
1819 onClicked: {
1820- goBackSearchMode()
1821- mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"), {
1822+ if (poiHeader.isSearchMode) {
1823+ goBackSearchMode()
1824+ }
1825+ mainPageStack.addPageToCurrentColumn(poiPage, Qt.resolvedUrl("PoiListPage.qml"), {
1826 lat: poiPage.lat,
1827 lng: poiPage.lng,
1828 poiType: model.label,
1829
1830=== modified file 'qml/RouteInfoListPage.qml'
1831--- qml/RouteInfoListPage.qml 2016-04-15 21:08:18 +0000
1832+++ qml/RouteInfoListPage.qml 2016-04-28 16:10:40 +0000
1833@@ -28,22 +28,17 @@
1834 header: UNavHeader {
1835 title: i18n.tr("Route Info")
1836 flickable: resultsListView
1837-
1838- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
1839- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
1840- // at which point this back button can be removed.
1841- leadingActionBar.actions: Action {
1842- iconName: "back"
1843- text: i18n.tr("Back")
1844- shortcut: "Escape"
1845- onTriggered: {
1846- mainPageStack.pop()
1847- }
1848- }
1849+ trailingActionBar.actions: CloseHeaderAction {}
1850 }
1851
1852 anchors.fill: parent
1853
1854+ Component.onDestruction: {
1855+ // Hide 2nd column when returning to the map to avoid an empty white column
1856+ if (mainPageStack.columns === 1)
1857+ mainPageStack.hideSideBar()
1858+ }
1859+
1860 ListModel {
1861 id: routeInfoListModel
1862
1863
1864=== modified file 'qml/SearchPage.qml'
1865--- qml/SearchPage.qml 2016-04-18 21:05:40 +0000
1866+++ qml/SearchPage.qml 2016-04-28 16:10:40 +0000
1867@@ -23,18 +23,18 @@
1868 Page {
1869 id: searchPage
1870
1871- property bool addFavoriteFromMap: false
1872 property string favLat
1873 property string favLng
1874 property string favName
1875
1876 Component.onCompleted: {
1877 mainPageStack.executeJavaScript("qml_set_route_status();")
1878- // On adding a favorite from map, show the favorites section and then the appropriate
1879- // add favorite dialog (add/overwrite)
1880- if (addFavoriteFromMap) {
1881- addFavorite()
1882- }
1883+ }
1884+
1885+ Component.onDestruction: {
1886+ // Hide 2nd column when returning to the map to avoid an empty white column
1887+ if (mainPageStack.columns === 1)
1888+ mainPageStack.hideSideBar()
1889 }
1890
1891 // This connection is needed to add a favorite from the search results returned
1892@@ -62,18 +62,6 @@
1893
1894 flickable: typeSections.selectedIndex !== 2 ? mainLoader.item.flickable : null
1895
1896- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
1897- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
1898- // at which point this back button can be removed.
1899- leadingActionBar.actions: Action {
1900- iconName: "back"
1901- text: i18n.tr("Back")
1902- shortcut: "Escape"
1903- onTriggered: {
1904- mainPageStack.pop()
1905- }
1906- }
1907-
1908 contents: Label {
1909 textSize: Label.Large
1910 color: "White"
1911@@ -84,16 +72,20 @@
1912 anchors.verticalCenter: parent.verticalCenter
1913 }
1914
1915- trailingActionBar.actions: Action {
1916- id: actionButton
1917- iconSource: Qt.resolvedUrl("../nav/img/header/favorite-new.svg")
1918- shortcut: "Ctrl+N"
1919- visible: typeSections.selectedIndex === 1
1920- text: i18n.tr("Add Favorite")
1921- onTriggered: {
1922- addActionList.show()
1923+ trailingActionBar.actions: [
1924+ CloseHeaderAction {},
1925+
1926+ Action {
1927+ id: actionButton
1928+ iconSource: Qt.resolvedUrl("../nav/img/header/favorite-new.svg")
1929+ shortcut: "Ctrl+N"
1930+ visible: typeSections.selectedIndex === 1
1931+ text: i18n.tr("Add Favorite")
1932+ onTriggered: {
1933+ addActionList.show()
1934+ }
1935 }
1936- }
1937+ ]
1938
1939 extension: UNavPageSection {
1940 id: typeSections
1941@@ -175,9 +167,10 @@
1942
1943 }
1944 Action {
1945+ visible: mainPageStack.columns === 1
1946 text: i18n.tr("Add by clicking on Map")
1947 onTriggered: {
1948- mainPageStack.clear();
1949+ mainPageStack.removePages(searchPage)
1950 }
1951 }
1952 }
1953
1954=== modified file 'qml/SettingsPage.qml'
1955--- qml/SettingsPage.qml 2016-04-17 09:25:31 +0000
1956+++ qml/SettingsPage.qml 2016-04-28 16:10:40 +0000
1957@@ -25,28 +25,26 @@
1958 Page {
1959 id: settingsPage
1960
1961+ Component.onDestruction: {
1962+ // Hide 2nd column when returning to the map to avoid an empty white column
1963+ if (mainPageStack.columns === 1)
1964+ mainPageStack.hideSideBar()
1965+ }
1966+
1967 header: UNavHeader {
1968 title: i18n.tr("Settings")
1969 flickable: flickable
1970
1971- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
1972- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
1973- // at which point this back button can be removed.
1974- leadingActionBar.actions: Action {
1975- iconName: "back"
1976- text: i18n.tr("Back")
1977- shortcut: "Escape"
1978- onTriggered: {
1979- mainPageStack.pop()
1980+ trailingActionBar.actions: [
1981+ CloseHeaderAction {},
1982+
1983+ Action {
1984+ id: actionInfo
1985+ iconName: "info"
1986+ text: i18n.tr("About")
1987+ onTriggered: mainPageStack.addPageToCurrentColumn(settingsPage, Qt.resolvedUrl("AboutPage.qml"))
1988 }
1989- }
1990-
1991- trailingActionBar.actions: Action {
1992- id: actionInfo
1993- iconName: "info"
1994- text: i18n.tr("About")
1995- onTriggered: mainPageStack.push(Qt.resolvedUrl("AboutPage.qml"))
1996- }
1997+ ]
1998 }
1999
2000 signal settingsChanged()
2001
2002=== modified file 'qml/Share.qml'
2003--- qml/Share.qml 2016-04-18 20:39:34 +0000
2004+++ qml/Share.qml 2016-04-28 16:10:40 +0000
2005@@ -25,22 +25,24 @@
2006 property var lat
2007 property var lon
2008
2009+ // Property to indicate if the share page was opened directly (from a popup)
2010+ // or as a child (from the search page)
2011+ property bool isParentPage: false
2012+
2013 header: UNavHeader {
2014 title: i18n.tr("Share location to")
2015
2016- // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back.
2017- // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages,
2018- // at which point this back button can be removed.
2019- leadingActionBar.actions: Action {
2020- iconName: "back"
2021- text: i18n.tr("Back")
2022- shortcut: "Escape"
2023- onTriggered: {
2024- mainPageStack.pop()
2025- }
2026+ trailingActionBar.actions: CloseHeaderAction {
2027+ visible: mainPageStack.columns !== 1 && isParentPage
2028 }
2029 }
2030
2031+ Component.onDestruction: {
2032+ // Hide 2nd column when returning to the map to avoid an empty white column
2033+ if (mainPageStack.columns === 1 && isParentPage)
2034+ mainPageStack.hideSideBar()
2035+ }
2036+
2037 Component {
2038 id: resultComponent
2039 ContentItem {}
2040@@ -56,7 +58,11 @@
2041 anchors.topMargin: picker.header.height
2042
2043 onCancelPressed: {
2044- mainPageStack.pop()
2045+ // Do not pop the share page when in a 2-column layout as it will leave
2046+ // an empty second column
2047+ if (mainPageStack.columns === 1) {
2048+ mainPageStack.removePages(picker)
2049+ }
2050 }
2051
2052 onPeerSelected: {
2053@@ -64,7 +70,11 @@
2054 var url2shared = 'http://unav-go.github.io/?p=' + parseFloat(picker.lat).toFixed(5) + ',' + parseFloat(picker.lon).toFixed(5);
2055 request.items = [ resultComponent.createObject(navApp.mainPageStack, {"url": url2shared}) ];
2056 request.state = ContentTransfer.Charged;
2057- mainPageStack.pop()
2058+ // Do not pop the share page when in a 2-column layout as it will leave
2059+ // an empty second column
2060+ if (mainPageStack.columns === 1) {
2061+ mainPageStack.removePages(picker)
2062+ }
2063 }
2064 }
2065 }
2066
2067=== added file 'qml/components/CloseHeaderAction.qml'
2068--- qml/components/CloseHeaderAction.qml 1970-01-01 00:00:00 +0000
2069+++ qml/components/CloseHeaderAction.qml 2016-04-28 16:10:40 +0000
2070@@ -0,0 +1,27 @@
2071+/*
2072+ * uNav http://launchpad.net/unav
2073+ * Copyright (C) 2016 Nekhelesh Ramananthan https://launchpad.net/~nik90
2074+ *
2075+ * uNav is free software; you can redistribute it and/or modify
2076+ * it under the terms of the GNU General Public License as published by
2077+ * the Free Software Foundation; either version 3 of the License, or
2078+ * (at your option) any later version.
2079+ *
2080+ * uNav is distributed in the hope that it will be useful,
2081+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2082+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2083+ * GNU General Public License for more details.
2084+ */
2085+
2086+import QtQuick 2.4
2087+import Ubuntu.Components 1.3
2088+
2089+Action {
2090+ id: closeButton
2091+ iconName: "close"
2092+ visible: mainPageStack.columns !== 1
2093+ onTriggered: {
2094+ mainPageStack.hideSideBar()
2095+ mainPageStack.removePages(mainPageStack.primaryPage)
2096+ }
2097+}
2098
2099=== modified file 'qml/components/ZoomButtons.qml'
2100--- qml/components/ZoomButtons.qml 2016-04-12 18:47:27 +0000
2101+++ qml/components/ZoomButtons.qml 2016-04-28 16:10:40 +0000
2102@@ -32,11 +32,10 @@
2103 radius: units.gu(2)
2104 width: zoomIn.width + units.gu(2)
2105 height: zoomIn.height + zoomOut.height
2106-
2107+
2108 anchors {
2109 right: parent.right
2110 verticalCenter: parent.verticalCenter
2111- verticalCenterOffset: units.gu(-3)
2112 }
2113
2114 onVisibleChanged: {
2115
2116=== modified file 'qml/tuto/WelcomeWizard.qml'
2117--- qml/tuto/WelcomeWizard.qml 2016-04-02 15:05:20 +0000
2118+++ qml/tuto/WelcomeWizard.qml 2016-04-28 16:10:40 +0000
2119@@ -24,7 +24,7 @@
2120 onFinished: {
2121 navApp.settings.showTuto = false;
2122 console.log("[LOG]: Welcome tour complete")
2123- mainPageStack.pop(walkthrough);
2124+ mainPageStack.removePages(walkthrough)
2125 }
2126 model: [
2127 Slide1{},

Subscribers

People subscribed via source and target branches