diff options
author | philippe colliot <fifitaneki@hotmail.com> | 2016-11-28 17:38:01 +0100 |
---|---|---|
committer | philippe colliot <fifitaneki@hotmail.com> | 2016-11-28 17:38:01 +0100 |
commit | 10671e67622bd92b2aace2ed04dafddfebcb8ab4 (patch) | |
tree | f2cbe3438b6effd4ff67733db0248e3af6cc8f35 /src/hmi | |
parent | f1d4e8e76b7e1baef927455a06c1b6348fc8ea59 (diff) | |
download | navigation-10671e67622bd92b2aace2ed04dafddfebcb8ab4.tar.gz |
preparation of a more simple HMI - in progress
Diffstat (limited to 'src/hmi')
-rw-r--r-- | src/hmi/qml/Core/NavigationAppHMIBgImage.qml | 34 | ||||
-rw-r--r-- | src/hmi/qml/Core/NavigationAppHMIMenu.qml | 194 | ||||
-rw-r--r-- | src/hmi/qml/Core/gimp/draft-theme/800x480/NavigationAppSearch.xcf | bin | 567349 -> 256336 bytes | |||
-rw-r--r-- | src/hmi/qml/NavigationApp.qml | 2 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppEntry.qml | 214 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppMain.qml | 46 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppPOI.qml | 8 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppSearch.qml | 575 |
8 files changed, 1040 insertions, 33 deletions
diff --git a/src/hmi/qml/Core/NavigationAppHMIBgImage.qml b/src/hmi/qml/Core/NavigationAppHMIBgImage.qml new file mode 100644 index 0000000..260f8ee --- /dev/null +++ b/src/hmi/qml/Core/NavigationAppHMIBgImage.qml @@ -0,0 +1,34 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* +* \file HMIBgImage.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 +* +* 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-05-08, Philippe Colliot, use of css file so change path of the image +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +import QtQuick 2.1 + +BorderImage { + property string image; + source:"../"+image; + anchors { fill: parent; topMargin: parent.headlineHeight} +} diff --git a/src/hmi/qml/Core/NavigationAppHMIMenu.qml b/src/hmi/qml/Core/NavigationAppHMIMenu.qml new file mode 100644 index 0000000..ef6b0c6 --- /dev/null +++ b/src/hmi/qml/Core/NavigationAppHMIMenu.qml @@ -0,0 +1,194 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* +* \file HMIMenu.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 "genivi.js" as Genivi; +import "style-sheets/style-constants.js" as Constants; +import lbs.plugin.wheelarea 1.0 + +Rectangle { + id: menu + property alias loader: pageLoader + property string pageBack + property Item next + property Item prev + color: "transparent" + focus: true + anchors.fill: parent + + KeyNavigation.tab:next + KeyNavigation.backtab:prev + + MouseArea { + acceptedButtons: Qt.MiddleButton + anchors.fill: parent + onClicked: { + var focus=find_focus(menu); + focus.mclicked(focus); + } + + } + + function focus_next() + { + var focus=find_focus(menu); + if (focus.next != focus && focus.giveFocus) + focus.giveFocus(); + do { + focus=focus.next; + } while (focus.disabled); + if (focus.takeFocus) { + focus.takeFocus(1); + } else { + focus.forceActiveFocus(); + } + } + + function focus_prev() + { + var focus=find_focus(menu); + if (focus.prev != focus && focus.giveFocus) + focus.giveFocus(); + do { + focus=focus.prev; + } while (focus.disabled); + if (focus.takeFocus) { + focus.takeFocus(-1); + } else { + focus.forceActiveFocus(); + } + } + + Keys.onBacktabPressed:{focus_prev();} + + Keys.onTabPressed:{focus_next();} + + WheelArea { + property real deltasum; + property real step: 120; + property real dir: 1; + anchors.fill: parent + onWheel: { + deltasum+=delta*dir; + //console.log(delta); + while (deltasum >= step) { + focus_next(); + deltasum-=step; + } + while (deltasum <= -step) { + focus_prev(); + deltasum+=step; + } + } + } + + property real wspc: 60 + property real hspc: 60 + + function w(cols) { + return ((menu.width - (cols+1)*wspc) / cols); + } + + function h(rows) { + return ((menu.height - (rows+1)*hspc) / rows); + } + + function find_focus(it) { + //console.log("testing "+it); + if (it.focus && it.next && it.prev) + return it; + for (var i = 0 ; i < it.children.length ; i++) { + var ret=find_focus(it.children[i]); + if (ret) + return ret; + } + //console.log("no focus found"); + return null; + } + + + Loader { + id: pageLoader + states: State { + name: "visible" + PropertyChanges { target: pageLoader; opacity: 1 } + } + transitions: Transition { + NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 } + NumberAnimation { properties: "opacity"; easing.type: "InQuad"; duration: 200 } + } + } + + function entryMenu(inmenu,outmenu) + { + Genivi.entrybackheapsize += 1; + Genivi.entryback[Genivi.entrybackheapsize] = outmenu.pagefile; + outmenu.state = "hidden"; + container.load(inmenu); + } + + function leaveMenu() + { + var outmenu=Genivi.entryback[Genivi.entrybackheapsize]; + Genivi.entrybackheapsize -= 1; + menu.state="hidden"; + container.load(outmenu); + } + + function routeMenu() + { //location entered, go to route menu and reinit the heap + menu.state="hidden"; + Genivi.entrybackheapsize = 1; + Genivi.entryback[Genivi.entrybackheapsize] = "MainMenu"; + container.load("NavigationAppBrowseMap"); + } + + function mapMenu() + { //go to map view menu and reinit the heap + menu.state="hidden"; + Genivi.entrybackheapsize = 1; + Genivi.entryback[Genivi.entrybackheapsize] = "MainMenu"; + container.load("NavigationAppBrowseMap"); + } + + + function pageOpen(command) { + menu.state="hidden"; + container.load(command); + } + + states: State { + name: "hidden" + PropertyChanges { target: parent; opacity: 0 } + } + transitions: Transition { + NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 } + NumberAnimation { properties: "opacity"; easing.type: "InQuad"; duration: 200 } + } + + Component.onCompleted: { + console.log("Level: ",Genivi.entrybackheapsize," Menu: ",pagefile); + } +} 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 e3cf05e..acf78d0 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/NavigationApp.qml b/src/hmi/qml/NavigationApp.qml index cb115f4..d767977 100644 --- a/src/hmi/qml/NavigationApp.qml +++ b/src/hmi/qml/NavigationApp.qml @@ -48,6 +48,6 @@ ApplicationWindow { Component.onCompleted: { Genivi.setlang("eng_USA"); //by default set to english US - load("navigationAppMain"); + load("NavigationAppMain"); } } diff --git a/src/hmi/qml/NavigationAppEntry.qml b/src/hmi/qml/NavigationAppEntry.qml new file mode 100644 index 0000000..885aa4a --- /dev/null +++ b/src/hmi/qml/NavigationAppEntry.qml @@ -0,0 +1,214 @@ +/** +* @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/NavigationAppMain.qml b/src/hmi/qml/NavigationAppMain.qml index ff114ba..a7b3a6b 100644 --- a/src/hmi/qml/NavigationAppMain.qml +++ b/src/hmi/qml/NavigationAppMain.qml @@ -42,7 +42,7 @@ HMIMenu { } HMIBgImage { - image:StyleSheet.fsa_main_menu_background[Constants.SOURCE]; + image:StyleSheet.navigation_app_main_background[Constants.SOURCE]; anchors { fill: parent; topMargin: parent.headlineHeight} Text { @@ -56,7 +56,7 @@ HMIMenu { StdButton { source:StyleSheet.select_navigation[Constants.SOURCE]; x:StyleSheet.select_navigation[Constants.X]; y:StyleSheet.select_navigation[Constants.Y]; width:StyleSheet.select_navigation[Constants.WIDTH]; height:StyleSheet.select_navigation[Constants.HEIGHT]; id:navigation; explode:false; next:mapview; prev:quit; onClicked: { - entryMenu("NavigationSearch",menu); + entryMenu("NavigationAppSearch",menu); } } @@ -70,28 +70,13 @@ HMIMenu { StdButton { source:StyleSheet.select_mapview[Constants.SOURCE]; x:StyleSheet.select_mapview[Constants.X]; y:StyleSheet.select_mapview[Constants.Y]; width:StyleSheet.select_mapview[Constants.WIDTH]; height:StyleSheet.select_mapview[Constants.HEIGHT]; - id:mapview; explode:false; next:trip; prev:navigation; onClicked: { + id:mapview; explode:false; next:poi; prev:navigation; onClicked: { Genivi.data["show_current_position"]=true; - entryMenu("NavigationBrowseMap",menu); + entryMenu("NavigationAppBrowseMap",menu); } } Text { - x:StyleSheet.tripText[Constants.X]; y:StyleSheet.tripText[Constants.Y]; width:StyleSheet.tripText[Constants.WIDTH]; height:StyleSheet.tripText[Constants.HEIGHT];color:StyleSheet.tripText[Constants.TEXTCOLOR];styleColor:StyleSheet.tripText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.tripText[Constants.PIXELSIZE]; - id:tripText; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("Trip") - } - - StdButton { - source:StyleSheet.select_trip[Constants.SOURCE]; x:StyleSheet.select_trip[Constants.X]; y:StyleSheet.select_trip[Constants.Y]; width:StyleSheet.select_trip[Constants.WIDTH]; height:StyleSheet.select_trip[Constants.HEIGHT]; - id:trip; explode:false; next:poi; prev:mapview;onClicked: { - entryMenu("TripComputer",menu); - } - } - - Text { x:StyleSheet.poiText[Constants.X]; y:StyleSheet.poiText[Constants.Y]; width:StyleSheet.poiText[Constants.WIDTH]; height:StyleSheet.poiText[Constants.HEIGHT];color:StyleSheet.poiText[Constants.TEXTCOLOR];styleColor:StyleSheet.poiText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.poiText[Constants.PIXELSIZE]; id:poiText; style: Text.Sunken; @@ -101,28 +86,33 @@ HMIMenu { StdButton { source:StyleSheet.select_poi[Constants.SOURCE]; x:StyleSheet.select_poi[Constants.X]; y:StyleSheet.select_poi[Constants.Y]; width:StyleSheet.select_poi[Constants.WIDTH]; height:StyleSheet.select_poi[Constants.HEIGHT]; - id:poi; explode:false; next:configuration; prev:trip; onClicked: { - entryMenu("POI",menu); + id:poi; explode:false; next:trip; prev:mapview; onClicked: { + entryMenu("NavigationAppPOI",menu); } } Text { - x:StyleSheet.configurationText[Constants.X]; y:StyleSheet.configurationText[Constants.Y]; width:StyleSheet.configurationText[Constants.WIDTH]; height:StyleSheet.configurationText[Constants.HEIGHT];color:StyleSheet.configurationText[Constants.TEXTCOLOR];styleColor:StyleSheet.configurationText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.configurationText[Constants.PIXELSIZE]; - id:configurationText; + x:StyleSheet.tripText[Constants.X]; y:StyleSheet.tripText[Constants.Y]; width:StyleSheet.tripText[Constants.WIDTH]; height:StyleSheet.tripText[Constants.HEIGHT];color:StyleSheet.tripText[Constants.TEXTCOLOR];styleColor:StyleSheet.tripText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.tripText[Constants.PIXELSIZE]; + id:tripText; style: Text.Sunken; smooth: true - text: Genivi.gettext("Configuration") + text: Genivi.gettext("Trip") } StdButton { - source:StyleSheet.select_configuration[Constants.SOURCE]; x:StyleSheet.select_configuration[Constants.X]; y:StyleSheet.select_configuration[Constants.Y]; width:StyleSheet.select_configuration[Constants.WIDTH]; height:StyleSheet.select_configuration[Constants.HEIGHT]; - id:configuration; explode:false; next:quit; prev:trip; onClicked: { - entryMenu("NavigationSettings",menu); + source:StyleSheet.select_trip[Constants.SOURCE]; x:StyleSheet.select_trip[Constants.X]; y:StyleSheet.select_trip[Constants.Y]; width:StyleSheet.select_trip[Constants.WIDTH]; height:StyleSheet.select_trip[Constants.HEIGHT]; + id:trip; explode:false; next:quit; prev:poi;onClicked: { + entryMenu("NavigationAppTripComputer",menu); } } StdButton { source:StyleSheet.quit[Constants.SOURCE]; x:StyleSheet.quit[Constants.X]; y:StyleSheet.quit[Constants.Y]; width:StyleSheet.quit[Constants.WIDTH]; height:StyleSheet.quit[Constants.HEIGHT];textColor:StyleSheet.quitText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.quitText[Constants.PIXELSIZE]; - id:quit; text: Genivi.gettext("Quit"); explode:false; next:navigation; prev:configuration; onClicked:{Qt.quit()}} + id:quit; text: Genivi.gettext("Quit"); explode:false; next:navigation; prev:trip; onClicked:{Qt.quit()}} + } + + Component.onCompleted: { + } + } diff --git a/src/hmi/qml/NavigationAppPOI.qml b/src/hmi/qml/NavigationAppPOI.qml index 06c0147..49f081d 100644 --- a/src/hmi/qml/NavigationAppPOI.qml +++ b/src/hmi/qml/NavigationAppPOI.qml @@ -30,10 +30,10 @@ 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/fsa-poi-menu-css.js" as StyleSheet; +import "Core/style-sheets/NavigationAppPOI-css.js" as StyleSheet; import lbs.plugin.dbusif 1.0 -HMIMenu { +NavigationAppHMIMenu { id: menu property string pagefile:"POI" @@ -46,7 +46,7 @@ HMIMenu { selectedStationValue.text="See details of \nthe station \nhere" } HMIBgImage { - image:StyleSheet.fsa_poi_menu_background[Constants.SOURCE]; + image:StyleSheet.navigation_app_poi_background[Constants.SOURCE]; anchors { fill: parent; topMargin: parent.headlineHeight } Text { x:StyleSheet.searchResultTitle[Constants.X]; y:StyleSheet.searchResultTitle[Constants.Y]; width:StyleSheet.searchResultTitle[Constants.WIDTH]; height:StyleSheet.searchResultTitle[Constants.HEIGHT];color:StyleSheet.searchResultTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.searchResultTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.searchResultTitle[Constants.PIXELSIZE]; @@ -194,7 +194,7 @@ HMIMenu { mapMenu(); } else { - pageOpen("NavigationCalculatedRoute"); + pageOpen("NavigationAppSearch"); } } } diff --git a/src/hmi/qml/NavigationAppSearch.qml b/src/hmi/qml/NavigationAppSearch.qml index 05dbb9b..a71d631 100644 --- a/src/hmi/qml/NavigationAppSearch.qml +++ b/src/hmi/qml/NavigationAppSearch.qml @@ -28,3 +28,578 @@ 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/NavigationAppSearch-css.js" as StyleSheet; +import lbs.plugin.dbusif 1.0 + +NavigationAppHMIMenu { + id: menu + property string pagefile:"NavigationAppSearch" + property Item currentSelectionCriterionSignal; + property Item searchStatusSignal; + property Item searchResultListSignal; + property Item contentUpdatedSignal; + property Item mapmatchedpositionPositionUpdateSignal; + property Item routeCalculationSuccessfulSignal; + property Item routeCalculationFailedSignal; + property Item routeCalculationProgressUpdateSignal; + property string routeText:" " + property real lat + property real lon + + function loadWithCountry() + { + //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; + } + else + Genivi.preloadMode=false; + } + + function setLocation() + { + Genivi.route_calculated = false; //position or destination changed, so needs to calculate a new route + locationValue.text=Genivi.data['description']; + positionValue.text=(Genivi.data['position'] ? Genivi.data['position']['description']:""); + destinationValue.text=(Genivi.data['destination'] ? Genivi.data['destination']['description']:""); + } + + function updateCurrentPosition() + { + var res=Genivi.mapmatchedposition_GetPosition(dbusIf); + var oklat=0; + var oklong=0; + for (var i=0;i<res[3].length;i+=4){ + if ((res[3][i+1]== Genivi.NAVIGATIONCORE_LATITUDE) && (res[3][i+3][3][1] != 0)){ + oklat=1; + } else { + if ((res[3][i+1]== Genivi.NAVIGATIONCORE_LONGITUDE) && (res[3][i+3][3][1] != 0)){ + oklong=1; + } + } + } + if ((oklat == 1) && (oklong == 1) && Genivi.data['destination']) { + calculate_curr.disabled=false; + } else { + calculate_curr.disabled=true; + } + } + + function mapmatchedpositionPositionUpdate(args) + { + Genivi.hookSignal("mapmatchedpositionPositionUpdate"); + updateCurrentPosition(); + } + + function routeCalculationFailed(args) + { + Genivi.hookSignal("routeCalculationFailed"); + //console.log("routeCalculationFailed:"); + //Genivi.dump("",args); + + statusValue.text=Genivi.gettext("CalculatedRouteFailed"); + Genivi.route_calculated = false; + // Tell the FSA that there's no route available + Genivi.fuelstopadvisor_ReleaseRouteHandle(dbusIf,Genivi.g_routing_handle); + } + + function routeCalculationProgressUpdate(args) + { + Genivi.hookSignal("routeCalculationProgressUpdate"); + statusValue.text=Genivi.gettext("CalculatedRouteInProgress"); + Genivi.route_calculated = false; + } + + function updateStartStop() + { + var res=Genivi.guidance_GetGuidanceStatus(dbusIf); + if (res[1] != Genivi.NAVIGATIONCORE_INACTIVE) { + guidance_start.disabled=true; + guidance_stop.disabled=false; + } else { + guidance_start.disabled=false; + guidance_stop.disabled=true; + } + } + + function routeCalculationSuccessful(args) + { //routeHandle 1, unfullfilledPreferences 3 + Genivi.hookSignal("routeCalculationSuccessful"); + show_route_on_map.disabled=false; + show_route_in_list.disabled=false; + statusValue.text=Genivi.gettext("CalculatedRouteSuccess"); + Genivi.route_calculated = true; + var res=Genivi.routing_GetRouteOverviewTimeAndDistance(dbusIf); + + var i, time = 0, distance = 0; + for (i=0;i<res[1].length;i+=4) + { + if (res[1][i+1] == Genivi.NAVIGATIONCORE_TOTAL_TIME) + { + time = res[1][i+3][3][1]; + } + else + { + if (Genivi.NAVIGATIONCORE_TOTAL_DISTANCE) + { + distance = res[1][i+3][3][1]; + } + } + } + + distanceValue.text =Genivi.distance(distance); + timeValue.text= Genivi.time(time); + + // Give the route handle to the FSA + Genivi.fuelstopadvisor_SetRouteHandle(dbusIf,Genivi.g_routing_handle); + updateStartStop(); + } + + function currentSelectionCriterion(args) + {// locationInputHandle 1, selectionCriterion 3 + Genivi.hookSignal("currentSelectionCriterion"); + var selectionCriterion=args[3]; + Genivi.entrycriterion = selectionCriterion; + } + + function searchStatus(args) + { //locationInputHandle 1, statusValue 3 + 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 === countryValue.criterion) + { + if (Genivi.address[Genivi.NAVIGATIONCORE_CITY] !== "") + { + cityValue.text=Genivi.address[Genivi.NAVIGATIONCORE_CITY]; + accept(cityValue); + streetValue.disabled=false; + } + else + Genivi.preloadMode=false; + } + else + { + if (Genivi.entrycriterion === cityValue.criterion) + { + if (Genivi.address[Genivi.NAVIGATIONCORE_STREET] !== "") + { + streetValue.text=Genivi.address[Genivi.NAVIGATIONCORE_STREET]; + accept(streetValue); + numberValue.disabled=false; + } + + } + else + { + 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"); + } + + function contentUpdated(args) + { //locationInputHandle 1, guidable 3, availableSelectionCriteria 5, address 7 + Genivi.hookSignal("contentUpdated"); + // Check if the destination is guidable + var guidable=args[3]; + if (guidable) { + ok.disabled=false; + } + else + { + //to do something is it's not guidable + } + + // Manage the available entries + var availableSelectionCriteria=args[5]; + countryValue.disabled=true; + cityValue.disabled=true; + streetValue.disabled=true; + numberValue.disabled=true; + for (var i=0 ; i < args.length ; i++) { + if (availableSelectionCriteria[i] == Genivi.NAVIGATIONCORE_COUNTRY) countryValue.disabled=false; + if (availableSelectionCriteria[i] == Genivi.NAVIGATIONCORE_CITY) cityValue.disabled=false; + if (availableSelectionCriteria[i] == Genivi.NAVIGATIONCORE_STREET) streetValue.disabled=false; + if (availableSelectionCriteria[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=""; + + // Manage the content + var address=args[7]; + countryValue.text=""; + cityValue.text=""; + streetValue.text=""; + numberValue.text=""; + for (var i=0 ; i < address.length ; i+=4) { + if (address[i+1] == Genivi.NAVIGATIONCORE_LATITUDE) lat=address[i+3][3][1]; + if (address[i+1] == Genivi.NAVIGATIONCORE_LONGITUDE) lon=address[i+3][3][1]; + if (address[i+1] == Genivi.NAVIGATIONCORE_COUNTRY) countryValue.text=address[i+3][3][1]; + if (address[i+1] == Genivi.NAVIGATIONCORE_CITY) cityValue.text=address[i+3][3][1]; + if (address[i+1] == Genivi.NAVIGATIONCORE_STREET) streetValue.text=address[i+3][3][1]; + if (address[i+1] == Genivi.NAVIGATIONCORE_HOUSENUMBER) numberValue.text=address[i+3][3][1]; + } + + // Manage the focus + 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 connectSignals() + { + currentSelectionCriterionSignal=Genivi.connect_currentSelectionCriterionSignal(dbusIf,menu); + searchStatusSignal=Genivi.connect_searchStatusSignal(dbusIf,menu); + searchResultListSignal=Genivi.connect_searchResultListSignal(dbusIf,menu); + contentUpdatedSignal=Genivi.connect_contentUpdatedSignal(dbusIf,menu); + mapmatchedpositionPositionUpdateSignal=Genivi.connect_mapmatchedpositionPositionUpdateSignal(dbusIf,menu); + routeCalculationSuccessfulSignal=Genivi.connect_routeCalculationSuccessfulSignal(dbusIf,menu); + routeCalculationFailedSignal=Genivi.connect_routeCalculationFailedSignal(dbusIf,menu); + routeCalculationProgressUpdateSignal=Genivi.connect_routeCalculationProgressUpdateSignal(dbusIf,menu); + } + + function disconnectSignals() + { + currentSelectionCriterionSignal.destroy(); + searchStatusSignal.destroy(); + searchResultListSignal.destroy(); + contentUpdatedSignal.destroy(); + mapmatchedpositionPositionUpdateSignal.destroy(); + routeCalculationSuccessfulSignal.destroy(); + routeCalculationFailedSignal.destroy(); + routeCalculationProgressUpdateSignal.destroy(); + } + + function accept(what) + { + ok.disabled=true; + Genivi.locationinput_SetSelectionCriterion(dbusIf,what.criterion); + Genivi.locationinput_Search(dbusIf,what.text,10); + } + + function leave(toOtherMenu) + { + disconnectSignals(); + if (toOtherMenu) { + Genivi.locationinput_handle_clear(dbusIf); + } + //Genivi.navigationcore_session_clear(dbusIf); + } + + DBusIf { + id: dbusIf + } + + NavigationAppHMIBgImage { + image:StyleSheet.navigation_app_search_background[Constants.SOURCE]; + anchors { fill: parent; topMargin: parent.headlineHeight} + id: content + + // location input menu + 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: countryValue + prev: streetValue + disabled: true + onLeave:{menu.leave(0)} + } + + // route menu + Text { + x:StyleSheet.guidanceTitle[Constants.X]; y:StyleSheet.guidanceTitle[Constants.Y]; width:StyleSheet.guidanceTitle[Constants.WIDTH]; height:StyleSheet.guidanceTitle[Constants.HEIGHT];color:StyleSheet.guidanceTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.guidanceTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.guidanceTitle[Constants.PIXELSIZE]; + id:guidanceTitle; + style: Text.Sunken; + smooth: true; + text: Genivi.gettext("Guidance"); + visible: (Genivi.route_calculated); + } + Text { + x:StyleSheet.displayRouteTitle[Constants.X]; y:StyleSheet.displayRouteTitle[Constants.Y]; width:StyleSheet.displayRouteTitle[Constants.WIDTH]; height:StyleSheet.displayRouteTitle[Constants.HEIGHT];color:StyleSheet.displayRouteTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.displayRouteTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.displayRouteTitle[Constants.PIXELSIZE]; + id:displayRouteTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("DisplayRoute") + visible: (Genivi.route_calculated); + } + Text { + x:StyleSheet.distanceTitle[Constants.X]; y:StyleSheet.distanceTitle[Constants.Y]; width:StyleSheet.distanceTitle[Constants.WIDTH]; height:StyleSheet.distanceTitle[Constants.HEIGHT];color:StyleSheet.distanceTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.distanceTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.distanceTitle[Constants.PIXELSIZE]; + id:distanceTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("RouteDistance") + visible: (Genivi.route_calculated); + } + SmartText { + x:StyleSheet.distanceValue[Constants.X]; y:StyleSheet.distanceValue[Constants.Y]; width:StyleSheet.distanceValue[Constants.WIDTH]; height:StyleSheet.distanceValue[Constants.HEIGHT];color:StyleSheet.distanceValue[Constants.TEXTCOLOR];styleColor:StyleSheet.distanceValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.distanceValue[Constants.PIXELSIZE]; + id:distanceValue + text: "" + visible: (Genivi.route_calculated); + } + Text { + x:StyleSheet.timeTitle[Constants.X]; y:StyleSheet.timeTitle[Constants.Y]; width:StyleSheet.timeTitle[Constants.WIDTH]; height:StyleSheet.timeTitle[Constants.HEIGHT];color:StyleSheet.timeTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.timeTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.timeTitle[Constants.PIXELSIZE]; + id:timeTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("RouteTime") + visible: (Genivi.route_calculated); + } + SmartText { + x:StyleSheet.timeValue[Constants.X]; y:StyleSheet.timeValue[Constants.Y]; width:StyleSheet.timeValue[Constants.WIDTH]; height:StyleSheet.timeValue[Constants.HEIGHT];color:StyleSheet.timeValue[Constants.TEXTCOLOR];styleColor:StyleSheet.timeValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.timeValue[Constants.PIXELSIZE]; + id:timeValue + text: "" + visible: (Genivi.route_calculated); + } + Text { + x:StyleSheet.statusTitle[Constants.X]; y:StyleSheet.statusTitle[Constants.Y]; width:StyleSheet.statusTitle[Constants.WIDTH]; height:StyleSheet.statusTitle[Constants.HEIGHT];color:StyleSheet.statusTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.statusTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.statusTitle[Constants.PIXELSIZE]; + id:statusTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("StatusTitle") + visible: (Genivi.route_calculated); + } + SmartText { + x:StyleSheet.statusValue[Constants.X]; y:StyleSheet.statusValue[Constants.Y]; width:StyleSheet.statusValue[Constants.WIDTH]; height:StyleSheet.statusValue[Constants.HEIGHT];color:StyleSheet.statusValue[Constants.TEXTCOLOR];styleColor:StyleSheet.statusValue[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.statusValue[Constants.PIXELSIZE]; + id:statusValue + 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 + explode:false; disabled:true; next:show_route_in_list; prev:back + visible: (Genivi.route_calculated); + onClicked: { + disconnectSignals(); + Genivi.data["mapback"]="NavigationCalculatedRoute"; + Genivi.data["show_route_handle"]=Genivi.routing_handle(dbusIf); + Genivi.data["zoom_route_handle"]=Genivi.routing_handle(dbusIf); + mapMenu(); + } + } + StdButton { + source:StyleSheet.show_route_in_list[Constants.SOURCE]; x:StyleSheet.show_route_in_list[Constants.X]; y:StyleSheet.show_route_in_list[Constants.Y]; width:StyleSheet.show_route_in_list[Constants.WIDTH]; height:StyleSheet.show_route_in_list[Constants.HEIGHT]; + id:show_route_in_list; + explode:false; disabled:true; next:back; prev:show_route_on_map; + visible: (Genivi.route_calculated); + onClicked: { + 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 + visible: (Genivi.route_calculated); + onClicked: { + disconnectSignals(); + Genivi.guidance_StartGuidance(dbusIf,Genivi.routing_handle(dbusIf)); + Genivi.data["mapback"]="NavigationCalculatedRoute"; + Genivi.data["show_route_handle"]=Genivi.routing_handle(dbusIf); + Genivi.data["show_current_position"]=true; + mapMenu(); + } + } + StdButton { + source:StyleSheet.guidance_stop[Constants.SOURCE]; x:StyleSheet.guidance_stop[Constants.X]; y:StyleSheet.guidance_stop[Constants.Y]; width:StyleSheet.guidance_stop[Constants.WIDTH]; height:StyleSheet.guidance_stop[Constants.HEIGHT];textColor:StyleSheet.stopText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.stopText[Constants.PIXELSIZE]; + id:guidance_stop;text: Genivi.gettext("Off");explode:false; disabled:true; next:show_route_on_map; prev:guidance_start + visible: (Genivi.route_calculated); + onClicked: { + Genivi.guidance_StopGuidance(dbusIf); + guidance_start.disabled=false; + guidance_stop.disabled=true; + } + } + + 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; + onClicked: { + var position,destination; + //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']); + + //launch route calculation + destination=Genivi.latlon_to_map(Genivi.data['destination']); + position=""; + Genivi.routing_SetWaypoints(dbusIf,true,position,destination); + Genivi.data['calculate_route']=true; + disconnectSignals(); + Genivi.data['lat']=''; + Genivi.data['lon']=''; + entryMenu("NavigationCalculatedRoute",menu); + } + disabled:true; next:back; prev:calculate_curr + } + + 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"); + onClicked: { + disconnectSignals(); + Genivi.data['lat']=''; + Genivi.data['lon']=''; + leaveMenu(); + } + disabled:false; next:streetValue; prev:calculate_curr; + } + + } + Component.onCompleted: { + connectSignals(); + + //Test if the navigation server is connected + var res=Genivi.navigationcore_session_GetVersion(dbusIf); + if (res[0] != "error") { + res=Genivi.navigationcore_session(dbusIf); + res=Genivi.locationinput_handle(dbusIf); + } else { + Genivi.dump("",res); + } + // Preload address if activated + if (Genivi.entryselectedentry) { + Genivi.locationinput_SelectEntry(dbusIf,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; + + if (Genivi.preloadMode==true) + { + loadWithCountry(); + } +/* + // Check is route is active + if (Genivi.data["calculate_route"]) { + Genivi.routing_CalculateRoute(dbusIf); + delete(Genivi.data["calculate_route"]); + } else { + routeCalculationSuccessful("dummy"); + } + updateStartStop();*/ + } +} |