summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp43
1 files changed, 11 insertions, 32 deletions
diff --git a/main.cpp b/main.cpp
index 8bf8b51..a82198a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -4,28 +4,15 @@
#include <getopt.h>
#include <libhomescreen.hpp>
-#include <qlibwindowmanager.h>
-
#include <navigation.h>
#define DEFAULT_CREDENTIALS_FILE "/etc/poikey"
using namespace std;
-static QLibWindowmanager* qwm;
-static LibHomeScreen* hs;
static QString graphic_role;
static MainApp *mainapp;
-
-static void SyncDrawHandler(json_object *object)
-{
- qwm->endDraw(graphic_role);
-}
-
-static void ShowWindowHandler(json_object *object)
-{
- qwm->activateWindow(graphic_role);
-}
+static LibHomeScreen* hs;
// Callback to drive raising navigation app
static void NavWindowRaiseHandler(void)
@@ -35,14 +22,20 @@ static void NavWindowRaiseHandler(void)
}
}
+static void ShowWindowHandler(json_object *object)
+{
+
+}
+
int main(int argc, char *argv[], char *env[])
{
int opt;
QApplication a(argc, argv);
QString credentialsFile(DEFAULT_CREDENTIALS_FILE);
- qwm = new QLibWindowmanager();
+
hs = new LibHomeScreen();
graphic_role = QString("poi");
+ a.setDesktopFileName(graphic_role);
QString pt = QString(argv[1]);
int port = pt.toInt();
@@ -58,23 +51,8 @@ int main(int argc, char *argv[], char *env[])
query.addQueryItem(QStringLiteral("token"), secret);
bindingAddress.setQuery(query);
- if (qwm->init(port, secret) != 0) {
- exit(EXIT_FAILURE);
- }
-
- if (qwm->requestSurface(graphic_role) != 0) {
- cerr << "Error: wm check failed" << endl;
- exit(EXIT_FAILURE);
- }
-
- qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, SyncDrawHandler);
-
mainapp = new MainApp(new Navigation(bindingAddress));
- hs->init(port, token.c_str());
-
- hs->set_event_handler(LibHomeScreen::Event_ShowWindow, ShowWindowHandler);
-
// force setting
mainapp->setInfoScreen(true);
mainapp->setKeyboard(true);
@@ -82,6 +60,9 @@ int main(int argc, char *argv[], char *env[])
// hook up callback to start/raise navigation app
mainapp->setNavWindowRaiseCallback(NavWindowRaiseHandler);
+ hs->init(port, token.c_str());
+ hs->set_event_handler(LibHomeScreen::Event_ShowWindow, ShowWindowHandler);
+
/* then, authenticate connexion to POI service: */
if (mainapp->AuthenticatePOI(credentialsFile) < 0)
{
@@ -95,8 +76,6 @@ int main(int argc, char *argv[], char *env[])
if (mainapp->StartMonitoringUserInput() < 0)
return -1;
- qwm->activateWindow(graphic_role);
-
/* main loop: */
return a.exec();
}