Merge lp:~nik90/unav/poi-details-page into lp:unav
- poi-details-page
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 43 | ||||
Proposed branch: | lp:~nik90/unav/poi-details-page | ||||
Merge into: | lp:unav | ||||
Prerequisite: | lp:~costales/unav/0.59-place_id-page | ||||
Diff against target: |
602 lines (+520/-5) 9 files modified
nav/img/poi/wheelchair-negative.svg (+56/-0) nav/img/poi/wheelchair.svg (+56/-0) qml/Main.qml (+3/-3) qml/PoiDetailsPage.qml (+307/-0) qml/PoiListPage.qml (+6/-0) qml/RoutePage.qml (+1/-1) qml/components/GridIconDelegate.qml (+48/-0) qml/components/PoiDetailRow.qml (+42/-0) qml/js/utils.js (+1/-1) |
||||
To merge this branch: | bzr merge lp:~nik90/unav/poi-details-page | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
costales | Approve | ||
JkB | Approve | ||
Review via email: mp+291470@code.launchpad.net |
Commit message
Description of the change
Added a POI details page. Screenshot at http://
- 43. By Nekhelesh Ramananthan
-
Fixed popup width
- 44. By Nekhelesh Ramananthan
-
Added license headers
- 45. By Nekhelesh Ramananthan
-
Added coordinates
- 46. By Nekhelesh Ramananthan
-
Added simulate route button
- 47. By Nekhelesh Ramananthan
-
Added nearby action
- 48. By Nekhelesh Ramananthan
-
Added wifi detail
- 49. By Nekhelesh Ramananthan
-
Added wheelchair (need to change icon)
- 50. By Nekhelesh Ramananthan
-
Added proper wheelchair icon
- 51. By Nekhelesh Ramananthan
-
Improved wifi and wheelchair strings and made them translatable
- 52. By Nekhelesh Ramananthan
-
Added comments
- 53. By Nekhelesh Ramananthan
-
Added POI distance
- 54. By Nekhelesh Ramananthan
-
Removed wifi icon colors :/
- 55. By Nekhelesh Ramananthan
-
Changed grid style and added thin divider
- 56. By Nekhelesh Ramananthan
-
Minor text fix
- 57. By Nekhelesh Ramananthan
-
Applied costales patch
Nekhelesh Ramananthan (nik90) wrote : | # |
Applied patch. Thnx marcos!
costales (costales) wrote : | # |
Looks great for me :) Great work Nekhelesh!
@Joerg?
The icons in the popup will be in another branch better :)
- 58. By Nekhelesh Ramananthan
-
Merged lp:unav
- 59. By Nekhelesh Ramananthan
-
Merged lp:unav
- 60. By Nekhelesh Ramananthan
-
Prevent white screen issue in PoiDetailsPage
JkB (joergberroth) wrote : | # |
Hey some things are popping up now that I had time to test it.
Great work!!
Some suggestions:
1. to be consistent in design:
- for the coordinates " | dist m" instead of "(dist m)"
- we use the world icon as a www now. We have it as "Coordinates".qml also. We have to change it in one of them. I suggest in the coordinates page to the compass icon.
- for the opening hours a "clock" icon would be better than the "alarm-clock" icon, maybe.
- the "info" icon to the description?!
2. I would like to see a bit more topMargin from the header. Same as to the line maybe.
4. The link to that page as a trailing action in the poiListPage.
4.a) By the way it would be great to have the sections bar in the header of poiListPage for the search state, too. ;-)
Thanks a lot nik!
Best Joerg
costales (costales) wrote : | # |
One improvement more :)
http://
Don't allow URLs without http. An example is bad POI URL:
http://
- 61. By Nekhelesh Ramananthan
-
Fixed the design issues that Joerg pointed out
- 62. By Nekhelesh Ramananthan
-
Merged patch from costales for bad web urls
Nekhelesh Ramananthan (nik90) wrote : | # |
> Hey some things are popping up now that I had time to test it.
>
> Great work!!
Thanks mate!
>
> Some suggestions:
> 1. to be consistent in design:
> - for the coordinates " | dist m" instead of "(dist m)"
> - we use the world icon as a www now. We have it as "Coordinates".qml also. We
> have to change it in one of them. I suggest in the coordinates page to the
> compass icon.
> - for the opening hours a "clock" icon would be better than the "alarm-clock"
> icon, maybe.
> - the "info" icon to the description?!
>
> 2. I would like to see a bit more topMargin from the header. Same as to the
> line maybe.
>
You are a good tester with spotting even tiny issues I may have missed out. Nice work! I agree and fixed all the design inconsistencies you pointed out.
> 4. The link to that page as a trailing action in the poiListPage.
At first I wasn't sure about this, but on thinking more it makes perfect sense. Nice suggestion!
> 4.a) By the way it would be great to have the sections bar in the header of
> poiListPage for the search state, too. ;-)
>
I would like to defer this to another branch if you don't mind.
- 63. By Nekhelesh Ramananthan
-
Added trailing edge action in the poi list page
Nekhelesh Ramananthan (nik90) wrote : | # |
@Joerg, @Costales, fixed all your comments. (Except for 4a which I will defer to another branch). Hope this is good to be merged now.
costales (costales) wrote : | # |
So great work Nekhelesh!!
> 4. The link to that page as a trailing action in the poiListPage.
We should remove icons in there too :)
Preview Diff
1 | === added file 'nav/img/poi/wheelchair-negative.svg' |
2 | --- nav/img/poi/wheelchair-negative.svg 1970-01-01 00:00:00 +0000 |
3 | +++ nav/img/poi/wheelchair-negative.svg 2016-04-11 20:00:36 +0000 |
4 | @@ -0,0 +1,56 @@ |
5 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
6 | +<svg |
7 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
8 | + xmlns:cc="http://creativecommons.org/ns#" |
9 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
10 | + xmlns:svg="http://www.w3.org/2000/svg" |
11 | + xmlns="http://www.w3.org/2000/svg" |
12 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
13 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
14 | + version="1.0" |
15 | + x="0px" |
16 | + y="0px" |
17 | + viewBox="0 0 86.735 100" |
18 | + enable-background="new 0 0 86.735 100" |
19 | + xml:space="preserve" |
20 | + id="svg2" |
21 | + inkscape:version="0.48.4 r9939" |
22 | + width="100%" |
23 | + height="100%" |
24 | + sodipodi:docname="wheelchair.svg"><metadata |
25 | + id="metadata16"><rdf:RDF><cc:Work |
26 | + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type |
27 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs |
28 | + id="defs14" /><sodipodi:namedview |
29 | + pagecolor="#ffffff" |
30 | + bordercolor="#666666" |
31 | + borderopacity="1" |
32 | + objecttolerance="10" |
33 | + gridtolerance="10" |
34 | + guidetolerance="10" |
35 | + inkscape:pageopacity="0" |
36 | + inkscape:pageshadow="2" |
37 | + inkscape:window-width="1034" |
38 | + inkscape:window-height="615" |
39 | + id="namedview12" |
40 | + showgrid="false" |
41 | + inkscape:zoom="2.36" |
42 | + inkscape:cx="15.616852" |
43 | + inkscape:cy="50" |
44 | + inkscape:window-x="124" |
45 | + inkscape:window-y="72" |
46 | + inkscape:window-maximized="0" |
47 | + inkscape:current-layer="svg2" /><g |
48 | + id="g4" |
49 | + style="fill:#ed3146;fill-opacity:1"><path |
50 | + d="M61.075,65.383c0.002,0.146,0.011,0.288,0.011,0.434c0,14.833-12.068,26.901-26.902,26.901 c-14.833,0-26.902-12.068-26.902-26.901c0-8.966,4.413-16.916,11.176-21.807l-0.915-8.038C7.087,41.825,0,53.006,0,65.816 C0,84.666,15.334,100,34.184,100c15.979,0,29.427-11.021,33.154-25.859L61.075,65.383z" |
51 | + id="path6" |
52 | + style="fill:#ed3146;fill-opacity:1" /></g><circle |
53 | + cx="29.795" |
54 | + cy="8.698" |
55 | + r="8.698" |
56 | + id="circle8" |
57 | + style="fill:#ed3146;fill-opacity:1" /><path |
58 | + d="M85.867,76.098L66.35,48.807c-1.022-1.429-2.726-2.105-4.457-1.957c-0.129-0.012-0.258-0.023-0.389-0.023H39.209 l-0.553-4.854h16.572c1.927,0,3.489-1.562,3.489-3.489s-1.562-3.489-3.489-3.489H37.862l-0.907-7.97 c-0.53-4.662-4.74-8.011-9.401-7.48c-4.662,0.531-8.011,4.74-7.48,9.401l2.562,22.509c0.496,4.353,4.196,7.557,8.478,7.533 c0.014,0,0.028,0.003,0.043,0.003h29.172l16.738,23.403c1.598,2.237,4.866,2.641,7.297,0.901 C86.793,81.557,87.467,78.334,85.867,76.098z" |
59 | + id="path10" |
60 | + style="fill:#ed3146;fill-opacity:1" /></svg> |
61 | \ No newline at end of file |
62 | |
63 | === added file 'nav/img/poi/wheelchair.svg' |
64 | --- nav/img/poi/wheelchair.svg 1970-01-01 00:00:00 +0000 |
65 | +++ nav/img/poi/wheelchair.svg 2016-04-11 20:00:36 +0000 |
66 | @@ -0,0 +1,56 @@ |
67 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
68 | +<svg |
69 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
70 | + xmlns:cc="http://creativecommons.org/ns#" |
71 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
72 | + xmlns:svg="http://www.w3.org/2000/svg" |
73 | + xmlns="http://www.w3.org/2000/svg" |
74 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
75 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
76 | + version="1.0" |
77 | + x="0px" |
78 | + y="0px" |
79 | + viewBox="0 0 86.735 100" |
80 | + enable-background="new 0 0 86.735 100" |
81 | + xml:space="preserve" |
82 | + id="svg2" |
83 | + inkscape:version="0.48.4 r9939" |
84 | + width="100%" |
85 | + height="100%" |
86 | + sodipodi:docname="wheelchair.svg"><metadata |
87 | + id="metadata16"><rdf:RDF><cc:Work |
88 | + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type |
89 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs |
90 | + id="defs14" /><sodipodi:namedview |
91 | + pagecolor="#ffffff" |
92 | + bordercolor="#666666" |
93 | + borderopacity="1" |
94 | + objecttolerance="10" |
95 | + gridtolerance="10" |
96 | + guidetolerance="10" |
97 | + inkscape:pageopacity="0" |
98 | + inkscape:pageshadow="2" |
99 | + inkscape:window-width="1034" |
100 | + inkscape:window-height="615" |
101 | + id="namedview12" |
102 | + showgrid="false" |
103 | + inkscape:zoom="2.36" |
104 | + inkscape:cx="15.616852" |
105 | + inkscape:cy="50" |
106 | + inkscape:window-x="-18" |
107 | + inkscape:window-y="80" |
108 | + inkscape:window-maximized="0" |
109 | + inkscape:current-layer="svg2" /><g |
110 | + id="g4" |
111 | + style="fill:#3eb34f;fill-opacity:1"><path |
112 | + d="M61.075,65.383c0.002,0.146,0.011,0.288,0.011,0.434c0,14.833-12.068,26.901-26.902,26.901 c-14.833,0-26.902-12.068-26.902-26.901c0-8.966,4.413-16.916,11.176-21.807l-0.915-8.038C7.087,41.825,0,53.006,0,65.816 C0,84.666,15.334,100,34.184,100c15.979,0,29.427-11.021,33.154-25.859L61.075,65.383z" |
113 | + id="path6" |
114 | + style="fill:#3eb34f;fill-opacity:1" /></g><circle |
115 | + cx="29.795" |
116 | + cy="8.698" |
117 | + r="8.698" |
118 | + id="circle8" |
119 | + style="fill:#3eb34f;fill-opacity:1" /><path |
120 | + d="M85.867,76.098L66.35,48.807c-1.022-1.429-2.726-2.105-4.457-1.957c-0.129-0.012-0.258-0.023-0.389-0.023H39.209 l-0.553-4.854h16.572c1.927,0,3.489-1.562,3.489-3.489s-1.562-3.489-3.489-3.489H37.862l-0.907-7.97 c-0.53-4.662-4.74-8.011-9.401-7.48c-4.662,0.531-8.011,4.74-7.48,9.401l2.562,22.509c0.496,4.353,4.196,7.557,8.478,7.533 c0.014,0,0.028,0.003,0.043,0.003h29.172l16.738,23.403c1.598,2.237,4.866,2.641,7.297,0.901 C86.793,81.557,87.467,78.334,85.867,76.098z" |
121 | + id="path10" |
122 | + style="fill:#3eb34f;fill-opacity:1" /></svg> |
123 | \ No newline at end of file |
124 | |
125 | === modified file 'qml/Main.qml' |
126 | --- qml/Main.qml 2016-04-11 17:48:41 +0000 |
127 | +++ qml/Main.qml 2016-04-11 20:00:36 +0000 |
128 | @@ -439,7 +439,7 @@ |
129 | id: goThereActionPopover |
130 | |
131 | // #FIXME: Find out how to replace these hardcoded width and height and use the delegate's dimension automatically |
132 | - width: goThereActionPopover.poiName !== i18n.tr("Current Position") ? units.gu(46.5) : units.gu(39) |
133 | + width: goThereActionPopover.poiName !== i18n.tr("Current Position") && goThereActionPopover.osm_id !== 'none' ? units.gu(46.5) : units.gu(38.5) |
134 | height: mainPageStack.favPopup ? units.gu(21) : units.gu(16) |
135 | |
136 | property string poiName |
137 | @@ -588,8 +588,8 @@ |
138 | visible: goThereActionPopover.osm_id !== 'none' |
139 | color: UbuntuColors.orange |
140 | onClicked: { |
141 | - console.log(goThereActionPopover.osm_id); |
142 | - console.log(goThereActionPopover.osm_type); |
143 | + goThereActionPopover.hide(); |
144 | + mainPageStack.push(Qt.resolvedUrl("PoiDetailsPage.qml"), {osm_id: goThereActionPopover.osm_id, osm_type: goThereActionPopover.osm_type, poiName: goThereActionPopover.poiName}) |
145 | } |
146 | } |
147 | |
148 | |
149 | === added file 'qml/PoiDetailsPage.qml' |
150 | --- qml/PoiDetailsPage.qml 1970-01-01 00:00:00 +0000 |
151 | +++ qml/PoiDetailsPage.qml 2016-04-11 20:00:36 +0000 |
152 | @@ -0,0 +1,307 @@ |
153 | +/* |
154 | + * uNav http://launchpad.net/unav |
155 | + * Copyright (C) 2016 Nekhelesh Ramananthan https://launchpad.net/~nik90 |
156 | + * |
157 | + * uNav is free software; you can redistribute it and/or modify |
158 | + * it under the terms of the GNU General Public License as published by |
159 | + * the Free Software Foundation; either version 3 of the License, or |
160 | + * (at your option) any later version. |
161 | + * |
162 | + * uNav is distributed in the hope that it will be useful, |
163 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
164 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
165 | + * GNU General Public License for more details. |
166 | + */ |
167 | + |
168 | +import QtQuick 2.4 |
169 | +import Ubuntu.Components 1.3 |
170 | +import QtQuick.XmlListModel 2.0 |
171 | +import Ubuntu.Components.Popups 1.3 |
172 | +import "js/utils.js" as QmlJs |
173 | +import "components" |
174 | + |
175 | +Page { |
176 | + id: poiDetailsPage |
177 | + |
178 | + property string osm_type |
179 | + property string osm_id |
180 | + property string poiName |
181 | + |
182 | + header: UNavHeader { |
183 | + title: poiName |
184 | + flickable: flickable |
185 | + // #FIXME: This back button is only here to allow the user to press Escape keyboard key to go back. |
186 | + // This feature will be implemented upstream by the SDK devs when they add keyboard shortcuts to pages, |
187 | + // at which point this back button can be removed. |
188 | + leadingActionBar.actions: Action { |
189 | + iconName: "back" |
190 | + text: i18n.tr("Back") |
191 | + shortcut: "Escape" |
192 | + onTriggered: { |
193 | + mainPageStack.pop() |
194 | + mainPageStack.executeJavaScript("force_show_map()"); |
195 | + } |
196 | + } |
197 | + } |
198 | + |
199 | + anchors.fill: parent |
200 | + |
201 | + Component.onCompleted: mainPageStack.executeJavaScript("qml_set_route_status()") |
202 | + |
203 | + XmlListModel { |
204 | + id: poiDetailsModel |
205 | + |
206 | + readonly property string baseUrl: "http://nominatim.openstreetmap.org/reverse?format=xml&addressdetails=1&email=costales.marcos@gmail.com&extratags=1" |
207 | + readonly property string url: baseUrl + "&osm_type=" + osm_type + "&osm_id=" + osm_id |
208 | + |
209 | + property string lat |
210 | + property string lng |
211 | + property string distance |
212 | + |
213 | + onStatusChanged: { |
214 | + if (status === XmlListModel.Ready) { |
215 | + description.title = poiDetailsModel.get(0).description |
216 | + address.title = poiDetailsModel.get(0).address |
217 | + cuisine.title = poiDetailsModel.get(0).cuisine |
218 | + phone.title = poiDetailsModel.get(0).phone |
219 | + openingHours.title = poiDetailsModel.get(0).opening_hours |
220 | + website.title = poiDetailsModel.get(0).website |
221 | + internet.title = poiDetailsModel.get(0).internet_access |
222 | + wheelchair.title = poiDetailsModel.get(0).wheelchair |
223 | + lat = poiDetailsModel.get(0).lat |
224 | + lng = poiDetailsModel.get(0).lng |
225 | + |
226 | + distance = QmlJs.formatDistance(QmlJs.calcPoiDistance(mainPageStack.currentLat, mainPageStack.currentLng, lat, lng, 10), navApp.settings.unit) |
227 | + |
228 | + coordinates.title = "%1 %2, %3 %4".arg(i18n.tr("Lat, Long:")).arg(parseFloat(lat).toFixed(6)).arg(parseFloat(lng).toFixed(6)).arg((distance ? '| '+distance : '')) |
229 | + |
230 | + // Internet access values returned by OSM are (yes, no, wlan, terminal and wired) which |
231 | + // are too short and not translated. They are converted to meaningful phrases and also |
232 | + // used to set the icon colors for better visiblity. |
233 | + if (internet.title === "yes") { |
234 | + internet.title = i18n.tr("Available") |
235 | + } else if (internet.title === "no") { |
236 | + internet.title = i18n.tr("Not Available") |
237 | + } else if (internet.title === "wlan") { |
238 | + internet.title = i18n.tr("Wi-Fi Hotspot Available") |
239 | + } else if (internet.title === "wired") { |
240 | + internet.title = i18n.tr("Wired Connection Available (ethernet connection)") |
241 | + } else if (internet.title === "terminal") { |
242 | + internet.title = i18n.tr("Computer Terminal Available") |
243 | + } |
244 | + |
245 | + // Wheelchair values returned by OSM are (yes, no, limited) which are too short |
246 | + // and not translated. They are converted to meaningful phrases and also used to |
247 | + // set the icon colors for better visibility. |
248 | + if (wheelchair.title === "yes") { |
249 | + wheelchair.title = i18n.tr("Available") |
250 | + } else if (wheelchair.title === "no") { |
251 | + wheelchair.title = i18n.tr("Not Available") |
252 | + wheelchair.icon.source = Qt.resolvedUrl("../nav/img/poi/wheelchair-negative.svg") |
253 | + } else if (wheelchair.title === "limited") { |
254 | + wheelchair.title = i18n.tr("Limited Availability") |
255 | + wheelchair.icon.source = Qt.resolvedUrl("../nav/img/poi/wheelchair-negative.svg") |
256 | + } |
257 | + |
258 | + if (lat && lng) { |
259 | + mapActionButtonModel.append({mode: "ROUTE", iconName: "send"}) |
260 | + mapActionButtonModel.append({mode: "SAVE", iconName: "starred"}) |
261 | + mapActionButtonModel.append({mode: "SHARE", iconName: "share"}) |
262 | + mapActionButtonModel.append({mode: "NEARBY", iconName: "location"}) |
263 | + } |
264 | + |
265 | + if (mainPageStack.ptFromLat === "null" && lat && lng) { |
266 | + mapActionButtonModel.append({mode: "PTFROM", iconName: "transfer-progress-upload"}) |
267 | + } |
268 | + |
269 | + if (mainPageStack.ptFromLat !== "null" && lat && lng) { |
270 | + mapActionButtonModel.append({mode: "PTTO", iconName: "transfer-progress-download"}) |
271 | + } |
272 | + |
273 | + if (phone.title) { |
274 | + poiActionButtonModel.append({mode: "CALL", iconName: "call-start"}) |
275 | + } |
276 | + |
277 | + if (website.title && website.title.substring(0, 4) === "http") { |
278 | + poiActionButtonModel.append({mode: "WEB", iconName: "stock_website"}) |
279 | + } |
280 | + } |
281 | + } |
282 | + |
283 | + onSourceChanged: console.log(url) |
284 | + |
285 | + source: url |
286 | + query: "/reversegeocode" |
287 | + |
288 | + XmlRole { name: "address"; query: "result/string()" } |
289 | + XmlRole { name: "description"; query: "extratags/tag[@key='description']/@value/string()" } |
290 | + XmlRole { name: "cuisine"; query: "extratags/tag[@key='cuisine']/@value/string()" } |
291 | + XmlRole { name: "phone"; query: "extratags/tag[@key='phone']/@value/string()" } |
292 | + XmlRole { name: "opening_hours"; query: "extratags/tag[@key='opening_hours']/@value/string()" } |
293 | + XmlRole { name: "website"; query: "extratags/tag[@key='website']/@value/string()" } |
294 | + XmlRole { name: "internet_access"; query: "extratags/tag[@key='internet_access']/@value/string()" } |
295 | + XmlRole { name: "wheelchair"; query: "extratags/tag[@key='wheelchair']/@value/string()" } |
296 | + XmlRole { name: "lat"; query: "result/@lat/string()"; } |
297 | + XmlRole { name: "lng"; query: "result/@lon/string()"; } |
298 | + } |
299 | + |
300 | + Label { |
301 | + id: statusLabel |
302 | + wrapMode: Text.WordWrap |
303 | + anchors.centerIn: parent |
304 | + width: parent.width - units.gu(4) |
305 | + horizontalAlignment: Text.AlignHCenter |
306 | + visible: poiDetailsModel.status === XmlListModel.Loading |
307 | + text: i18n.tr("Loading POI details...") |
308 | + } |
309 | + |
310 | + // Indicator to show load activity |
311 | + ActivityIndicator { |
312 | + id: searchActivity |
313 | + running: poiDetailsModel.status === XmlListModel.Loading |
314 | + anchors { bottom: statusLabel.top; bottomMargin: units.gu (1); horizontalCenter: parent.horizontalCenter } |
315 | + } |
316 | + |
317 | + ListModel { |
318 | + id: mapActionButtonModel |
319 | + } |
320 | + |
321 | + ListModel{ |
322 | + id: poiActionButtonModel |
323 | + } |
324 | + |
325 | + Flickable { |
326 | + id: flickable |
327 | + |
328 | + anchors.fill: parent |
329 | + contentHeight: mainColumn.height + units.gu(10) |
330 | + |
331 | + Column { |
332 | + id: mainColumn |
333 | + |
334 | + spacing: units.gu(3) |
335 | + anchors { top: parent.top; left: parent.left; right: parent.right; margins: units.gu(2); topMargin: units.gu(3) } |
336 | + |
337 | + CustomGridView { |
338 | + id: mapButtonGrid |
339 | + |
340 | + itemWidth: units.gu(7) |
341 | + model: mapActionButtonModel |
342 | + anchors.horizontalCenter: parent.horizontalCenter |
343 | + |
344 | + delegate: GridIconDelegate { |
345 | + |
346 | + icon.name: model.iconName |
347 | + |
348 | + onClicked: { |
349 | + if (model.mode === "ROUTE") { |
350 | + mainPageStack.clear() |
351 | + mainPageStack.center_onpos = 2; |
352 | + mainPageStack.routeState = 'yes' |
353 | + mainPageStack.executeJavaScript("calc2coord("+ poiDetailsModel.lat + "," + poiDetailsModel.lng + ");"); |
354 | + } else if (model.mode === "SAVE") { |
355 | + mainPageStack.push(Qt.resolvedUrl("FavoritesPage.qml"), {isAddedFromPopup: true, lat: poiDetailsModel.lat, lng: poiDetailsModel.lng, favName: poiName}) |
356 | + } else if (model.mode === "SHARE") { |
357 | + mainPageStack.push(Qt.resolvedUrl("Share.qml"), {"lat": poiDetailsModel.lat, "lon": poiDetailsModel.lng}) |
358 | + } else if (model.mode === "NEARBY") { |
359 | + mainPageStack.push(Qt.resolvedUrl("PoiPage.qml"), {"lat": poiDetailsModel.lat, "lng": poiDetailsModel.lng}) |
360 | + } else if (model.mode === "PTFROM") { |
361 | + mainPageStack.clear() |
362 | + mainPageStack.ptFromLat = mainPageStack.clickedLat; |
363 | + mainPageStack.ptFromLng = mainPageStack.clickedLng; |
364 | + } else if (model.mode === "PTTO") { |
365 | + mainPageStack.clear() |
366 | + mainPageStack.routeState = 'simulate_calculating'; |
367 | + mainPageStack.executeJavaScript("simulate2coord(" + mainPageStack.ptFromLat + ", " + mainPageStack.ptFromLng + ", " + mainPageStack.clickedLat + ", " + mainPageStack.clickedLng + ");"); |
368 | + mainPageStack.ptFromLat = "null"; |
369 | + } |
370 | + } |
371 | + } |
372 | + } |
373 | + |
374 | + CustomGridView { |
375 | + id: poiButtonGrid |
376 | + |
377 | + visible: poiActionButtonModel.count !== 0 |
378 | + itemWidth: units.gu(9) |
379 | + model: poiActionButtonModel |
380 | + anchors.horizontalCenter: parent.horizontalCenter |
381 | + |
382 | + delegate: GridIconDelegate { |
383 | + |
384 | + width: units.gu(9) |
385 | + icon.name: model.iconName |
386 | + |
387 | + onClicked: { |
388 | + if (model.mode === "CALL") { |
389 | + Qt.openUrlExternally("tel:///" + phone.title) |
390 | + } else if (model.mode === "WEB") { |
391 | + Qt.openUrlExternally(website.title) |
392 | + } |
393 | + } |
394 | + } |
395 | + } |
396 | + |
397 | + Rectangle { |
398 | + width: parent.width |
399 | + height: units.dp(0.5) |
400 | + color: UbuntuColors.slate |
401 | + visible: !searchActivity.running |
402 | + } |
403 | + |
404 | + PoiDetailRow { |
405 | + id: description |
406 | + icon.name: "info" |
407 | + visible: title |
408 | + } |
409 | + |
410 | + PoiDetailRow { |
411 | + id: address |
412 | + icon.name: "location" |
413 | + visible: title |
414 | + } |
415 | + |
416 | + PoiDetailRow { |
417 | + id: coordinates |
418 | + icon.name: "webbrowser-app-symbolic" |
419 | + visible: title |
420 | + } |
421 | + |
422 | + PoiDetailRow { |
423 | + id: cuisine |
424 | + icon.source: Qt.resolvedUrl("../nav/img/poi/Restaurant.svg") |
425 | + visible: title |
426 | + } |
427 | + |
428 | + PoiDetailRow { |
429 | + id: phone |
430 | + icon.name: "call-start" |
431 | + visible: title |
432 | + } |
433 | + |
434 | + PoiDetailRow { |
435 | + id: openingHours |
436 | + icon.name: "clock" |
437 | + visible: title |
438 | + } |
439 | + |
440 | + PoiDetailRow { |
441 | + id: website |
442 | + icon.name: "stock_website" |
443 | + visible: title |
444 | + } |
445 | + |
446 | + PoiDetailRow { |
447 | + id: internet |
448 | + icon.name: "network-wifi-symbolic" |
449 | + visible: title |
450 | + } |
451 | + |
452 | + PoiDetailRow { |
453 | + id: wheelchair |
454 | + icon.source: Qt.resolvedUrl("../nav/img/poi/wheelchair.svg") |
455 | + visible: title |
456 | + } |
457 | + } |
458 | + } |
459 | +} |
460 | |
461 | === modified file 'qml/PoiListPage.qml' |
462 | --- qml/PoiListPage.qml 2016-04-11 17:48:41 +0000 |
463 | +++ qml/PoiListPage.qml 2016-04-11 20:00:36 +0000 |
464 | @@ -294,6 +294,12 @@ |
465 | onTriggered: { |
466 | Qt.openUrlExternally("tel:///"+ phone) |
467 | } |
468 | + }, |
469 | + Action { |
470 | + iconName: "info" |
471 | + onTriggered: { |
472 | + mainPageStack.push(Qt.resolvedUrl("PoiDetailsPage.qml"), {osm_id: model.osm_id, osm_type: model.osm_type, poiName: model.name !== "" ? model.name : poiListPage.poiType}) |
473 | + } |
474 | } |
475 | ] |
476 | } |
477 | |
478 | === modified file 'qml/RoutePage.qml' |
479 | --- qml/RoutePage.qml 2016-04-10 09:43:33 +0000 |
480 | +++ qml/RoutePage.qml 2016-04-11 20:00:36 +0000 |
481 | @@ -57,7 +57,7 @@ |
482 | routePageModel.append({mode: "SEARCH", text: i18n.tr("Search"), iconName: "find", visible: true}) |
483 | routePageModel.append({mode: "FAVORITES", text: i18n.tr("Favorites"), iconName: "starred", visible: true}) |
484 | routePageModel.append({mode: "NEARBY", text: i18n.tr("Nearby"), iconName: "location", visible: true}) |
485 | - routePageModel.append({mode: "COORDINATES", text: i18n.tr("Coordinates"), iconName: "stock_website", visible: true}) |
486 | + routePageModel.append({mode: "COORDINATES", text: i18n.tr("Coordinates"), iconName: "webbrowser-app-symbolic", visible: true}) |
487 | routePageModel.append({mode: "SHARE", text: i18n.tr("Share"), iconName: "share", visible: true}) |
488 | routePageModel.append({mode: "CANCEL", text: i18n.tr("Cancel Route"), iconName: "dialog-error-symbolic", visible: mainPageStack.routeState !== 'no'}) |
489 | } |
490 | |
491 | === added file 'qml/components/GridIconDelegate.qml' |
492 | --- qml/components/GridIconDelegate.qml 1970-01-01 00:00:00 +0000 |
493 | +++ qml/components/GridIconDelegate.qml 2016-04-11 20:00:36 +0000 |
494 | @@ -0,0 +1,48 @@ |
495 | +/* |
496 | + * uNav http://launchpad.net/unav |
497 | + * Copyright (C) 2016 Nekhelesh Ramananthan https://launchpad.net/~nik90 |
498 | + * |
499 | + * uNav is free software; you can redistribute it and/or modify |
500 | + * it under the terms of the GNU General Public License as published by |
501 | + * the Free Software Foundation; either version 3 of the License, or |
502 | + * (at your option) any later version. |
503 | + * |
504 | + * uNav is distributed in the hope that it will be useful, |
505 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
506 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
507 | + * GNU General Public License for more details. |
508 | + */ |
509 | + |
510 | +import QtQuick 2.4 |
511 | +import Ubuntu.Components 1.3 |
512 | + |
513 | +AbstractButton { |
514 | + id: gridDelegate |
515 | + |
516 | + // Public APIs |
517 | + property alias icon: _icon |
518 | + |
519 | + width: units.gu(7) |
520 | + height: _icon.height |
521 | + |
522 | + Loader { |
523 | + sourceComponent: gridDelegate.pressed ? backgroundComponent : undefined |
524 | + anchors { fill: _icon; margins: -units.gu(2) } |
525 | + } |
526 | + |
527 | + Component { |
528 | + id: backgroundComponent |
529 | + UbuntuShape { |
530 | + opacity: 0.15 |
531 | + backgroundColor: UbuntuColors.darkGrey |
532 | + } |
533 | + } |
534 | + |
535 | + Icon { |
536 | + id: _icon |
537 | + width: height |
538 | + height: units.gu(4) |
539 | + anchors.centerIn: parent |
540 | + } |
541 | +} |
542 | + |
543 | |
544 | === added file 'qml/components/PoiDetailRow.qml' |
545 | --- qml/components/PoiDetailRow.qml 1970-01-01 00:00:00 +0000 |
546 | +++ qml/components/PoiDetailRow.qml 2016-04-11 20:00:36 +0000 |
547 | @@ -0,0 +1,42 @@ |
548 | +/* |
549 | + * uNav http://launchpad.net/unav |
550 | + * Copyright (C) 2016 Nekhelesh Ramananthan https://launchpad.net/~nik90 |
551 | + * |
552 | + * uNav is free software; you can redistribute it and/or modify |
553 | + * it under the terms of the GNU General Public License as published by |
554 | + * the Free Software Foundation; either version 3 of the License, or |
555 | + * (at your option) any later version. |
556 | + * |
557 | + * uNav is distributed in the hope that it will be useful, |
558 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
559 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
560 | + * GNU General Public License for more details. |
561 | + */ |
562 | + |
563 | +import QtQuick 2.4 |
564 | +import Ubuntu.Components 1.3 |
565 | + |
566 | +Item { |
567 | + id: address |
568 | + |
569 | + width: parent.width |
570 | + height: Math.max(icon.height, title.implicitHeight) |
571 | + |
572 | + property alias icon: icon |
573 | + property alias title: title.text |
574 | + |
575 | + Icon { |
576 | + id: icon |
577 | + width: units.gu(2.5) |
578 | + height: width |
579 | + color: UbuntuColors.jet |
580 | + anchors { verticalCenter: parent.veticalCenter; left: parent.left } |
581 | + } |
582 | + |
583 | + Label { |
584 | + id: title |
585 | + text: "" |
586 | + wrapMode: Text.WordWrap |
587 | + anchors { left: icon.right; right: parent.right; verticalCenter: parent.verticalCenter; leftMargin: units.gu(2) } |
588 | + } |
589 | +} |
590 | |
591 | === modified file 'qml/js/utils.js' |
592 | --- qml/js/utils.js 2016-04-03 20:20:20 +0000 |
593 | +++ qml/js/utils.js 2016-04-11 20:00:36 +0000 |
594 | @@ -8,7 +8,7 @@ |
595 | * @return integer Distance (in meters) |
596 | */ |
597 | function calcPoiDistance(cur_lat, cur_lng, poi_lat, poi_lng, accuracy) { |
598 | - if (cur_lat === null || cur_lng === null) |
599 | + if (cur_lat === null || cur_lng === null || cur_lat === 'null' || cur_lng === 'null') |
600 | return null; |
601 | |
602 | accuracy = Math.floor(accuracy) || 1; |
Great work :) paste.ubuntu. com/15764220/
Please, could you apply this diff?
http://
This will:
- Parse latitude,longitude to 6 decimals max (accuracy of centimeters).
- No º for a decimal coordinate.
- Added order of lat, long as title.
- Calculate from current lat,long.
- Not show distance if there is not a position