diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-09-22 20:38:07 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-09-23 20:57:30 -0700 |
commit | b4364919e5a74325812f2f527adbfe62a165109e (patch) | |
tree | 2c3f1c5d14aec6318a3b009479ef8e37e6b46603 /app/file_operation.cpp | |
parent | 0cd23d5caf31753164b2bca64290e2b636a1999f (diff) |
qml: allow map plugins to be set on runtime
Allow selection of OSM over MapBox with enableOSM
configuration file option.
Bug-AGL: SPEC-2667
Change-Id: Ie055ca1263b0a6f2a74046e5ff85535e48e60d31
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/file_operation.cpp')
-rw-r--r-- | app/file_operation.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/app/file_operation.cpp b/app/file_operation.cpp index 09bd4d0..819cce5 100644 --- a/app/file_operation.cpp +++ b/app/file_operation.cpp @@ -15,6 +15,7 @@ void File_Operation::initFileOperation(){ m_update_interval = 100; // set default millisecond 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); @@ -27,13 +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("speed")){ m_car_speed = jsonObj["speed"].toDouble(); }else{ @@ -62,6 +56,21 @@ 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{ |