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
|
/**
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
*
* \file Entry.qml
*
* \brief This file is part of the navigation hmi.
*
* \author Martin Schaller <martin.schaller@it-schaller.de>
*
* \version
*
* 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:
* <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 lbs.plugin.dbusif 1.0
HMIMenu {
id: menu
color: Constants.MENU_BACKGROUND_COLOR
//property Item currentSelectionCriterionSignal;
property Item searchStatusSignal;
property Item searchResultListSignal;
//property Item contentUpdatedSignal;
property real criterion;
DBusIf {
id:dbusIf
}
function searchStatus(args)
{
if (args[3] == Genivi.NAVIGATIONCORE_SEARCHING) {
viewListAddress.model.clear();
viewListPOI.model.clear();
text.color='red'; //(Searching)
} else
text.color='white';
}
function searchResultListAddress(args)
{
var model=viewListAddress.model;
if (args[4] == "uint16" && args[8] == "array") {
var offset=args[5];
var array=args[9];
for (var i=0 ; i < array.length ; i+=2) {
if (array[i] == "map") {
var map=array[i+1];
for (var j = 0 ; j < map.length ; j+=4) {
if (map[j] == "uint16" && map[j+1] == criterion) {
if (map[j+2] == "variant") {
var variant=map[j+3];
if (variant[0] == "string") {
model.append({"name":variant[1],"number":(i/2)+offset+1});
}
}
}
}
}
}
} else {
console.log("Unexpected result from SearchResultList:");
Genivi.dump("",args);
}
}
function search(input)
{
Genivi.locationinput_message(dbusIf,"Search",["string",input,"uint16",10]);
}
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,"searchResultListAddress");
//contentUpdatedSignal=dbusIf.connect("","/org/genivi/navigationcore","org.genivi.navigationcore.LocationInput","ContentUpdated",menu,"contentUpdated");
}
function disconnectSignals()
{
//currentSelectionCriterionSignal.destroy();
searchStatusSignal.destroy();
searchResultListSignal.destroy();
//contentUpdatedSignal.destroy();
}
Keys.onPressed: {
if (event.text) {
if (event.text == '\b') {
if (text.text.length) {
text.text=text.text.slice(0,-1);
}
} else {
text.text+=event.text;
}
search(event.text);
}
}
Column {
id:content
anchors { fill: parent; topMargin: menu.hspc/2 }
Row {
id:textrow
spacing:menu.hspc/4;
anchors.topMargin: 100;
Rectangle {
color:'black';
width:content.width-back.width-menu.hspc/4-menu.hspc/8;
height:back.height;
Text {
anchors.fill:parent;
id: text
font.pixelSize: 40;
color: "white"; smooth: true
focus: true
}
}
/*
StdButton { id:ok; text: "Ok"; onClicked: {
Genivi.data[Genivi.entrydest]=text.text;
disconnectSignals();
pageOpen(Genivi.entryback);
} next:back; prev:view}
*/
StdButton { id:back; text: "Back"; onClicked: {
disconnectSignals();
Genivi.entrycancel=true;
Genivi.preloadMode=true;
pageOpen(Genivi.entryback);
} next:viewListAddress; prev:keyboard}
}
Component {
id: listDelegateAddress
Text {
property real index:number;
width: 180;
height: 20;
id:text;
text: name;
font.pixelSize: 20;
style: Text.Sunken;
color: "white";
styleColor: "black";
smooth: true
}
}
Column {
width:parent.width/2;
height:parent.height-keyboard.height-textrow.height;
HMIList {
id:viewListAddress
property real selectedEntry
height:parent.height;
width:parent.width;
delegate: listDelegateAddress
next:keyboard
prev:back
onSelected:{
Genivi.entrydest=null;
disconnectSignals();
Genivi.entryselectedentry=what.index;
pageOpen(Genivi.entryback);
}
}
}
Component {
id: listDelegatePOI
Text {
property real index:number;
width: 180;
height: 20;
id:text;
text: name;
font.pixelSize: 20;
style: Text.Sunken;
color: "white";
styleColor: "black";
smooth: true
}
}
Column {
HMIList {
id:viewListPOI
property real selectedEntry
height:parent.height-keyboard.height-textrow.height;
width:parent.width/2;
delegate: listDelegatePOI
next:keyboard
prev:viewListAddress
onSelected:{
Genivi.entrydest=null;
disconnectSignals();
Genivi.entryselectedentry=what.index;
pageOpen(Genivi.entryback);
}
}
}
Keyboard {
id: keyboard
height: 200;
width: menu.width;
destination: text;
firstLayout: "ABC";
secondLayout: "abc";
next: back;
prev: viewListAddress;
onKeypress: { search(what); }
}
}
Component.onCompleted: {
viewListAddress.forceActiveFocus();
if (Genivi.entrycriterion) {
criterion=Genivi.entrycriterion;
Genivi.entrycriterion=0;
Genivi.locationinput_message(dbusIf,"SetSelectionCriterion",["uint16",criterion]);
}
connectSignals();
}
}
|