summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-11-22 13:27:35 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2017-11-22 13:27:35 +0000
commit2c179df8e22fd1434c88b8595ddd65ec0ed48622 (patch)
treea695520d513218943271e63b7bb626acaca5350c
parent2fa542a8c95b196020e5f27f96cbffa7c44e72e9 (diff)
parentbf3c9fb7ae0f39d6df454807dcfaccc97715fbcf (diff)
Merge "Change libwindowmanager to qlibwindowmanager"eel_4.99.3eel/4.99.34.99.3
-rw-r--r--homescreen/homescreen.pro5
-rw-r--r--homescreen/qml/ShortcutArea.qml4
-rw-r--r--homescreen/src/homescreenhandler.cpp8
-rw-r--r--homescreen/src/homescreenhandler.h3
-rw-r--r--homescreen/src/layouthandler.cpp99
-rw-r--r--homescreen/src/layouthandler.h44
-rw-r--r--homescreen/src/main.cpp17
7 files changed, 19 insertions, 161 deletions
diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro
index 5e58612..b86126f 100644
--- a/homescreen/homescreen.pro
+++ b/homescreen/homescreen.pro
@@ -19,12 +19,13 @@ QT = qml quick dbus
CONFIG += c++11 link_pkgconfig
DESTDIR = $${OUT_PWD}/../package/root/bin
#PKGCONFIG += libpulse
+PKGCONFIG += qlibwindowmanager
LIBS += -lsystemd
LIBS += -lafbwsc
LIBS += -ljson-c
LIBS += -lhomescreen
-LIBS += -lwindowmanager
+#LIBS += -lwindowmanager
include(../interfaces/interfaces.pri)
@@ -33,7 +34,6 @@ INSTALLS += target
SOURCES += \
src/main.cpp \
- src/layouthandler.cpp \
src/applicationmodel.cpp \
src/appinfo.cpp \
src/statusbarmodel.cpp \
@@ -43,7 +43,6 @@ SOURCES += \
src/homescreenhandler.cpp
HEADERS += \
- src/layouthandler.h \
src/statusbarmodel.h \
src/statusbarserver.h \
src/applicationlauncher.h \
diff --git a/homescreen/qml/ShortcutArea.qml b/homescreen/qml/ShortcutArea.qml
index bbe6565..1638bcf 100644
--- a/homescreen/qml/ShortcutArea.qml
+++ b/homescreen/qml/ShortcutArea.qml
@@ -79,6 +79,10 @@ Item {
}
}
homescreenHandler.tapShortcut(model.name)
+ if(model.name == 'Home')
+ {
+ layoutHandler.activateSurface('HomeScreen');
+ }
}
}
}
diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp
index badb91f..5da8b9e 100644
--- a/homescreen/src/homescreenhandler.cpp
+++ b/homescreen/src/homescreenhandler.cpp
@@ -49,14 +49,6 @@ void HomescreenHandler::init(int port, const char *token)
HMI_DEBUG("HomeScreen","set_event_handler Event_OnScreenMessage display_message = %s", display_message);
});
- mp_hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [this](json_object *object){
- const char *application_name = json_object_get_string(
- json_object_object_get(object, "application_name"));
- if(strcmp(application_name, "Home") == 0){
- emit this->homeButton();
- }
- });
-
}
void HomescreenHandler::tapShortcut(QString application_name)
diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h
index 6209631..c18d7a0 100644
--- a/homescreen/src/homescreenhandler.h
+++ b/homescreen/src/homescreenhandler.h
@@ -40,9 +40,6 @@ public:
static void* myThis;
static void onRep_static(struct json_object* reply_contents);
static void onEv_static(const string& event, struct json_object* event_contents);
-signals:
- void homeButton();
-
private:
LibHomeScreen *mp_hs;
};
diff --git a/homescreen/src/layouthandler.cpp b/homescreen/src/layouthandler.cpp
deleted file mode 100644
index 9d72221..0000000
--- a/homescreen/src/layouthandler.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "hmi-debug.h"
-#include "layouthandler.h"
-
-#define HOMESCREEN "HomeScreen"
-
-LayoutHandler::LayoutHandler(QObject *parent) :
- QObject(parent),
- mp_wm(NULL)
-{
- isActived = false;
-}
-
-LayoutHandler::~LayoutHandler()
-{
-}
-
-void LayoutHandler::init(int port, const char* token)
-{
- if (mp_wm != NULL) exit(EXIT_FAILURE);
-
- mp_wm = new LibWindowmanager();
-
- if (mp_wm->init(port, token) != 0) {
- exit(EXIT_FAILURE);
- }
-
- json_object *obj = json_object_new_object();
- json_object_object_add(obj, mp_wm->kKeyDrawingName, json_object_new_string(HOMESCREEN));
- mp_wm->requestSurface(obj);
-
- mp_wm->set_event_handler(LibWindowmanager::Event_Active, [this](json_object *object) {
- this->isActived = true;
- HMI_DEBUG("HomeScreen","Surface %s got activated!", HOMESCREEN);
- });
-
- mp_wm->set_event_handler(LibWindowmanager::Event_Inactive, [this](json_object *object) {
- this->isActived = false;
- HMI_DEBUG("HomeScreen","Surface %s got deactivated!", HOMESCREEN);
- });
-
- mp_wm->set_event_handler(LibWindowmanager::Event_Visible, [](json_object *object) {
- HMI_DEBUG("HomeScreen","Surface %s got visibled!", HOMESCREEN);
- });
-
- mp_wm->set_event_handler(LibWindowmanager::Event_Invisible, [](json_object *object) {
- HMI_DEBUG("HomeScreen","Surface %s got invisibled!", HOMESCREEN);
- });
-
- mp_wm->set_event_handler(LibWindowmanager::Event_SyncDraw, [this](json_object *object) {
- HMI_DEBUG("HomeScreen","Surface %s got syncDraw!", HOMESCREEN);
- HMI_DEBUG("HomeScreen","Try to endDraw Surface %s Start!", HOMESCREEN);
- json_object *obj = json_object_new_object();
- json_object_object_add(obj, mp_wm->kKeyDrawingName, json_object_new_string(HOMESCREEN));
- this->mp_wm->endDraw(obj);
- HMI_DEBUG("HomeScreen","Try to endDraw Surface %s End!", HOMESCREEN);
- });
-
- mp_wm->set_event_handler(LibWindowmanager::Event_FlushDraw, [](json_object *object) {
- HMI_DEBUG("HomeScreen","Surface %s got flushDraw!", HOMESCREEN);
- });
-}
-
-void LayoutHandler::activateSurface()
-{
- json_object *obj = json_object_new_object();
- json_object_object_add(obj, mp_wm->kKeyDrawingName, json_object_new_string(HOMESCREEN));
- json_object_object_add(obj, mp_wm->kKeyDrawingArea, json_object_new_string("normal.full"));
- mp_wm->activateSurface(obj);
-}
-
-void LayoutHandler::slotActivateSurface()
-{
- if(isActived)
- return;
- HMI_DEBUG("HomeScreen","called");
- this->activateSurface();
-}
-
-void LayoutHandler::slotHomeButton()
-{
- HMI_DEBUG("HomeScreen","called");
- this->activateSurface();
-}
diff --git a/homescreen/src/layouthandler.h b/homescreen/src/layouthandler.h
deleted file mode 100644
index 45cfd9c..0000000
--- a/homescreen/src/layouthandler.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef LAYOUTHANDLER_H
-#define LAYOUTHANDLER_H
-
-#include <QObject>
-#include <libwindowmanager.h>
-
-class LayoutHandler : public QObject
-{
- Q_OBJECT
-public:
- explicit LayoutHandler(QObject *parent = 0);
- ~LayoutHandler();
-
- void init(int port, const char* token);
- void activateSurface();
-
-signals:
-
-public slots:
- void slotActivateSurface();
- void slotHomeButton();
-
-private:
- LibWindowmanager* mp_wm;
- bool isActived;
-};
-
-#endif // LAYOUTHANDLER_H
diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp
index 45a7c0f..e0850d6 100644
--- a/homescreen/src/main.cpp
+++ b/homescreen/src/main.cpp
@@ -23,7 +23,7 @@
#include <QtQml/qqml.h>
#include <QQuickWindow>
-#include "layouthandler.h"
+#include <qlibwindowmanager.h>
#include "applicationlauncher.h"
#include "statusbarmodel.h"
#include "applicationmodel.h"
@@ -96,8 +96,18 @@ int main(int argc, char *argv[])
qDBusRegisterMetaType<AppInfo>();
qDBusRegisterMetaType<QList<AppInfo> >();
- LayoutHandler* layoutHandler = new LayoutHandler();
- layoutHandler->init(port, token.toStdString().c_str());
+ QLibWindowmanager* layoutHandler = new QLibWindowmanager();
+ if(layoutHandler->init(port,token) != 0){
+ exit(EXIT_FAILURE);
+ }
+
+ if (layoutHandler->requestSurface(QString("HomeScreen")) != 0) {
+ exit(EXIT_FAILURE);
+ }
+
+ layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler](json_object *object) {
+ layoutHandler->endDraw(QString("HomeScreen"));
+ });
HomescreenHandler* homescreenHandler = new HomescreenHandler();
homescreenHandler->init(port, token.toStdString().c_str());
@@ -111,7 +121,6 @@ int main(int argc, char *argv[])
QObject *root = engine.rootObjects().first();
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
QObject::connect(window, SIGNAL(frameSwapped()), layoutHandler, SLOT(slotActivateSurface()));
- QObject::connect(homescreenHandler, SIGNAL(homeButton()), layoutHandler, SLOT(slotHomeButton()));
return a.exec();
}