Merge lp:~costales/unav/0.62-choose-tiles into lp:unav

Proposed by costales
Status: Merged
Merged at revision: 95
Proposed branch: lp:~costales/unav/0.62-choose-tiles
Merge into: lp:unav
Diff against target: 671 lines (+199/-113)
5 files modified
nav/class/UI.js (+26/-20)
nav/index.html (+7/-5)
nav/locales/unav.pot (+85/-73)
qml/Main.qml (+10/-1)
qml/SettingsPage.qml (+71/-14)
To merge this branch: bzr merge lp:~costales/unav/0.62-choose-tiles
Reviewer Review Type Date Requested Status
uNav developers Pending
Review via email: mp+301657@code.launchpad.net

Description of the change

Allow choose OSM pure tiles

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nav/class/UI.js'
2--- nav/class/UI.js 2016-07-17 13:29:59 +0000
3+++ nav/class/UI.js 2016-08-01 14:52:58 +0000
4@@ -29,8 +29,6 @@
5 this.zoom_unav = true;
6 this.map_stretched = true;
7
8- this.map_layer = 0;
9-
10 this.marker_pos = new ol.Overlay({
11 positioning: 'center-center',
12 element: document.getElementById('marker_pos')
13@@ -126,24 +124,32 @@
14 return this.center_onpos;
15 }
16
17-UI.prototype.set_map_layer = function(value) {
18- this.map_layer = value;
19- if (value == 0) {
20- this.map.getLayers().getArray()[0].setVisible(true); // Online
21- this.map.getLayers().getArray()[1].setVisible(false); // Offline
22- $('#map_attribution').show();
23- $(".map").removeClass('body_bg');
24- }
25- else {
26- this.map.getLayers().getArray()[0].setVisible(false); // Online
27- this.map.getLayers().getArray()[1].setVisible(true); // Offline
28- $('#map_attribution').hide();
29- $(".map").addClass('body_bg');
30- }
31-}
32-
33-UI.prototype.get_map_layer = function() {
34- return this.map_layer;
35+UI.prototype.set_map_layer = function(layer) {
36+ switch (layer) {
37+ case 'terrain':
38+ this.map.getLayers().getArray()[0].setVisible(true); // Online terrain
39+ this.map.getLayers().getArray()[1].setVisible(false); // Online OSM
40+ this.map.getLayers().getArray()[2].setVisible(false); // Offline
41+ $('#map_attribution').html("<span onclick=\"qml_go_url('https://mapzen.com')\">© Mapzen</span> <span onclick=\"qml_go_url('http://stamen.com')\">© Stamen</span> <span onclick=\"qml_go_url('http://www.openstreetmap.org/copyright')\">© OpenStreetMap contributors</span>");
42+ $('#map_attribution').show();
43+ $(".map").removeClass('body_bg');
44+ break;
45+ case 'OSM':
46+ this.map.getLayers().getArray()[0].setVisible(false); // Online terrain
47+ this.map.getLayers().getArray()[1].setVisible(true); // Online OSM
48+ this.map.getLayers().getArray()[2].setVisible(false); // Offline
49+ $('#map_attribution').html("<span onclick=\"qml_go_url('https://mapzen.com')\">© Mapzen</span> <span onclick=\"qml_go_url('http://www.openstreetmap.org/copyright')\">© OpenStreetMap contributors</span>");
50+ $('#map_attribution').show();
51+ $(".map").removeClass('body_bg');
52+ break;
53+ case 'offline':
54+ this.map.getLayers().getArray()[0].setVisible(false); // Online terrain
55+ this.map.getLayers().getArray()[1].setVisible(false); // Online OSM
56+ this.map.getLayers().getArray()[2].setVisible(true); // Offline
57+ $('#map_attribution').show();
58+ $(".map").addClass('body_bg');
59+ break;
60+ }
61 }
62
63 UI.prototype.set_center_1st_pos = function(status) {
64
65=== modified file 'nav/index.html'
66--- nav/index.html 2016-07-17 13:29:59 +0000
67+++ nav/index.html 2016-08-01 14:52:58 +0000
68@@ -95,7 +95,7 @@
69 </div>
70
71 <!-- Map attribution -->
72- <div id="map_attribution" style="display:none;"><span onclick="qml_go_url('https://mapzen.com')">© Mapzen</span> <span onclick="qml_go_url('http://stamen.com')">© Stamen</span> <span onclick="qml_go_url('http://www.openstreetmap.org/copyright')">© OpenStreetMap contributors</span></div>
73+ <div id="map_attribution" style="display:none;"></div>
74
75 <!-- Max speed radar alert -->
76 <div id="max_speed_alert" style="display:none;">
77@@ -198,19 +198,21 @@
78 <!-- Map -->
79 <script src="libraries/ol.js"></script>
80 <script>
81- var online_layer = new ol.layer.Tile({
82+ var online_layer_terrain = new ol.layer.Tile({
83 source: new ol.source.Stamen({layer: 'terrain'}),
84 visible: false
85 });
86+ var online_layer_OSM = new ol.layer.Tile({
87+ source: new ol.source.OSM({url: 'http://{a-c}.osm.maptiles.xyz/{z}/{x}/{y}.png'}),
88+ visible: false
89+ });
90 var offline_layer = new ol.layer.Tile({
91 source: new ol.source.OSM({url: '/home/phablet/.local/share/navigator.costales/maps/{z}/{x}/{y}.png'}),
92 visible: false
93 });
94- online_layer.setVisible(false);
95- offline_layer.setVisible(false);
96
97 var map = new ol.Map({
98- layers: [online_layer, offline_layer],
99+ layers: [online_layer_terrain, online_layer_OSM, offline_layer],
100 controls: [],
101 target: 'map',
102 view: new ol.View({
103
104=== modified file 'nav/locales/unav.pot'
105--- nav/locales/unav.pot 2016-06-30 18:30:33 +0000
106+++ nav/locales/unav.pot 2016-08-01 14:52:58 +0000
107@@ -8,7 +8,7 @@
108 msgstr ""
109 "Project-Id-Version: PACKAGE VERSION\n"
110 "Report-Msgid-Bugs-To: \n"
111-"POT-Creation-Date: 2016-06-30 20:30+0200\n"
112+"POT-Creation-Date: 2016-08-01 16:50+0200\n"
113 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
114 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
115 "Language-Team: LANGUAGE <LL@li.org>\n"
116@@ -90,34 +90,34 @@
117 msgid "Sexagesimal"
118 msgstr ""
119
120-#: qml/Coordinate.qml:77 qml/Coordinate.qml:168
121+#: qml/Coordinate.qml:77 qml/Coordinate.qml:171
122 msgid "Lat:"
123 msgstr ""
124
125-#: qml/Coordinate.qml:94 qml/Coordinate.qml:239
126+#: qml/Coordinate.qml:94 qml/Coordinate.qml:242
127 msgid "Long:"
128 msgstr ""
129
130-#: qml/Coordinate.qml:109 qml/Coordinate.qml:309
131+#: qml/Coordinate.qml:109 qml/Coordinate.qml:312
132 msgid "Show on Map"
133 msgstr ""
134
135-#: qml/Coordinate.qml:146 qml/Coordinate.qml:371
136+#: qml/Coordinate.qml:149 qml/Coordinate.qml:383
137 msgid "Coordinates are not valid"
138 msgstr ""
139
140-#: qml/Coordinate.qml:147
141+#: qml/Coordinate.qml:150
142 msgid ""
143 "Enter valid decimal coordinates\n"
144 "\n"
145 "Expected format is:"
146 msgstr ""
147
148-#: qml/Coordinate.qml:149 qml/Coordinate.qml:374
149+#: qml/Coordinate.qml:152 qml/Coordinate.qml:386
150 msgid "Close"
151 msgstr ""
152
153-#: qml/Coordinate.qml:372
154+#: qml/Coordinate.qml:384
155 msgid ""
156 "Enter valid sexagesimal coordinates\n"
157 "\n"
158@@ -146,11 +146,11 @@
159 msgid "Insert a favorite name"
160 msgstr ""
161
162-#: qml/Favorites.qml:214 qml/Main.qml:748 nav/class/UI.js:40
163+#: qml/Favorites.qml:214 qml/Main.qml:770 nav/class/UI.js:38
164 msgid "Current Position"
165 msgstr ""
166
167-#: qml/Favorites.qml:229 qml/SettingsPage.qml:367
168+#: qml/Favorites.qml:229 qml/SettingsPage.qml:424
169 msgid "Cancel"
170 msgstr ""
171
172@@ -166,99 +166,99 @@
173 msgid "Update"
174 msgstr ""
175
176-#: qml/Location.qml:40 qml/PoiListPage.qml:143
177+#: qml/Location.qml:44 qml/PoiListPage.qml:146
178 msgid "Time out! Please try again"
179 msgstr ""
180
181 #. TRANSLATORS: This string is search shown when no POIs are found with the chosen search radius.
182-#: qml/Location.qml:48
183+#: qml/Location.qml:52
184 msgid "Sorry, nothing found. Try another search"
185 msgstr ""
186
187-#: qml/Location.qml:131 qml/Location.qml:319 qml/Location.qml:381
188+#: qml/Location.qml:141 qml/Location.qml:329 qml/Location.qml:391
189 msgid "Search history"
190 msgstr ""
191
192-#: qml/Location.qml:141 qml/Location.qml:325 qml/Location.qml:383
193+#: qml/Location.qml:151 qml/Location.qml:335 qml/Location.qml:393
194 msgid "Favorite history"
195 msgstr ""
196
197-#: qml/Location.qml:151 qml/Location.qml:322 qml/Location.qml:338
198-#: qml/Location.qml:349 qml/Location.qml:364 qml/Location.qml:371
199-#: qml/Location.qml:402 qml/Location.qml:408
200+#: qml/Location.qml:161 qml/Location.qml:332 qml/Location.qml:348
201+#: qml/Location.qml:359 qml/Location.qml:374 qml/Location.qml:381
202+#: qml/Location.qml:412 qml/Location.qml:418
203 msgid "Nearby history"
204 msgstr ""
205
206-#: qml/Location.qml:168
207+#: qml/Location.qml:178
208 msgid "No history yet…"
209 msgstr ""
210
211-#: qml/Location.qml:168
212+#: qml/Location.qml:178
213 msgid "History is disabled"
214 msgstr ""
215
216-#: qml/Location.qml:215
217+#: qml/Location.qml:225
218 msgid "Search location"
219 msgstr ""
220
221-#: qml/Location.qml:220 qml/PoiListPage.qml:160
222+#: qml/Location.qml:230 qml/PoiListPage.qml:163
223 msgid "Searching…"
224 msgstr ""
225
226-#: qml/Main.qml:192 qml/SettingsPage.qml:35
227+#: qml/Main.qml:204 qml/SettingsPage.qml:35
228 msgid "Settings"
229 msgstr ""
230
231-#: qml/Main.qml:204
232+#: qml/Main.qml:215
233 msgid "Center on Position"
234 msgstr ""
235
236-#: qml/Main.qml:208 qml/Main.qml:513
237+#: qml/Main.qml:219 qml/Main.qml:528
238 msgid "Searching your position… This could take a while"
239 msgstr ""
240
241-#: qml/Main.qml:222 qml/PoiPage.qml:83 qml/SearchPage.qml:69
242+#: qml/Main.qml:233 qml/PoiPage.qml:83 qml/SearchPage.qml:69
243 msgid "Search"
244 msgstr ""
245
246-#: qml/Main.qml:234
247+#: qml/Main.qml:244
248 msgid "Destination"
249 msgstr ""
250
251-#: qml/Main.qml:391
252+#: qml/Main.qml:399
253 msgid "Error getting speed cameras!"
254 msgstr ""
255
256-#: qml/Main.qml:394
257+#: qml/Main.qml:402
258 msgid "Error finding route! Retrying again in 30 seconds…"
259 msgstr ""
260
261-#: qml/Main.qml:397
262+#: qml/Main.qml:405
263 msgid "Error finding route! Trying again…"
264 msgstr ""
265
266-#: qml/Main.qml:440 qml/Main.qml:466
267+#: qml/Main.qml:456 qml/Main.qml:482
268 msgid "Shared Position"
269 msgstr ""
270
271-#: qml/Main.qml:691
272+#: qml/Main.qml:713
273 msgid "NearBy Destination"
274 msgstr ""
275
276-#: qml/Main.qml:692
277+#: qml/Main.qml:714
278 msgid "Cancel Route"
279 msgstr ""
280
281-#: qml/Main.qml:737
282+#: qml/Main.qml:759
283 #, qt-format
284 msgid "Coord: %1, %2"
285 msgstr ""
286
287-#: qml/Main.qml:805 qml/PoiDetailsPage.qml:225
288+#: qml/Main.qml:827 qml/PoiDetailsPage.qml:225
289 msgid "Simulate from here! Now click on destination"
290 msgstr ""
291
292-#: qml/Main.qml:822
293+#: qml/Main.qml:844
294 msgid "Set a different coordinates for simulating"
295 msgstr ""
296
297@@ -294,33 +294,33 @@
298 msgid "Loading POI details..."
299 msgstr ""
300
301-#: qml/PoiListPage.qml:44
302+#: qml/PoiListPage.qml:45
303 msgid "Show POIs on map"
304 msgstr ""
305
306-#: qml/PoiListPage.qml:65
307+#: qml/PoiListPage.qml:68
308 msgid "Unknown current position"
309 msgstr ""
310
311-#: qml/PoiListPage.qml:81
312+#: qml/PoiListPage.qml:84
313 msgid "Something went wrong. Please, try again…"
314 msgstr ""
315
316 #. TRANSLATORS: This string is search shown when no POIs are found with the chosen search radius. %1 is the POI type eg..Pub, Airport
317 #. Example string, "Sorry, no Airport found nearby. Try again with a larger search radius"
318-#: qml/PoiListPage.qml:150
319+#: qml/PoiListPage.qml:153
320 #, qt-format
321 msgid "Sorry, no %1 found nearby. Try again with a larger search radius"
322 msgstr ""
323
324 #. TRANSLATORS: Abbreviation for Public Holiday. This string is used while showing the opening hours
325 #. of a place which might be closed during public holidays.
326-#: qml/PoiListPage.qml:320
327+#: qml/PoiListPage.qml:324
328 msgid "PH"
329 msgstr ""
330
331 #. TRANSLATORS: This string indicates that a place is closed.
332-#: qml/PoiListPage.qml:322
333+#: qml/PoiListPage.qml:326
334 msgid "Closed"
335 msgstr ""
336
337@@ -354,7 +354,7 @@
338 msgid "Max. %1 POIs can be selected."
339 msgstr ""
340
341-#: qml/PoiQuickAccessPage.qml:206 qml/SettingsPage.qml:388
342+#: qml/PoiQuickAccessPage.qml:206 qml/SettingsPage.qml:445
343 msgid "OK"
344 msgstr ""
345
346@@ -421,78 +421,90 @@
347 msgstr ""
348
349 #: qml/SettingsPage.qml:91
350+msgid "Terrain"
351+msgstr ""
352+
353+#: qml/SettingsPage.qml:92
354+msgid "OpenStreetMap"
355+msgstr ""
356+
357+#: qml/SettingsPage.qml:102
358 msgid "Online"
359 msgstr ""
360
361-#: qml/SettingsPage.qml:92
362+#: qml/SettingsPage.qml:103
363 msgid "Offline"
364 msgstr ""
365
366-#: qml/SettingsPage.qml:114
367+#: qml/SettingsPage.qml:125
368 msgid "Navigation"
369 msgstr ""
370
371-#: qml/SettingsPage.qml:121
372+#: qml/SettingsPage.qml:132
373 msgid "Navigation Mode"
374 msgstr ""
375
376-#: qml/SettingsPage.qml:155
377+#: qml/SettingsPage.qml:166
378 msgid "Avoid Tolls"
379 msgstr ""
380
381-#: qml/SettingsPage.qml:173
382+#: qml/SettingsPage.qml:184
383 msgid "Speed Camera Alerts"
384 msgstr ""
385
386-#: qml/SettingsPage.qml:194
387+#: qml/SettingsPage.qml:205
388 msgid "Guidance"
389 msgstr ""
390
391-#: qml/SettingsPage.qml:225
392+#: qml/SettingsPage.qml:236
393 msgid "Map"
394 msgstr ""
395
396-#: qml/SettingsPage.qml:232
397+#: qml/SettingsPage.qml:243
398 msgid "Mode"
399 msgstr ""
400
401-#: qml/SettingsPage.qml:262
402+#: qml/SettingsPage.qml:281
403 msgid "How to use offline maps"
404 msgstr ""
405
406-#: qml/SettingsPage.qml:279
407+#: qml/SettingsPage.qml:298
408+msgid "Online Style"
409+msgstr ""
410+
411+#: qml/SettingsPage.qml:336
412 msgid "Units"
413 msgstr ""
414
415-#: qml/SettingsPage.qml:313
416+#: qml/SettingsPage.qml:370
417 msgid "Show header in map view"
418 msgstr ""
419
420-#: qml/SettingsPage.qml:325
421+#: qml/SettingsPage.qml:382
422 msgid "History"
423 msgstr ""
424
425-#: qml/SettingsPage.qml:332
426+#: qml/SettingsPage.qml:389
427 msgid "Store new searches"
428 msgstr ""
429
430-#: qml/SettingsPage.qml:344 qml/SettingsPage.qml:354
431+#: qml/SettingsPage.qml:401 qml/SettingsPage.qml:411
432 msgid "Clear History"
433 msgstr ""
434
435-#: qml/SettingsPage.qml:355
436+#: qml/SettingsPage.qml:412
437 msgid "You'll delete the current history"
438 msgstr ""
439
440-#: qml/SettingsPage.qml:358
441+#: qml/SettingsPage.qml:415
442 msgid "Delete"
443 msgstr ""
444
445-#: qml/SettingsPage.qml:377
446+#: qml/SettingsPage.qml:434
447 msgid "Speed Camera alerts and the law"
448 msgstr ""
449
450-#: qml/SettingsPage.qml:378
451+#: qml/SettingsPage.qml:435
452 msgid ""
453 "uNav is only reading the OpenStreetMap database.\n"
454 "uNav will show a max speed notification and a Speed Camera marker (marker "
455@@ -502,7 +514,7 @@
456 "only if it's legal in the country."
457 msgstr ""
458
459-#: qml/SettingsPage.qml:384
460+#: qml/SettingsPage.qml:441
461 msgid "Read more about it"
462 msgstr ""
463
464@@ -1032,7 +1044,7 @@
465 msgid "Go to your left"
466 msgstr ""
467
468-#: nav/class/Navigator.js:288 nav/class/UI.js:438
469+#: nav/class/Navigator.js:288 nav/class/UI.js:475
470 msgid "You have arrived at your destination"
471 msgstr ""
472
473@@ -1172,47 +1184,47 @@
474 msgid ", %1"
475 msgstr ""
476
477-#: nav/class/UI.js:49
478+#: nav/class/UI.js:47
479 msgid "Current Start"
480 msgstr ""
481
482-#: nav/class/UI.js:58
483+#: nav/class/UI.js:56
484 msgid "Current End"
485 msgstr ""
486
487-#: nav/class/UI.js:375
488+#: nav/class/UI.js:410
489 msgid "Waiting for a GPS signal…"
490 msgstr ""
491
492-#: nav/class/UI.js:381
493+#: nav/class/UI.js:417
494 msgid "Searching for a route…"
495 msgstr ""
496
497-#: nav/class/UI.js:385
498+#: nav/class/UI.js:421
499 msgid "Drawing route…"
500 msgstr ""
501
502-#: nav/class/UI.js:389
503+#: nav/class/UI.js:425
504 msgid "Trying search again soon…"
505 msgstr ""
506
507-#: nav/class/UI.js:393
508+#: nav/class/UI.js:429
509 msgid "Recalculating route…"
510 msgstr ""
511
512-#: nav/class/UI.js:414
513+#: nav/class/UI.js:450
514 msgid "Navigation will start soon"
515 msgstr ""
516
517-#: nav/class/UI.js:445
518+#: nav/class/UI.js:482
519 msgid "Simulating route…"
520 msgstr ""
521
522-#: nav/class/UI.js:449
523+#: nav/class/UI.js:486
524 msgid "Error simulating route. Try different points"
525 msgstr ""
526
527-#: nav/class/UI.js:470
528+#: nav/class/UI.js:507
529 msgid "Click onto the icon for reviewing the route"
530 msgstr ""
531
532
533=== modified file 'qml/Main.qml'
534--- qml/Main.qml 2016-07-22 17:40:38 +0000
535+++ qml/Main.qml 2016-08-01 14:52:58 +0000
536@@ -67,6 +67,7 @@
537 property var settings: Settings {
538 property int soundIndications: 0 // 0 voice 1 notification 2 none
539 property int layer: 0
540+ property int onlineLayer: 0
541 property int unit: 0
542 property int routingMode: 0 // 0 car, 1 walk, 2 bicycle
543 property bool avoidTolls: false
544@@ -419,7 +420,15 @@
545 mainPageStack.onLoadingExecuted = true;
546 //send saved Setting states:
547 mainPageStack.executeJavaScript("settings.set_sound(" + navApp.settings.soundIndications + ");");
548- mainPageStack.executeJavaScript("ui.set_map_layer(" + navApp.settings.layer + ");")
549+ if (!navApp.settings.layer) {
550+ if (!navApp.settings.onlineLayer) // Terrain
551+ mainPageStack.executeJavaScript("ui.set_map_layer('terrain');");
552+ else // OSM
553+ mainPageStack.executeJavaScript("ui.set_map_layer('OSM');");
554+ }
555+ else {
556+ mainPageStack.executeJavaScript("ui.set_map_layer('offline');");
557+ }
558 mainPageStack.executeJavaScript("settings.set_unit(\'" + ( navApp.settings.unit === 0 ? "km" : "mi" ) +"\');");
559 mainPageStack.executeJavaScript("ui.set_scale_unit(\'" + ( navApp.settings.unit === 0 ? "km" : "mi" ) +"\');");
560 mainPageStack.executeJavaScript("settings.set_routing_mode(" + navApp.settings.routingMode + ");");
561
562=== modified file 'qml/SettingsPage.qml'
563--- qml/SettingsPage.qml 2016-06-15 17:26:44 +0000
564+++ qml/SettingsPage.qml 2016-08-01 14:52:58 +0000
565@@ -85,6 +85,17 @@
566 }
567
568 ListModel {
569+ id: onlineLayerModel
570+ Component.onCompleted: initialize()
571+ function initialize() {
572+ onlineLayerModel.append({ "onlineLayer": i18n.tr("Terrain"), "index": 0 })
573+ onlineLayerModel.append({ "onlineLayer": i18n.tr("OpenStreetMap"), "index": 1 })
574+
575+ onlineLayerList.subText.text = onlineLayerModel.get(navApp.settings.onlineLayer).onlineLayer
576+ }
577+ }
578+
579+ ListModel {
580 id: layerModel
581 Component.onCompleted: initialize()
582 function initialize() {
583@@ -251,28 +262,74 @@
584
585 onClicked: {
586 navApp.settings.layer = model.index
587- mainPageStack.executeJavaScript("ui.set_map_layer(" + model.index + ");")
588+ if (!model.index) {
589+ if (!navApp.settings.onlineLayer)
590+ mainPageStack.executeJavaScript("ui.set_map_layer('terrain');")
591+ else
592+ mainPageStack.executeJavaScript("ui.set_map_layer('OSM');")
593+ }
594+ else {
595+ mainPageStack.executeJavaScript("ui.set_map_layer('offline');")
596+ }
597 layerList.subText.text = layerModel.get(navApp.settings.layer).layer
598 layerList.toggleExpansion()
599- }
600 }
601+ }
602
603- Label {
604- id: howToMapsLabel
605- text: "<a href='https://unav-go.github.io/offline'>" + i18n.tr("How to use offline maps") + "</a>"
606- visible: navApp.settings.layer !== 0 && !layerList.expansion.expanded // Offline
607- width: parent.width
608- anchors {
609- left: parent.left
610- leftMargin: units.gu(2)
611- bottom: parent.bottom
612- bottomMargin: units.gu(1)
613- }
614- onLinkActivated: Qt.openUrlExternally(link)
615+ Label {
616+ id: howToMapsLabel
617+ text: "<a href='https://unav-go.github.io/offline'>" + i18n.tr("How to use offline maps") + "</a>"
618+ visible: navApp.settings.layer !== 0 && !layerList.expansion.expanded // Offline
619+ width: parent.width
620+ anchors {
621+ left: parent.left
622+ leftMargin: units.gu(2)
623+ bottom: parent.bottom
624+ bottomMargin: units.gu(1)
625 }
626+ onLinkActivated: Qt.openUrlExternally(link)
627+ }
628 }
629
630 ExpandableListItem {
631+ id: onlineLayerList
632+
633+ listViewHeight: units.gu(8+1)
634+ titleText.text: i18n.tr("Online Style")
635+
636+ model: onlineLayerModel
637+ visible: !navApp.settings.layer
638+
639+ delegate: ListItem {
640+ divider.visible: false
641+ height: onlineLayerListItemLayout.height
642+ ListItemLayout {
643+ id: onlineLayerListItemLayout
644+ title.text: model.onlineLayer
645+ title.color: "#5D5D5D"
646+ padding { top: units.gu(1); bottom: units.gu(1) }
647+ Icon {
648+ SlotsLayout.position: SlotsLayout.Trailing
649+ width: units.gu(2)
650+ name: "tick"
651+ visible: navApp.settings.onlineLayer === model.index
652+ }
653+ }
654+
655+ onClicked: {
656+ navApp.settings.onlineLayer = model.index
657+ if (!model.index)
658+ mainPageStack.executeJavaScript("ui.set_map_layer('terrain')")
659+ else
660+ mainPageStack.executeJavaScript("ui.set_map_layer('OSM')")
661+ mainPageStack.executeJavaScript("ui.set_map_layer('tiles', " + model.index + ")")
662+ onlineLayerList.subText.text = onlineLayerModel.get(navApp.settings.onlineLayer).onlineLayer
663+ onlineLayerList.toggleExpansion()
664+ }
665+ }
666+ }
667+
668+ ExpandableListItem {
669 id: unitList
670
671 listViewHeight: units.gu(8+1)

Subscribers

People subscribed via source and target branches