summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2018-07-18 13:20:06 +0000
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2018-07-19 05:41:02 +0000
commit67a76b6cc7125e652b1747bfcb2ed03d4d77322a (patch)
tree28915561a7f49310b186bfafbf2c32e2d9f9de2f
parent57100f64e1813eac59ddc0f2b98641b351fda03b (diff)
Use libwindowmanager instead of qlibwindowmanagerflounder_5.99.2flounder/5.99.25.99.2
To improve unnecessary dependency, use libwindowmanager instead of qlibwindowmanager. Also rename AGLWindow to AGLWmClient because of naming conflict between WindowManager (It starts to use 'Window' as different meaning from AGL FF). Bug-AGL: SPEC-1594 Change-Id: I7215bc1c1338ced69bf114f54850e0a151baa61c Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
-rw-r--r--config.tests/libwindowmanager/libwindowmanager.cpp8
-rw-r--r--config.tests/libwindowmanager/libwindowmanager.pro2
-rw-r--r--config.tests/qlibwindowmanager/qlibwindowmanager.cpp8
-rw-r--r--config.tests/qlibwindowmanager/qlibwindowmanager.pro2
-rw-r--r--src/aglextras/aglextras.pro4
-rw-r--r--src/aglextras/configure.json20
-rw-r--r--src/aglextras/hmi/aglapplication.cpp10
-rw-r--r--src/aglextras/hmi/aglapplication_p.h4
-rw-r--r--src/aglextras/hmi/aglwindow.cpp128
-rw-r--r--src/aglextras/hmi/aglwmclient.cpp156
-rw-r--r--src/aglextras/hmi/aglwmclient.h (renamed from src/aglextras/hmi/aglwindow.h)25
-rw-r--r--src/aglextras/hmi/aglwmclient_p.h (renamed from src/aglextras/hmi/aglwindow_p.h)10
-rw-r--r--src/aglextras/hmi/hmi.pri6
13 files changed, 206 insertions, 177 deletions
diff --git a/config.tests/libwindowmanager/libwindowmanager.cpp b/config.tests/libwindowmanager/libwindowmanager.cpp
new file mode 100644
index 0000000..c21116a
--- /dev/null
+++ b/config.tests/libwindowmanager/libwindowmanager.cpp
@@ -0,0 +1,8 @@
+#include <libwindowmanager.h>
+
+int main(int argc,char **argv)
+{
+ LibWindowmanager wm;
+ return 0;
+}
+
diff --git a/config.tests/libwindowmanager/libwindowmanager.pro b/config.tests/libwindowmanager/libwindowmanager.pro
new file mode 100644
index 0000000..cbd0345
--- /dev/null
+++ b/config.tests/libwindowmanager/libwindowmanager.pro
@@ -0,0 +1,2 @@
+SOURCES = libwindowmanager.cpp
+CONFIG += qt
diff --git a/config.tests/qlibwindowmanager/qlibwindowmanager.cpp b/config.tests/qlibwindowmanager/qlibwindowmanager.cpp
deleted file mode 100644
index bb95c93..0000000
--- a/config.tests/qlibwindowmanager/qlibwindowmanager.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <qlibwindowmanager.h>
-
-int main(int argc,char **argv)
-{
- QLibWindowmanager qwm;
- return 0;
-}
-
diff --git a/config.tests/qlibwindowmanager/qlibwindowmanager.pro b/config.tests/qlibwindowmanager/qlibwindowmanager.pro
deleted file mode 100644
index 26e1611..0000000
--- a/config.tests/qlibwindowmanager/qlibwindowmanager.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = qlibwindowmanager.cpp
-CONFIG += qt
diff --git a/src/aglextras/aglextras.pro b/src/aglextras/aglextras.pro
index 1a4d2ac..24028a9 100644
--- a/src/aglextras/aglextras.pro
+++ b/src/aglextras/aglextras.pro
@@ -6,8 +6,8 @@ QT += core-private
include(hmi/hmi.pri)
qtConfig(agl_hmi_framework) {
- DEFINES += USE_AGL_HMI_FRAMEWORK
- QMAKE_USE += libhomescreen qlibwindowmanager
+ DEFINES += USE_AGL_HMI_LOWLEVEL_API
+ QMAKE_USE += libhomescreen libwindowmanager
}
load(qt_module)
diff --git a/src/aglextras/configure.json b/src/aglextras/configure.json
index 1940e3d..513c237 100644
--- a/src/aglextras/configure.json
+++ b/src/aglextras/configure.json
@@ -8,7 +8,7 @@
"commandline": {
"options": {
"libhomescreen": "boolean",
- "qlibwindowmanager": "boolean"
+ "libwindowmanager": "boolean"
}
},
@@ -21,12 +21,12 @@
"args": "libhomescreen" }
]
},
- "qlibwindowmanager": {
- "label": "QLibWindowManager",
- "test": "qlibwindowmanager",
+ "libwindowmanager": {
+ "label": "LibWindowManager",
+ "test": "libwindowmanager",
"sources": [
{ "type": "pkgConfig",
- "args": "qlibwindowmanager" }
+ "args": "libwindowmanager" }
]
}
},
@@ -37,14 +37,14 @@
"condition": "libs.libhomescreen",
"output": [ "feature", "privateFeature" ]
},
- "qlibwindowmanager": {
- "label": "QLibWindowManager",
- "condition": "libs.qlibwindowmanager",
+ "libwindowmanager": {
+ "label": "LibWindowManager",
+ "condition": "libs.libwindowmanager",
"output": [ "feature", "privateFeature" ]
},
"agl_hmi_framework": {
"label": "AGL HMI Framework",
- "condition": "features.libhomescreen && features.qlibwindowmanager",
+ "condition": "features.libhomescreen && features.libwindowmanager",
"output": [ "feature", "privateFeature" ]
}
},
@@ -57,7 +57,7 @@
"section": "Qt AGLExtras",
"entries": [
"libhomescreen",
- "qlibwindowmanager",
+ "libwindowmanager",
"agl_hmi_framework"
]
}
diff --git a/src/aglextras/hmi/aglapplication.cpp b/src/aglextras/hmi/aglapplication.cpp
index 102a990..82e49bf 100644
--- a/src/aglextras/hmi/aglapplication.cpp
+++ b/src/aglextras/hmi/aglapplication.cpp
@@ -17,8 +17,8 @@
*/
#include "aglapplication.h"
#include "aglapplication_p.h"
-#include "aglwindow.h"
-#include "aglwindow_p.h"
+#include "aglwmclient.h"
+#include "aglwmclient_p.h"
#include <QtCore/QCommandLineParser>
#include <QtCore/QUrlQuery>
@@ -99,15 +99,15 @@ AGLApplication::load (const QString &filePath)
int
AGLApplication::exec (void)
{
- if (d_ptr->window) {
- d_ptr->window->attach(d_ptr->engine);
+ if (d_ptr->wmclient) {
+ d_ptr->wmclient->attach(d_ptr->engine);
}
return QGuiApplication::exec();
}
void AGLApplication::setupApplicationRole (const QString &role)
{
- d_ptr->window = new AGLWindow(role, d_ptr->port, d_ptr->secret);
+ d_ptr->wmclient = new AGLWmClient(role, d_ptr->port, d_ptr->secret);
}
QT_END_NAMESPACE
diff --git a/src/aglextras/hmi/aglapplication_p.h b/src/aglextras/hmi/aglapplication_p.h
index b12b5f4..93e5976 100644
--- a/src/aglextras/hmi/aglapplication_p.h
+++ b/src/aglextras/hmi/aglapplication_p.h
@@ -21,7 +21,7 @@
QT_BEGIN_NAMESPACE
class QUrl;
class QQmlApplicationEngine;
-class AGLWindow;
+class AGLWmClient;
class AGLApplication;
class AGLApplicationPrivate
{
@@ -34,7 +34,7 @@ class AGLApplicationPrivate
QString secret;
QUrl* binding_address;
QQmlApplicationEngine *engine;
- AGLWindow* window;
+ AGLWmClient* wmclient;
friend class AGLApplication;
};
QT_END_NAMESPACE
diff --git a/src/aglextras/hmi/aglwindow.cpp b/src/aglextras/hmi/aglwindow.cpp
deleted file mode 100644
index 7a16a4b..0000000
--- a/src/aglextras/hmi/aglwindow.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- * Copyright (C) 2017 The Qt Company Ltd.
- * Copyright (c) 2017 Panasonic 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 "aglwindow.h"
-#include "aglwindow_p.h"
-
-#include <QtQuick/QQuickWindow>
-#include <QtQml/QQmlApplicationEngine>
-
-#ifdef USE_AGL_HMI_FRAMEWORK
-#include <libhomescreen.hpp>
-#include <qlibwindowmanager.h>
-#endif // USE_AGL_HMI_FRAMEWORK
-
-QT_BEGIN_NAMESPACE
-
-AGLWindowPrivate::AGLWindowPrivate (AGLWindow*)
-{
- ;
-}
-
-AGLWindowPrivate::~AGLWindowPrivate (void)
-{
- ;
-}
-
-void AGLWindow::activate_surface (void)
-{
-#ifdef USE_AGL_HMI_FRAMEWORK
- qDebug("Disconnect!! SLOT activate_surface()");
- QLibWindowmanager::disconnect(d_ptr->loading);
-
- w_ptr->activateSurface(QString(d_ptr->layout));
-#endif // USE_AGL_HMI_FRAMEWORK
-}
-
-#ifdef USE_AGL_HMI_FRAMEWORK
-void AGLWindow::attach (QQmlApplicationEngine* engine)
-{
- if (d_ptr->binding) {
- QQuickWindow *window = qobject_cast<QQuickWindow *>(engine->rootObjects().first());
-
- qDebug("Connect!! frameSapped! (activate_surface())");
- d_ptr->loading = QLibWindowmanager::connect(window, SIGNAL(frameSwapped()),
- this, SLOT(activate_surface()));
- }
-}
-#else
-void AGLWindow::attach (QQmlApplicationEngine* engine)
-{
- QQuickWindow *window = qobject_cast<QQuickWindow *>(engine->rootObjects().first());
- window->resize(1080, 1920 - 218 - 215);
- window->setVisible(true);
-}
-#endif // USE_AGL_HMI_FRAMEWORK
-
-#ifdef USE_AGL_HMI_FRAMEWORK
-AGLWindow::AGLWindow (const QString& layout, int port, QString secret)
- : d_ptr(new AGLWindowPrivate(this)),
- h_ptr(new LibHomeScreen()),
- w_ptr(new QLibWindowmanager(nullptr))
-#else
-AGLWindow::AGLWindow (const QString&, int port, QString)
- : d_ptr(new AGLWindowPrivate(this))
-#endif // USE_AGL_HMI_FRAMEWORK
-{
- if (port == -1) {
- qDebug("This is not AGL binding application");
- return;
- }
-#ifdef USE_AGL_HMI_FRAMEWORK
- if (w_ptr->init(port, secret) != 0 ||
- h_ptr->init(port, secret.toStdString().c_str()) != 0) {
- qDebug("Cannot get binding API");
- return;
- }
-
- d_ptr->layout = layout;
-
- // Request a surface as described in layers.json windowmanager’s file
- if (w_ptr->requestSurface(d_ptr->layout) != 0) {
- qDebug("Cannot get surface for %s", qPrintable(d_ptr->layout));
- return;
- }
-
- d_ptr->binding = true;
-
- // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs
- w_ptr->set_event_handler (
- QLibWindowmanager::Event_SyncDraw,
- [this](json_object*) {
- qDebug("Surface got syncDraw!\n");
- w_ptr->endDraw(d_ptr->layout);
- }
- );
-
- // Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
- h_ptr->set_event_handler (
- LibHomeScreen::Event_TapShortcut,
- [this](json_object* object) {
- json_object *jo_app_name = nullptr;
- if(json_object_object_get_ex(object, "application_name", &jo_app_name)) {
- QString name(QLatin1String(json_object_get_string(jo_app_name)));
- if(d_ptr->layout == name) {
- qDebug("Surface %s got tapShortcut\n", qPrintable(name));
- w_ptr->activateSurface(d_ptr->layout);
- }
- }
- }
- );
-#endif // USE_AGL_HMI_FRAMEWORK
-}
-
-QT_END_NAMESPACE
diff --git a/src/aglextras/hmi/aglwmclient.cpp b/src/aglextras/hmi/aglwmclient.cpp
new file mode 100644
index 0000000..cb80e17
--- /dev/null
+++ b/src/aglextras/hmi/aglwmclient.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ * Copyright (C) 2017 The Qt Company Ltd.
+ * Copyright (c) 2017 Panasonic 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 "aglwmclient.h"
+#include "aglwmclient_p.h"
+
+#include <QtQuick/QQuickWindow>
+#include <QtQml/QQmlApplicationEngine>
+
+#ifdef USE_AGL_HMI_LOWLEVEL_API
+#include <libhomescreen.hpp>
+#include <libwindowmanager.h>
+#endif // USE_AGL_HMI_LOWLEVEL_API
+
+QT_BEGIN_NAMESPACE
+
+AGLWmClientPrivate::AGLWmClientPrivate (AGLWmClient*)
+{
+ ;
+}
+
+AGLWmClientPrivate::~AGLWmClientPrivate (void)
+{
+ ;
+}
+
+void AGLWmClient::activate_window (void)
+{
+#ifdef USE_AGL_HMI_LOWLEVEL_API
+ json_object *obj = json_object_new_object();
+ std::string target = QString(d_ptr->layout).toStdString();
+
+ // request area "normal.full"
+ std::string area = w_ptr->kStrLayoutNormal + "." + w_ptr->kStrAreaFull;
+ json_object_object_add(obj, w_ptr->kKeyDrawingName, json_object_new_string(target.c_str()));
+ json_object_object_add(obj, w_ptr->kKeyDrawingArea, json_object_new_string(area.c_str()));
+
+ w_ptr->activateWindow(obj);
+#endif // USE_AGL_HMI_LOWLEVEL_API
+}
+
+void AGLWmClient::disconnect_frame_swapped (void)
+{
+#ifdef USE_AGL_HMI_LOWLEVEL_API
+ qDebug("Disconnect!! SLOT disconnect_frame_swapped()");
+ disconnect(d_ptr->loading);
+
+ activate_window();
+#endif // USE_AGL_HMI_LOWLEVEL_API
+}
+
+#ifdef USE_AGL_HMI_LOWLEVEL_API
+void AGLWmClient::attach (QQmlApplicationEngine* engine)
+{
+ if (d_ptr->binding) {
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(engine->rootObjects().first());
+
+ qDebug("Connect!! frameSapped! (activate_window())");
+ d_ptr->loading = connect(window, SIGNAL(frameSwapped()),
+ this, SLOT(disconnect_frame_swapped()));
+ }
+}
+#else
+void AGLWmClient::attach (QQmlApplicationEngine* engine)
+{
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(engine->rootObjects().first());
+ window->resize(1080, 1920 - 218 - 215);
+ window->setVisible(true);
+}
+#endif // USE_AGL_HMI_LOWLEVEL_API
+
+#ifdef USE_AGL_HMI_LOWLEVEL_API
+AGLWmClient::AGLWmClient (const QString& layout, int port, QString secret)
+ : d_ptr(new AGLWmClientPrivate(this)),
+ h_ptr(new LibHomeScreen()),
+ w_ptr(new LibWindowmanager())
+#else
+AGLWmClient::AGLWmClient (const QString&, int port, QString)
+ : d_ptr(new AGLWmClientPrivate(this))
+#endif // USE_AGL_HMI_LOWLEVEL_API
+{
+ if (port == -1) {
+ qDebug("This is not AGL binding application");
+ return;
+ }
+#ifdef USE_AGL_HMI_LOWLEVEL_API
+ if (w_ptr->init(port, secret.toStdString().c_str()) != 0 ||
+ h_ptr->init(port, secret.toStdString().c_str()) != 0) {
+ qDebug("Cannot get binding API");
+ return;
+ }
+
+ d_ptr->binding = true;
+ d_ptr->layout = layout;
+
+ // Request a surface as described in layers.json windowmanager’s file
+ std::string role = layout.toStdString();
+
+ json_object *obj = json_object_new_object();
+ json_object_object_add(obj, w_ptr->kKeyDrawingName, json_object_new_string(role.c_str()));
+
+ int surface_id = w_ptr->requestSurface(obj);
+ if (surface_id < 0) {
+ qDebug("Cannot get surface for %s", qPrintable(d_ptr->layout));
+ return;
+ } else {
+ qDebug("SurfaceID is set to %d", surface_id);
+ std::string ivi_id = std::to_string(surface_id);
+ setenv("QT_IVI_SURFACE_ID", ivi_id.c_str(), true);
+ }
+
+
+ // Create an event callback against an event type. Here a lambda is called when SyncDraw event occurs
+ w_ptr->set_event_handler (
+ LibWindowmanager::Event_SyncDraw,
+ [this](json_object*) {
+ qDebug("Surface got syncDraw!\n");
+ json_object *obj = json_object_new_object();
+ std::string target = QString(d_ptr->layout).toStdString();
+ json_object_object_add(obj, w_ptr->kKeyDrawingName, json_object_new_string(target.c_str()));
+ w_ptr->endDraw(obj);
+ }
+ );
+
+ // Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
+ h_ptr->set_event_handler (
+ LibHomeScreen::Event_TapShortcut,
+ [this](json_object* object) {
+ json_object *jo_app_name = nullptr;
+ if(json_object_object_get_ex(object, "application_name", &jo_app_name)) {
+ QString name(QLatin1String(json_object_get_string(jo_app_name)));
+ if(d_ptr->layout == name) {
+ qDebug("Surface %s got tapShortcut\n", qPrintable(name));
+ activate_window();
+ }
+ }
+ }
+ );
+#endif // USE_AGL_HMI_LOWLEVEL_API
+}
+
+QT_END_NAMESPACE
diff --git a/src/aglextras/hmi/aglwindow.h b/src/aglextras/hmi/aglwmclient.h
index 7c7773a..4603610 100644
--- a/src/aglextras/hmi/aglwindow.h
+++ b/src/aglextras/hmi/aglwmclient.h
@@ -15,34 +15,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef AGLWINDOW_H
-#define AGLWINDOW_H
+#ifndef AGLWMCLIENT_H
+#define AGLWMCLIENT_H
#include <QtAGLExtras/aglextrasglobal.h>
#include <QSharedPointer>
QT_BEGIN_NAMESPACE
class LibHomeScreen;
-class QLibWindowmanager;
+class LibWindowmanager;
class QQmlApplicationEngine;
-class AGLWindowPrivate;
-class AGLEXTRAS_EXPORT AGLWindow : public QObject
+class AGLWmClientPrivate;
+class AGLEXTRAS_EXPORT AGLWmClient : public QObject
{
Q_OBJECT
public:
- AGLWindow (const QString& layout, int port, QString secret);
+ AGLWmClient (const QString& layout, int port, QString secret);
void attach (QQmlApplicationEngine* engine);
-public slots:
- void activate_surface (void);
+private slots:
+ void disconnect_frame_swapped (void);
private:
- friend class AGLWindowPrivate;
- QSharedPointer<AGLWindowPrivate> d_ptr;
+ void activate_window (void);
+ friend class AGLWmClientPrivate;
+ QSharedPointer<AGLWmClientPrivate> d_ptr;
QSharedPointer<LibHomeScreen> h_ptr;
- QSharedPointer<QLibWindowmanager> w_ptr;
+ QSharedPointer<LibWindowmanager> w_ptr;
};
QT_END_NAMESPACE
-#endif // AGLWINDOW_H
+#endif // AGLWMCLIENT_H
diff --git a/src/aglextras/hmi/aglwindow_p.h b/src/aglextras/hmi/aglwmclient_p.h
index 0ad6510..239a4ae 100644
--- a/src/aglextras/hmi/aglwindow_p.h
+++ b/src/aglextras/hmi/aglwmclient_p.h
@@ -19,18 +19,18 @@
#define AGLWINDOW_P_H
QT_BEGIN_NAMESPACE
-class AGLWindowPrivate
+class AGLWmClientPrivate
{
public:
- explicit AGLWindowPrivate (AGLWindow* window);
- ~AGLWindowPrivate (void);
+ explicit AGLWmClientPrivate (AGLWmClient* wmclient);
+ ~AGLWmClientPrivate (void);
private:
QString layout; // id of layaout which is managed by AGL WM
QMetaObject::Connection loading;
bool binding = false;
- friend class AGLWindow;
+ friend class AGLWmClient;
};
QT_END_NAMESPACE
-#endif // AGLWINDOW_P_H
+#endif // AGLWMCLIENT_P_H
diff --git a/src/aglextras/hmi/hmi.pri b/src/aglextras/hmi/hmi.pri
index 91c712d..6b179cd 100644
--- a/src/aglextras/hmi/hmi.pri
+++ b/src/aglextras/hmi/hmi.pri
@@ -1,9 +1,9 @@
SOURCES += \
$$PWD/aglapplication.cpp \
- $$PWD/aglwindow.cpp
+ $$PWD/aglwmclient.cpp
HEADERS += \
$$PWD/aglapplication.h \
$$PWD/aglapplication_p.h \
- $$PWD/aglwindow.h \
- $$PWD/aglwindow_p.h
+ $$PWD/aglwmclient.h \
+ $$PWD/aglwmclient_p.h