Merge lp:~nik90/unav/fix-unav-list-items into lp:~costales/unav/trunk

Proposed by Nekhelesh Ramananthan
Status: Merged
Merge reported by: costales
Merged at revision: not available
Proposed branch: lp:~nik90/unav/fix-unav-list-items
Merge into: lp:~costales/unav/trunk
Diff against target: 1479 lines (+615/-766)
5 files modified
qml/AboutPage.qml (+144/-254)
qml/FavoritesPage.qml (+11/-28)
qml/HeaderListItem.qml (+30/-0)
qml/SearchPage.qml (+356/-418)
qml/SettingsPage.qml (+74/-66)
To merge this branch: bzr merge lp:~nik90/unav/fix-unav-list-items
Reviewer Review Type Date Requested Status
costales Pending
Review via email: mp+288997@code.launchpad.net

Commit message

- Converts listitems to using ListItemLayouts
- Replace UbuntuListView with just ListView
- Added custom header listitem which uses the new ListItem instead of the deprecated ListItem.Header.
- Massive simplication of the about page code

Description of the change

This MP basically revamps all the list items shown in uNav to follow the system design. It also converts them to the new ListItemLayouts which is more performant, consistent design etc.

Also replaces UbuntuListView with ListView since we are not using any of the features offered by UbuntuListView thereby wasting memory use.

Simplified massively the about page code by using just one listmodel and one listview.

Added custom header listitem which uses the new ListItem instead of the deprecated ListItem.Header.

Note: It seems like a huge code diff in SearchPage.qml, but turns out I just aligned the code accidentally by pressing Ctrl+A and then Ctrl+I. Rest assured it just aligns the code correctly.

To post a comment you must log in.
lp:~nik90/unav/fix-unav-list-items updated
7. By Nekhelesh Ramananthan

Massive simplication of the about page (code wise)

Revision history for this message
costales (costales) wrote :

