diff options
author | Scott Murray <scott.murray@konsulko.com> | 2019-10-20 11:30:15 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-10-20 13:16:26 -0400 |
commit | d7d65ef59bd9e54787fdebebe39ea0d8e1155769 (patch) | |
tree | 26fc3bba8202707beddd2034ebaaecf8c6dd3b09 /app/file_operation.cpp | |
parent | 1d3670c387c43f355f7190274085c55098fac90f (diff) |
Fixes and rework to allow using with cluster demo
Changes include:
- Remove older libhomescreen and qlibwindowmanager detection and
configuration from qmake configuration in favor of PKGCONFIG
usage.
- Rework main.cpp to look more like ondemandnavi, and use
qlibhomescreen instead of libhomescreen.
- Update file_operation.{h,cpp} with the newer versions from
ondemandnavi that include OSM configuration.
- Fixed typo in arrived signal name in org.agl.naviapi.xml and
dbus_client.cpp.
- Change some qDebug messages in dbus_client.cpp to qWarning as it
seems more appropriate.
- Rework QtLocation plugin configuration in MapWindow.qml to
support OSM and replace mapboxgl with mapbox, as mapboxgl does not
seem to work out of the box.
- Tweak various things in MapWindow.qml to try to better match the
look of ondemandnavi.
- Many commenting and whitespace fixes in MapWindow.qml.
- Update widget config.xml to add now required display permission,
and add the hidden permission so the application will not show up
in the launcher.
- Add license files for the various header files in include/mapbox,
and update README.md to indicate where they come from and what
files the different licenses apply to.
Bug-AGL: SPEC-2913
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I192efd45ab94ace8234dbe6c8983257a24e51d23
Diffstat (limited to 'app/file_operation.cpp')
-rw-r--r-- | app/file_operation.cpp | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/app/file_operation.cpp b/app/file_operation.cpp index a191c76..819cce5 100644 --- a/app/file_operation.cpp +++ b/app/file_operation.cpp @@ -13,8 +13,10 @@ void File_Operation::initFileOperation(){ m_mapAccessToken = ""; m_car_speed = 60; // set default Km/h m_update_interval = 100; // set default millisecond - m_start_latitude = 35.692396; // set default coordinate Tokyo Hilton - m_start_longitute = 139.691102; + m_start_latitude = 36.136261; // set default coordinate Westgate + m_start_longitute = -115.151254; + m_enable_osm = false; + m_mapStyleUrls = "mapbox://styles/mapbox/streets-v10"; // set default map style QFile file(NAVI_CONFIG_FILEPATH); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ @@ -26,19 +28,6 @@ void File_Operation::initFileOperation(){ QJsonDocument jsonDoc(QJsonDocument::fromJson(data)); QJsonObject jsonObj(jsonDoc.object()); - if(jsonObj.contains("mapAccessToken")){ - m_mapAccessToken = jsonObj["mapAccessToken"].toString(); - }else{ - fprintf(stderr,"Failed to find mapAccessToken data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH)); - return; - } - if(jsonObj.contains("mapStyle")){ - m_mapStyle = jsonObj["mapStyle"].toString(); - }else{ - fprintf(stderr,"Failed to find mapStyle data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH)); - return; - } - if(jsonObj.contains("speed")){ m_car_speed = jsonObj["speed"].toDouble(); }else{ @@ -67,6 +56,28 @@ void File_Operation::initFileOperation(){ return; } + // Check if using OSM + if (jsonObj.contains("enableOSM")){ + m_enable_osm = jsonObj["enableOSM"].toBool(); + if (m_enable_osm) + return; + } + + // MapBox only settings + if(jsonObj.contains("mapAccessToken")){ + m_mapAccessToken = jsonObj["mapAccessToken"].toString(); + }else{ + fprintf(stderr,"Failed to find mapAccessToken data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH)); + return; + } + + if(jsonObj.contains("mapStyleUrls")){ + m_mapStyleUrls = jsonObj["mapStyleUrls"].toString(); + }else{ + fprintf(stderr,"Failed to find mapStyleUrls data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH)); + return; + } + file.close(); return; @@ -75,9 +86,6 @@ void File_Operation::initFileOperation(){ QString File_Operation::getMapAccessToken() { return m_mapAccessToken; } -QString File_Operation::getMapStyle() { - return m_mapStyle; -} double File_Operation::getCarSpeed(){ return m_car_speed; } @@ -90,3 +98,6 @@ double File_Operation::getStartLatitude(){ double File_Operation::getStartLongitute(){ return m_start_longitute; } +QString File_Operation::getMapStyleUrls() { + return m_mapStyleUrls; +} |