diff options
Diffstat (limited to 'src/hmi')
-rw-r--r-- | src/hmi/config/fsa_london.conf | 14 | ||||
-rw-r--r-- | src/hmi/config/fsa_paris.conf | 14 | ||||
-rw-r--r-- | src/hmi/config/fsa_switzerland.conf | 14 | ||||
-rw-r--r-- | src/hmi/config/fsa_tokyo.conf | 14 | ||||
-rw-r--r-- | src/hmi/hmi-launcher/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/hmi/hmi-launcher/main.cpp | 13 | ||||
-rw-r--r-- | src/hmi/hmi-launcher/settings.h | 50 | ||||
-rw-r--r-- | src/hmi/qml/NavigationApp.qml | 14 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppSettings.qml | 6 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppTokyo.qml | 80 |
10 files changed, 130 insertions, 95 deletions
diff --git a/src/hmi/config/fsa_london.conf b/src/hmi/config/fsa_london.conf new file mode 100644 index 0000000..48c782a --- /dev/null +++ b/src/hmi/config/fsa_london.conf @@ -0,0 +1,14 @@ +[Locale] +language=eng +country=USA +script=Latn +[DefaultPosition] +latitude=51.507576 +longitude=-0.127878 +altitude=20 +[DefaultAddress] +country=United Kingdom +city=London +street=Culworth Street +number=1 + diff --git a/src/hmi/config/fsa_paris.conf b/src/hmi/config/fsa_paris.conf new file mode 100644 index 0000000..674f9ff --- /dev/null +++ b/src/hmi/config/fsa_paris.conf @@ -0,0 +1,14 @@ +[Locale] +language=eng +country=USA +script=Latn +[DefaultPosition] +latitude=48.840051 +longitude=2.338001 +altitude=20 +[DefaultAddress] +country=France +city=Versailles +street=Rue Colbert +number=13 + diff --git a/src/hmi/config/fsa_switzerland.conf b/src/hmi/config/fsa_switzerland.conf new file mode 100644 index 0000000..a07afe7 --- /dev/null +++ b/src/hmi/config/fsa_switzerland.conf @@ -0,0 +1,14 @@ +[Locale] +language=eng +country=USA +script=Latn +[DefaultPosition] +latitude=46.202038 +longitude=6.146845 +altitude=392 +[DefaultAddress] +country=Switzerland +city=Lausanne +street=Rue de Midi +number=8 + diff --git a/src/hmi/config/fsa_tokyo.conf b/src/hmi/config/fsa_tokyo.conf new file mode 100644 index 0000000..9b56b1f --- /dev/null +++ b/src/hmi/config/fsa_tokyo.conf @@ -0,0 +1,14 @@ +[Locale] +language=jpn +country=JPN +script=Hrkt +[DefaultPosition] +latitude=35.758795 +longitude=139.316533 +altitude=19 +[DefaultAddress] +country=Japan +city=東京 +street=井ノ頭通り +number=17 + diff --git a/src/hmi/hmi-launcher/CMakeLists.txt b/src/hmi/hmi-launcher/CMakeLists.txt index 33cca2c..319a001 100644 --- a/src/hmi/hmi-launcher/CMakeLists.txt +++ b/src/hmi/hmi-launcher/CMakeLists.txt @@ -127,6 +127,7 @@ set (SRC_TO_MOC ${CMAKE_CURRENT_SOURCE_DIR}/wheelarea.h ${CMAKE_CURRENT_SOURCE_DIR}/wheelareaplugin.h ${CMAKE_CURRENT_SOURCE_DIR}/preference.h + ${CMAKE_CURRENT_SOURCE_DIR}/settings.h ) execute_process( WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" @@ -153,12 +154,7 @@ add_executable(hmi-launcher main.cpp dbusif.cpp wheelareaplugin.cpp - wheelareaplugin.h preference.cpp - dbusif.h - dbusifsignal.h - wheelarea.h - preference.h ) target_link_libraries(hmi-launcher ${LIBRARIES}) diff --git a/src/hmi/hmi-launcher/main.cpp b/src/hmi/hmi-launcher/main.cpp index 7e6b662..31ae95c 100644 --- a/src/hmi/hmi-launcher/main.cpp +++ b/src/hmi/hmi-launcher/main.cpp @@ -38,6 +38,7 @@ #include "dbusif.h" #include "wheelarea.h" #include "preference.h" +#include "settings.h" int main(int argc, char ** argv) { @@ -48,9 +49,21 @@ int main(int argc, char ** argv) qmlRegisterType<Preference>("lbs.plugin.preference", 1,0, "Preference"); qmlRegisterType<WheelArea>("lbs.plugin.wheelarea", 1, 0, "WheelArea"); + //get settings stored into the conf file (in $HOME/.config/navigation/fsa.conf) + + app.setOrganizationName(QString("navigation")); + app.setApplicationName(QString("fsa")); + + Settings* settings=new Settings; + settings->setIniCodec("UTF-8"); + + QString toto=settings->getValue("DefaultAddress/city").toString(); + int rc = 0; QQmlEngine engine; + engine.rootContext()->setContextProperty("Settings",settings); + QQmlComponent *component = new QQmlComponent(&engine); QPalette pal = app.palette(); diff --git a/src/hmi/hmi-launcher/settings.h b/src/hmi/hmi-launcher/settings.h new file mode 100644 index 0000000..13891cb --- /dev/null +++ b/src/hmi/hmi-launcher/settings.h @@ -0,0 +1,50 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2017, PSA Group +* +* \file settings.h +* +* \brief This file is part of the FSA HMI. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 1.0 +* +* 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@ +*/ +#ifndef INCLUDE_SETTINGS +#define INCLUDE_SETTINGS + +#include <QSettings> +#include <QCoreApplication> + +class Settings:public QSettings +{ +Q_OBJECT + +public: +explicit Settings(QObject *parent = 0) : QSettings(QSettings::UserScope, + QCoreApplication::instance()->organizationName(), + QCoreApplication::instance()->applicationName(), + parent) {} + +Q_INVOKABLE inline void setValue(const QString &key, const QVariant &value) { QSettings::setValue(key, value); } +Q_INVOKABLE inline QVariant getValue(const QString &key, const QVariant &defaultValue = QVariant()) const { return QSettings::value(key, defaultValue); } + +}; +Q_DECLARE_METATYPE(Settings*) + +#endif diff --git a/src/hmi/qml/NavigationApp.qml b/src/hmi/qml/NavigationApp.qml index 81c991d..56ea5fc 100644 --- a/src/hmi/qml/NavigationApp.qml +++ b/src/hmi/qml/NavigationApp.qml @@ -32,6 +32,7 @@ import "../style-sheets/style-constants.js" as Constants; import "../style-sheets/NavigationAppBrowseMap-css.js" as StyleSheetMap; import "Core/genivi.js" as Genivi; import lbs.plugin.dbusif 1.0 +import lbs.plugin.preference 1.0 ApplicationWindow { id: container @@ -56,11 +57,16 @@ ApplicationWindow { id:dbusIf; } + Preference { + source: 0 + mode: 0 + } + Component.onCompleted: { - //set persistent data - Genivi.setlang("eng","USA","Latn"); //set to english US - Genivi.setDefaultPosition(46.202038,6.146845,392); // (rue Jean Calvin Genève) - Genivi.setDefaultAddress("Switzerland","Lausanne","Rue de Midi","8"); // preferred address + //init persistent data + 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")); //configure the middleware Genivi.navigationcore_configuration_SetLocale(dbusIf,Genivi.g_language,Genivi.g_country,Genivi.g_script); diff --git a/src/hmi/qml/NavigationAppSettings.qml b/src/hmi/qml/NavigationAppSettings.qml index f8dd28d..d46b006 100644 --- a/src/hmi/qml/NavigationAppSettings.qml +++ b/src/hmi/qml/NavigationAppSettings.qml @@ -32,7 +32,6 @@ import "Core/genivi.js" as Genivi; import "../style-sheets/style-constants.js" as Constants; import "../style-sheets/NavigationAppSettings-css.js" as StyleSheet; import lbs.plugin.dbusif 1.0 -import lbs.plugin.preference 1.0 NavigationAppHMIMenu { id: menu @@ -154,11 +153,6 @@ NavigationAppHMIMenu { // (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 diff --git a/src/hmi/qml/NavigationAppTokyo.qml b/src/hmi/qml/NavigationAppTokyo.qml deleted file mode 100644 index 4779796..0000000 --- a/src/hmi/qml/NavigationAppTokyo.qml +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @licence app begin@ -* SPDX-License-Identifier: MPL-2.0 -* -* \copyright Copyright (C) 2013-2017, PSA GROUPE -* -* \file NavigationApp.qml -* -* \brief This file is part of the navigation hmi. -* -* \author Philippe Colliot <philippe.colliot@mpsa.com> -* -* \version 1.0 -* -* 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 QtQuick.Controls 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Dialogs 1.0 -import "../style-sheets/style-constants.js" as Constants; -import "../style-sheets/NavigationAppBrowseMap-css.js" as StyleSheetMap; -import "Core/genivi.js" as Genivi; -import lbs.plugin.dbusif 1.0 - -ApplicationWindow { - id: container - flags: Qt.FramelessWindowHint - color: "transparent" - visible: true - width: StyleSheetMap.menu[Constants.WIDTH]; - height: StyleSheetMap.menu[Constants.HEIGHT]; - property Item component; - function load(page) - { - if (component) { - component.destroy(); - } - component = Qt.createQmlObject(page+"{}",container,"dynamic"); - } - - //------------------------------------------// - // Management of the DBus exchanges - //------------------------------------------// - DBusIf { - id:dbusIf; - } - - Component.onCompleted: { - //set persistent data - Genivi.setlang("jpn","JPN","Hrkt"); //set to japanese - Genivi.setDefaultPosition(35.758795,139.316533,19); // (1 Chome-1-5 Gonokami Hamura-shi, Tōkyō-to) - - //configure the middleware - Genivi.setDefaultAddress("Japan","東京","井ノ頭通り","17"); // preferred address - Genivi.navigationcore_configuration_SetLocale(dbusIf,Genivi.g_language,Genivi.g_country,Genivi.g_script); - - //launch the map viewer and init the scale list - Genivi.mapviewer_handle(dbusIf,width,height,Genivi.MAPVIEWER_MAIN_MAP); - Genivi.initScale(dbusIf); - - //launch the HMI - load("NavigationAppMain"); - } - - Component.onDestruction: { - //release the map viewer - Genivi.mapviewer_handle_clear(dbusIf); - } -} |