Thanks a lot Nekhelesh!! Great contribution!!
I added you to the credits with your name and your LP url, if you prefer another, tell me :)
A hug!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/AboutPage.qml'
--- qml/AboutPage.qml 2016-03-14 18:40:54 +0000
+++ qml/AboutPage.qml 2016-03-15 01:14:51 +0000
@@ -16,261 +16,151 @@
1616
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItem
20import "js/utils.js" as QmlJs19import "js/utils.js" as QmlJs
2120
22Page {21Page {
23 id: aboutPage22 id: aboutPage
24 title: i18n.tr("About")23
2524 header: PageHeader {
26 Flickable {25 title: i18n.tr("About")
27 id: flickable26 flickable: creditsListView
28 anchors.fill: parent27 }
29 contentHeight: appColumn.height + donateColumn.height + launchpadColumn.height + devColumn.height + voicesColumn.height + i18nColumn.height + poweredByColumn.height + units.gu(16)28
3029 ListModel {
31 Column {30 id: creditsModel
32 id: appColumn31
33 spacing: units.gu(1)32 Component.onCompleted: initialize()
34 anchors {33
35 top: parent.top; left: parent.left; right: parent.right; topMargin: units.gu(5)34 function initialize() {
36 }35 // Resources
37 Image {36 creditsModel.append({ category: i18n.tr("Resources"), name: i18n.tr("Bugs"), link: "https://bugs.launchpad.net/unav" })
38 id: appImage37 creditsModel.append({ category: i18n.tr("Resources"), name: i18n.tr("Translations"), link: "https://translations.launchpad.net/unav" })
39 source: "../nav/img/about/logo.png"38 creditsModel.append({ category: i18n.tr("Resources"), name: i18n.tr("Answers"), link: "https://answers.launchpad.net/unav" })
40 anchors.horizontalCenter: parent.horizontalCenter39 creditsModel.append({ category: i18n.tr("Resources"), name: i18n.tr("Contact"), link: "mailto:costales.marcos@gmail.com" })
41 }40
42 Label {41 // Developers
43 width: parent.width42 creditsModel.append({ category: i18n.tr("Developers"), name: "JkB", link: "https://launchpad.net/~joergberroth" })
44 wrapMode: Text.WordWrap43 creditsModel.append({ category: i18n.tr("Developers"), name: "Marcos Costales (" + i18n.tr("Founder") + ")", link: "https://wiki.ubuntu.com/costales" })
45 horizontalAlignment: Text.AlignHCenter44
46 //TRANSLATORS: %1 and %2 are links that do not have to be translated: Year + Project + License45 // Voices
47 text: "© uNav 2015-" + new Date().getFullYear()46 switch (Qt.locale().name.substring(0,2).toLowerCase()) {
48 }47 case 'de':
49 Label {48 creditsModel.append({ category: i18n.tr("Voice"), name: "Ilonka Oettershagen", link: "https://plus.google.com/107664665064221547104" });
50 width: parent.width49 break;
51 wrapMode: Text.WordWrap50 case 'es':
52 horizontalAlignment: Text.AlignHCenter51 creditsModel.append({ category: i18n.tr("Voice"), name: "Fernando Lanero", link: "https://twitter.com/ferlanero" })
53 //TRANSLATORS: %1 and %2 are links that do not have to be translated: Year + Project + License52 break;
54 text: i18n.tr("Version %1. Under License %2").arg(navApp.applicationVersion).arg("<a href=\"http://www.gnu.org/licenses/gpl-3.0.en.html\">GPL3</a>")53 case 'it':
55 onLinkActivated: Qt.openUrlExternally(link)54 creditsModel.append({ category: i18n.tr("Voice"), name: "Silvia Bindelli", link: "https://twitter.com/SilviaBindelli" })
56 }55 break;
57 }56 case 'nl':
5857 creditsModel.append({ category: i18n.tr("Voice"), name: "Mark van den Driesche", link: "http://google.com/+Markcortbass" })
59 Column {58 break;
60 id: donateColumn59 case 'sl':
61 anchors.top: appColumn.bottom60 creditsModel.append({ category: i18n.tr("Voice"), name: "Bernard Banko", link: "https://launchpad.net/~beernarrd" })
62 anchors.topMargin: units.gu(3)61 break;
63 width: parent.width62 default:
64 spacing: units.gu(1)63 creditsModel.append({ category: i18n.tr("Voice"), name: "Nathan Haines", link: "http://www.nhaines.com" })
65 Label {64 }
66 id: donateLabel65
67 text: i18n.tr("Support its future development")66 // Translators
68 anchors.horizontalCenter: parent.horizontalCenter67 var translators = QmlJs.getTranslators( i18n.tr("translator-credits") )
69 wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere68 translators.forEach(function(translator) {
70 horizontalAlignment: Text.AlignHCenter69 creditsModel.append({ category: i18n.tr("Translators"), name: translator['name'], link: translator['link'] });
71 width: parent.width - units.gu(12)70 });
72 }71
73 Button {72 // Powered By
74 anchors.horizontalCenter: parent.horizontalCenter73 creditsModel.append({ category: i18n.tr("Powered by"), name: "OpenStreetMap & Contributors", link: "http://www.openstreetmap.org" })
75 color: UbuntuColors.green74 creditsModel.append({ category: i18n.tr("Powered by"), name: "Mapzen", link: "https://mapzen.com/projects/valhalla" })
76 text: i18n.tr("Buy Donate Version")75 creditsModel.append({ category: i18n.tr("Powered by"), name: "MapQuest", link: "http://open.mapquest.com/" })
77 onClicked: Qt.openUrlExternally("scope://com.canonical.scopes.clickstore?q=unavdonateversion")76 creditsModel.append({ category: i18n.tr("Powered by"), name: "OpenStreetMap Nominatin", link: "http://open.mapquestapi.com/nominatim" })
78 }77 creditsModel.append({ category: i18n.tr("Powered by"), name: "Overpass API", link: "http://wiki.openstreetmap.org/wiki/Overpass_API/XAPI_Compatibility_Layer" })
79 }78 creditsModel.append({ category: i18n.tr("Powered by"), name: "OpenLayers", link: "http://openlayers.org" })
8079 creditsModel.append({ category: i18n.tr("Powered by"), name: "Turf.js", link: "http://turfjs.org" })
81 Column {80 creditsModel.append({ category: i18n.tr("Powered by"), name: "JQuery", link: "https://jquery.com" })
82 id: launchpadColumn81 creditsModel.append({ category: i18n.tr("Powered by"), name: "jquery.localize.js", link: "https://github.com/coderifous/jquery-localize" })
83 anchors.top: donateColumn.bottom82 creditsModel.append({ category: i18n.tr("Powered by"), name: "The Noun Project", link: "https://thenounproject.com" })
84 width: parent.width83 creditsModel.append({ category: i18n.tr("Powered by"), name: "Wikimedia", link: "https://commons.wikimedia.org/wiki/Category:Multi-touch_gestures" })
85 ListItem.Header {84 creditsModel.append({ category: i18n.tr("Powered by"), name: "IconFinder", link: "https://www.iconfinder.com/icons/172062/navigation_icon" })
86 id: lpHeader85 creditsModel.append({ category: i18n.tr("Powered by"), name: "Leaflet Marker", link: "https://github.com/Leaflet/Leaflet" })
87 text: i18n.tr("Resources")86 }
88 }87 }
8988
90 Repeater {89 ListView {
91 id: lpListView90 id: creditsListView
9291
93 model: lpModel92 model: creditsModel
94 delegate: ListItem.Standard {93 anchors.fill: parent
95 progression: true94 section.property: "category"
96 showDivider: false95 section.criteria: ViewSection.FullString
97 text: model.name96 section.delegate: HeaderListItem {
98 onClicked: Qt.openUrlExternally(model.link)97 title: section
99 }98 }
100 }99
101100 header: Item {
102 ListModel {101 width: parent.width
103 id: lpModel102 height: appColumn.height + donateColumn.height + units.gu(10)
104 Component.onCompleted: initialize()103 Column {
105 function initialize() {104 id: appColumn
106 lpModel.append({ name: i18n.tr("Bugs"), link: "https://bugs.launchpad.net/unav" })105 spacing: units.gu(1)
107 lpModel.append({ name: i18n.tr("Translations"), link: "https://translations.launchpad.net/unav" })106 anchors {
108 lpModel.append({ name: i18n.tr("Answers"), link: "https://answers.launchpad.net/unav" })107 top: parent.top; left: parent.left; right: parent.right; topMargin: units.gu(5)
109 lpModel.append({ name: i18n.tr("Contact"), link: "mailto:costales.marcos@gmail.com" })108 }
110 }109 Image {
111 }110 id: appImage
112 }111 source: "../nav/img/about/logo.png"
113112 anchors.horizontalCenter: parent.horizontalCenter
114 Column {113 }
115 id: devColumn114 Label {
116 anchors.top: launchpadColumn.bottom115 width: parent.width
117 anchors.topMargin: units.gu(2)116 wrapMode: Text.WordWrap
118 width: parent.width117 horizontalAlignment: Text.AlignHCenter
119 ListItem.Header {118 //TRANSLATORS: %1 and %2 are links that do not have to be translated: Year + Project + License
120 id: devHeader119 text: "© uNav 2015-" + new Date().getFullYear()
121 text: i18n.tr("Developers")120 }
122 }121 Label {
123122 width: parent.width
124 Repeater {123 wrapMode: Text.WordWrap
125 id: devListView124 horizontalAlignment: Text.AlignHCenter
126125 //TRANSLATORS: %1 and %2 are links that do not have to be translated: Year + Project + License
127 model: devModel126 text: i18n.tr("Version %1. Under License %2").arg(navApp.applicationVersion).arg("<a href=\"http://www.gnu.org/licenses/gpl-3.0.en.html\">GPL3</a>")
128 delegate: ListItem.Standard {127 onLinkActivated: Qt.openUrlExternally(link)
129 progression: true128 }
130 showDivider: false129 }
131 text: model.name130
132 onClicked: Qt.openUrlExternally(model.link)131 Column {
133 }132 id: donateColumn
134 }133 anchors.top: appColumn.bottom
135134 anchors.topMargin: units.gu(3)
136 ListModel {135 width: parent.width
137 id: devModel136 spacing: units.gu(1)
138 Component.onCompleted: initialize()137 Label {
139 function initialize() {138 id: donateLabel
140 devModel.append({ name: "JkB", link: "https://launchpad.net/~joergberroth" })139 text: i18n.tr("Support its future development")
141 devModel.append({ name: "Marcos Costales (" + i18n.tr("Founder") + ")", link: "https://wiki.ubuntu.com/costales" })140 anchors.horizontalCenter: parent.horizontalCenter
142 }141 wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
143 }142 horizontalAlignment: Text.AlignHCenter
144 }143 width: parent.width - units.gu(12)
145144 }
146 Column {145 Button {
147 id: voicesColumn146 anchors.horizontalCenter: parent.horizontalCenter
148 anchors.top: devColumn.bottom147 color: UbuntuColors.green
149 anchors.topMargin: units.gu(2)148 text: i18n.tr("Buy Donate Version")
150 width: parent.width149 onClicked: Qt.openUrlExternally("scope://com.canonical.scopes.clickstore?q=unavdonateversion")
151150 }
152 ListItem.Header {151 }
153 id: voicesHeader152 }
154 text: i18n.tr("Voice")153
155 }154 delegate: ListItem {
156155 height: creditsDelegateLayout.height
157 Repeater {156 divider.visible: false
158 id: voicesListView157 ListItemLayout {
159 anchors.top: voicesColumn.bottom158 id: creditsDelegateLayout
160159 title.text: model.name
161 model: voicesModel160 ProgressionSlot {}
162 delegate: ListItem.Standard {161 }
163 progression: true162 onClicked: Qt.openUrlExternally(model.link)
164 showDivider: false163 }
165 text: model.name164 }
166 onClicked: Qt.openUrlExternally(model.link)
167 }
168 }
169
170 ListModel {
171 id: voicesModel
172 Component.onCompleted: initialize()
173 function initialize() {
174 switch (Qt.locale().name.substring(0,2).toLowerCase()) {
175 case 'de':
176 voicesModel.append({name: "Ilonka Oettershagen", link: "https://plus.google.com/107664665064221547104"});
177 break;
178 case 'es':
179 voicesModel.append({name: "Fernando Lanero", link: "https://twitter.com/ferlanero"})
180 break;
181 case 'it':
182 voicesModel.append({name: "Silvia Bindelli", link: "https://twitter.com/SilviaBindelli"})
183 break;
184 case 'nl':
185 voicesModel.append({name: "Mark van den Driesche", link: "http://google.com/+Markcortbass"})
186 break;
187 case 'sl':
188 voicesModel.append({name: "Bernard Banko", link: "https://launchpad.net/~beernarrd"})
189 break;
190 default:
191 voicesModel.append({name: "Nathan Haines", link: "http://www.nhaines.com"})
192 }
193 }
194 }
195 }
196
197 Column {
198 id: i18nColumn
199 anchors.top: voicesColumn.bottom
200 anchors.topMargin: units.gu(2)
201 width: parent.width
202
203 ListItem.Header {
204 id: i18nHeader
205 text: i18n.tr("Translators")
206 }
207
208 Repeater {
209 id: i18nListView
210
211 model: i18nModel
212 delegate: ListItem.Standard {
213 progression: true
214 showDivider: false
215 text: model.name
216 onClicked: Qt.openUrlExternally(model.link)
217 }
218 }
219
220 ListModel {
221 id: i18nModel
222 Component.onCompleted: initialize()
223 function initialize() {
224 var translators = QmlJs.getTranslators( i18n.tr("translator-credits") )
225 translators.forEach(function(translator) {
226 i18nModel.append({ name: translator['name'], link: translator['link'] });
227 });
228 }
229 }
230 }
231
232 Column {
233 id: poweredByColumn
234 anchors.top: i18nColumn.bottom
235 anchors.topMargin: units.gu(2)
236 width: parent.width
237
238 ListItem.Header {
239 id: poweredbyHeader
240 text: i18n.tr("Powered by")
241 }
242
243 Repeater {
244 id: poweredbyListView
245
246 model: poweredbyModel
247 delegate: ListItem.Standard {
248 progression: true
249 showDivider: false
250 text: model.name
251 onClicked: Qt.openUrlExternally(model.link)
252 }
253 }
254
255 ListModel {
256 id: poweredbyModel
257 Component.onCompleted: initialize()
258 function initialize() {
259 poweredbyModel.append({ name: "OpenStreetMap & Contributors", link: "http://www.openstreetmap.org" })
260 poweredbyModel.append({ name: "Mapzen", link: "https://mapzen.com/projects/valhalla" })
261 poweredbyModel.append({ name: "MapQuest", link: "http://open.mapquest.com/" })
262 poweredbyModel.append({ name: "OpenStreetMap Nominatin", link: "http://open.mapquestapi.com/nominatim" })
263 poweredbyModel.append({ name: "Overpass API", link: "http://wiki.openstreetmap.org/wiki/Overpass_API/XAPI_Compatibility_Layer" })
264 poweredbyModel.append({ name: "OpenLayers", link: "http://openlayers.org" })
265 poweredbyModel.append({ name: "Turf.js", link: "http://turfjs.org" })
266 poweredbyModel.append({ name: "JQuery", link: "https://jquery.com" })
267 poweredbyModel.append({ name: "jquery.localize.js", link: "https://github.com/coderifous/jquery-localize" })
268 poweredbyModel.append({ name: "The Noun Project", link: "https://thenounproject.com" })
269 poweredbyModel.append({ name: "Wikimedia", link: "https://commons.wikimedia.org/wiki/Category:Multi-touch_gestures" })
270 poweredbyModel.append({ name: "IconFinder", link: "https://www.iconfinder.com/icons/172062/navigation_icon" })
271 poweredbyModel.append({ name: "Leaflet Marker", link: "https://github.com/Leaflet/Leaflet" })
272 }
273 }
274 }
275 }
276}165}
166
277167
=== modified file 'qml/FavoritesPage.qml'
--- qml/FavoritesPage.qml 2016-03-14 18:40:54 +0000
+++ qml/FavoritesPage.qml 2016-03-15 01:14:51 +0000
@@ -200,12 +200,16 @@
200 }200 }
201 }201 }
202202
203 UbuntuListView {203 ListView {
204 id: favoritesListView204 id: favoritesListView
205
205 model: favoritesModel206 model: favoritesModel
206 anchors.fill: parent207 anchors.fill: parent
207208
208 delegate: ListItem {209 delegate: ListItem {
210 id: delegate
211
212 height: favouriteDelegateLayout.height + divider.height
209 leadingActions: ListItemActions {213 leadingActions: ListItemActions {
210 actions: [214 actions: [
211 Action {215 Action {
@@ -237,33 +241,12 @@
237 ]241 ]
238 }242 }
239243
240 contentItem.anchors {244 ListItemLayout {
241 leftMargin: units.gu(1)245 id: favouriteDelegateLayout
242 rightMargin: units.gu(1)246 title.text: model.name
243 topMargin: units.gu(0.5)247 subtitle.visible: mainPageStack.center_onpos !== 0
244 bottomMargin: units.gu(0.5)248 subtitle.text: QmlJs.formatDistance(QmlJs.calcPoiDistance(mainPageStack.currentLat, mainPageStack.currentLng, model.lat, model.lng, 10), navApp.settings.unit)
245 }249 }
246
247 Label {
248 height: parent.height
249 width: parent.width *4/5
250 text: model.name
251 elide: Text.ElideRight
252 wrapMode: Text.WordWrap
253 }
254
255 Label {
256 anchors.bottom: parent.bottom
257 width: parent.width /5
258 anchors.right: parent.right
259 horizontalAlignment: Text.AlignRight
260 visible: (mainPageStack.center_onpos !== 0)
261 text: QmlJs.formatDistance(
262 QmlJs.calcPoiDistance(mainPageStack.currentLat, mainPageStack.currentLng, model.lat, model.lng, 10),
263 navApp.settings.unit
264 )
265 fontSize: "small"
266 }
267250
268 onClicked: {251 onClicked: {
269 mainPageStack.pop(favoritesPage)252 mainPageStack.pop(favoritesPage)
270253
=== added file 'qml/HeaderListItem.qml'
--- qml/HeaderListItem.qml 1970-01-01 00:00:00 +0000
+++ qml/HeaderListItem.qml 2016-03-15 01:14:51 +0000
@@ -0,0 +1,30 @@
1/*
2 * uNav http://launchpad.net/unav
3 * Copyright (C) 2016 Nekhelesh Ramananthan https://launchpad.net/~nik90
4 *
5 * uNav is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * uNav is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16import QtQuick 2.4
17import Ubuntu.Components 1.3
18
19ListItem {
20 id: headerListItem
21
22 property string title
23
24 height: units.gu(4)
25 Label {
26 anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(2) }
27 text: title
28 font.bold: true
29 }
30}
031
=== modified file 'qml/SearchPage.qml'
--- qml/SearchPage.qml 2016-03-14 18:40:54 +0000
+++ qml/SearchPage.qml 2016-03-15 01:14:51 +0000
@@ -18,428 +18,366 @@
18import QtQuick.Layouts 1.118import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.319import Ubuntu.Components 1.3
20import Ubuntu.Components.Popups 1.320import Ubuntu.Components.Popups 1.3
21import Ubuntu.Components.ListItems 1.3 as ListItems
22import QtQuick.LocalStorage 2.021import QtQuick.LocalStorage 2.0
23import QtQuick.XmlListModel 2.022import QtQuick.XmlListModel 2.0
24import "js/utils.js" as QmlJs23import "js/utils.js" as QmlJs
25import "js/db.js" as UnavDB24import "js/db.js" as UnavDB
2625
27Page {26Page {
28 id: searchPage27 id: searchPage
2928
30 title: i18n.tr("Search")29 title: i18n.tr("Search")
31 anchors.fill: parent30
3231 state: "search"
33 state: "search"32 states: [
34 states: [33 PageHeadState {
35 PageHeadState {34 name: "search"
36 name: "search"35 head: searchPage.head
37 head: searchPage.head36
3837 backAction: Action {
39 backAction: Action {38 iconName: "back"
40 iconName: "back"39 text: i18n.tr("Back")
41 text: i18n.tr("Back")40 onTriggered: {
42 onTriggered: {41 mainPageStack.pop(searchPage)
43 mainPageStack.pop(searchPage)42 }
44 }43 }
45 }44
4645 contents: TextField {
47 contents: TextField {46 id: searchField
48 id: searchField47 width: parent ? parent.width - units.gu(2) : undefined
49 width: parent ? parent.width - units.gu(2) : undefined48 inputMethodHints: Qt.ImhNoPredictiveText
50 inputMethodHints: Qt.ImhNoPredictiveText49 hasClearButton: true
51 hasClearButton: true50 placeholderText: i18n.tr("Where do we go?")
52 placeholderText: i18n.tr("Where do we go?")51 onTriggered: {
53 onTriggered: {52 if (text.length > 2) {
54 if (text.length > 2) {53 statusLabel.visible = true
55 statusLabel.visible = true54 statusLabel.text = i18n.tr("Searching…");
56 statusLabel.text = i18n.tr("Searching…");55 resultsListView.visible = false
57 resultsListView.visible = false56 xmlSearchModel.searchString = text;
58 xmlSearchModel.searchString = text;57 xmlSearchModel.search();
59 xmlSearchModel.search();58 } else {
60 } else {59 searchField.text = "";
61 searchField.text = "";60 }
62 }61 }
63 }62 }
64 }63 }
65 }64 ]
66 ]65
6766 Label {
68 Label {67 id: statusLabel
69 id: statusLabel68 width: parent.width - units.gu(4)
70 width: parent.width - units.gu(4)69 anchors.centerIn: parent
71 anchors.horizontalCenter: parent.horizontalCenter70 visible: historyModel.count === 0
72 anchors.verticalCenter: parent.verticalCenter71 horizontalAlignment: Text.AlignHCenter
73 visible: historyModel.count === 072 wrapMode: Text.WordWrap
74 horizontalAlignment: Text.AlignHCenter73 text: navApp.settings.saveHistory ? i18n.tr("No history yet…")
75 wrapMode: Text.WordWrap74 : i18n.tr("History is disabled")
76 text: navApp.settings.saveHistory ? i18n.tr("No history yet…") : i18n.tr("History is disabled")75 }
77 }76
7877 Icon {
79 Icon {78 id: historyIcon
80 id: historyIcon79 width: units.gu(6)
81 width: units.gu(6)80 anchors { horizontalCenter: parent.horizontalCenter; bottom: statusLabel.top; bottomMargin: units.gu(2) }
82 anchors.horizontalCenter: parent.horizontalCenter81 visible: historyModel.count === 0 && xmlSearchModel.status !== XmlListModel.Loading
83 anchors.bottom: statusLabel.top82 name: "history"
84 anchors.bottomMargin: units.gu(2)83 }
85 visible: historyModel.count === 0 && xmlSearchModel.status !== XmlListModel.Loading84
86 name: "history"85 // Indicator to show search activity
87 }86 ActivityIndicator {
8887 id: searchActivity
89 // Indicator to show search activity88 anchors {
90 ActivityIndicator {89 bottom: statusLabel.top
91 id: searchActivity90 bottomMargin: units.gu (1)
92 anchors {91 horizontalCenter: parent.horizontalCenter
93 bottom: statusLabel.top92 }
94 bottomMargin: units.gu (1)93 running: xmlSearchModel.status === XmlListModel.Loading
95 horizontalCenter: parent.horizontalCenter94 }
96 }95
97 running: xmlSearchModel.status === XmlListModel.Loading96 ListModel {
98 }97 id: historyModel
9998 function initialize() {
100 ListModel {99 historyModel.clear();
101 id: historyModel100 var res = UnavDB.getSearchHistory();
102 function initialize() {101 var len = res.rows.length;
103 historyModel.clear();102 for (var i = 0; i < len; ++i) {
104 var res = UnavDB.getSearchHistory();103 historyModel.append({
105 var len = res.rows.length;104 title: i18n.tr("Search history"),
106 for (var i = 0; i < len; ++i) {105 name: res.rows.item(i).key,
107 historyModel.append({106 lat: res.rows.item(i).lat,
108 title: i18n.tr("Search history"),107 lng: res.rows.item(i).lng
109 name: res.rows.item(i).key,108 });
110 lat: res.rows.item(i).lat,109 }
111 lng: res.rows.item(i).lng110 res = UnavDB.getfavHistory();
112 });111 len = res.rows.length;
113 }112 for (i = 0; i < len; ++i) {
114 res = UnavDB.getfavHistory();113 historyModel.append({
115 len = res.rows.length;114 title: i18n.tr("Favorite history"),
116 for (i = 0; i < len; ++i) {115 name: res.rows.item(i).key,
117 historyModel.append({116 lat: res.rows.item(i).lat,
118 title: i18n.tr("Favorite history"),117 lng: res.rows.item(i).lng
119 name: res.rows.item(i).key,118 });
120 lat: res.rows.item(i).lat,119 }
121 lng: res.rows.item(i).lng120 res = UnavDB.getNearByHistory();
122 });121 len = res.rows.length;
123 }122 for (i = 0; i < len; ++i) {
124 res = UnavDB.getNearByHistory();123 historyModel.append({
125 len = res.rows.length;124 title: i18n.tr("Nearby history"),
126 for (i = 0; i < len; ++i) {125 name: i18n.tr(res.rows.item(i).type),
127 historyModel.append({126 en_name: res.rows.item(i).type,
128 title: i18n.tr("Nearby history"),127 clause: res.rows.item(i).clause
129 name: i18n.tr(res.rows.item(i).type),128 });
130 en_name: res.rows.item(i).type,129 }
131 clause: res.rows.item(i).clause130 }
132 });131 Component.onCompleted: initialize()
133 }132 }
134 }133
135 Component.onCompleted: initialize()134 //OSMTouch Model:
136 }135 XmlListModel {
137136 id: xmlSearchModel
138 //OSMTouch Model:137
139 XmlListModel {138 onStatusChanged: {
140 id: xmlSearchModel139 if (status === XmlListModel.Error) {
141140 statusLabel.text = i18n.tr("Time out! Please try again");
142 onStatusChanged: {141 statusLabel.visible = true;
143 if (status === XmlListModel.Error) {142 historyIcon.visible = false;
144 statusLabel.text = i18n.tr("Time out! Please try again");143 resultsListView.visible = false;
145 statusLabel.visible = true;144 } if (status === XmlListModel.Ready && count === 0) {
146 historyIcon.visible = false;145 //TRANSLATORS: The Argument is the search input. E.G. a Town, Address....
147 resultsListView.visible = false;146 statusLabel.text = i18n.tr("Sorry, no result for %1").arg(searchField.text);
148 } if (status === XmlListModel.Ready && count === 0) {147 statusLabel.visible = true;
149 //TRANSLATORS: The Argument is the search input. E.G. a Town, Address....148 historyIcon.visible = false;
150 statusLabel.text = i18n.tr("Sorry, no result for %1").arg(searchField.text);149 resultsListView.visible = false;
151 statusLabel.visible = true;150 } if (status === XmlListModel.Ready && count >> 0) {
152 historyIcon.visible = false;151 statusLabel.visible = false;
153 resultsListView.visible = false;152 historyIcon.visible = false;
154 } if (status === XmlListModel.Ready && count >> 0) {153 sortedSearchModel.sortXmlList();
155 statusLabel.visible = false;154 }
156 historyIcon.visible = false;155 }
157 sortedSearchModel.sortXmlList();156
158 }157 readonly property string searchUrl: "https://nominatim.openstreetmap.org/search?format=xml&email=marcos.costales@gmail.com&limit=50&q="
159 }158 property string searchString
160159
161 readonly property string searchUrl: "https://nominatim.openstreetmap.org/search?format=xml&email=marcos.costales@gmail.com&limit=50&q="160 function search() {
162 property string searchString161 xmlSearchModel.clear()
163162 sortedSearchModel.clear()
164 function search() {163 source = (searchUrl + searchString);
165 xmlSearchModel.clear()164 }
166 sortedSearchModel.clear()165
167 source = (searchUrl + searchString);166 function clear() {
168 }167 source: "";
169168 }
170 function clear() {169
171 source: "";170 source: ""
172 }171 query: "/searchresults/place"
173172
174 source: ""173 XmlRole { name: "name"; query: "@display_name/string()"; isKey: true }
175 query: "/searchresults/place"174 XmlRole { name: "lat"; query: "@lat/string()"; isKey: true }
176175 XmlRole { name: "lng"; query: "@lon/string()"; isKey: true }
177 XmlRole { name: "name"; query: "@display_name/string()"; isKey: true }176 XmlRole { name: "icon"; query: "@icon/string()"; isKey: true }
178 XmlRole { name: "lat"; query: "@lat/string()"; isKey: true }177 }
179 XmlRole { name: "lng"; query: "@lon/string()"; isKey: true }178
180 XmlRole { name: "icon"; query: "@icon/string()"; isKey: true }179 ListModel {
181 }180 id: sortedSearchModel
182181
183 ListModel {182 function sortXmlList (){
184 id: sortedSearchModel183 sortedSearchModel.clear()
185184 var item
186 function sortXmlList (){185 for (var i = 0; i < xmlSearchModel.count; i++) {
187 sortedSearchModel.clear()186 item = {
188 var item187 "name": xmlSearchModel.get(i).name,
189 for (var i = 0; i < xmlSearchModel.count; i++) {188 "lat": xmlSearchModel.get(i).lat,
190 item = {189 "lng": xmlSearchModel.get(i).lng,
191 "name": xmlSearchModel.get(i).name,190 "icon": (xmlSearchModel.get(i).icon).replace('.p.20.png', '.p.32.png'),
192 "lat": xmlSearchModel.get(i).lat,191 "distance": QmlJs.calcPoiDistance(
193 "lng": xmlSearchModel.get(i).lng,192 mainPageStack.currentLat,
194 "icon": (xmlSearchModel.get(i).icon).replace('.p.20.png', '.p.32.png'),193 mainPageStack.currentLng,
195 "distance": QmlJs.calcPoiDistance(194 xmlSearchModel.get(i).lat,
196 mainPageStack.currentLat,195 xmlSearchModel.get(i).lng,
197 mainPageStack.currentLng,196 10
198 xmlSearchModel.get(i).lat,197 )
199 xmlSearchModel.get(i).lng,198 }
200 10199 if (i === 0) {
201 )200 sortedSearchModel.append(item)
202 }201 } else { // sort model by distance
203 if (i === 0) {202 var j = 0;
204 sortedSearchModel.append(item)203 while (j <= sortedSearchModel.count) {
205 } else { // sort model by distance204 if (j === sortedSearchModel.count) {
206 var j = 0;205 sortedSearchModel.append(item)
207 while (j <= sortedSearchModel.count) {206 break;
208 if (j === sortedSearchModel.count) {207 } else if (item.distance < sortedSearchModel.get(j).distance){
209 sortedSearchModel.append(item)208 sortedSearchModel.insert(j,item)
210 break;209 break;
211 } else if (item.distance < sortedSearchModel.get(j).distance){210 } else {
212 sortedSearchModel.insert(j,item)211 j++;
213 break;212 }
214 } else {213 }
215 j++;214 }
216 }215 xmlSearchModel.clear();
217 }216 historyListView.visible = false;
218 }217 resultsListView.visible = true;
219 xmlSearchModel.clear();218 }
220 historyListView.visible = false;219 }
221 resultsListView.visible = true;220 }
222 }221
223 }222 ListView {
224 }223 id: historyListView
225224
226 Component {225 model: historyModel
227 id: sectionHeading226 visible: !statusLabel.visible
228227 anchors.fill: parent
229 Rectangle {228
230 width: parent.width229 section.property: "title"
231 height: childrenRect.height230 section.criteria: ViewSection.FullString
232231 section.delegate: HeaderListItem {
233 ListItems.Header {232 title: section
234 id: listHeader233 }
235 text: section234
236 }235 delegate: ListItem {
237 }236 height: historyDelegateLayout.height + divider.height
238 }237 leadingActions: ListItemActions {
239238 actions: [
240 UbuntuListView {239 Action {
241 id: historyListView240 iconName: "delete"
242 model: historyModel241 onTriggered: {
243 visible: !statusLabel.visible242 switch (model.title) {
244 anchors.fill: parent243 case i18n.tr("Search history"):
245244 UnavDB.removeHistorySearch(model.name);
246 section.property: "title"245 break;
247 section.criteria: ViewSection.FullString246 case i18n.tr("Nearby history"):
248 //section.labelPositioning: ViewSection.CurrentLabelAtStart + ViewSection.InlineLabels247 UnavDB.removeHistoryNearby(model.en_name);
249 section.delegate: sectionHeading248 break;
250249 case i18n.tr("Favorite history"):
251 delegate: ListItem {250 UnavDB.removeHistoryFavorite(model.name);
252 leadingActions: ListItemActions {251 }
253 actions: [252 historyModel.initialize()
254 Action {253 }
255 iconName: "delete"254 }
256 onTriggered: {255 ]
257 switch (model.title) {256 }
258 case i18n.tr("Search history"):257
259 UnavDB.removeHistorySearch(model.name);258 trailingActions: ListItemActions {
260 break;259 actions: [
261 case i18n.tr("Nearby history"):260 Action {
262 UnavDB.removeHistoryNearby(model.en_name);261 iconName: "send"
263 break;262 onTriggered: {
264 case i18n.tr("Favorite history"):263 mainPageStack.pop(searchPage);
265 UnavDB.removeHistoryFavorite(model.name);264 mainPageStack.routeState = 'yes';
266 }265 mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");
267 historyModel.initialize()266 }
268 }267 },
269 }268 Action {
270 ]269 iconName: "share"
271 }270 onTriggered: {
272271 PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng})
273 trailingActions: ListItemActions {272 }
274 actions: [273 }
275 Action {274 ]
276 iconName: "send"275 }
277 onTriggered: {276
278 mainPageStack.pop(searchPage);277 ListItemLayout {
279 mainPageStack.routeState = 'yes';278 id: historyDelegateLayout
280 mainPageStack.executeJavaScript("calc2coord("+ model.lat + "," + model.lng + ");");279
281 }280 title.text: model.name
282 },281 title.maximumLineCount: 2
283 Action {282 subtitle.text: QmlJs.formatDistance(QmlJs.calcPoiDistance(mainPageStack.currentLat, mainPageStack.currentLng, model.lat, model.lng, 10), navApp.settings.unit)
284 iconName: "share"283 subtitle.visible: model.title !== i18n.tr("Nearby history") && mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
285 onTriggered: {284
286 PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng})285 Icon {
287 }286 id: progressionIcon
288 }287 height: units.gu(2.5)
289 ]288 name: "next"
290 }289 visible: model.title === i18n.tr("Nearby history")
291290 SlotsLayout.position: SlotsLayout.Last
292 contentItem.anchors {291 }
293 leftMargin: units.gu(2)292
294 rightMargin: units.gu(1)293 }
295 topMargin: units.gu(0.5)294
296 bottomMargin: units.gu(0.5)295 onClicked: {
297 }296 mainPageStack.pop(searchPage)
298297 if (model.title === i18n.tr("Nearby history")) {
299 Label {298 mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"),
300 height: parent.height299 {
301 width: parent.width *4/5300 lat: mainPageStack.currentLat,
302 text: model.name301 lng: mainPageStack.currentLng,
303 elide: Text.ElideRight302 poiType: model.name,
304 wrapMode: Text.WordWrap303 clause: model.clause,
305 }304 geoDistFactor: 5
306305 })
307 Icon {306 } else {
308 id: progressionIcon307 mainPageStack.executeJavaScript("ui.markers_POI_set([{ title: \"" +
309 anchors {308 model.name + "\", lat: " +
310 right: parent.right309 model.lat + ", lng: " +
311 verticalCenter: parent.verticalCenter310 model.lng + "}]);");
312 }311 }
313 height: units.gu(2.5)312 }
314 name: "next"313 }
315 visible: model.title === i18n.tr("Nearby history")314 }
316 }315
317316 ListView {
318 Label {317 id: resultsListView
319 anchors.bottom: parent.bottom318
320 width: parent.width /5319 anchors.fill: parent
321 anchors.right: parent.right320 anchors.topMargin: units.gu(6)
322 horizontalAlignment: Text.AlignRight321 visible: false
323 visible: model.title !== i18n.tr("Nearby history") && mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"322
324 text: QmlJs.formatDistance(323 model: sortedSearchModel
325 QmlJs.calcPoiDistance(324
326 mainPageStack.currentLat,325 delegate: ListItem {
327 mainPageStack.currentLng,326 height: resultsDelegateLayout.height + divider.height
328 model.lat, model.lng, 327 trailingActions: ListItemActions {
329 10328 actions: [
330 ),329 Action {
331 navApp.settings.unit330 iconName: "send"
332 )331 onTriggered: {
333 fontSize: "small"332 if (navApp.settings.saveHistory) {
334 }333 UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)
335334 }
336 onClicked: {335 mainPageStack.pop(searchPage);
337 mainPageStack.pop(searchPage)336 mainPageStack.routeState = 'yes'
338 if (model.title === i18n.tr("Nearby history")) {337 mainPageStack.executeJavaScript("calc2coord(" + model.lat + "," + model.lng + ");")
339 mainPageStack.push(Qt.resolvedUrl("PoiListPage.qml"), 338 }
340 {339 },
341 lat: mainPageStack.currentLat,340 Action {
342 lng: mainPageStack.currentLng,341 iconName: "share"
343 poiType: model.name,342 onTriggered: {
344 clause: model.clause,343 PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng})
345 geoDistFactor: 5344 }
346 })345 },
347 } else {346 Action {
348 mainPageStack.executeJavaScript("ui.markers_POI_set([{ title: \"" +347 iconName: "non-starred"
349 model.name + "\", lat: " +348 onTriggered: {
350 model.lat + ", lng: " +349 mainPageStack.pop(searchPage)
351 model.lng + "}]);");350 mainPageStack.push(Qt.resolvedUrl("FavoritesPage.qml"), {state:"adding", lat: model.lat, lng: model.lng, favName: model.name})
352 }351 }
353 }352 }
354 }353 ]
355 }354 }
356355
357 UbuntuListView {356 onClicked: {
358 id: resultsListView357 if (navApp.settings.saveHistory) {
359 model: sortedSearchModel358 UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)
360359 }
361 width: parent.width360 mainPageStack.pop(searchPage)
362 height: parent.height - units.gu(6)361 mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + model.name + "\", lat: " + model.lat + ", lng: " + model.lng + "}]);");
363 anchors.top: parent.top362 }
364 anchors.topMargin: units.gu(6)363
365 visible: false364 ListItemLayout {
366365 id: resultsDelegateLayout
367 delegate: ListItem {366
368 trailingActions: ListItemActions {367 title.text: model.name
369 actions: [368 title.maximumLineCount: 2
370 Action {369 subtitle.text: QmlJs.formatDistance(model.distance, navApp.settings.unit)
371 iconName: "send"370 subtitle.visible: mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
372 onTriggered: {371
373 if (navApp.settings.saveHistory) {372 Icon {
374 UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)373 id: resIcon
375 }374 height: units.gu(2.5)
376 mainPageStack.pop(searchPage);375 width: height
377 mainPageStack.routeState = 'yes'376 visible: model.icon !== ""
378 mainPageStack.executeJavaScript("calc2coord(" + model.lat + "," + model.lng + ");")377 source: model.icon
379 }378 SlotsLayout.position: SlotsLayout.Last
380 },379 }
381 Action {380 }
382 iconName: "share"381 }
383 onTriggered: {382 }
384 PopupUtils.open(Qt.resolvedUrl("./Share.qml"), navApp, {"lat": model.lat, "lon": model.lng})
385 }
386 },
387 Action {
388 iconName: "non-starred"
389 onTriggered: {
390 mainPageStack.pop(searchPage)
391 mainPageStack.push(Qt.resolvedUrl("FavoritesPage.qml"), {state:"adding", lat: model.lat, lng: model.lng, favName: model.name})
392 }
393 }
394 ]
395 }
396
397 onClicked: {
398 if (navApp.settings.saveHistory) {
399 UnavDB.saveToSearchHistory(model.name, model.lat, model.lng)
400 }
401 mainPageStack.pop(searchPage)
402 mainPageStack.executeJavaScript("ui.markers_POI_set([{title: \"" + model.name + "\", lat: " + model.lat + ", lng: " + model.lng + "}]);");
403 }
404
405 contentItem.anchors {
406 leftMargin: units.gu(1)
407 rightMargin: units.gu(1)
408 topMargin: units.gu(0.5)
409 bottomMargin: units.gu(0.5)
410 }
411
412 Label {
413 anchors.left: parent.left
414 height: parent.height
415 width: parent.width *4/5
416 text: model.name
417 elide: Text.ElideRight
418 wrapMode: Text.WordWrap
419
420 }
421
422 Icon {
423 id: resIcon
424 height: 32
425 width: height
426 visible: model.icon !== ""
427 anchors {
428 top: parent.top
429 right: parent.right
430 }
431 source: model.icon
432 }
433
434 Label {
435 anchors.bottom: parent.bottom
436 width: parent.width /5
437 anchors.right: parent.right
438 horizontalAlignment: Text.AlignRight
439 visible: mainPageStack.currentLat !== "null" && mainPageStack.currentLng !== "null"
440 text: QmlJs.formatDistance(model.distance, navApp.settings.unit)
441 fontSize: "small"
442 }
443 }
444 }
445}383}
446384
=== modified file 'qml/SettingsPage.qml'
--- qml/SettingsPage.qml 2016-03-14 18:40:54 +0000
+++ qml/SettingsPage.qml 2016-03-15 01:14:51 +0000
@@ -17,7 +17,7 @@
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.Popups 1.319import Ubuntu.Components.Popups 1.3
20import Ubuntu.Components.ListItems 1.3 as ListItem20import Ubuntu.Components.ListItems 1.3 as ListItems
21import QtQuick.LocalStorage 2.021import QtQuick.LocalStorage 2.0
22import "js/db.js" as UnavDB22import "js/db.js" as UnavDB
2323
@@ -41,12 +41,12 @@
41 right: parent.right41 right: parent.right
42 }42 }
4343
44 ListItem.Header {44 HeaderListItem {
45 id: mapModeHeader45 id: mapModeHeader
46 text: i18n.tr("Navigation")46 title: i18n.tr("Navigation")
47 }47 }
4848
49 ListItem.ItemSelector {49 ListItems.ItemSelector {
50 id: modeList50 id: modeList
51 text: i18n.tr("Mode:")51 text: i18n.tr("Mode:")
52 width: parent.width52 width: parent.width
@@ -63,40 +63,46 @@
63 mainPageStack.executeJavaScript("if (nav.get_route_status() != 'no'){nav.set_route_status('waiting4signal')}; settings.set_routing_mode(" + selectedIndex +");")63 mainPageStack.executeJavaScript("if (nav.get_route_status() != 'no'){nav.set_route_status('waiting4signal')}; settings.set_routing_mode(" + selectedIndex +");")
64 }64 }
65 }65 }
66 66
67 ListItem.Standard {67 ListItem {
68 visible: navApp.settings.routingMode === 0 ? true : false68 height: tollsLayout.height + divider.height
69 showDivider: true69 ListItemLayout {
70 text: i18n.tr("Avoid Tolls")70 id: tollsLayout
71 control: Switch {71 title.text: i18n.tr("Avoid Tolls")
72 id: tollsSwitch72 Switch {
73 checked: navApp.settings.avoidTolls73 id: tollsSwitch
74 onClicked: { 74 checked: navApp.settings.avoidTolls
75 navApp.settings.avoidTolls = checked;75 onClicked: {
76 mainPageStack.executeJavaScript("if (nav.get_route_status() != 'no'){nav.set_route_status('waiting4signal')}; settings.set_avoid_tolls(" + checked.toString() + ");")76 navApp.settings.avoidTolls = checked;
77 }77 mainPageStack.executeJavaScript("if (nav.get_route_status() != 'no'){nav.set_route_status('waiting4signal')}; settings.set_avoid_tolls(" + checked.toString() + ");")
78 }78 }
79 }79 SlotsLayout.position: SlotsLayout.Last
80 80 }
81 ListItem.Standard {81 }
82 visible: navApp.settings.routingMode === 0 ? true : false82 }
83 showDivider: true83
84 text: i18n.tr("Speed Camera Alerts")84 ListItem {
85 control: Switch {85 height: speedCameraLayout.height + divider.height
86 id: radarsSwitch86 ListItemLayout {
87 checked: navApp.settings.alertRadars87 id: speedCameraLayout
88 onClicked: {88 title.text: i18n.tr("Speed Camera Alerts")
89 navApp.settings.alertRadars = checked;89 Switch {
90 mainPageStack.executeJavaScript("if (nav.get_route_status() != 'no'){nav.set_route_status('waiting4signal')}; settings.set_alert_radars(" + checked.toString() + ");");90 id: radarsSwitch
91 if (navApp.settings.legalRadarShow) {91 checked: navApp.settings.alertRadars
92 navApp.settings.legalRadarShow = false;92 onClicked: {
93 PopupUtils.open(confirmEnableRadar);93 navApp.settings.alertRadars = checked;
94 }94 mainPageStack.executeJavaScript("if (nav.get_route_status() != 'no'){nav.set_route_status('waiting4signal')}; settings.set_alert_radars(" + checked.toString() + ");");
95 }95 if (navApp.settings.legalRadarShow) {
96 }96 navApp.settings.legalRadarShow = false;
97 }97 PopupUtils.open(confirmEnableRadar);
98 98 }
99 ListItem.ItemSelector {99 }
100 SlotsLayout.position: SlotsLayout.Last
101 }
102 }
103 }
104
105 ListItems.ItemSelector {
100 id: soundsList106 id: soundsList
101 text: i18n.tr("Indications:")107 text: i18n.tr("Indications:")
102 width: parent.width108 width: parent.width
@@ -114,12 +120,12 @@
114 }120 }
115 }121 }
116122
117 ListItem.Header {123 HeaderListItem {
118 id: mapListHeader124 id: mapListHeader
119 text: i18n.tr("Map")125 title: i18n.tr("Map")
120 }126 }
121127
122 ListItem.ItemSelector {128 ListItems.ItemSelector {
123 id: unitsList129 id: unitsList
124 text: i18n.tr("Units:")130 text: i18n.tr("Units:")
125 width: parent.width131 width: parent.width
@@ -137,30 +143,32 @@
137 }143 }
138 }144 }
139145
140 ListItem.Header {146 HeaderListItem {
141 id: privacyListHeader147 id: privacyListHeader
142 text: i18n.tr("History")148 title: i18n.tr("History")
143 }149 }
144150
145 ListItem.Standard {151 ListItem {
146 showDivider: false152 height: storeSearchLayout.height + divider.height
147 text: i18n.tr("Store new searches")153 ListItemLayout {
148154 id: storeSearchLayout
149 control: Switch {155 title.text: i18n.tr("Store new searches")
150 id: saveHistorySwitch156 Switch {
151 checked: navApp.settings.saveHistory157 id: saveHistorySwitch
152 onClicked: {158 checked: navApp.settings.saveHistory
153 navApp.settings.saveHistory = checked;159 onClicked: navApp.settings.saveHistory = checked
154 }160 SlotsLayout.position: SlotsLayout.Last
155 }161 }
156 }162 }
157163 }
158 ListItem.Standard {164
159 showDivider: true165 ListItem {
160 text: i18n.tr("Clear History")166 Label {
161 onClicked: PopupUtils.open(confirmEraseHistory)167 anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(2) }
162 }168 text: i18n.tr("Clear History")
163 169 }
170 onClicked: PopupUtils.open(confirmEraseHistory)
171 }
164 }172 }
165 173
166 Component {174 Component {

Subscribers

People subscribed via source and target branches