X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=app%2Fmain.cpp;h=57c731e8152343e9d5cbed30af1b9aed771966cd;hb=4f843a3f37537aa9a3969c7cb33eb429ddeb5ddd;hp=7722a0a28b516656c09243b1906fe7ee2f9140bf;hpb=101b535c71b6055bb35884b606e4a978d2ce2599;p=apps%2Fhvac.git diff --git a/app/main.cpp b/app/main.cpp index 7722a0a..57c731e 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -23,14 +23,13 @@ #include #include #include -#include "qlibwindowmanager.h" +#include int main(int argc, char *argv[]) { - std::string myname = std::string("HVAC"); + QString myname = QString("HVAC"); QGuiApplication app(argc, argv); - app.setApplicationName(myname.c_str()); app.setApplicationVersion(QStringLiteral("0.1.0")); app.setOrganizationDomain(QStringLiteral("automotivelinux.org")); app.setOrganizationName(QStringLiteral("AutomotiveGradeLinux")); @@ -69,29 +68,27 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } // Request a surface as described in layers.json windowmanager’s file - if (qwm->requestSurface(json_object_new_string(myname.c_str())) != 0) { + if (qwm->requestSurface(myname) != 0) { exit(EXIT_FAILURE); } - // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs + // Create an event callbnewack against an event type. Here a lambda is called when SyncDraw event occurs qwm->set_event_handler(QLibWindowmanager::Event_SyncDraw, [qwm, myname](json_object *object) { fprintf(stderr, "Surface got syncDraw!\n"); - qwm->endDraw(json_object_new_string(myname.c_str())); + qwm->endDraw(myname); }); // HomeScreen hs->init(port, token.c_str()); // Set the event handler for Event_TapShortcut which will activate the surface for windowmanager hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [qwm, myname](json_object *object){ - qDebug("object %s", json_object_to_json_string(object)); json_object *appnameJ = nullptr; if(json_object_object_get_ex(object, "application_name", &appnameJ)) { const char *appname = json_object_get_string(appnameJ); - qDebug("appnameJ %s", json_object_to_json_string(appnameJ)); if(myname == appname) { qDebug("Surface %s got tapShortcut\n", appname); - qwm->activateSurface(json_object_new_string(myname.c_str())); + qwm->activateSurface(myname); } } });