From 1d45229ee1c6d6ba665ce72e932bd1169f53e7bd Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Fri, 30 Jun 2017 17:18:49 +0200 Subject: add keyboard and search on string --- src/fuel-stop-advisor/log.h | 154 +++++++++++++++++++++++++++++ src/hmi/config/fsa_london.conf | 4 + src/hmi/config/fsa_paris.conf | 4 + src/hmi/config/fsa_switzerland.conf | 4 + src/hmi/config/fsa_tokyo.conf | 4 + src/hmi/hmi-launcher/main.cpp | 2 - src/hmi/qml/Core/NavigationAppKeyboard.qml | 21 ---- src/hmi/qml/Core/genivi-capi.js | 21 +++- src/hmi/qml/Core/genivi-origin.js | 21 +++- src/hmi/qml/NavigationApp.qml | 28 +++++- src/hmi/qml/NavigationAppMain.qml | 2 +- src/hmi/qml/NavigationAppPOI.qml | 35 ++++--- src/hmi/qml/NavigationAppSearch.qml | 3 +- src/hmi/qml/NavigationAppSettings.qml | 73 +++++++------- src/run | 16 ++- 15 files changed, 300 insertions(+), 92 deletions(-) create mode 100644 src/fuel-stop-advisor/log.h (limited to 'src') diff --git a/src/fuel-stop-advisor/log.h b/src/fuel-stop-advisor/log.h new file mode 100644 index 0000000..4d946fb --- /dev/null +++ b/src/fuel-stop-advisor/log.h @@ -0,0 +1,154 @@ +/************************************************************************** +* @licence app begin@ +* +* SPDX-License-Identifier: MPL-2.0 +* +* \ingroup GNSSService +* +* \copyright Copyright (C) BMW Car IT GmbH 2011 +* Copyright (C) 2013, XS Embedded GmbH +* +* \license +* This Source Code Form is subject to the terms of the +* Mozilla Public License, 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/. +* +* @licence end@ +**************************************************************************/ + +#ifndef INCLUDE_LOG +#define INCLUDE_LOG + +// turn-on via cmake define: +// $ cmake -DWITH_DLT=1 -DDEBUG_ENABLED=1 .. + +#if (!DLT_ENABLED) +/*****************************************************************************/ +// use printf +#include + +// some type-name used instead of DLT context +typedef const char* NoDltContext; + +#define DLT_DECLARE_CONTEXT(CONTEXT) \ + NoDltContext CONTEXT; + +#define DLT_IMPORT_CONTEXT(CONTEXT) \ + extern NoDltContext CONTEXT; + +#define DLT_REGISTER_CONTEXT(CONTEXT, CONTEXT_ID, DESC) \ + CONTEXT = CONTEXT_ID; + +#define DLT_REGISTER_APP(CONTEXT, DESC) ; + +#define DLT_UNREGISTER_CONTEXT(CONTEXT) ; +#define DLT_UNREGISTER_APP() ; +#define dlt_free() ; + +// log calls +#if (!DEBUG_ENABLED) + +#define LOG_VERBOSE_MSG(context, msg) ; +#define LOG_VERBOSE(context, fmt, ...) ; + +#define LOG_DEBUG_MSG(context, msg) ; +#define LOG_DEBUG(context, fmt, ...) ; + +#define LOG_INFO_MSG(context, msg) ; +#define LOG_INFO(context, fmt, ...) ; + +#define LOG_WARNING_MSG(context, msg) ; +#define LOG_WARNING(context, fmt, ...) ; + +#else + +#define LOG_VERBOSE_MSG(context, msg) \ + fprintf(stderr, "[VERBO][%4s] " msg "\n", context) +#define LOG_VERBOSE(context, fmt, ...) \ + fprintf(stderr, "[VERBO][%4s] " fmt "\n", context, __VA_ARGS__) + +#define LOG_DEBUG_MSG(context, msg) \ + fprintf(stderr, "[DEBUG][%4s] " msg "\n", context) +#define LOG_DEBUG(context, fmt, ...) \ + fprintf(stderr, "[DEBUG][%4s] " fmt "\n", context, __VA_ARGS__) + +#define LOG_INFO_MSG(context, msg) \ + fprintf(stderr, "[INFO ][%4s] " msg "\n", context) +#define LOG_INFO(context, fmt, ...) \ + fprintf(stderr, "[INFO ][%4s] " fmt "\n", context, __VA_ARGS__) + +#define LOG_WARNING_MSG(context, msg) \ + fprintf(stderr, "[WARN ][%4s] " msg "\n", context) +#define LOG_WARNING(context, fmt, ...) \ + fprintf(stderr, "[WARN ][%4s] " fmt "\n", context, __VA_ARGS__) +#endif + +#define LOG_ERROR_MSG(context, msg) \ + fprintf(stderr, "[ERROR][%4s] " msg "\n", context) +#define LOG_ERROR(context, fmt, ...) \ + fprintf(stderr, "[ERROR][%4s] " fmt "\n", context, __VA_ARGS__) + +#define LOG_FATAL_MSG(context, msg) \ + fprintf(stderr, "[FATAL][%4s] " msg "\n", context) +#define LOG_FATAL(context, fmt, ...) \ + fprintf(stderr, "[FATAL][%4s] " fmt "\n", context, __VA_ARGS__) + +#else /* DLT_ENABLED */ +/*****************************************************************************/ +// use DLT +#include "dlt.h" + +typedef const char* Context; + +#define LOG_VERBOSE_MSG(context, msg) \ + DLT_LOG(context, DLT_LOG_VERBOSE, DLT_STRING(msg)); +#define LOG_VERBOSE(context, fmt, ...) \ + { \ + char logBuffer[256]; \ + sprintf(logBuffer, fmt, __VA_ARGS__); \ + DLT_LOG(context, DLT_LOG_VERBOSE, DLT_STRING(logBuffer)); \ + } +#define LOG_DEBUG_MSG(context, msg) \ + DLT_LOG(context, DLT_LOG_DEBUG, DLT_STRING(msg)); +#define LOG_DEBUG(context, fmt, ...) \ + { \ + char logBuffer[256]; \ + sprintf(logBuffer, fmt, __VA_ARGS__); \ + DLT_LOG(context, DLT_LOG_DEBUG, DLT_STRING(logBuffer)); \ + } +#define LOG_INFO_MSG(context, msg) \ + DLT_LOG(context, DLT_LOG_INFO, DLT_STRING(msg)); +#define LOG_INFO(context, fmt, ...) \ + { \ + char logBuffer[256]; \ + sprintf(logBuffer, fmt, __VA_ARGS__); \ + DLT_LOG(context, DLT_LOG_INFO, DLT_STRING(logBuffer)); \ + } +#define LOG_WARNING_MSG(context, msg) \ + DLT_LOG(context, DLT_LOG_WARN, DLT_STRING(msg)); +#define LOG_WARNING(context, fmt, ...) \ + { \ + char logBuffer[256]; \ + sprintf(logBuffer, fmt, __VA_ARGS__); \ + DLT_LOG(context, DLT_LOG_WARN, DLT_STRING(logBuffer)); \ + } +#define LOG_ERROR_MSG(context, msg) \ + DLT_LOG(context, DLT_LOG_ERROR, DLT_STRING(msg)); +#define LOG_ERROR(context, fmt, ...) \ + { \ + char logBuffer[256]; \ + sprintf(logBuffer, fmt, __VA_ARGS__); \ + DLT_LOG(context, DLT_LOG_ERROR, DLT_STRING(logBuffer)); \ + } +#define LOG_FATAL_MSG(context, msg) \ + DLT_LOG(context, DLT_LOG_FATAL, DLT_STRING(msg)); +#define LOG_FATAL(context, fmt, ...) \ + { \ + char logBuffer[256]; \ + sprintf(logBuffer, fmt, __VA_ARGS__); \ + DLT_LOG(context, DLT_LOG_FATAL, DLT_STRING(logBuffer)); \ + } + +#endif /* DLT_ENABLED */ + +#endif /* INCLUDE_LOG */ diff --git a/src/hmi/config/fsa_london.conf b/src/hmi/config/fsa_london.conf index 48c782a..c8d05c6 100644 --- a/src/hmi/config/fsa_london.conf +++ b/src/hmi/config/fsa_london.conf @@ -11,4 +11,8 @@ country=United Kingdom city=London street=Culworth Street number=1 +[Settings] +simulationMode=true +showroom=true +autoguidance=false diff --git a/src/hmi/config/fsa_paris.conf b/src/hmi/config/fsa_paris.conf index 674f9ff..873a3d1 100644 --- a/src/hmi/config/fsa_paris.conf +++ b/src/hmi/config/fsa_paris.conf @@ -11,4 +11,8 @@ country=France city=Versailles street=Rue Colbert number=13 +[Settings] +simulationMode=false +showroom=false +autoguidance=false diff --git a/src/hmi/config/fsa_switzerland.conf b/src/hmi/config/fsa_switzerland.conf index a07afe7..4b0e76a 100644 --- a/src/hmi/config/fsa_switzerland.conf +++ b/src/hmi/config/fsa_switzerland.conf @@ -11,4 +11,8 @@ country=Switzerland city=Lausanne street=Rue de Midi number=8 +[Settings] +simulationMode=true +showroom=true +autoguidance=false diff --git a/src/hmi/config/fsa_tokyo.conf b/src/hmi/config/fsa_tokyo.conf index 9b56b1f..f0dea7f 100644 --- a/src/hmi/config/fsa_tokyo.conf +++ b/src/hmi/config/fsa_tokyo.conf @@ -11,4 +11,8 @@ country=Japan city=東京 street=井ノ頭通り number=17 +[Settings] +simulationMode=true +showroom=true +autoguidance=false diff --git a/src/hmi/hmi-launcher/main.cpp b/src/hmi/hmi-launcher/main.cpp index 31ae95c..6bc7e73 100644 --- a/src/hmi/hmi-launcher/main.cpp +++ b/src/hmi/hmi-launcher/main.cpp @@ -57,8 +57,6 @@ int main(int argc, char ** argv) Settings* settings=new Settings; settings->setIniCodec("UTF-8"); - QString toto=settings->getValue("DefaultAddress/city").toString(); - int rc = 0; QQmlEngine engine; diff --git a/src/hmi/qml/Core/NavigationAppKeyboard.qml b/src/hmi/qml/Core/NavigationAppKeyboard.qml index 119fe56..eac1bc2 100644 --- a/src/hmi/qml/Core/NavigationAppKeyboard.qml +++ b/src/hmi/qml/Core/NavigationAppKeyboard.qml @@ -89,8 +89,6 @@ Item { 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; } @@ -102,25 +100,6 @@ Item { shift(shiftlevel); } - function activateAllKeys() - { - var keys; - keys='\b'+'␣'+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - if(Genivi.g_language ==="eng"){ - }else{ - if(Genivi.g_language==="fra"){ - }else{ - if(Genivi.g_language==="jpn"){ - keys+="あかさたなはまやらわいきしちにひみりをうくすつぬふむゆるんえけせてねへめれ”おこそとのほもよろ°"; - }else{ - if(Genivi.g_language==="deu"){ - } - } - } - } - setactivekeys(keys,true); - } - function shift(what) { shiftlevel=what; secondLayout=""; diff --git a/src/hmi/qml/Core/genivi-capi.js b/src/hmi/qml/Core/genivi-capi.js index 22724e6..697a571 100644 --- a/src/hmi/qml/Core/genivi-capi.js +++ b/src/hmi/qml/Core/genivi-capi.js @@ -38,7 +38,8 @@ var g_mapviewer_session=["uint32",0]; var g_mapviewer_handle=["uint32",0]; var g_mapviewer_handle2=["uint32",0]; var g_poisearch_handle=["uint32",0]; -var g_language,g_country,g_script; +var g_language,g_country,g_script; //initialized by conf file +var g_default_category_name='fuel' var data=new Array; data['destination']=new Array; //the destination @@ -54,9 +55,9 @@ var categoriesIdNameList; var translations=new Array; -var simulationMode=false;// simulation mode off by default -var showroom=false; //showroom off by default -var autoguidance=false; //no automatic display route on guidance by default +var simulationMode; //initialized by conf file +var showroom; //initialized by conf file +var autoguidance; //initialized by conf file var guidance_activated=false; var route_calculated=false; @@ -326,6 +327,11 @@ var japaneseLayout={   'かな','ABC','','','','','','','','←', ], }; +var allKeys; +var germanAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +var frenchAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +var englishAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +var japaneseAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789あかさたなはまやらわいきしちにひみりをうくすつぬふむゆるんえけせてねへめれ”おこそとのほもよろ°アカサタナハマヤラワイキシチニヒミリヲウクスツヌフムユルンエケセテネヘメレオコソトノホモヨロ"; // Language and text function setlang(language,country,script) @@ -337,6 +343,7 @@ function setlang(language,country,script) Qt.include("../../translations/"+g_language + "_" + g_country+".js"); if(g_language==="eng"){ keyboardLayout=englishLayout; + allKeys=englishAllKeys; kbdFirstLayout="ABC"; kbdSecondLayout="123"; kbdColumns=8; //number of rows per line @@ -346,6 +353,7 @@ function setlang(language,country,script) }else{ if(g_language==="fra"){ keyboardLayout=frenchLayout; + allKeys=frenchAllKeys; kbdFirstLayout="ABC"; kbdSecondLayout="123"; kbdColumns=8; //number of rows per line @@ -355,6 +363,7 @@ function setlang(language,country,script) }else{ if(g_language==="jpn"){ keyboardLayout=japaneseLayout; + allKeys=japaneseAllKeys; kbdFirstLayout="かな"; kbdSecondLayout="カナ"; kbdColumns=10; //number of rows per line @@ -364,6 +373,7 @@ function setlang(language,country,script) }else{ if(g_language==="deu"){ keyboardLayout=germanLayout; + allKeys=germanAllKeys; kbdFirstLayout="ABC"; kbdSecondLayout="123"; kbdColumns=8; //number of rows per line @@ -373,6 +383,7 @@ function setlang(language,country,script) }else{ //default keyboardLayout=germanLayout; + allKeys=germanAllKeys; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -970,7 +981,7 @@ function mapviewer_GetDisplayedRoutes(dbusIf) function mapviewer_SetMapViewScale(dbusIf,scaleID) { - mapviewercontrol_message(dbusIf,"setMapViewScale", ["uint16",scaleID]); + mapviewercontrol_message(dbusIf,"setMapViewScale", ["uint8",scaleID]); } function mapviewer_SetMapViewScaleByDelta(dbusIf,scaleDelta) diff --git a/src/hmi/qml/Core/genivi-origin.js b/src/hmi/qml/Core/genivi-origin.js index f58a500..26dc7ea 100644 --- a/src/hmi/qml/Core/genivi-origin.js +++ b/src/hmi/qml/Core/genivi-origin.js @@ -38,7 +38,8 @@ var g_mapviewer_session=["uint32",0]; var g_mapviewer_handle=["uint32",0]; var g_mapviewer_handle2=["uint32",0]; var g_poisearch_handle=["uint32",0]; -var g_language,g_country,g_script; +var g_language,g_country,g_script; //initialized by conf file +var g_default_category_name='fuel' var data=new Array; data['destination']=new Array; //the destination @@ -54,9 +55,9 @@ var categoriesIdNameList; var translations=new Array; -var simulationMode=false;// simulation mode off by default -var showroom=false; //showroom off by default -var autoguidance=false; //no automatic display route on guidance by default +var simulationMode; //initialized by conf file +var showroom; //initialized by conf file +var autoguidance; //initialized by conf file var guidance_activated=false; var route_calculated=false; @@ -326,6 +327,11 @@ var japaneseLayout={   'かな','ABC','','','','','','','','←', ], }; +var allKeys; +var germanAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +var frenchAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +var englishAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +var japaneseAllKeys="\b ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789あかさたなはまやらわいきしちにひみりをうくすつぬふむゆるんえけせてねへめれ”おこそとのほもよろ°アカサタナハマヤラワイキシチニヒミリヲウクスツヌフムユルンエケセテネヘメレオコソトノホモヨロ"; // Language and text function setlang(language,country,script) @@ -337,6 +343,7 @@ function setlang(language,country,script) Qt.include("../../translations/"+g_language + "_" + g_country+".js"); if(g_language==="eng"){ keyboardLayout=englishLayout; + allKeys=englishAllKeys; kbdFirstLayout="ABC"; kbdSecondLayout="123"; kbdColumns=8; //number of rows per line @@ -346,6 +353,7 @@ function setlang(language,country,script) }else{ if(g_language==="fra"){ keyboardLayout=frenchLayout; + allKeys=frenchAllKeys; kbdFirstLayout="ABC"; kbdSecondLayout="123"; kbdColumns=8; //number of rows per line @@ -355,6 +363,7 @@ function setlang(language,country,script) }else{ if(g_language==="jpn"){ keyboardLayout=japaneseLayout; + allKeys=japaneseAllKeys; kbdFirstLayout="かな"; kbdSecondLayout="カナ"; kbdColumns=10; //number of rows per line @@ -364,6 +373,7 @@ function setlang(language,country,script) }else{ if(g_language==="deu"){ keyboardLayout=germanLayout; + allKeys=germanAllKeys; kbdFirstLayout="ABC"; kbdSecondLayout="123"; kbdColumns=8; //number of rows per line @@ -373,6 +383,7 @@ function setlang(language,country,script) }else{ //default keyboardLayout=germanLayout; + allKeys=germanAllKeys; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -967,7 +978,7 @@ function mapviewer_GetDisplayedRoutes(dbusIf) function mapviewer_SetMapViewScale(dbusIf,scaleID) { - mapviewercontrol_message(dbusIf,"SetMapViewScale", ["uint16",scaleID]); + mapviewercontrol_message(dbusIf,"SetMapViewScale", ["uint8",scaleID]); } function mapviewer_SetMapViewScaleByDelta(dbusIf,scaleDelta) diff --git a/src/hmi/qml/NavigationApp.qml b/src/hmi/qml/NavigationApp.qml index 56ea5fc..a21746f 100644 --- a/src/hmi/qml/NavigationApp.qml +++ b/src/hmi/qml/NavigationApp.qml @@ -50,6 +50,16 @@ ApplicationWindow { component = Qt.createQmlObject(page+"{}",container,"dynamic"); } + function saveSettings() + { + Settings.setValue("Settings/simulationMode",Genivi.simulationMode); + Settings.setValue("Settings/showroom",Genivi.showroom); + Settings.setValue("Settings/autoguidance",Genivi.autoguidance); + Settings.setValue("Locale/language",Genivi.g_language) + Settings.setValue("Locale/country",Genivi.g_country); + Settings.setValue("Locale/script",Genivi.g_script); + } + //------------------------------------------// // Management of the DBus exchanges //------------------------------------------// @@ -64,10 +74,24 @@ ApplicationWindow { Component.onCompleted: { //init persistent data + //NB: settings are stored as strings, so it may need some rework for persistent data that are not strings (to be improved ?) Genivi.setlang(Settings.getValue("Locale/language"),Settings.getValue("Locale/country"),Settings.getValue("Locale/script")); Genivi.setDefaultPosition(Settings.getValue("DefaultPosition/latitude"),Settings.getValue("DefaultPosition/longitude"),Settings.getValue("DefaultPosition/altitude")); Genivi.setDefaultAddress(Settings.getValue("DefaultAddress/country"),Settings.getValue("DefaultAddress/city"),Settings.getValue("DefaultAddress/street"),Settings.getValue("DefaultAddress/number")); + if(Settings.getValue("Settings/simulationMode")==="true") + Genivi.simulationMode=true; + else + Genivi.simulationMode=false; + if(Settings.getValue("Settings/showroom")==="true") + Genivi.showroom=true; + else + Genivi.showroom=false; + if(Settings.getValue("Settings/autoguidance")==="true") + Genivi.autoguidance=true; + else + Genivi.autoguidance=false; + //configure the middleware Genivi.navigationcore_configuration_SetLocale(dbusIf,Genivi.g_language,Genivi.g_country,Genivi.g_script); @@ -76,13 +100,15 @@ ApplicationWindow { Genivi.initScale(dbusIf); //set verbose mode on - Genivi.setVerbose(); + //Genivi.setVerbose(); //launch the HMI load("NavigationAppMain"); } Component.onDestruction: { + saveSettings(); + //release the map viewer Genivi.mapviewer_handle_clear(dbusIf); } diff --git a/src/hmi/qml/NavigationAppMain.qml b/src/hmi/qml/NavigationAppMain.qml index bcf161c..a65d065 100644 --- a/src/hmi/qml/NavigationAppMain.qml +++ b/src/hmi/qml/NavigationAppMain.qml @@ -124,7 +124,7 @@ 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; - disabled:!(vehicleLocated || Genivi.showroom ) + disabled: !(vehicleLocated|Genivi.showroom) onClicked: { Genivi.data['display_on_map']='show_current_position'; entryMenu("NavigationAppBrowseMap",menu); diff --git a/src/hmi/qml/NavigationAppPOI.qml b/src/hmi/qml/NavigationAppPOI.qml index 1a74dbe..34f088a 100644 --- a/src/hmi/qml/NavigationAppPOI.qml +++ b/src/hmi/qml/NavigationAppPOI.qml @@ -36,7 +36,6 @@ import lbs.plugin.dbusif 1.0 NavigationAppHMIMenu { id: menu property string pagefile:"NavigationAppPOI" - property string extraspell; property string all_categories: "all categories" property string poiCategoryName property bool vehicleLocated: false @@ -92,11 +91,6 @@ NavigationAppHMIMenu { select_search.update(); } - function spell(input) - { - keyboardArea.destination.text = input; - } - function displayCategoryList() { var model=view.model; @@ -105,10 +99,10 @@ NavigationAppHMIMenu { if(Genivi.categoriesIdNameList[i+1][3]!==all_categories) model.append({"name":Genivi.categoriesIdNameList[i+1][3],"number":i/2}); } - categoryValue.text=model.get(0).name; + categoryValue.text=model.get(0).name; // to be clarified } - function displayPoiList() + function searchPois() { var model=view.model; var ids=[]; @@ -136,10 +130,17 @@ NavigationAppHMIMenu { Genivi.poisearch_SetCenter(dbusIf,latitude,longitude,0); Genivi.poisearch_SetCategories(dbusIf,categoriesAndRadiusList); - Genivi.poisearch_StartPoiSearch(dbusIf,"",Genivi.POISERVICE_SORT_BY_DISTANCE); + Genivi.poisearch_StartPoiSearch(dbusIf,keyboardArea.destination.text,Genivi.POISERVICE_SORT_BY_DISTANCE); var attributeList=[]; attributeList[0]=0; var res=Genivi.poisearch_RequestResultList(dbusIf,Genivi.offset,Genivi.maxResultListSize,attributeList); + if(res[3]===0) + { + //no match + //to do something to inform the user + return + } + var res_win=res[5]; var i; for (i = 0 ; i < res_win.length ; i+=2) { @@ -173,7 +174,7 @@ NavigationAppHMIMenu { //------------------------------------------// Keys.onPressed: { if (event.text) { - if (event.text == '\b') { + if (event.text === '\b') { if (text.text.length) { text.text=text.text.slice(0,-1); } @@ -184,6 +185,11 @@ NavigationAppHMIMenu { } } + function spell(input) + { + keyboardArea.destination.text = keyboardArea.destination.text+input; + } + NavigationAppHMIBgImage { image:StyleSheet.navigation_app_poi_background[Constants.SOURCE]; anchors { fill: parent; topMargin: parent.headlineHeight } @@ -331,12 +337,13 @@ NavigationAppHMIMenu { NavigationAppKeyboard { x:StyleSheet.keyboardArea[Constants.X]; y:StyleSheet.keyboardArea[Constants.Y]; width:StyleSheet.keyboardArea[Constants.WIDTH]; height:StyleSheet.keyboardArea[Constants.HEIGHT]; id: keyboardArea; + visible: true; destination: poiValue; firstLayout: Genivi.kbdFirstLayout; secondLayout: Genivi.kbdSecondLayout; next: select_search; prev: poiKeyboard; - onKeypress: { } + onKeypress: { } } StdButton { @@ -344,7 +351,7 @@ NavigationAppHMIMenu { id:select_search disabled:!(vehicleLocated || Genivi.showroom ); onClicked: { - displayPoiList(); + searchPois(); } } StdButton { @@ -419,12 +426,11 @@ NavigationAppHMIMenu { selectedValueTitle.visible=true; select_reroute.disabled=false; select_display_on_map.disabled=false; - displayPoiList(); }else{ Genivi.poi_data=[]; selectedValue.text="Lat:\nLon:\nDist:\n"; for (var j = 0 ; j < Genivi.categoriesIdNameList.length ; j+=2) { - if (Genivi.categoriesIdNameList[j+1][3] == 'fuel') { + if (Genivi.categoriesIdNameList[j+1][3] === Genivi.g_default_category_name) { Genivi.category_id=Genivi.categoriesIdNameList[j+1][1]; poiCategoryName=Genivi.categoriesIdNameList[j+1][3]; } @@ -434,6 +440,7 @@ NavigationAppHMIMenu { categoryValue.text=poiCategoryName; keyboardArea.destination=poiValue; // by default + keyboardArea.setactivekeys(Genivi.allKeys,true); poiFrame.visible=true; if(!Genivi.showroom) { diff --git a/src/hmi/qml/NavigationAppSearch.qml b/src/hmi/qml/NavigationAppSearch.qml index e058a3d..32e0e10 100644 --- a/src/hmi/qml/NavigationAppSearch.qml +++ b/src/hmi/qml/NavigationAppSearch.qml @@ -641,7 +641,7 @@ NavigationAppHMIMenu { { spell(''); } else { //there's a bug for street - keyboardArea.activateAllKeys(); + keyboardArea.setactivekeys(Genivi.allKeys,true); listArea.model.clear(); } } @@ -1025,6 +1025,7 @@ NavigationAppHMIMenu { destination: countryValue; // by default firstLayout: Genivi.kbdFirstLayout; secondLayout: Genivi.kbdSecondLayout; + shiftlevel: Genivi.kbdFirstLayout; next: listArea; prev: numberKeyboard; onKeypress: { spell(what); } diff --git a/src/hmi/qml/NavigationAppSettings.qml b/src/hmi/qml/NavigationAppSettings.qml index d46b006..9f3feca 100644 --- a/src/hmi/qml/NavigationAppSettings.qml +++ b/src/hmi/qml/NavigationAppSettings.qml @@ -231,6 +231,34 @@ NavigationAppHMIMenu { updatePreferences(); } + function updateSettings() + { + if (Genivi.autoguidance===true) + { + autoguidance.setState("ENABLE"); + } + else + { + autoguidance.setState("DISABLE"); + } + if (Genivi.simulationMode===true) + { + simu_mode.setState("ENABLE"); + } + else + { + simu_mode.setState("DISABLE"); + } + if (Genivi.showroom===true) + { + showroom.setState("ENABLE"); + } + else + { + showroom.setState("DISABLE"); + } + } + //------------------------------------------// // Menu elements //------------------------------------------// @@ -339,18 +367,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:back; disabled:false; - source: - { - if (Genivi.simulationMode==true) - { - source=StyleSheet.simu_mode_enable[Constants.SOURCE]; - } - else - { - source=StyleSheet.simu_mode_disable[Constants.SOURCE]; - } - } - + source:StyleSheet.simu_mode_enable[Constants.SOURCE]; function setState(name) { if (name=="ENABLE") @@ -387,21 +404,10 @@ 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:back; disabled:false; - source: - { - if (Genivi.showroom==true) - { - source=StyleSheet.showroom_enable[Constants.SOURCE]; - } - else - { - source=StyleSheet.showroom_disable[Constants.SOURCE]; - } - } - + source: StyleSheet.showroom_disable[Constants.SOURCE]; function setState(name) { - if (name=="ENABLE") + if (name==="ENABLE") { source=StyleSheet.showroom_enable[Constants.SOURCE]; } @@ -412,7 +418,7 @@ NavigationAppHMIMenu { } onClicked: { - if (Genivi.showroom ===true) + if (Genivi.showroom===true) { Genivi.showroom=false; showroom.setState("DISABLE"); @@ -435,18 +441,7 @@ NavigationAppHMIMenu { StdButton { x:StyleSheet.autoguidance_enable[Constants.X]; y:StyleSheet.autoguidance_enable[Constants.Y]; width:StyleSheet.autoguidance_enable[Constants.WIDTH]; height:StyleSheet.autoguidance_enable[Constants.HEIGHT]; id:autoguidance; next:back; prev:back; disabled:false; - source: - { - if (Genivi.autoguidance==true) - { - source=StyleSheet.autoguidance_enable[Constants.SOURCE]; - } - else - { - source=StyleSheet.autoguidance_disable[Constants.SOURCE]; - } - } - + source: StyleSheet.autoguidance_disable[Constants.SOURCE]; function setState(name) { if (name=="ENABLE") @@ -478,6 +473,7 @@ NavigationAppHMIMenu { id:back; text: Genivi.gettext("Back"); disabled:false; next:simu_mode; prev:showroom; onClicked:{ disconnectSignals(); + saveSettings(); leaveMenu(); } } @@ -516,5 +512,6 @@ NavigationAppHMIMenu { updateLanguageAndUnits(); updatePreferences(); + updateSettings(); } } diff --git a/src/run b/src/run index 5dbba56..d74be41 100755 --- a/src/run +++ b/src/run @@ -108,6 +108,7 @@ wm="" #to store the current window manager (in case of start with the layer mana verbose=0 #no debug or log messages displayed center="4612 N 0608 E" #geneva config_file=fsa_switzerland.conf #switzerland settings +persistent=0 #reuse of persistent data disabled CUR_DIR=$PWD BIN_DIR=$CUR_DIR/build @@ -165,7 +166,7 @@ VEHICLE_GATEWAY_BIN_DIR=$BIN_DIR/$VEHICLE_GATEWAY devices="/dev/ttyUSB0 /dev/ttyACM0" # options analysis -while getopts a:c:df:g:lnorvx opt +while getopts a:c:df:g:lnoprvx opt do case $opt in a) #select another hmi panel @@ -213,6 +214,9 @@ do o) #enable the log file log=1 ;; + p) #enable the reuse of persistent data + persistent=1 + ;; r) #disable the log replayer replayer=0 ;; @@ -224,7 +228,7 @@ do ;; \?) echo "Usage:" - echo "$0 [-a application][-c center][-glnorvx]" + echo "$0 [-a application][-c center][-glnoprvx]" echo "-a: Set application (default application.qml)" echo "-c: Set center (supported values: paris,tokyo,longitude latitude). Default is geneve" echo "-d: Run subprocesses within gdb (only with -x)" @@ -232,6 +236,7 @@ do echo "-l: Use layermanager" echo "-n: Don't start enhanced positioning service" echo "-o: Create log file of subprocess output" + echo "-p: Reuse of persistent data (i.e. in $HOME, so don't reinit it with default file)" echo "-r: Don't start replayer" echo "-v: Enable the output of log or debug messages" echo "-x: Run subprocesses in own xterm to get separated log messages (doesn't make sense with -l)" @@ -263,8 +268,11 @@ export NAVIT_GRAPHICS='sdl' # set the language to en_US for navit export LANGUAGE=en_US -# set the config file for Qt -cp $CONFIG_DIR/$config_file $HOME/.config/navigation/fsa.conf +if [ "$persistent" = 0 ] +then + # reinit the config file for Qt (persistent data) + cp $CONFIG_DIR/$config_file $HOME/.config/navigation/fsa.conf +fi # start the automotive message broker and wait for dbus service cd $AUTOMOTIVE_MESSAGE_BROKER_BIN_DIR -- cgit v1.2.1