diff options
author | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2019-06-14 12:59:52 +0900 |
---|---|---|
committer | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2019-06-14 12:59:52 +0900 |
commit | 23d822085e6768797111f7c9c21d3edf35ad2da2 (patch) | |
tree | 8e5c3584119966a0cdee08b183ad1a5516c6aba5 | |
parent | 80ebab9c1dfc8953a641c37287a064cfc93f2001 (diff) |
fix bug for 0614
-rw-r--r-- | app/file_operation.cpp | 17 | ||||
-rw-r--r-- | app/file_operation.h | 3 | ||||
-rw-r--r-- | app/qml/Main.qml | 20 | ||||
-rw-r--r-- | app/qml/MapWindow.qml | 4 | ||||
-rw-r--r-- | app/qml/TbtBoard.qml | 4 |
5 files changed, 37 insertions, 11 deletions
diff --git a/app/file_operation.cpp b/app/file_operation.cpp index b51477e..803eef5 100644 --- a/app/file_operation.cpp +++ b/app/file_operation.cpp @@ -15,6 +15,8 @@ void File_Operation::initFileOperation(){ m_start_latitude = 36.136261; // set default coordinate Tokyo Hilton m_start_longitute = -115.151254; m_mapStyleUrls = "mapbox://styles/mapbox/streets-v10"; // set default map style + m_demo_state = 0; + m_demo_boolstate = false; QFile file(NAVI_CONFIG_FILEPATH); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){ @@ -61,6 +63,13 @@ void File_Operation::initFileOperation(){ return; } + if(jsonObj.contains("demostate")){ + m_demo_state = jsonObj["demostate"].toInt(); + }else{ + fprintf(stderr,"Failed to find mapStyleUrls data \"%s\": %m", qPrintable(NAVI_CONFIG_FILEPATH)); + return; + } + file.close(); return; @@ -81,3 +90,11 @@ double File_Operation::getStartLongitute(){ QString File_Operation::getMapStyleUrls() { return m_mapStyleUrls; } +bool File_Operation::getDemoState(){ + if(m_demo_state == 0){ + m_demo_boolstate = false; + } else{ + m_demo_boolstate = true; + } + return m_demo_boolstate; +} diff --git a/app/file_operation.h b/app/file_operation.h index 9fbbd6c..175813c 100644 --- a/app/file_operation.h +++ b/app/file_operation.h @@ -20,6 +20,8 @@ class File_Operation: public QObject{ double m_start_latitude; double m_start_longitute; QString m_mapStyleUrls; + int m_demo_state; + bool m_demo_boolstate; public: File_Operation(); @@ -30,6 +32,7 @@ public: Q_INVOKABLE double getStartLatitude(); Q_INVOKABLE double getStartLongitute(); Q_INVOKABLE QString getMapStyleUrls(); + Q_INVOKABLE bool getDemoState(); private: void initFileOperation(); diff --git a/app/qml/Main.qml b/app/qml/Main.qml index ec10893..525758e 100644 --- a/app/qml/Main.qml +++ b/app/qml/Main.qml @@ -25,6 +25,7 @@ ApplicationWindow { property string event_setdestpos: "naviapi/navicore_setdestpos" property string event_gps: "naviapi/navicore_gps" property string event_getdestdir: "naviapi/navicore_getdestdir" + property bool st_demo_state: fileOperation.getDemoState() property var msgid_enu: { "call":2, "retok":3, "reterr":4, "event":5 } WebSocket { @@ -45,7 +46,7 @@ ApplicationWindow { } onTextMessageReceived: { - //console.log("tbtnavi:onTextMessageReceived: " + message) + console.log("tbtnavi:onTextMessageReceived: " + message) var message_json = JSON.parse(message) //analyse the infomation from the naviapi service @@ -58,7 +59,10 @@ ApplicationWindow { var longitude = message_json[2].data[0].DemoLongitude var distance = message_json[2].data[0].DemoDistance var direction = message_json[2].data[0].DemoDirection - //console.log("tbtnavi: distance = " + distance + "direction = " + direction) + console.log("tbtnavi: distance = " + distance + "direction = " + direction) + if (st_demo_state === true){ + mapwindow.do_setCoordinate(latitude,longitude) + } mapwindow.do_setDirection(direction) mapwindow.do_setNextCrossDistance(distance) } @@ -83,11 +87,13 @@ ApplicationWindow { mapwindow.do_setdest(allroutes,destlat,destlon) } else if(message_json[2].event === event_gps){ - //console.log ("tbt:Receive Event======event_gps") - var lat = message_json[2].data.latitude - var lon = message_json[2].data.longitude - //console.log ("tbt:Receive Event lat====== " + lat+" "+"lon======"+lon) - mapwindow.do_setCoordinate(lat,lon) + if (st_demo_state === false){ + console.log ("tbt:Receive Event======event_gps") + var lat = message_json[2].data.latitude + var lon = message_json[2].data.longitude + console.log ("tbt:Receive Event lat====== " + lat+" "+"lon======"+lon) + mapwindow.do_setCoordinate(lat,lon) + } } else if(message_json[2].event === event_getdestdir){ diff --git a/app/qml/MapWindow.qml b/app/qml/MapWindow.qml index efb4bcf..8321515 100644 --- a/app/qml/MapWindow.qml +++ b/app/qml/MapWindow.qml @@ -185,7 +185,7 @@ Item { } var dis = (total - ruler.currentDistance).toFixed(1); - //console.log("tbtnavi:dis = " + dis) + console.log("tbtnavi:dis = " + dis) // Set distance tbt_board.do_setDistance(dis) @@ -289,7 +289,7 @@ Item { function do_setNextCrossDistance(distance) { var dis = distance; - //console.log("tbtnavi:dis = " + dis) + console.log("tbtnavi:dis = " + dis) // Set distance tbt_board.do_setDistance(dis) diff --git a/app/qml/TbtBoard.qml b/app/qml/TbtBoard.qml index 738530d..2aa1076 100644 --- a/app/qml/TbtBoard.qml +++ b/app/qml/TbtBoard.qml @@ -104,8 +104,8 @@ Item { }, State { name: "1" // DirectionForward - PropertyChanges { target: turnDirectionBoard; source: "" } - PropertyChanges { target: turnDirection; source: "" } + PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-0-large.png" } + PropertyChanges { target: turnDirection; source: "qrc:arrow-0-large.png" } }, State { name: "2" // DirectionBearRight |