From 8ef878357ecc476069829c6556f7ad4919fffb58 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Wed, 22 Jul 2020 17:18:58 +0300 Subject: [PATCH] Rework take 1 Signed-off-by: Marius Vlad --- homescreen/src/main.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 2d9ac4d..4d93f87 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -49,19 +49,25 @@ struct shell_container { // used to propagate events from C/C++ event handlers from the protocol // to the QML in case we need them Shell *a_shell; + ApplicationLauncher *launcher; }; static void application_id_event(void *data, struct agl_shell_desktop *agl_shell_desktop, - const char *app_id) + const char *app_id) { + } static void application_state_event(void *data, struct agl_shell_desktop *agl_shell_desktop, - const char *app_id, const char *app_data, - uint32_t app_state, uint32_t app_role) + const char *app_id, const char *app_data, + uint32_t app_state, uint32_t app_role) { + struct shell_container *sc = static_cast(data); + + qDebug() << "app_id " << app_id << " app_data " << app_data + << " app_state " << app_state << " app_role " << app_role; } static const struct agl_shell_desktop_listener agl_shell_desktop_listener = { @@ -268,6 +274,7 @@ int main(int argc, char *argv[]) } HMI_DEBUG("HomeScreen","port = %d, token = %s", port, token.toStdString().c_str()); + ApplicationLauncher *launcher = new ApplicationLauncher(); sc = register_agl_shell(native); if (!sc) { @@ -280,6 +287,7 @@ int main(int argc, char *argv[]) shell_desktop{sc->agl_shell_desktop, agl_shell_desktop_destroy}; Shell *aglShell = new Shell(shell, shell_desktop, &a); sc->a_shell = aglShell; + sc->launcher = launcher; // import C++ class to QML // qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); @@ -288,7 +296,6 @@ int main(int argc, char *argv[]) qmlRegisterUncreatableType("SpeechChrome", 1, 0, "SpeechChromeController", QLatin1String("SpeechChromeController is uncreatable.")); - ApplicationLauncher *launcher = new ApplicationLauncher(); HomescreenHandler* homescreenHandler = new HomescreenHandler(aglShell); homescreenHandler->init(port, token.toStdString().c_str()); -- 2.16.6