diff options
-rw-r--r-- | src/hmi/qml/Core/NavigationAppEntryField.qml | 6 | ||||
-rw-r--r-- | src/hmi/qml/Core/NavigationAppHMIList.qml | 120 | ||||
-rw-r--r-- | src/hmi/qml/Core/NavigationAppKeyboard.qml | 231 | ||||
-rw-r--r-- | src/hmi/qml/Core/gimp/draft-theme/800x480/NavigationAppSearch.xcf | bin | 251362 -> 268774 bytes | |||
-rw-r--r-- | src/hmi/qml/Core/translations/deu_DEU.js | 1 | ||||
-rw-r--r-- | src/hmi/qml/Core/translations/eng_USA.js | 1 | ||||
-rw-r--r-- | src/hmi/qml/Core/translations/fra_FRA.js | 1 | ||||
-rw-r--r-- | src/hmi/qml/Core/translations/jpn_JPN.js | 1 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppEntry.qml | 214 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppSearch.qml | 234 | ||||
-rw-r--r-- | test/.gitignore | 3 |
11 files changed, 556 insertions, 256 deletions
diff --git a/src/hmi/qml/Core/NavigationAppEntryField.qml b/src/hmi/qml/Core/NavigationAppEntryField.qml index 589b514..1216268 100644 --- a/src/hmi/qml/Core/NavigationAppEntryField.qml +++ b/src/hmi/qml/Core/NavigationAppEntryField.qml @@ -55,9 +55,11 @@ Column { Genivi.entrydest=globaldata; Genivi.entrycriterion=criterion; if (criterion && criterion != Genivi.NAVIGATIONCORE_FULL_ADDRESS) { - entryMenu("Entry",menu); + keyboardActivated = true; + keyboardArea.destination = this; + input.text = ""; } else { - entryMenu("EntryFreeText",menu); + //to do } } diff --git a/src/hmi/qml/Core/NavigationAppHMIList.qml b/src/hmi/qml/Core/NavigationAppHMIList.qml new file mode 100644 index 0000000..30c21a8 --- /dev/null +++ b/src/hmi/qml/Core/NavigationAppHMIList.qml @@ -0,0 +1,120 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* +* \file HMIList.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 + +Rectangle { + id:rectangle + property alias delegate: view.delegate + property alias model: view.model + property alias next: view.next + property alias prev: view.prev + signal selected(variant what) + color: "#141414" + + function takeFocus(dir) { + view.takeFocus(dir); + } + + ListView { + id:view + property Item prev + property Item next + property Item prevsave + property Item nextsave + highlightFollowsCurrentItem:false + property bool hasFocus:false + // interactive:false + signal mclicked() + anchors.fill: parent + model: ListModel{} + highlight: Rectangle { color: "lightsteelblue"; radius: 5 } + clip: true + + onMclicked: { + rectangle.selected(view.currentItem); + } + MouseArea { + anchors.fill: parent + onPressed: { + view.highlightFollowsCurrentItem=true; + view.currentIndex=view.indexAt(view.contentX+mouse.x,view.contentY+mouse.y); + } + onCanceled: { + view.currentIndex=-1; + } + onClicked: { + view.currentIndex=view.indexAt(view.contentX+mouse.x,view.contentY+mouse.y); + rectangle.selected(view.currentItem); + } + } + function takeFocus(dir) { + var max=view.model.count-1; + if (!hasFocus) { + forceActiveFocus(); + hasFocus=true; + nextsave=next; + prevsave=prev; + next=view; + prev=view; + highlightFollowsCurrentItem=true; + if (dir > 0) { + view.positionViewAtBeginning(); + currentIndex=0; + } else { + view.positionViewAtEnd(); + currentIndex=max; + } + return; + } + prev=view; + next=view; + if (dir > 0) { + if (currentIndex < max) { + currentIndex++; + return; + } + } else { + if (currentIndex > 0) { + currentIndex--; + return; + } + } + hasFocus=false; + highlightFollowsCurrentItem=false; + next=nextsave; + prev=prevsave; + if (dir > 0) + menu.focus_next(); + else + menu.focus_prev(); + } + + function giveFocus() { + currentIndex=-1; + } + } +} + diff --git a/src/hmi/qml/Core/NavigationAppKeyboard.qml b/src/hmi/qml/Core/NavigationAppKeyboard.qml new file mode 100644 index 0000000..59b7826 --- /dev/null +++ b/src/hmi/qml/Core/NavigationAppKeyboard.qml @@ -0,0 +1,231 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* +* \file Keyboard.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 + +Item { + id: keyboard; + property real wspc: keyboard.width/80; + property real hspc: keyboard.height/20; + property real w: (keyboard.width-wspc*7)/8+0.5; + property real h: keyboard.height/5 + property Item destination; + property Item layout; + property string firstLayout; + property string secondLayout: null; + property Item next; + property Item prev; + property string activekeys; + property bool activekeys_enabled; + property string shiftlevel; + signal keypress(string what); + + function takeFocus(dir) { + if (dir > 0) { + key1.forceActiveFocus(); + } else { + key32.forceActiveFocus(); + } + } + + function keytext(what) + { + if (what == '␣') { + return ' '; + } + if (what == '←') { + return '\b'; + } + return what; + } + + function append(what) { + what=keytext(what); + if (what.length > 1) { + shift(what); + return; + } + if (secondLayout && !destination.text.length) { + shift(secondLayout); + } + keypress(what); + if (what == '\b') { + backspace(); + } else { + destination.text+=what; + } + } + + function backspace() { + if (destination.text.length) { + destination.text=destination.text.slice(0,-1); + if (secondLayout && !destination.text.length) { + shift(firstLayout); + } + } + } + + function set(id,text) + { + id.text=text; + var stext=keytext(text.toLowerCase()); + var disabled=true; + if (text.length) { + if (!activekeys_enabled || text.length > 1 || activekeys.indexOf(stext) != -1) + disabled=false; + if (stext == '\b' && !destination.text.length) + disabled=true; + } + id.disabled=disabled; + } + + function setactivekeys(keys,enabled) + { + activekeys=keys.toLowerCase(); + activekeys_enabled=enabled; + shift(shiftlevel); + } + + function shift(what) { + shiftlevel=what; + secondLayout=""; + var layouts={ + 'ABC':['A','B','C','D','E','F','G','H', + 'I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X', + 'Y','Z','␣','','abc','123','ÄÖÜ','←', + ], + 'abc':['a','b','c','d','e','f','g','h', + 'i','j','k','l','m','n','o','p', + 'q','r','s','t','u','v','w','x', + 'y','z','␣','','ABC','123','äöü','←', + ], + 'ÄÖÜ':['Ä','Ö','Ü','ß','','','','', + '','','','','','','','', + '','','','','','','','', + '','','','','ABC','123','äöü','←', + ], + 'äöü':['ä','ö','ü','ß','','','','', + '','','','','','','','', + '','','','','','','','', + '','','','','abc','123','ÄÖÜ','←', + ], + '123':['0','1','2','3','4','5','6','7', + '8','9','-','.',',','','','', + '','','','','','','','', + '','','','','','ABC','abc','←', + ], + }; + var l=layouts[what]; + set(key1,l[0]); + set(key2,l[1]); + set(key3,l[2]); + set(key4,l[3]); + set(key5,l[4]); + set(key6,l[5]); + set(key7,l[6]); + set(key8,l[7]); + set(key9,l[8]); + set(key10,l[9]); + set(key11,l[10]); + set(key12,l[11]); + set(key13,l[12]); + set(key14,l[13]); + set(key15,l[14]); + set(key16,l[15]); + set(key17,l[16]); + set(key18,l[17]); + set(key19,l[18]); + set(key20,l[19]); + set(key21,l[20]); + set(key22,l[21]); + set(key23,l[22]); + set(key24,l[23]); + set(key25,l[24]); + set(key26,l[25]); + set(key27,l[26]); + set(key28,l[27]); + set(key29,l[28]); + set(key30,l[29]); + set(key31,l[30]); + set(key32,l[31]); + } + + Component.onCompleted: { + if (destination.text.length && secondLayout) { + shift(secondLayout); + } else { + shift(firstLayout); + } + } + + Column { + spacing:keyboard.hspc + Row { + spacing:keyboard.wspc + KButton { id:key1; next:key2; prev:keyboard.prev } + KButton { id:key2; next:key3; prev:key1 } + KButton { id:key3; next:key4; prev:key2 } + KButton { id:key4; next:key5; prev:key3 } + KButton { id:key5; next:key6; prev:key4 } + KButton { id:key6; next:key7; prev:key5 } + KButton { id:key7; next:key8; prev:key6 } + KButton { id:key8; next:key9; prev:key7 } + } + Row { + spacing:keyboard.wspc + KButton { id:key9; next:key10; prev:key8 } + KButton { id:key10; next:key11; prev:key9 } + KButton { id:key11; next:key12; prev:key10 } + KButton { id:key12; next:key13; prev:key11 } + KButton { id:key13; next:key14; prev:key12 } + KButton { id:key14; next:key15; prev:key13 } + KButton { id:key15; next:key16; prev:key14 } + KButton { id:key16; next:key17; prev:key15 } + } + Row { + spacing:keyboard.wspc + KButton { id:key17; next:key18; prev:key16 } + KButton { id:key18; next:key19; prev:key17 } + KButton { id:key19; next:key20; prev:key18 } + KButton { id:key20; next:key21; prev:key19 } + KButton { id:key21; next:key22; prev:key20 } + KButton { id:key22; next:key23; prev:key21 } + KButton { id:key23; next:key24; prev:key22 } + KButton { id:key24; next:key25; prev:key23 } + } + Row { + spacing:keyboard.wspc + KButton { id:key25; next:key26; prev:key24 } + KButton { id:key26; next:key27; prev:key25 } + KButton { id:key27; next:key28; prev:key26 } + KButton { id:key28; next:key29; prev:key27 } + KButton { id:key29; next:key30; prev:key28 } + KButton { id:key30; next:key31; prev:key29 } + KButton { id:key31; next:key32; prev:key30 } + KButton { id:key32; next:keyboard.next; prev:key31 } + } + } +} diff --git a/src/hmi/qml/Core/gimp/draft-theme/800x480/NavigationAppSearch.xcf b/src/hmi/qml/Core/gimp/draft-theme/800x480/NavigationAppSearch.xcf Binary files differindex 5aaed43..9d5844c 100644 --- a/src/hmi/qml/Core/gimp/draft-theme/800x480/NavigationAppSearch.xcf +++ b/src/hmi/qml/Core/gimp/draft-theme/800x480/NavigationAppSearch.xcf diff --git a/src/hmi/qml/Core/translations/deu_DEU.js b/src/hmi/qml/Core/translations/deu_DEU.js index ea46bc3..d5d8ddf 100644 --- a/src/hmi/qml/Core/translations/deu_DEU.js +++ b/src/hmi/qml/Core/translations/deu_DEU.js @@ -161,5 +161,6 @@ translations["On"]="ON"; translations["Off"]="OFF"; translations["Back"]="BACK"; translations["Menu"]="MENU"; +translations["Cancel"]="CANCEL"; translations["Quit"]="QUIT"; diff --git a/src/hmi/qml/Core/translations/eng_USA.js b/src/hmi/qml/Core/translations/eng_USA.js index ab56c5e..c0b41a6 100644 --- a/src/hmi/qml/Core/translations/eng_USA.js +++ b/src/hmi/qml/Core/translations/eng_USA.js @@ -161,5 +161,6 @@ translations["On"]="ON"; translations["Off"]="OFF"; translations["Back"]="BACK"; translations["Menu"]="MENU"; +translations["Cancel"]="CANCEL"; translations["Quit"]="QUIT"; diff --git a/src/hmi/qml/Core/translations/fra_FRA.js b/src/hmi/qml/Core/translations/fra_FRA.js index d227816..6c7e7d7 100644 --- a/src/hmi/qml/Core/translations/fra_FRA.js +++ b/src/hmi/qml/Core/translations/fra_FRA.js @@ -162,5 +162,6 @@ translations["On"]="ON"; translations["Off"]="OFF"; translations["Back"]="RETOUR"; translations["Menu"]="MENU"; +translations["Cancel"]="ANNUL"; translations["Quit"]="QUITTER"; diff --git a/src/hmi/qml/Core/translations/jpn_JPN.js b/src/hmi/qml/Core/translations/jpn_JPN.js index ef55f84..d669411 100644 --- a/src/hmi/qml/Core/translations/jpn_JPN.js +++ b/src/hmi/qml/Core/translations/jpn_JPN.js @@ -161,6 +161,7 @@ translations["On"]="ON"; translations["Off"]="OFF"; translations["Back"]="BACK"; translations["Menu"]="MENU"; +translations["Cancel"]="キャンセル"; translations["Quit"]="QUIT"; diff --git a/src/hmi/qml/NavigationAppEntry.qml b/src/hmi/qml/NavigationAppEntry.qml deleted file mode 100644 index 885aa4a..0000000 --- a/src/hmi/qml/NavigationAppEntry.qml +++ /dev/null @@ -1,214 +0,0 @@ -/** -* @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 - property string pagefile:"Entry" - - color: Constants.MENU_BACKGROUND_COLOR - - //property Item currentSelectionCriterionSignal; - property Item searchStatusSignal; - property Item searchResultListSignal; - //property Item contentUpdatedSignal; - property Item spellResultSignal; - property real criterion; - property string extraspell; - - DBusIf { - id:dbusIf - } - - function searchStatus(args) - { //locationInputHandle 1, statusValue 3 - Genivi.hookSignal("searchStatus"); - var statusValue=args[3]; - if (statusValue == Genivi.NAVIGATIONCORE_SEARCHING) { - view.model.clear(); - text.color='red'; //(Searching) - } else { - if (statusValue == Genivi.NAVIGATIONCORE_FINISHED) - { - text.color='white'; - Genivi.locationinput_RequestListUpdate(dbusIf,0,10); - } - } - } - - function searchResultList(args) - {//locationInputHandle 1, totalSize 3, windowOffset 5, windowSize 7, resultListWindow 9 - Genivi.hookSignal("searchResultList"); - var model=view.model; - var windowOffset=args[5]; - var resultListWindow=args[9]; - var offset=args[5]; - var array=args[9]; - for (var i=0 ; i < resultListWindow.length ; i+=2) { - for (var j = 0 ; j < resultListWindow[i+1].length ; j+=4) { - if (resultListWindow[i+1][j+1] == criterion) { - model.append({"name":resultListWindow[i+1][j+3][3][1],"number":(i/2)+windowOffset+1}); - } - } - } - } - - function spellResult(args) - {//locationInputHandle 1, uniqueString 3, validCharacters 5, fullMatch 7 - Genivi.hookSignal("spellResult"); - var uniqueString=args[3]; - var validCharacters=args[5]; - if (text.text.length < uniqueString.length) { - extraspell=uniqueString.substr(text.text.length); - text.text=uniqueString; - } - keyboard.setactivekeys('\b'+validCharacters,true); - } - - function spell(input) - { - input=extraspell+input; - extraspell=''; - Genivi.locationinput_Spell(dbusIf,input,10); - } - - function connectSignals() - { - searchStatusSignal=Genivi.connect_searchStatusSignal(dbusIf,menu); - searchResultListSignal=Genivi.connect_searchResultListSignal(dbusIf,menu); - spellResultSignal=Genivi.connect_spellResultSignal(dbusIf,menu); - } - - function disconnectSignals() - { - searchStatusSignal.destroy(); - searchResultListSignal.destroy(); - spellResultSignal.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; - } - spell(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:back; text: "Back"; onClicked: { - disconnectSignals(); - Genivi.entrycancel=true; - Genivi.preloadMode=true; - leaveMenu(); - } next:view; prev:keyboard} - } - - Component { - id: listDelegate - 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 - } - } - - HMIList { - property real selectedEntry - height:parent.height-keyboard.height-textrow.height; - width:parent.width; - id:view - delegate: listDelegate - next:keyboard - prev:back - onSelected:{ - Genivi.entrydest=null; - disconnectSignals(); - Genivi.entryselectedentry=what.index; - leaveMenu(); - } - } - - Keyboard { - id: keyboard - height: 200; - width: menu.width; - destination: text; - firstLayout: "ABC"; - secondLayout: "abc"; - next: back; - prev: view; - onKeypress: { spell(what); } - } - } - Component.onCompleted: { - view.forceActiveFocus(); - if (Genivi.entrycriterion) { - criterion=Genivi.entrycriterion; - Genivi.entrycriterion=0; - Genivi.locationinput_SetSelectionCriterion(dbusIf,criterion); - } - extraspell=''; - if(criterion != Genivi.NAVIGATIONCORE_STREET) - { - spell(''); - } - - connectSignals(); - } -} diff --git a/src/hmi/qml/NavigationAppSearch.qml b/src/hmi/qml/NavigationAppSearch.qml index 15827fe..dad5e09 100644 --- a/src/hmi/qml/NavigationAppSearch.qml +++ b/src/hmi/qml/NavigationAppSearch.qml @@ -34,6 +34,8 @@ import lbs.plugin.dbusif 1.0 NavigationAppHMIMenu { id: menu property string pagefile:"NavigationAppSearch" + + // signals property Item currentSelectionCriterionSignal; property Item searchStatusSignal; property Item searchResultListSignal; @@ -42,10 +44,15 @@ NavigationAppHMIMenu { property Item routeCalculationSuccessfulSignal; property Item routeCalculationFailedSignal; property Item routeCalculationProgressUpdateSignal; + property Item spellResultSignal; + + property real criterion; + property string extraspell; property string routeText:" " property real lat property real lon property bool vehicleLocated + property bool keyboardActivated function loadWithCountry() { @@ -82,11 +89,12 @@ NavigationAppHMIMenu { } } } - if ((oklat == 1) && (oklong == 1) && Genivi.data['destination']) { + if ((oklat == 1) && (oklong == 1)) { vehicleLocated=true; } else { vehicleLocated=false; } + console.log(vehicleLocated); } function mapmatchedpositionPositionUpdate(args) @@ -168,56 +176,94 @@ NavigationAppHMIMenu { function searchStatus(args) { //locationInputHandle 1, statusValue 3 - Genivi.hookSignal("searchStatus"); - var statusValue=args[3]; - if (statusValue === Genivi.NAVIGATIONCORE_FINISHED) + if (keyboardActivated === true) { - Genivi.locationinput_SelectEntry(dbusIf,Genivi.entryselectedentry); - if (Genivi.preloadMode === true) - { - if (Genivi.entrycriterion === countryValue.criterion) + Genivi.hookSignal("searchStatus"); + var statusValue=args[3]; + if (statusValue == Genivi.NAVIGATIONCORE_SEARCHING) { + listArea.model.clear(); + //keyboardArea.destination.color='red'; //(Searching) + } else { + if (statusValue == Genivi.NAVIGATIONCORE_FINISHED) { - if (Genivi.address[Genivi.NAVIGATIONCORE_CITY] !== "") - { - cityValue.text=Genivi.address[Genivi.NAVIGATIONCORE_CITY]; - accept(cityValue); - streetValue.disabled=false; - } - else - Genivi.preloadMode=false; + //keyboardArea.destination.color='white'; + Genivi.locationinput_RequestListUpdate(dbusIf,0,10); } - else + } + } + else + { + Genivi.hookSignal("searchStatus"); + var statusValue=args[3]; + if (statusValue === Genivi.NAVIGATIONCORE_FINISHED) + { + Genivi.locationinput_SelectEntry(dbusIf,Genivi.entryselectedentry); + if (Genivi.preloadMode === true) { - if (Genivi.entrycriterion === cityValue.criterion) + if (Genivi.entrycriterion === countryValue.criterion) { - if (Genivi.address[Genivi.NAVIGATIONCORE_STREET] !== "") + if (Genivi.address[Genivi.NAVIGATIONCORE_CITY] !== "") { - streetValue.text=Genivi.address[Genivi.NAVIGATIONCORE_STREET]; - accept(streetValue); - numberValue.disabled=false; + cityValue.text=Genivi.address[Genivi.NAVIGATIONCORE_CITY]; + accept(cityValue); + streetValue.disabled=false; } - + else + Genivi.preloadMode=false; } else { - if (Genivi.entrycriterion === streetValue.criterion) + if (Genivi.entrycriterion === cityValue.criterion) { - Genivi.preloadMode=false; + if (Genivi.address[Genivi.NAVIGATIONCORE_STREET] !== "") + { + streetValue.text=Genivi.address[Genivi.NAVIGATIONCORE_STREET]; + accept(streetValue); + numberValue.disabled=false; + } + } else { - Genivi.preloadMode=false; - console.log("Error when load a preloaded address"); + if (Genivi.entrycriterion === streetValue.criterion) + { + Genivi.preloadMode=false; + } + else + { + Genivi.preloadMode=false; + console.log("Error when load a preloaded address"); + } } } } } } + } function searchResultList(args) { - Genivi.hookSignal("searchResultList"); + if (keyboardActivated === true) + { + Genivi.hookSignal("searchResultList"); + var model=listArea.model; + var windowOffset=args[5]; + var resultListWindow=args[9]; + var offset=args[5]; + var array=args[9]; + for (var i=0 ; i < resultListWindow.length ; i+=2) { + for (var j = 0 ; j < resultListWindow[i+1].length ; j+=4) { + if (resultListWindow[i+1][j+1] == criterion) { + model.append({"name":resultListWindow[i+1][j+3][3][1],"number":(i/2)+windowOffset+1}); + } + } + } + } + else + { + Genivi.hookSignal("searchResultList"); + } } function contentUpdated(args) @@ -282,6 +328,40 @@ NavigationAppHMIMenu { focus.takeFocus(); } + function spellResult(args) + {//locationInputHandle 1, uniqueString 3, validCharacters 5, fullMatch 7 + Genivi.hookSignal("spellResult"); + var uniqueString=args[3]; + var validCharacters=args[5]; + if (textItem.text.length < uniqueString.length) { + extraspell=uniqueString.substr(textItem.text.length); + textItem.text=uniqueString; + } + keyboardArea.setactivekeys('\b'+validCharacters,true); + } + + function spell(input) + { + input=extraspell+input; + extraspell=''; + Genivi.locationinput_Spell(dbusIf,input,10); + } + + function initKeyboard() + { + listArea.forceActiveFocus(); + if (Genivi.entrycriterion) { + criterion=Genivi.entrycriterion; + Genivi.entrycriterion=0; + Genivi.locationinput_SetSelectionCriterion(dbusIf,criterion); + } + extraspell=''; + if(criterion != Genivi.NAVIGATIONCORE_STREET) + { + spell(''); + } + } + function connectSignals() { currentSelectionCriterionSignal=Genivi.connect_currentSelectionCriterionSignal(dbusIf,menu); @@ -292,6 +372,9 @@ NavigationAppHMIMenu { routeCalculationSuccessfulSignal=Genivi.connect_routeCalculationSuccessfulSignal(dbusIf,menu); routeCalculationFailedSignal=Genivi.connect_routeCalculationFailedSignal(dbusIf,menu); routeCalculationProgressUpdateSignal=Genivi.connect_routeCalculationProgressUpdateSignal(dbusIf,menu); + searchStatusSignal=Genivi.connect_searchStatusSignal(dbusIf,menu); + searchResultListSignal=Genivi.connect_searchResultListSignal(dbusIf,menu); + spellResultSignal=Genivi.connect_spellResultSignal(dbusIf,menu); } function disconnectSignals() @@ -304,6 +387,9 @@ NavigationAppHMIMenu { routeCalculationSuccessfulSignal.destroy(); routeCalculationFailedSignal.destroy(); routeCalculationProgressUpdateSignal.destroy(); + searchStatusSignal.destroy(); + searchResultListSignal.destroy(); + spellResultSignal.destroy(); } function accept(what) @@ -322,6 +408,19 @@ NavigationAppHMIMenu { //Genivi.navigationcore_session_clear(dbusIf); } + 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; + } + spell(event.text); + } + } + DBusIf { id: dbusIf } @@ -343,7 +442,8 @@ NavigationAppHMIMenu { source:StyleSheet.countryKeyboard[Constants.SOURCE]; x:StyleSheet.countryKeyboard[Constants.X]; y:StyleSheet.countryKeyboard[Constants.Y]; width:StyleSheet.countryKeyboard[Constants.WIDTH]; height:StyleSheet.countryKeyboard[Constants.HEIGHT]; id:countryKeyboard; disabled:false; next:cityKeyboard; prev:back; explode:false; onClicked: { - countryValue.callEntry() + countryValue.callEntry(); + initKeyboard(); } } NavigationAppEntryField { @@ -367,7 +467,8 @@ NavigationAppHMIMenu { source:StyleSheet.cityKeyboard[Constants.SOURCE]; x:StyleSheet.cityKeyboard[Constants.X]; y:StyleSheet.cityKeyboard[Constants.Y]; width:StyleSheet.cityKeyboard[Constants.WIDTH]; height:StyleSheet.cityKeyboard[Constants.HEIGHT]; id:cityKeyboard; disabled:false; next:streetKeyboard; prev:countryKeyboard; explode:false; onClicked: { - cityValue.callEntry() + cityValue.callEntry(); + initKeyboard(); } } NavigationAppEntryField { @@ -391,7 +492,8 @@ NavigationAppHMIMenu { source:StyleSheet.streetKeyboard[Constants.SOURCE]; x:StyleSheet.streetKeyboard[Constants.X]; y:StyleSheet.streetKeyboard[Constants.Y]; width:StyleSheet.streetKeyboard[Constants.WIDTH]; height:StyleSheet.streetKeyboard[Constants.HEIGHT]; id:streetKeyboard; disabled:false; next:numberKeyboard; prev:cityKeyboard; explode:false; onClicked: { - streetValue.callEntry() + streetValue.callEntry(); + initKeyboard(); } } NavigationAppEntryField { @@ -415,7 +517,8 @@ NavigationAppHMIMenu { source:StyleSheet.numberKeyboard[Constants.SOURCE]; x:StyleSheet.numberKeyboard[Constants.X]; y:StyleSheet.numberKeyboard[Constants.Y]; width:StyleSheet.numberKeyboard[Constants.WIDTH]; height:StyleSheet.numberKeyboard[Constants.HEIGHT]; id:numberKeyboard; disabled:false; next:back; prev:streetKeyboard; explode:false; onClicked: { - numberValue.callEntry() + numberValue.callEntry(); + initKeyboard(); } } NavigationAppEntryField { @@ -488,7 +591,6 @@ NavigationAppHMIMenu { text: "" visible: (Genivi.route_calculated); } - StdButton { source:StyleSheet.show_route_on_map[Constants.SOURCE]; x:StyleSheet.show_route_on_map[Constants.X]; y:StyleSheet.show_route_on_map[Constants.Y]; width:StyleSheet.show_route_on_map[Constants.WIDTH]; height:StyleSheet.show_route_on_map[Constants.HEIGHT]; id: show_route_on_map @@ -511,7 +613,6 @@ NavigationAppHMIMenu { entryMenu("NavigationRouteDescription",menu); } } - StdButton { source:StyleSheet.guidance_start[Constants.SOURCE]; x:StyleSheet.guidance_start[Constants.X]; y:StyleSheet.guidance_start[Constants.Y]; width:StyleSheet.guidance_start[Constants.WIDTH]; height:StyleSheet.guidance_start[Constants.HEIGHT];textColor:StyleSheet.startText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.startText[Constants.PIXELSIZE]; id:guidance_start; text: Genivi.gettext("On");explode:false; disabled:true; next:guidance_stop; prev:show_route_on_map @@ -536,6 +637,53 @@ NavigationAppHMIMenu { } } + // enter a location by the keyboard menu + // keyboard + NavigationAppKeyboard { + x:StyleSheet.keyboardArea[Constants.X]; y:StyleSheet.keyboardArea[Constants.Y]; width:StyleSheet.keyboardArea[Constants.WIDTH]; height:StyleSheet.keyboardArea[Constants.HEIGHT]; + id: keyboardArea; + visible: (keyboardActivated); + destination: countryValue; // by default + firstLayout: "ABC"; + secondLayout: "abc"; + next: listArea; + prev: numberKeyboard; + onKeypress: { spell(what); } + } + + // list of items + Component { + id: listDelegate + Text { + property real index:number; + width:StyleSheet.list_delegate[Constants.WIDTH]; height:StyleSheet.list_delegate[Constants.HEIGHT];color:StyleSheet.list_delegate[Constants.TEXTCOLOR];styleColor:StyleSheet.list_delegate[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.list_delegate[Constants.PIXELSIZE]; + id:textItem; + text: name; + style: Text.Sunken; + smooth: true + } + } + + NavigationAppHMIList { + property real selectedEntry + x:StyleSheet.listArea[Constants.X]; y:StyleSheet.listArea[Constants.Y]; width:StyleSheet.listArea[Constants.WIDTH]; height:StyleSheet.listArea[Constants.HEIGHT]; + id:listArea + visible: (keyboardActivated); + delegate: listDelegate + next:cancel + prev:keyboardArea + onSelected:{ + Genivi.entrydest=null; + Genivi.entryselectedentry=what.index; + // Set value of corresponding field and hide keyboard and list + Genivi.locationinput_SelectEntry(dbusIf,Genivi.entryselectedentry-1); + keyboardActivated = false; + keyboardArea.visible = false; + listArea.visible = false; + } + } + + // bottom banner StdButton { source:StyleSheet.calculate_curr[Constants.SOURCE]; x:StyleSheet.calculate_curr[Constants.X]; y:StyleSheet.calculate_curr[Constants.Y]; width:StyleSheet.calculate_curr[Constants.WIDTH]; height:StyleSheet.calculate_curr[Constants.HEIGHT];textColor:StyleSheet.calculate_currText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.calculate_currText[Constants.PIXELSIZE]; id:calculate_curr; text: Genivi.gettext("GoTo"); explode:false; @@ -570,14 +718,24 @@ NavigationAppHMIMenu { } disabled:true; next:back; prev:numberKeyboard } - + StdButton { + source:StyleSheet.cancel[Constants.SOURCE]; x:StyleSheet.cancel[Constants.X]; y:StyleSheet.cancel[Constants.Y]; width:StyleSheet.cancel[Constants.WIDTH]; height:StyleSheet.cancel[Constants.HEIGHT];textColor:StyleSheet.cancelText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.cancelText[Constants.PIXELSIZE]; + id:cancel; text: Genivi.gettext("Cancel"); + visible: (keyboardActivated); + onClicked: { + Genivi.entrycancel=true; + Genivi.preloadMode=true; + keyboardActivated = false; + loadWithCountry(); + } + disabled:false; next:settings; prev:calculate_curr; + } StdButton { source:StyleSheet.settings[Constants.SOURCE]; x:StyleSheet.settings[Constants.X]; y:StyleSheet.settings[Constants.Y]; width:StyleSheet.settings[Constants.WIDTH]; height:StyleSheet.settings[Constants.HEIGHT]; id:settings; explode:false; next:back; prev:calculate_curr; onClicked: { entryMenu("NavigationAppSettings",menu); } } - 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"); @@ -595,6 +753,7 @@ NavigationAppHMIMenu { connectSignals(); vehicleLocated = false; + keyboardActivated = false; //Test if the navigation server is connected var res=Genivi.navigationcore_session_GetVersion(dbusIf); @@ -605,9 +764,6 @@ NavigationAppHMIMenu { Genivi.dump("",res); } // Preload address if activated - if (Genivi.entryselectedentry) { - Genivi.locationinput_SelectEntry(dbusIf,Genivi.entryselectedentry-1); - } if (Genivi.entrydest == 'countryValue') { accept(countryValue); diff --git a/test/.gitignore b/test/.gitignore index 9c4c9ea..bd92202 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -2,4 +2,5 @@ *.config *.creator *.files -*.includes
\ No newline at end of file +*.includes +pygame |