aboutsummaryrefslogtreecommitdiffstats
path: root/app/file_operation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/file_operation.cpp')
-rw-r--r--app/file_operation.cpp23
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{