aboutsummaryrefslogtreecommitdiffstats
path: root/launcher/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/src/main.cpp')
-rw-r--r--launcher/src/main.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp
index 1d324b2..5fed90a 100644
--- a/launcher/src/main.cpp
+++ b/launcher/src/main.cpp
@@ -29,8 +29,7 @@
#include "applicationmodel.h"
#include "appinfo.h"
#include "afm_user_daemon_proxy.h"
-#include "homescreenhandler.h"
-#include "shortcutappmodel.h"
+#include "qlibhomescreen.h"
#include "hmi-debug.h"
// XXX: We want this DBus connection to be shared across the different
@@ -89,21 +88,18 @@ int main(int argc, char *argv[])
// import C++ class to QML
qmlRegisterType<ApplicationModel>("AppModel", 1, 0, "ApplicationModel");
- qmlRegisterType<ShortcutAppModel>("ShortcutAppModel", 1, 0, "ShortcutAppModel");
// DBus
qDBusRegisterMetaType<AppInfo>();
qDBusRegisterMetaType<QList<AppInfo> >();
+ QLibHomeScreen* homescreenHandler = new QLibHomeScreen();
ApplicationLauncher *launcher = new ApplicationLauncher();
QLibWindowmanager* layoutHandler = new QLibWindowmanager();
- ShortcutAppModel* shortcutAppModel = new ShortcutAppModel();
if(layoutHandler->init(port,token) != 0){
exit(EXIT_FAILURE);
}
-// AGLScreenInfo screenInfo(layoutHandler->get_scale_factor());
-
if (layoutHandler->requestSurface(myname) != 0) {
exit(EXIT_FAILURE);
}
@@ -123,10 +119,6 @@ int main(int argc, char *argv[])
HMI_DEBUG("launch", "surface %s Event_Invisible", label);
});
- HomescreenHandler* homescreenHandler = new HomescreenHandler();
- QObject::connect(homescreenHandler, SIGNAL(updateShortcutList(QStringList)), shortcutAppModel, SLOT(shortcutUpdate(QStringList)));
- homescreenHandler->init(port, token.toStdString().c_str(), layoutHandler, myname);
-
QUrl bindingAddress;
bindingAddress.setScheme(QStringLiteral("ws"));
bindingAddress.setHost(QStringLiteral("localhost"));
@@ -137,16 +129,28 @@ int main(int argc, char *argv[])
query.addQueryItem(QStringLiteral("token"), token);
bindingAddress.setQuery(query);
+ const QByteArray hack_delay = qgetenv("HMI_LAUNCHER_STARTUP_DELAY");
+ int delay_time = 1;
+
+ if (!hack_delay.isEmpty()) {
+ delay_time = (QString::fromLocal8Bit(hack_delay)).toInt();
+ }
+
+ QThread::sleep(delay_time);
+ qDebug("Sleep %d sec to resolve race condtion between HomeScreen and Launcher", delay_time);
+
// mail.qml loading
QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty(QStringLiteral("layoutHandler"), layoutHandler);
- engine.rootContext()->setContextProperty(QStringLiteral("homescreenHandler"), homescreenHandler);
- engine.rootContext()->setContextProperty(QStringLiteral("launcher"), launcher);
-// engine.rootContext()->setContextProperty(QStringLiteral("screenInfo"), &screenInfo);
- engine.rootContext()->setContextProperty(QStringLiteral("shortcutAppModel"), shortcutAppModel);
+ engine.rootContext()->setContextProperty("layoutHandler", layoutHandler);
+ engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler);
+ engine.rootContext()->setContextProperty("launcher", launcher);
engine.load(QUrl(QStringLiteral("qrc:/Launcher.qml")));
- homescreenHandler->getRunnables();
+ homescreenHandler->init(port, token.toStdString().c_str());
+
+ homescreenHandler->set_event_handler(QLibHomeScreen::Event_TapShortcut, [layoutHandler, myname](json_object *object){
+ layoutHandler->activateSurface(myname);
+ });
QObject *root = engine.rootObjects().first();
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
homescreenHandler->setQuickWindow(window);