1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
*
* \file NavigationSearchAddress.qml
*
* \brief This file is part of the navigation hmi.
*
* \author Martin Schaller <martin.schaller@it-schaller.de>
* \author Philippe Colliot <philippe.colliot@mpsa.com>
*
* \version 1.1
*
* This Source Code Form is subject to the terms of the
* Mozilla Public License (MPL), v. 2.0.
* If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For further information see http://www.genivi.org/.
*
* List of changes:
* 2014-03-05, Philippe Colliot, migration to the new HMI design
* <date>, <name>, <description of change>
*
* @licence end@
*/
import QtQuick 2.1
import "Core"
import "Core/genivi.js" as Genivi;
import "Core/style-sheets/style-constants.js" as Constants;
import "Core/style-sheets/navigation-search-address-menu-css.js" as StyleSheet;
import lbs.plugin.dbusif 1.0
HMIMenu {
id: menu
property string pagefile:"NavigationSearchAddress"
property Item currentSelectionCriterionSignal;
property Item searchStatusSignal;
property Item searchResultListSignal;
property Item contentUpdatedSignal;
property real lat
property real lon
function loadWithAddress()
{
//load the field with saved values
if (Genivi.address[Genivi.NAVIGATIONCORE_COUNTRY] !== "")
{//need to test empty string
countryValue.text=Genivi.address[Genivi.NAVIGATIONCORE_COUNTRY];
accept(countryValue);
cityValue.disabled=false;
if (Genivi.address[Genivi.NAVIGATIONCORE_CITY] !== "")
{
cityValue.text=Genivi.address[Genivi.NAVIGATIONCORE_CITY];
accept(cityValue);
streetValue.disabled=false;
if (Genivi.address[Genivi.NAVIGATIONCORE_STREET] !== "")
{
streetValue.text=Genivi.address[Genivi.NAVIGATIONCORE_STREET];
accept(streetValue);
numberValue.disabled=false;
}
}
}
}
function currentSelectionCriterion(args)
{
Genivi.entrycriterion = args[1];
}
function searchStatus(args)
{
if (args[3] == Genivi.NAVIGATIONCORE_FINISHED)
{
Genivi.locationinput_message(dbusIf,"SelectEntry",["uint16",Genivi.entryselectedentry]);
}
}
function searchResultList(args)
{
}
function setContent(args)
{
countryValue.text="";
cityValue.text="";
streetValue.text="";
numberValue.text="";
for (var i=0 ; i < args.length ; i+=4) {
if (args[i+1] == Genivi.NAVIGATIONCORE_LATITUDE) lat=args[i+3][1];
if (args[i+1] == Genivi.NAVIGATIONCORE_LONGITUDE) lon=args[i+3][1];
if (args[i+1] == Genivi.NAVIGATIONCORE_COUNTRY) countryValue.text=args[i+3][1];
if (args[i+1] == Genivi.NAVIGATIONCORE_CITY) cityValue.text=args[i+3][1];
if (args[i+1] == Genivi.NAVIGATIONCORE_STREET) streetValue.text=args[i+3][1];
if (args[i+1] == Genivi.NAVIGATIONCORE_HOUSENUMBER) numberValue.text=args[i+3][1];
}
}
function setDisabled(args)
{
countryValue.disabled=true;
cityValue.disabled=true;
streetValue.disabled=true;
numberValue.disabled=true;
for (var i=0 ; i < args.length ; i++) {
if (args[i] == Genivi.NAVIGATIONCORE_COUNTRY) countryValue.disabled=false;
if (args[i] == Genivi.NAVIGATIONCORE_CITY) cityValue.disabled=false;
if (args[i] == Genivi.NAVIGATIONCORE_STREET) streetValue.disabled=false;
if (args[i] == Genivi.NAVIGATIONCORE_HOUSENUMBER) numberValue.disabled=false;
}
if (countryValue.disabled)
countryValue.text="";
if (cityValue.disabled)
cityValue.text="";
if (streetValue.disabled)
streetValue.text="";
if (numberValue.disabled)
numberValue.text="";
}
function setFocus()
{
var focus;
if (!countryValue.disabled)
focus=countryValue;
if (!cityValue.disabled)
focus=cityValue;
if (!streetValue.disabled)
focus=streetValue;
if (!numberValue.disabled)
focus=numberValue;
focus.takeFocus();
}
function contentUpdated(args)
{
if (args[3]) {
ok.disabled=false;
}
setDisabled(args[5]);
setContent(args[7]);
setFocus();
}
function connectSignals()
{
currentSelectionCriterionSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.LocationInput","CurrentSelectionCriterion",menu,"currentSelectionCriterion");
searchStatusSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.LocationInput","SearchStatus",menu,"searchStatus");
searchResultListSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.LocationInput","SearchResultList",menu,"searchResultList");
contentUpdatedSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.LocationInput","ContentUpdated",menu,"contentUpdated");
}
function disconnectSignals()
{
currentSelectionCriterionSignal.destroy();
searchStatusSignal.destroy();
searchResultListSignal.destroy();
contentUpdatedSignal.destroy();
}
function accept(what)
{
ok.disabled=true;
Genivi.locationinput_message(dbusIf,"SetSelectionCriterion",["uint16",what.criterion]);
Genivi.locationinput_message(dbusIf,"Search",["string",what.text,"uint16",10]);
}
function leave(toOtherMenu)
{
disconnectSignals();
if (toOtherMenu) {
Genivi.loc_handle_clear(dbusIf);
}
//Genivi.nav_session_clear(dbusIf);
}
DBusIf {
id: dbusIf
Component.onCompleted: {
connectSignals();
var res=Genivi.nav_message(dbusIf,"Session","GetVersion",[]);
if (res[0] != "error") {
res=Genivi.nav_session(dbusIf);
res=Genivi.loc_handle(dbusIf);
} else {
Genivi.dump("",res);
}
if (Genivi.entryselectedentry) {
Genivi.locationinput_message(dbusIf,"SelectEntry",["uint16",Genivi.entryselectedentry-1]);
}
if (Genivi.entrydest == 'countryValue')
{
accept(countryValue);
}
if (Genivi.entrydest == 'cityValue')
{
accept(cityValue);
}
if (Genivi.entrydest == 'streetValue')
{
accept(streetValue);
}
if (Genivi.entrydest == 'numberValue')
{
accept(numberValue);
}
Genivi.entrydest=null;
}
}
HMIBgImage {
image:StyleSheet.navigation_search_by_address_menu_background[Constants.SOURCE];
anchors { fill: parent; topMargin: parent.headlineHeight}
id: content
Text {
x:StyleSheet.countryTitle[Constants.X]; y:StyleSheet.countryTitle[Constants.Y]; width:StyleSheet.countryTitle[Constants.WIDTH]; height:StyleSheet.countryTitle[Constants.HEIGHT];color:StyleSheet.countryTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.countryTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.countryTitle[Constants.PIXELSIZE];
style: Text.Sunken;
smooth: true;
id: countryTitle
text: Genivi.gettext("Country");
}
EntryField {
x:StyleSheet.countryValue[Constants.X]; y:StyleSheet.countryValue[Constants.Y]; width: StyleSheet.countryValue[Constants.WIDTH]; height: StyleSheet.countryValue[Constants.HEIGHT];
id: countryValue
criterion: Genivi.NAVIGATIONCORE_COUNTRY
globaldata: 'countryValue'
textfocus: true
next: cityValue
prev: back
onLeave:{menu.leave(0)}
}
Text {
x:StyleSheet.streetTitle[Constants.X]; y:StyleSheet.streetTitle[Constants.Y]; width:StyleSheet.streetTitle[Constants.WIDTH]; height:StyleSheet.streetTitle[Constants.HEIGHT];color:StyleSheet.streetTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.streetTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.streetTitle[Constants.PIXELSIZE];
style: Text.Sunken;
smooth: true;
id:streetTitle
text: Genivi.gettext("Street");
}
EntryField {
x:StyleSheet.streetValue[Constants.X]; y:StyleSheet.streetValue[Constants.Y]; width: StyleSheet.streetValue[Constants.WIDTH]; height: StyleSheet.streetValue[Constants.HEIGHT];
id:streetValue
criterion: Genivi.NAVIGATIONCORE_STREET
globaldata: 'streetValue'
next: numberValue
prev: cityValue
disabled: true
onLeave:{menu.leave(0)}
}
Text {
x:StyleSheet.cityTitle[Constants.X]; y:StyleSheet.cityTitle[Constants.Y]; width:StyleSheet.cityTitle[Constants.WIDTH]; height:StyleSheet.cityTitle[Constants.HEIGHT];color:StyleSheet.cityTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.cityTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.cityTitle[Constants.PIXELSIZE];
style: Text.Sunken;
smooth: true;
id:cityTitle
text: Genivi.gettext("City");
}
EntryField {
x:StyleSheet.cityValue[Constants.X]; y:StyleSheet.cityValue[Constants.Y]; width: StyleSheet.cityValue[Constants.WIDTH]; height: StyleSheet.cityValue[Constants.HEIGHT];
id:cityValue
criterion: Genivi.NAVIGATIONCORE_CITY
globaldata: 'cityValue'
next:streetValue
prev:countryValue
disabled: true
onLeave:{menu.leave(0)}
}
Text {
x:StyleSheet.numberTitle[Constants.X]; y:StyleSheet.numberTitle[Constants.Y]; width:StyleSheet.numberTitle[Constants.WIDTH]; height:StyleSheet.numberTitle[Constants.HEIGHT];color:StyleSheet.numberTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.numberTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.numberTitle[Constants.PIXELSIZE];
style: Text.Sunken;
smooth: true;
id:numberTitle
text: Genivi.gettext("Number");
}
EntryField {
x:StyleSheet.numberValue[Constants.X]; y:StyleSheet.numberValue[Constants.Y]; width: StyleSheet.numberValue[Constants.WIDTH]; height: StyleSheet.numberValue[Constants.HEIGHT];
id:numberValue
criterion: Genivi.NAVIGATIONCORE_HOUSENUMBER
globaldata: 'numberValue'
next: ok
prev: streetValue
disabled: true
onLeave:{menu.leave(0)}
}
StdButton { source:StyleSheet.ok[Constants.SOURCE]; x:StyleSheet.ok[Constants.X]; y:StyleSheet.ok[Constants.Y]; width:StyleSheet.ok[Constants.WIDTH]; height:StyleSheet.ok[Constants.HEIGHT];textColor:StyleSheet.okText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.okText[Constants.PIXELSIZE];
id:ok
next:back
prev:numberValue
text:Genivi.gettext("Ok")
disabled: true
onClicked:{
leave(1);
//save address for next time
Genivi.address[Genivi.NAVIGATIONCORE_COUNTRY]=countryValue.text;
Genivi.address[Genivi.NAVIGATIONCORE_CITY]=cityValue.text;
Genivi.address[Genivi.NAVIGATIONCORE_STREET]=streetValue.text;
Genivi.address[Genivi.NAVIGATIONCORE_HOUSENUMBER]=numberValue.text;
Genivi.data['lat']=menu.lat;
Genivi.data['lon']=menu.lon;
Genivi.data['description']=countryValue.text;
if (!cityValue.disabled)
Genivi.data['description']+=' '+cityValue.text;
if (!streetValue.disabled)
Genivi.data['description']+=' '+streetValue.text;
if (!numberValue.disabled)
Genivi.data['description']+=' '+numberValue.text;
//save entered location into the history
Genivi.updateHistoryOfLastEnteredLocation(Genivi.data['description'],Genivi.data['lat'],Genivi.data['lon']);
routeMenu();
}
}
StdButton { source:StyleSheet.back[Constants.SOURCE]; x:StyleSheet.back[Constants.X]; y:StyleSheet.back[Constants.Y]; width:StyleSheet.back[Constants.WIDTH]; height:StyleSheet.back[Constants.HEIGHT];textColor:StyleSheet.backText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.backText[Constants.PIXELSIZE];
id:back; text: Genivi.gettext("Back"); explode:false; next:countryValue; prev:ok;
onClicked:{leave(1); leaveMenu();}
}
}
Component.onCompleted: {
if (Genivi.preloadMode==true)
{
Genivi.preloadMode=false;
loadWithAddress();
}
}
}
|