summaryrefslogtreecommitdiffstats
path: root/app/file_operation.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-10-20 11:30:15 -0400
committerScott Murray <scott.murray@konsulko.com>2019-10-20 15:27:51 -0400
commitad1ba5b56c4e14a615a566d142290977a9be0805 (patch)
treede3970303047dcca8a6bb1f3f4a6460f2c351c67 /app/file_operation.cpp
parentcad9270984244bddf59f796dfb4d7ccef2f9674f (diff)
Fixes and rework to allow using with cluster demohalibut_8.0.3halibut/8.0.38.0.3
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: Ia42a4303f772bf9c2235c720c92af3faa2936485
Diffstat (limited to 'app/file_operation.cpp')
-rw-r--r--app/file_operation.cpp47
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;
+}