aboutsummaryrefslogtreecommitdiffstats
path: root/homescreen
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2017-11-15 11:56:17 +0900
committerZheng Wenlong <wenlong_zheng@nexty-ele.com>2017-11-15 02:58:27 +0000
commitbf3c9fb7ae0f39d6df454807dcfaccc97715fbcf (patch)
tree8a7d3c2d1ab44fad9f91e0f829380e3edea6d474 /homescreen
parente14318d2d3507252d8d2e3c2dc8bff74c0446f7a (diff)
Change libwindowmanager to qlibwindowmanager
Since qlibwindowmanager set environment QT_IVI_SURFACE_ID, and libwindowmanager remove setenv. HomeScreen need use qlibwindowmanager instead of libwindowmanager. Change-Id: I0d0babff168fe0cecb2ff689605df1f9bbc2c400 Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'homescreen')
-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();
}