diff options
author | asanoaozora <fifitaneki@hotmail.com> | 2017-02-28 12:56:30 +0100 |
---|---|---|
committer | asanoaozora <fifitaneki@hotmail.com> | 2017-02-28 12:56:30 +0100 |
commit | 32ceb558930c9cd432c41adcabc83e48342c9bd2 (patch) | |
tree | f8cf88854779aa6d952c9e0dc01672580d238c3f /src | |
parent | c1dd5aab4485771827f5e126aa3d35383be03805 (diff) | |
download | navigation-32ceb558930c9cd432c41adcabc83e48342c9bd2.tar.gz |
simplification of settings menu
Diffstat (limited to 'src')
-rw-r--r-- | src/hmi/qml/Core/genivi-capi.js | 2 | ||||
-rw-r--r-- | src/hmi/qml/Core/genivi-origin.js | 2 | ||||
-rwxr-xr-x | src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppBrowseMapSettings.xcf | bin | 47551 -> 47551 bytes | |||
-rwxr-xr-x | src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppMain.xcf | bin | 356365 -> 347325 bytes | |||
-rw-r--r-- | src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettings.xcf | bin | 136123 -> 218895 bytes | |||
-rw-r--r-- | src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsPreference.xcf | bin | 330182 -> 0 bytes | |||
-rw-r--r-- | src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsSettingsLanguageAndUnits.xcf | bin | 262668 -> 0 bytes | |||
-rw-r--r-- | src/hmi/qml/Core/referenceHMI.tar.gz | bin | 1236353 -> 1199770 bytes | |||
-rw-r--r-- | src/hmi/qml/NavigationAppBrowseMap.qml | 5 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppMain.qml | 80 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppSettings.qml | 342 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppSettingsLanguageAndUnits.qml | 194 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppSettingsPreferences.qml | 220 |
13 files changed, 405 insertions, 440 deletions
diff --git a/src/hmi/qml/Core/genivi-capi.js b/src/hmi/qml/Core/genivi-capi.js index 67b5d72..c2788a1 100644 --- a/src/hmi/qml/Core/genivi-capi.js +++ b/src/hmi/qml/Core/genivi-capi.js @@ -127,7 +127,7 @@ var radius=5000; //radius in m around the vehicle to search for the refill stati var offset=0; //offset of the start record to get on the list of pois var maxWindowSize=20; //max size of elements to return as a result var fuelCategoryId; //unique id of fuel category -var zoom_guidance=4; //zoom level when a guidance starts +var zoom_guidance=2; //zoom level when a guidance starts //the default data below will be managed by the persistency component in the future address[NAVIGATIONCORE_COUNTRY]="Switzerland"; diff --git a/src/hmi/qml/Core/genivi-origin.js b/src/hmi/qml/Core/genivi-origin.js index 76ca818..63dce3b 100644 --- a/src/hmi/qml/Core/genivi-origin.js +++ b/src/hmi/qml/Core/genivi-origin.js @@ -127,7 +127,7 @@ var radius=5000; //radius in m around the vehicle to search for the refill stati var offset=0; //offset of the start record to get on the list of pois var maxWindowSize=20; //max size of elements to return as a result var fuelCategoryId; //unique id of fuel category -var zoom_guidance=4; //zoom level when a guidance starts +var zoom_guidance=2; //zoom level when a guidance starts //the default data below will be managed by the persistency component in the future address[NAVIGATIONCORE_COUNTRY]="Switzerland"; diff --git a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppBrowseMapSettings.xcf b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppBrowseMapSettings.xcf Binary files differindex 7eac248..db3c406 100755 --- a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppBrowseMapSettings.xcf +++ b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppBrowseMapSettings.xcf diff --git a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppMain.xcf b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppMain.xcf Binary files differindex 6646a7a..2f1e14f 100755 --- a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppMain.xcf +++ b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppMain.xcf diff --git a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettings.xcf b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettings.xcf Binary files differindex 92551dd..ccfcc5d 100644 --- a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettings.xcf +++ b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettings.xcf diff --git a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsPreference.xcf b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsPreference.xcf Binary files differdeleted file mode 100644 index bb3b79e..0000000 --- a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsPreference.xcf +++ /dev/null diff --git a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsSettingsLanguageAndUnits.xcf b/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsSettingsLanguageAndUnits.xcf Binary files differdeleted file mode 100644 index 157717c..0000000 --- a/src/hmi/qml/Core/gimp/gdp-theme/800x480/NavigationAppSettingsSettingsLanguageAndUnits.xcf +++ /dev/null diff --git a/src/hmi/qml/Core/referenceHMI.tar.gz b/src/hmi/qml/Core/referenceHMI.tar.gz Binary files differindex 5bcff17..abf4b53 100644 --- a/src/hmi/qml/Core/referenceHMI.tar.gz +++ b/src/hmi/qml/Core/referenceHMI.tar.gz diff --git a/src/hmi/qml/NavigationAppBrowseMap.qml b/src/hmi/qml/NavigationAppBrowseMap.qml index 3e44475..5fcfb44 100644 --- a/src/hmi/qml/NavigationAppBrowseMap.qml +++ b/src/hmi/qml/NavigationAppBrowseMap.qml @@ -1481,6 +1481,9 @@ NavigationAppHMIMenu { Genivi.mapviewer_SetFollowCarMode(dbusIf,true); Genivi.mapviewer_SetMapViewScale(dbusIf,Genivi.zoom_guidance); if(Genivi.guidance_activated) { + if(Genivi.showroom) { + Genivi.data['current_position']=Genivi.data['default_position']; + } Genivi.mapviewer_SetTargetPoint(dbusIf,Genivi.data['current_position']['lat'],Genivi.data['current_position']['lon'],Genivi.data['current_position']['alt']); Genivi.mapviewer_DisplayRoute(dbusIf,Genivi.data['show_route_handle'],false); Genivi.fuelstopadvisor_SetFuelAdvisorSettings(dbusIf,1,50); //activate advisor mode @@ -1508,7 +1511,7 @@ NavigationAppHMIMenu { } else { if (Genivi.data['display_on_map']==='show_position') { - //show a given position on the map + //show a given position on the map, used to explore the map Genivi.mapviewer_SetFollowCarMode(dbusIf,false); Genivi.mapviewer_SetTargetPoint(dbusIf,Genivi.data['position']['lat'],Genivi.data['position']['lon'],Genivi.data['position']['alt']); Genivi.fuelstopadvisor_SetFuelAdvisorSettings(dbusIf,0,50); //no advisor mode diff --git a/src/hmi/qml/NavigationAppMain.qml b/src/hmi/qml/NavigationAppMain.qml index 25adf06..51e85d1 100644 --- a/src/hmi/qml/NavigationAppMain.qml +++ b/src/hmi/qml/NavigationAppMain.qml @@ -34,13 +34,64 @@ import lbs.plugin.dbusif 1.0 NavigationAppHMIMenu { id: menu property string pagefile:"NavigationAppMain" + property bool vehicleLocated: false pageBack: Genivi.entryback[Genivi.entrybackheapsize] next: navigation prev: quit + + //------------------------------------------// + // Management of the DBus exchanges + //------------------------------------------// DBusIf { id:dbusIf; } + property Item mapmatchedpositionPositionUpdateSignal; + function mapmatchedpositionPositionUpdate(args) + { + Genivi.hookSignal("mapmatchedpositionPositionUpdate"); + updateCurrentPosition(); + } + + function connectSignals() + { + mapmatchedpositionPositionUpdateSignal=Genivi.connect_mapmatchedpositionPositionUpdateSignal(dbusIf,menu); + } + + function disconnectSignals() + { + mapmatchedpositionPositionUpdateSignal.destroy(); + } + + 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; + Genivi.data['current_position']['lat']=res[3][i+3][3][1]; + } else { + if ((res[3][i+1]== Genivi.NAVIGATIONCORE_LONGITUDE) && (res[3][i+3][3][1] != 0)){ + oklong=1; + Genivi.data['current_position']['lon']=res[3][i+3][3][1]; + } else { + if (res[3][i+1]== Genivi.NAVIGATIONCORE_ALTITUDE){ + Genivi.data['current_position']['alt']=res[3][i+3][3][1]; + } + } + } + } + if ((oklat == 1) && (oklong == 1)) {vehicleLocated=true;} + else {vehicleLocated=false;} + mapview.update(); + } + + + //------------------------------------------// + // Menu elements + //------------------------------------------// NavigationAppHMIBgImage { image:StyleSheet.navigation_app_main_background[Constants.SOURCE]; anchors { fill: parent; topMargin: parent.headlineHeight} @@ -72,7 +123,9 @@ NavigationAppHMIMenu { 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; next:poi; prev:navigation; onClicked: { + id:mapview; next:poi; prev:navigation; + disabled:!(vehicleLocated || Genivi.showroom ) + onClicked: { Genivi.data['display_on_map']='show_current_position'; entryMenu("NavigationAppBrowseMap",menu); } @@ -103,30 +156,53 @@ NavigationAppHMIMenu { 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; next:quit; prev:poi;onClicked: { + id:trip; next:settings; prev:poi;onClicked: { entryMenu("NavigationAppTripComputer",menu); } } + Text { + x:StyleSheet.settingsText[Constants.X]; y:StyleSheet.settingsText[Constants.Y]; width:StyleSheet.settingsText[Constants.WIDTH]; height:StyleSheet.settingsText[Constants.HEIGHT];color:StyleSheet.settingsText[Constants.TEXTCOLOR];styleColor:StyleSheet.settingsText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.settingsText[Constants.PIXELSIZE]; + id:settingsText; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("Configuration") + } + + StdButton { + source:StyleSheet.select_settings[Constants.SOURCE]; x:StyleSheet.select_settings[Constants.X]; y:StyleSheet.select_settings[Constants.Y]; width:StyleSheet.select_settings[Constants.WIDTH]; height:StyleSheet.select_settings[Constants.HEIGHT]; + id:settings; next:quit; prev:trip; + onClicked: { + disconnectSignals(); + Genivi.preloadMode=true; //for the next call of this menu + entryMenu("NavigationAppSettings",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"); next:navigation; prev:trip; onClicked:{ Genivi.navigationcore_session_clear(dbusIf); + disconnectSignals(); Qt.quit(); //for the time being quit } } } 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); } else { + //to do something here Genivi.dump("",res); } + updateCurrentPosition(); } } diff --git a/src/hmi/qml/NavigationAppSettings.qml b/src/hmi/qml/NavigationAppSettings.qml index fa70b14..3c5c894 100644 --- a/src/hmi/qml/NavigationAppSettings.qml +++ b/src/hmi/qml/NavigationAppSettings.qml @@ -32,22 +32,309 @@ import "Core/genivi.js" as Genivi; import "Core/style-sheets/style-constants.js" as Constants; import "Core/style-sheets/NavigationAppSettings-css.js" as StyleSheet; import lbs.plugin.dbusif 1.0 +import lbs.plugin.preference 1.0 NavigationAppHMIMenu { id: menu property string pagefile:"NavigationAppSettings" next: back - prev: back + prev: back + //------------------------------------------// + // Management of the DBus exchanges + //------------------------------------------// DBusIf { id:dbusIf; } + property Item configurationChangedSignal; + function configurationChanged(args) + { //to be improved ! + Genivi.hookSignal("configurationChanged"); + for (var i=0; i < args[1].length;i+=2) { + switch (args[1][i+1]) { + case Genivi.NAVIGATIONCORE_LOCALE: + update(); + break; + case Genivi.NAVIGATIONCORE_UNITS_OF_MEASUREMENT: + update(); + break; + } + } + } + + function connectSignals() + { + configurationChangedSignal=Genivi.connect_configurationChangedSignal(dbusIf,menu); + } + + function disconnectSignals() + { + configurationChangedSignal.destroy(); + } + + //------------------------------------------// + // Management of the language and units + //------------------------------------------// + + function updateLanguageAndUnits() + { + var available_nav=Genivi.navigationcore_configuration_GetSupportedLocales(dbusIf); + var available_map=Genivi.mapviewer_configuration_GetSupportedLocales(dbusIf); + var current_nav=Genivi.navigationcore_configuration_GetLocale(dbusIf); + var current_map=Genivi.mapviewer_configuration_GetLocale(dbusIf); + var current_lang_nav; + var current_lang_map; + var lang_nav=[]; + var lang_map=[]; + + current_lang_nav=current_nav[1] + "_" + current_nav[3]; + current_lang_map=current_map[1] + "_" + current_map[3]; + + for (var i = 0 ; i < available_nav[1].length ; i+=2) { + lang_nav[available_nav[1][i+1][1]+"_"+available_nav[1][i+1][3]]=true; + } + + for (var i = 0 ; i < available_map[1].length ; i+=2) { + lang_map[available_map[1][i+1][1]+"_"+available_map[1][i+1][3]]=true; + } + + // only the locales for nav are used + for (var i = 0 ; i < content.children.length ; i++) { + var name=content.children[i].objectName; + if (name) { + content.children[i].visible=true; + if (name == current_lang_nav) { + content.children[i].disabled=true; + } + else { + content.children[i].disabled=false; + } + } + } + + Genivi.setlang(current_lang_nav); + + var units1,units2; + var res=Genivi.navigationcore_configuration_GetUnitsOfMeasurement(dbusIf); + + if (res[1][1] == Genivi.NAVIGATIONCORE_LENGTH) { + units1=res[1][3]; + } + var res1=Genivi.mapviewer_configuration_GetUnitsOfMeasurement(dbusIf); + if (res1[1][1] == Genivi.MAPVIEWER_LENGTH) { + units2=res1[1][3]; + } + unit_km.disabled=false; + unit_mile.disabled=false; + if (units1==Genivi.NAVIGATIONCORE_KM) unit_km.disabled=true; + if (units1==Genivi.NAVIGATIONCORE_MILE) unit_mile.disabled=true; + } + + function setLocale(language, country, script) + { + Genivi.navigationcore_configuration_SetLocale(dbusIf,language,country,script); + Genivi.mapviewer_configuration_SetLocale(dbusIf,language,country,script); + Genivi.setlang(language + "_" + country); + pageOpen(menu.pagefile); //reload page because of texts... + } + + function setUnitsLength(units1,units2) + { + Genivi.navigationcore_configuration_SetUnitsOfMeasurementLength(dbusIf,units1); + Genivi.mapviewer_configuration_SetUnitsOfMeasurementLength(dbusIf,units2); + updateLanguageAndUnits(); + } + + //------------------------------------------// + // Management of the preferences + //------------------------------------------// + // please note that the preferences are hard coded, limited to three couples: + // (NAVIGATIONCORE_AVOID,NAVIGATIONCORE_HIGHWAYS_MOTORWAYS) + // (NAVIGATIONCORE_AVOID,NAVIGATIONCORE_TOLL_ROADS) + // (NAVIGATIONCORE_AVOID,NAVIGATIONCORE_FERRY) + + Preference { + source: 0 + mode: 0 + } + + function updatePreferences() + { + Genivi.routing_SetRoutePreferences(dbusIf,""); //preferences applied to all countries + var active=Genivi.routing_GetRoutePreferences(dbusIf,""); + + var roadPreferenceList; + var conditionPreferenceList; + roadPreferenceList=active[1]; + conditionPreferenceList=active[3]; + var roadPreferenceMode,roadPreferenceSource; + var conditionPreferenceMode,conditionPreferenceSource; + + for(var i=0; i<roadPreferenceList.length; i+=2) + { + roadPreferenceMode=roadPreferenceList[i+1][1]; + roadPreferenceSource=roadPreferenceList[i+1][3]; + Genivi.roadPreferenceList[roadPreferenceSource]=roadPreferenceMode; + + if(roadPreferenceSource == Genivi.NAVIGATIONCORE_FERRY) + { + if(roadPreferenceMode == Genivi.NAVIGATIONCORE_AVOID) + { + ferries_yes.disabled=false; + ferries_no.disabled=true; + } + else + { + ferries_yes.disabled=true; + ferries_no.disabled=false; + } + } + else + { + if(roadPreferenceSource == Genivi.NAVIGATIONCORE_TOLL_ROADS) + { + if(roadPreferenceMode == Genivi.NAVIGATIONCORE_AVOID) + { + toll_roads_yes.disabled=false; + toll_roads_no.disabled=true; + } + else + { + toll_roads_yes.disabled=true; + toll_roads_no.disabled=false; + } + } + else + { + if(roadPreferenceSource == Genivi.NAVIGATIONCORE_HIGHWAYS_MOTORWAYS) + { + if(roadPreferenceMode == Genivi.NAVIGATIONCORE_AVOID) + { + motorways_yes.disabled=false; + motorways_no.disabled=true; + } + else + { + motorways_yes.disabled=true; + motorways_no.disabled=false; + } + } + } + } + } + } + + function use(preferenceSource) + { + Genivi.roadPreferenceList[preferenceSource]=Genivi.NAVIGATIONCORE_USE; + updatePreferences(); + } + + function avoid(preferenceSource) + { + Genivi.roadPreferenceList[preferenceSource]=Genivi.NAVIGATIONCORE_AVOID; + updatePreferences(); + } + + //------------------------------------------// + // Menu elements + //------------------------------------------// NavigationAppHMIBgImage { id: content image:StyleSheet.navigation_app_settings_background[Constants.SOURCE]; anchors { fill: parent; topMargin: parent.headlineHeight} + Text { + x:StyleSheet.languagesTitle[Constants.X]; y:StyleSheet.languagesTitle[Constants.Y]; width:StyleSheet.languagesTitle[Constants.WIDTH]; height:StyleSheet.languagesTitle[Constants.HEIGHT];color:StyleSheet.languagesTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.languagesTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.languagesTitle[Constants.PIXELSIZE]; + id:languagesTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("Language") + } + StdButton { objectName:"fra_FRA"; + source:StyleSheet.french_flag[Constants.SOURCE]; x:StyleSheet.french_flag[Constants.X]; y:StyleSheet.french_flag[Constants.Y]; width:StyleSheet.french_flag[Constants.WIDTH]; height:StyleSheet.french_flag[Constants.HEIGHT]; + id:fra_FRA; disabled:false; next:deu_DEU; prev:back; onClicked: {setLocale("fra","FRA","Latn");}} + StdButton { objectName:"deu_DEU"; + source:StyleSheet.german_flag[Constants.SOURCE]; x:StyleSheet.german_flag[Constants.X]; y:StyleSheet.german_flag[Constants.Y]; width:StyleSheet.german_flag[Constants.WIDTH]; height:StyleSheet.german_flag[Constants.HEIGHT]; + id:deu_DEU; disabled:false; next:eng_USA; prev:fra_FRA; onClicked: {setLocale("deu","DEU","Latn");}} + StdButton { objectName:"eng_USA"; + source:StyleSheet.usa_flag[Constants.SOURCE]; x:StyleSheet.usa_flag[Constants.X]; y:StyleSheet.usa_flag[Constants.Y]; width:StyleSheet.usa_flag[Constants.WIDTH]; height:StyleSheet.usa_flag[Constants.HEIGHT]; + id:eng_USA; disabled:false; next:jpn_JPN; prev:deu_DEU; onClicked: {setLocale("eng","USA","Latn");}} + StdButton { objectName:"jpn_JPN"; + source:StyleSheet.japanese_flag[Constants.SOURCE]; x:StyleSheet.japanese_flag[Constants.X]; y:StyleSheet.japanese_flag[Constants.Y]; width:StyleSheet.japanese_flag[Constants.WIDTH]; height:StyleSheet.japanese_flag[Constants.HEIGHT]; + id:jpn_JPN; disabled:false; next:back; prev:eng_USA; onClicked: {setLocale("jpn","JPN","Hrkt");}} + + Text { + x:StyleSheet.unitsTitle[Constants.X]; y:StyleSheet.unitsTitle[Constants.Y]; width:StyleSheet.unitsTitle[Constants.WIDTH]; height:StyleSheet.unitsTitle[Constants.HEIGHT];color:StyleSheet.unitsTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.unitsTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.unitsTitle[Constants.PIXELSIZE]; + id:unitsTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("Units") + } + StdButton { source:StyleSheet.unit_km[Constants.SOURCE]; x:StyleSheet.unit_km[Constants.X]; y:StyleSheet.unit_km[Constants.Y]; width:StyleSheet.unit_km[Constants.WIDTH]; height:StyleSheet.unit_km[Constants.HEIGHT]; + id:unit_km; disabled:false; next:back; prev:back; + onClicked: { + setUnitsLength(Genivi.NAVIGATIONCORE_KM,Genivi.MAPVIEWER_KM);} + } + StdButton { source:StyleSheet.unit_mile[Constants.SOURCE]; x:StyleSheet.unit_mile[Constants.X]; y:StyleSheet.unit_mile[Constants.Y]; width:StyleSheet.unit_mile[Constants.WIDTH]; height:StyleSheet.unit_mile[Constants.HEIGHT]; + id:unit_mile; disabled:false; next:back; prev:back; + onClicked: { + setUnitsLength(Genivi.NAVIGATIONCORE_MILE,Genivi.MAPVIEWER_MILE);} + } + + Text { + x:StyleSheet.costModelTitle[Constants.X]; y:StyleSheet.costModelTitle[Constants.Y]; width:StyleSheet.costModelTitle[Constants.WIDTH]; height:StyleSheet.costModelTitle[Constants.HEIGHT];color:StyleSheet.costModelTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.costModelTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.costModelTitle[Constants.PIXELSIZE]; + id:costModelTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("CostModel") + } + + Text { + x:StyleSheet.routingPreferencesTitle[Constants.X]; y:StyleSheet.routingPreferencesTitle[Constants.Y]; width:StyleSheet.routingPreferencesTitle[Constants.WIDTH]; height:StyleSheet.routingPreferencesTitle[Constants.HEIGHT];color:StyleSheet.routingPreferencesTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.routingPreferencesTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.routingPreferencesTitle[Constants.PIXELSIZE]; + id:routingPreferencesTitle; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("RoutingPreferences") + } + + Text { + x:StyleSheet.ferriesText[Constants.X]; y:StyleSheet.ferriesText[Constants.Y]; width:StyleSheet.ferriesText[Constants.WIDTH]; height:StyleSheet.ferriesText[Constants.HEIGHT];color:StyleSheet.ferriesText[Constants.TEXTCOLOR];styleColor:StyleSheet.ferriesText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.ferriesText[Constants.PIXELSIZE]; + id: ferriesText; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("Ferries") + } + StdButton { source:StyleSheet.allow_ferries[Constants.SOURCE]; x:StyleSheet.allow_ferries[Constants.X]; y:StyleSheet.allow_ferries[Constants.Y]; width:StyleSheet.allow_ferries[Constants.WIDTH]; height:StyleSheet.allow_ferries[Constants.HEIGHT]; + id:ferries_yes; next:back; prev:back; onClicked:{use(Genivi.NAVIGATIONCORE_FERRY)}} + StdButton { source:StyleSheet.avoid_ferries[Constants.SOURCE]; x:StyleSheet.avoid_ferries[Constants.X]; y:StyleSheet.avoid_ferries[Constants.Y]; width:StyleSheet.avoid_ferries[Constants.WIDTH]; height:StyleSheet.avoid_ferries[Constants.HEIGHT]; + id:ferries_no; next:back; prev:back; onClicked:{avoid(Genivi.NAVIGATIONCORE_FERRY)}} + + Text { + x:StyleSheet.tollRoadsText[Constants.X]; y:StyleSheet.tollRoadsText[Constants.Y]; width:StyleSheet.tollRoadsText[Constants.WIDTH]; height:StyleSheet.tollRoadsText[Constants.HEIGHT];color:StyleSheet.tollRoadsText[Constants.TEXTCOLOR];styleColor:StyleSheet.tollRoadsText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.tollRoadsText[Constants.PIXELSIZE]; + id: tollRoadsText; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("TollRoads") + } + StdButton { source:StyleSheet.allow_tollRoads[Constants.SOURCE]; x:StyleSheet.allow_tollRoads[Constants.X]; y:StyleSheet.allow_tollRoads[Constants.Y]; width:StyleSheet.allow_tollRoads[Constants.WIDTH]; height:StyleSheet.allow_tollRoads[Constants.HEIGHT]; + id:toll_roads_yes; next:back; prev:back; onClicked:{use(Genivi.NAVIGATIONCORE_TOLL_ROADS)}} + StdButton { source:StyleSheet.avoid_tollRoads[Constants.SOURCE]; x:StyleSheet.avoid_tollRoads[Constants.X]; y:StyleSheet.avoid_tollRoads[Constants.Y]; width:StyleSheet.avoid_tollRoads[Constants.WIDTH]; height:StyleSheet.avoid_tollRoads[Constants.HEIGHT]; + id:toll_roads_no; next:back; prev:back; onClicked:{avoid(Genivi.NAVIGATIONCORE_TOLL_ROADS)}} + + Text { + x:StyleSheet.motorWaysText[Constants.X]; y:StyleSheet.motorWaysText[Constants.Y]; width:StyleSheet.motorWaysText[Constants.WIDTH]; height:StyleSheet.motorWaysText[Constants.HEIGHT];color:StyleSheet.motorWaysText[Constants.TEXTCOLOR];styleColor:StyleSheet.motorWaysText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.motorWaysText[Constants.PIXELSIZE]; + id:motorWaysText; + style: Text.Sunken; + smooth: true + text: Genivi.gettext("MotorWays") + } + StdButton { source:StyleSheet.allow_motorways[Constants.SOURCE]; x:StyleSheet.allow_motorways[Constants.X]; y:StyleSheet.allow_motorways[Constants.Y]; width:StyleSheet.allow_motorways[Constants.WIDTH]; height:StyleSheet.allow_motorways[Constants.HEIGHT]; + id:motorways_yes; next:back; prev:back; onClicked:{use(Genivi.NAVIGATIONCORE_HIGHWAYS_MOTORWAYS)}} + StdButton { source:StyleSheet.avoid_motorways[Constants.SOURCE]; x:StyleSheet.avoid_motorways[Constants.X]; y:StyleSheet.avoid_motorways[Constants.Y]; width:StyleSheet.avoid_motorways[Constants.WIDTH]; height:StyleSheet.avoid_motorways[Constants.HEIGHT]; + id:motorways_no; next:back; prev:back; onClicked:{avoid(Genivi.NAVIGATIONCORE_HIGHWAYS_MOTORWAYS)}} + Text { x:StyleSheet.simulationTitle[Constants.X]; y:StyleSheet.simulationTitle[Constants.Y]; width:StyleSheet.simulationTitle[Constants.WIDTH]; height:StyleSheet.simulationTitle[Constants.HEIGHT];color:StyleSheet.simulationTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.simulationTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.simulationTitle[Constants.PIXELSIZE]; id:simulationTitle; @@ -57,7 +344,7 @@ NavigationAppHMIMenu { } StdButton { x:StyleSheet.simu_mode_enable[Constants.X]; y:StyleSheet.simu_mode_enable[Constants.Y]; width:StyleSheet.simu_mode_enable[Constants.WIDTH]; height:StyleSheet.simu_mode_enable[Constants.HEIGHT]; - id:simu_mode; next:back; prev:preferences; disabled:false; + id:simu_mode; next:back; prev:back; disabled:false; source: { if (Genivi.simulationMode==true) @@ -105,7 +392,7 @@ NavigationAppHMIMenu { } StdButton { x:StyleSheet.showroom_enable[Constants.X]; y:StyleSheet.showroom_enable[Constants.Y]; width:StyleSheet.showroom_enable[Constants.WIDTH]; height:StyleSheet.showroom_enable[Constants.HEIGHT]; - id:showroom; next:back; prev:preferences; disabled:false; + id:showroom; next:back; prev:back; disabled:false; source: { if (Genivi.showroom==true) @@ -145,29 +432,42 @@ NavigationAppHMIMenu { } StdButton { - source:StyleSheet.preferences[Constants.SOURCE]; x:StyleSheet.preferences[Constants.X]; y:StyleSheet.preferences[Constants.Y]; width:StyleSheet.preferences[Constants.WIDTH]; height:StyleSheet.preferences[Constants.HEIGHT];textColor:StyleSheet.preferencesText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.preferencesText[Constants.PIXELSIZE]; - id:preferences; text: Genivi.gettext("Preference"); disabled:false; next:languageAndUnit; prev:back; - onClicked: { - entryMenu("NavigationAppSettingsPreferences",menu); - } - } - - StdButton { - source:StyleSheet.languageAndUnit[Constants.SOURCE]; x:StyleSheet.languageAndUnit[Constants.X]; y:StyleSheet.languageAndUnit[Constants.Y]; width:StyleSheet.languageAndUnit[Constants.WIDTH]; height:StyleSheet.languageAndUnit[Constants.HEIGHT];textColor:StyleSheet.languageAndUnitText[Constants.TEXTCOLOR]; pixelSize:StyleSheet.languageAndUnitText[Constants.PIXELSIZE]; - id:languageAndUnit; text: Genivi.gettext("LanguageAndUnits"); disabled:false; next:back; prev:preferences; - onClicked: { - entryMenu("NavigationAppSettingsLanguageAndUnits",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"); disabled:false; next:simu_mode; prev:languageAndUnit; - onClicked:{leaveMenu();} + id:back; text: Genivi.gettext("Back"); disabled:false; next:simu_mode; prev:showroom; + onClicked:{ + disconnectSignals(); + leaveMenu(); + } } } Component.onCompleted: { + connectSignals(); + var res=Genivi.routing_GetCostModel(dbusIf); + var costmodel=res[1]; + var costModelsList=Genivi.routing_GetSupportedCostModels(dbusIf); + for (var i = 0 ; i < costModelsList[1].length ; i+=2) { + var button=Qt.createQmlObject('import QtQuick 2.1 ; import "Core"; StdButton { }',content,'dynamic'); + button.source=StyleSheet.cost_model[Constants.SOURCE]; + button.x=StyleSheet.cost_model[Constants.X]; + button.y=StyleSheet.cost_model[Constants.Y] + i*(StyleSheet.cost_model[Constants.HEIGHT]+10)/2; //to be improved + button.width=StyleSheet.cost_model[Constants.WIDTH]; + button.height=StyleSheet.cost_model[Constants.HEIGHT]; + button.textColor=StyleSheet.costModelValue[Constants.TEXTCOLOR]; + button.pixelSize=StyleSheet.costModelValue[Constants.PIXELSIZE]; + button.userdata=costModelsList[1][i+1]; + button.text=Genivi.CostModels[button.userdata]; + button.disabled=button.userdata == costmodel; + button.clicked.connect( + function(what) { + Genivi.routing_SetCostModel(dbusIf,what.userdata); + pageOpen(menu.pagefile); //reload the page + } + ); + } + + updateLanguageAndUnits(); + updatePreferences(); } } diff --git a/src/hmi/qml/NavigationAppSettingsLanguageAndUnits.qml b/src/hmi/qml/NavigationAppSettingsLanguageAndUnits.qml deleted file mode 100644 index 75b6ca0..0000000 --- a/src/hmi/qml/NavigationAppSettingsLanguageAndUnits.qml +++ /dev/null @@ -1,194 +0,0 @@ -/** -* @licence app begin@ -* SPDX-License-Identifier: MPL-2.0 -* -* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen -* -* \file NavigationSettingsLanguageAndUnits.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/NavigationAppSettingsSettingsLanguageAndUnits-css.js" as StyleSheet; -import lbs.plugin.dbusif 1.0 - -NavigationAppHMIMenu { - id: menu - property string pagefile:"NavigationAppSettingsLanguageAndUnits" - property Item configurationChangedSignal; - - DBusIf { - id: dbusIf - } - - function configurationChanged(args) - { //to be improved ! - Genivi.hookSignal("configurationChanged"); - for (var i=0; i < args[1].length;i+=2) { - switch (args[1][i+1]) { - case Genivi.NAVIGATIONCORE_LOCALE: - update(); - break; - case Genivi.NAVIGATIONCORE_UNITS_OF_MEASUREMENT: - update(); - break; - } - } - } - - function connectSignals() - { - configurationChangedSignal=Genivi.connect_configurationChangedSignal(dbusIf,menu); - } - - function disconnectSignals() - { - configurationChangedSignal.destroy(); - } - - function update() - { - var available_nav=Genivi.navigationcore_configuration_GetSupportedLocales(dbusIf); - var available_map=Genivi.mapviewer_configuration_GetSupportedLocales(dbusIf); - var current_nav=Genivi.navigationcore_configuration_GetLocale(dbusIf); - var current_map=Genivi.mapviewer_configuration_GetLocale(dbusIf); - var current_lang_nav; - var current_lang_map; - var lang_nav=[]; - var lang_map=[]; - - current_lang_nav=current_nav[1] + "_" + current_nav[3]; - current_lang_map=current_map[1] + "_" + current_map[3]; - - for (var i = 0 ; i < available_nav[1].length ; i+=2) { - lang_nav[available_nav[1][i+1][1]+"_"+available_nav[1][i+1][3]]=true; - } - - for (var i = 0 ; i < available_map[1].length ; i+=2) { - lang_map[available_map[1][i+1][1]+"_"+available_map[1][i+1][3]]=true; - } - - // only the locales for nav are used - for (var i = 0 ; i < content.children.length ; i++) { - var name=content.children[i].objectName; - if (name) { - content.children[i].visible=true; - if (name == current_lang_nav) { - content.children[i].disabled=true; - } - else { - content.children[i].disabled=false; - } - } - } - - Genivi.setlang(current_lang_nav); - - var units1,units2; - var res=Genivi.navigationcore_configuration_GetUnitsOfMeasurement(dbusIf); - - if (res[1][1] == Genivi.NAVIGATIONCORE_LENGTH) { - units1=res[1][3]; - } - var res1=Genivi.mapviewer_configuration_GetUnitsOfMeasurement(dbusIf); - if (res1[1][1] == Genivi.MAPVIEWER_LENGTH) { - units2=res1[1][3]; - } - unit_km.disabled=false; - unit_mile.disabled=false; - if (units1==Genivi.NAVIGATIONCORE_KM) unit_km.disabled=true; - if (units1==Genivi.NAVIGATIONCORE_MILE) unit_mile.disabled=true; - } - - function setLocale(language, country, script) - { - Genivi.navigationcore_configuration_SetLocale(dbusIf,language,country,script); - Genivi.mapviewer_configuration_SetLocale(dbusIf,language,country,script); - Genivi.setlang(language + "_" + country); - pageOpen(menu.pagefile); //reload page because of texts... - } - function setUnitsLength(units1,units2) - { - Genivi.navigationcore_configuration_SetUnitsOfMeasurementLength(dbusIf,units1); - Genivi.mapviewer_configuration_SetUnitsOfMeasurementLength(dbusIf,units2); - update(); - } - - NavigationAppHMIBgImage { - id: content - image:StyleSheet.navigation_app_settings_language_and_units_background[Constants.SOURCE]; - anchors { fill: parent; topMargin: parent.headlineHeight} - - Text { - x:StyleSheet.languagesTitle[Constants.X]; y:StyleSheet.languagesTitle[Constants.Y]; width:StyleSheet.languagesTitle[Constants.WIDTH]; height:StyleSheet.languagesTitle[Constants.HEIGHT];color:StyleSheet.languagesTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.languagesTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.languagesTitle[Constants.PIXELSIZE]; - id:languagesTitle; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("Language") - } - StdButton { objectName:"fra_FRA"; - source:StyleSheet.french_flag[Constants.SOURCE]; x:StyleSheet.french_flag[Constants.X]; y:StyleSheet.french_flag[Constants.Y]; width:StyleSheet.french_flag[Constants.WIDTH]; height:StyleSheet.french_flag[Constants.HEIGHT]; - id:fra_FRA; disabled:false; next:deu_DEU; prev:back; onClicked: {setLocale("fra","FRA","Latn");}} - StdButton { objectName:"deu_DEU"; - source:StyleSheet.german_flag[Constants.SOURCE]; x:StyleSheet.german_flag[Constants.X]; y:StyleSheet.german_flag[Constants.Y]; width:StyleSheet.german_flag[Constants.WIDTH]; height:StyleSheet.german_flag[Constants.HEIGHT]; - id:deu_DEU; disabled:false; next:eng_USA; prev:fra_FRA; onClicked: {setLocale("deu","DEU","Latn");}} - StdButton { objectName:"eng_USA"; - source:StyleSheet.usa_flag[Constants.SOURCE]; x:StyleSheet.usa_flag[Constants.X]; y:StyleSheet.usa_flag[Constants.Y]; width:StyleSheet.usa_flag[Constants.WIDTH]; height:StyleSheet.usa_flag[Constants.HEIGHT]; - id:eng_USA; disabled:false; next:jpn_JPN; prev:deu_DEU; onClicked: {setLocale("eng","USA","Latn");}} - StdButton { objectName:"jpn_JPN"; - source:StyleSheet.japanese_flag[Constants.SOURCE]; x:StyleSheet.japanese_flag[Constants.X]; y:StyleSheet.japanese_flag[Constants.Y]; width:StyleSheet.japanese_flag[Constants.WIDTH]; height:StyleSheet.japanese_flag[Constants.HEIGHT]; - id:jpn_JPN; disabled:false; next:back; prev:eng_USA; onClicked: {setLocale("jpn","JPN","Hrkt");}} - - Text { - x:StyleSheet.unitsTitle[Constants.X]; y:StyleSheet.unitsTitle[Constants.Y]; width:StyleSheet.unitsTitle[Constants.WIDTH]; height:StyleSheet.unitsTitle[Constants.HEIGHT];color:StyleSheet.unitsTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.unitsTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.unitsTitle[Constants.PIXELSIZE]; - id:unitsTitle; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("Units") - } - StdButton { source:StyleSheet.unit_km[Constants.SOURCE]; x:StyleSheet.unit_km[Constants.X]; y:StyleSheet.unit_km[Constants.Y]; width:StyleSheet.unit_km[Constants.WIDTH]; height:StyleSheet.unit_km[Constants.HEIGHT]; - id:unit_km; disabled:false; next:back; prev:back; - onClicked: { - setUnitsLength(Genivi.NAVIGATIONCORE_KM,Genivi.MAPVIEWER_KM);} - } - StdButton { source:StyleSheet.unit_mile[Constants.SOURCE]; x:StyleSheet.unit_mile[Constants.X]; y:StyleSheet.unit_mile[Constants.Y]; width:StyleSheet.unit_mile[Constants.WIDTH]; height:StyleSheet.unit_mile[Constants.HEIGHT]; - id:unit_mile; disabled:false; next:back; prev:back; - onClicked: { - setUnitsLength(Genivi.NAVIGATIONCORE_MILE,Genivi.MAPVIEWER_MILE);} - } - 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"); disabled:false; next:back; prev:back; - onClicked:{ - disconnectSignals(); - leaveMenu(); - } - } - - } - - Component.onCompleted: { - connectSignals(); - update(); - } -} diff --git a/src/hmi/qml/NavigationAppSettingsPreferences.qml b/src/hmi/qml/NavigationAppSettingsPreferences.qml deleted file mode 100644 index 0f06564..0000000 --- a/src/hmi/qml/NavigationAppSettingsPreferences.qml +++ /dev/null @@ -1,220 +0,0 @@ -/** -* @licence app begin@ -* SPDX-License-Identifier: MPL-2.0 -* -* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen -* -* \file NavigationSettingsPreferences.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/NavigationAppSettingsPreference-css.js" as StyleSheet; -import lbs.plugin.dbusif 1.0 -import lbs.plugin.preference 1.0 - -NavigationAppHMIMenu { - id: menu - property string pagefile:"NavigationAppSettingsPreferences" - - DBusIf { - id: dbusIf - } - -// please note that the preferences are hard coded, limited to three couples: -// (NAVIGATIONCORE_AVOID,NAVIGATIONCORE_HIGHWAYS_MOTORWAYS) -// (NAVIGATIONCORE_AVOID,NAVIGATIONCORE_TOLL_ROADS) -// (NAVIGATIONCORE_AVOID,NAVIGATIONCORE_FERRY) - - Preference { - source: 0 - mode: 0 - } - - function update() - { - Genivi.routing_SetRoutePreferences(dbusIf,""); //preferences applied to all countries - var active=Genivi.routing_GetRoutePreferences(dbusIf,""); - - var roadPreferenceList; - var conditionPreferenceList; - roadPreferenceList=active[1]; - conditionPreferenceList=active[3]; - var roadPreferenceMode,roadPreferenceSource; - var conditionPreferenceMode,conditionPreferenceSource; - - for(var i=0; i<roadPreferenceList.length; i+=2) - { - roadPreferenceMode=roadPreferenceList[i+1][1]; - roadPreferenceSource=roadPreferenceList[i+1][3]; - Genivi.roadPreferenceList[roadPreferenceSource]=roadPreferenceMode; - - if(roadPreferenceSource == Genivi.NAVIGATIONCORE_FERRY) - { - if(roadPreferenceMode == Genivi.NAVIGATIONCORE_AVOID) - { - ferries_yes.disabled=false; - ferries_no.disabled=true; - } - else - { - ferries_yes.disabled=true; - ferries_no.disabled=false; - } - } - else - { - if(roadPreferenceSource == Genivi.NAVIGATIONCORE_TOLL_ROADS) - { - if(roadPreferenceMode == Genivi.NAVIGATIONCORE_AVOID) - { - toll_roads_yes.disabled=false; - toll_roads_no.disabled=true; - } - else - { - toll_roads_yes.disabled=true; - toll_roads_no.disabled=false; - } - } - else - { - if(roadPreferenceSource == Genivi.NAVIGATIONCORE_HIGHWAYS_MOTORWAYS) - { - if(roadPreferenceMode == Genivi.NAVIGATIONCORE_AVOID) - { - motorways_yes.disabled=false; - motorways_no.disabled=true; - } - else - { - motorways_yes.disabled=true; - motorways_no.disabled=false; - } - } - } - } - } - } - - function use(preferenceSource) - { - Genivi.roadPreferenceList[preferenceSource]=Genivi.NAVIGATIONCORE_USE; - update(); - } - - function avoid(preferenceSource) - { - Genivi.roadPreferenceList[preferenceSource]=Genivi.NAVIGATIONCORE_AVOID; - update(); - } - - NavigationAppHMIBgImage { - id: content - image:StyleSheet.navigation_app_settings_preference_background[Constants.SOURCE]; - anchors { fill: parent; topMargin: parent.headlineHeight} - Text { - x:StyleSheet.costModelTitle[Constants.X]; y:StyleSheet.costModelTitle[Constants.Y]; width:StyleSheet.costModelTitle[Constants.WIDTH]; height:StyleSheet.costModelTitle[Constants.HEIGHT];color:StyleSheet.costModelTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.costModelTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.costModelTitle[Constants.PIXELSIZE]; - id:costModelTitle; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("CostModel") - } - - Text { - x:StyleSheet.routingPreferencesTitle[Constants.X]; y:StyleSheet.routingPreferencesTitle[Constants.Y]; width:StyleSheet.routingPreferencesTitle[Constants.WIDTH]; height:StyleSheet.routingPreferencesTitle[Constants.HEIGHT];color:StyleSheet.routingPreferencesTitle[Constants.TEXTCOLOR];styleColor:StyleSheet.routingPreferencesTitle[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.routingPreferencesTitle[Constants.PIXELSIZE]; - id:routingPreferencesTitle; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("RoutingPreferences") - } - - Text { - x:StyleSheet.ferriesText[Constants.X]; y:StyleSheet.ferriesText[Constants.Y]; width:StyleSheet.ferriesText[Constants.WIDTH]; height:StyleSheet.ferriesText[Constants.HEIGHT];color:StyleSheet.ferriesText[Constants.TEXTCOLOR];styleColor:StyleSheet.ferriesText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.ferriesText[Constants.PIXELSIZE]; - id: ferriesText; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("Ferries") - } - StdButton { source:StyleSheet.allow_ferries[Constants.SOURCE]; x:StyleSheet.allow_ferries[Constants.X]; y:StyleSheet.allow_ferries[Constants.Y]; width:StyleSheet.allow_ferries[Constants.WIDTH]; height:StyleSheet.allow_ferries[Constants.HEIGHT]; - id:ferries_yes; next:back; prev:back; onClicked:{use(Genivi.NAVIGATIONCORE_FERRY)}} - StdButton { source:StyleSheet.avoid_ferries[Constants.SOURCE]; x:StyleSheet.avoid_ferries[Constants.X]; y:StyleSheet.avoid_ferries[Constants.Y]; width:StyleSheet.avoid_ferries[Constants.WIDTH]; height:StyleSheet.avoid_ferries[Constants.HEIGHT]; - id:ferries_no; next:back; prev:back; onClicked:{avoid(Genivi.NAVIGATIONCORE_FERRY)}} - - Text { - x:StyleSheet.tollRoadsText[Constants.X]; y:StyleSheet.tollRoadsText[Constants.Y]; width:StyleSheet.tollRoadsText[Constants.WIDTH]; height:StyleSheet.tollRoadsText[Constants.HEIGHT];color:StyleSheet.tollRoadsText[Constants.TEXTCOLOR];styleColor:StyleSheet.tollRoadsText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.tollRoadsText[Constants.PIXELSIZE]; - id: tollRoadsText; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("TollRoads") - } - StdButton { source:StyleSheet.allow_tollRoads[Constants.SOURCE]; x:StyleSheet.allow_tollRoads[Constants.X]; y:StyleSheet.allow_tollRoads[Constants.Y]; width:StyleSheet.allow_tollRoads[Constants.WIDTH]; height:StyleSheet.allow_tollRoads[Constants.HEIGHT]; - id:toll_roads_yes; next:back; prev:back; onClicked:{use(Genivi.NAVIGATIONCORE_TOLL_ROADS)}} - StdButton { source:StyleSheet.avoid_tollRoads[Constants.SOURCE]; x:StyleSheet.avoid_tollRoads[Constants.X]; y:StyleSheet.avoid_tollRoads[Constants.Y]; width:StyleSheet.avoid_tollRoads[Constants.WIDTH]; height:StyleSheet.avoid_tollRoads[Constants.HEIGHT]; - id:toll_roads_no; next:back; prev:back; onClicked:{avoid(Genivi.NAVIGATIONCORE_TOLL_ROADS)}} - - Text { - x:StyleSheet.motorWaysText[Constants.X]; y:StyleSheet.motorWaysText[Constants.Y]; width:StyleSheet.motorWaysText[Constants.WIDTH]; height:StyleSheet.motorWaysText[Constants.HEIGHT];color:StyleSheet.motorWaysText[Constants.TEXTCOLOR];styleColor:StyleSheet.motorWaysText[Constants.STYLECOLOR]; font.pixelSize:StyleSheet.motorWaysText[Constants.PIXELSIZE]; - id:motorWaysText; - style: Text.Sunken; - smooth: true - text: Genivi.gettext("MotorWays") - } - StdButton { source:StyleSheet.allow_motorways[Constants.SOURCE]; x:StyleSheet.allow_motorways[Constants.X]; y:StyleSheet.allow_motorways[Constants.Y]; width:StyleSheet.allow_motorways[Constants.WIDTH]; height:StyleSheet.allow_motorways[Constants.HEIGHT]; - id:motorways_yes; next:back; prev:back; onClicked:{use(Genivi.NAVIGATIONCORE_HIGHWAYS_MOTORWAYS)}} - StdButton { source:StyleSheet.avoid_motorways[Constants.SOURCE]; x:StyleSheet.avoid_motorways[Constants.X]; y:StyleSheet.avoid_motorways[Constants.Y]; width:StyleSheet.avoid_motorways[Constants.WIDTH]; height:StyleSheet.avoid_motorways[Constants.HEIGHT]; - id:motorways_no; next:back; prev:back; onClicked:{avoid(Genivi.NAVIGATIONCORE_HIGHWAYS_MOTORWAYS)}} - - 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"); disabled:false; next:back; prev:back; onClicked:{leaveMenu();}} - - } - - Component.onCompleted: { - var res=Genivi.routing_GetCostModel(dbusIf); - var costmodel=res[1]; - var costModelsList=Genivi.routing_GetSupportedCostModels(dbusIf); - for (var i = 0 ; i < costModelsList[1].length ; i+=2) { - var button=Qt.createQmlObject('import QtQuick 2.1 ; import "Core"; StdButton { }',content,'dynamic'); - button.source=StyleSheet.cost_model[Constants.SOURCE]; - button.x=StyleSheet.cost_model[Constants.X]; - button.y=StyleSheet.cost_model[Constants.Y] + i*50; //to be improved - button.width=StyleSheet.cost_model[Constants.WIDTH]; - button.height=StyleSheet.cost_model[Constants.HEIGHT]; - button.textColor=StyleSheet.costModelValue[Constants.TEXTCOLOR]; - button.pixelSize=StyleSheet.costModelValue[Constants.PIXELSIZE]; - button.userdata=costModelsList[1][i+1]; - button.text=Genivi.CostModels[button.userdata]; - button.disabled=button.userdata == costmodel; - button.clicked.connect( - function(what) { - Genivi.routing_SetCostModel(dbusIf,what.userdata); - pageOpen(menu.pagefile); //reload the page - } - ); - } - - update(); - } -} |