summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-11-11 00:46:59 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-11-12 22:14:19 -0800
commitf6e8b3ca7f1c11b8f7280542a4d8e3e3d22a085d (patch)
treebe24f66482af7491d0ebc49315854390c38e488b
parentbbdc6f93e73a7053616f21c270e445db50e26ad2 (diff)
poi-yelp: read starting location from naviconfig.ini
Bug-AGL: SPEC-2880 Change-Id: Iafb4f89a7efe579d24a5a6a58f41a38eb6c08a41 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--MainApp.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/MainApp.cpp b/MainApp.cpp
index 1b05538..a5a3865 100644
--- a/MainApp.cpp
+++ b/MainApp.cpp
@@ -19,6 +19,8 @@
#include "Keyboard.h"
#include "traces.h"
+#define NAVI_CONFIG_FILEPATH "/etc/naviconfig.ini"
+
#define DEFAULT_TEXT "Select your destination with Yelp !"
#define URL_AUTH "https://api.yelp.com/oauth2/token"
#define URL_AUTOCOMPLETE "https://api.yelp.com/v3/autocomplete"
@@ -52,7 +54,7 @@ MainApp::MainApp():QMainWindow(Q_NULLPTR, Qt::FramelessWindowHint),
networkManager(this),searchBtn(QIcon(tr(":/images/loupe-90.png")), tr(""), this),
lineEdit(this),keyboard(QRect(0, 688, COMPLETE_W_WITH_KB, 720), this),
mutex(QMutex::Recursive),token(""),currentSearchingText(""),currentSearchedText(""),
- pSearchReply(NULL),pInfoPanel(NULL),pResultList(NULL),currentLatitude(0.0),currentLongitude(0.0),
+ pSearchReply(NULL),pInfoPanel(NULL),pResultList(NULL),currentLatitude(36.136261),currentLongitude(-115.151254),
navicoreSession(0),currentIndex(0),fontId(-1),isInfoScreen(false),
isInputDisplayed(false),isKeyboard(false),isAglNavi(false)
{
@@ -76,6 +78,21 @@ MainApp::MainApp():QMainWindow(Q_NULLPTR, Qt::FramelessWindowHint),
lineEdit.setGeometry(QRect(LEFT_OFFSET + searchBtn.width() + SPACER, 0, lineEdit.width(), lineEdit.height()));
lineEdit.setVisible(false);
+
+ QFile file(NAVI_CONFIG_FILEPATH);
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text))
+ {
+ QByteArray data = file.readAll();
+ QJsonDocument jsonDoc(QJsonDocument::fromJson(data));
+ QJsonObject jsonObj(jsonDoc.object());
+
+ if (jsonObj.contains("latitude"))
+ currentLatitude = jsonObj["latitude"].toDouble();
+
+ if (jsonObj.contains("longitude"))
+ currentLongitude = jsonObj["longitude"].toDouble();
+ }
+
/* We might need a Japanese font: */
QFile fontFile(":/fonts/DroidSansJapanese.ttf");
if (!fontFile.open(QIODevice::ReadOnly))