diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-09-01 09:26:39 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-10-04 08:41:30 +0000 |
commit | d3afe18e88ba158b4eff13f6a0a359176d44c36d (patch) | |
tree | 7deb1fe0c8523911fed87920bef95954990d649a | |
parent | 7ee4be6af2c92c345539bb4950dd48d7a740847d (diff) |
Add QML API and documentation for ivi-application
Change-Id: I65504503f07477b05f7e645ee61544e62e728bdc
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
6 files changed, 192 insertions, 1 deletions
diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri index eda13476b..9c5b37eac 100644 --- a/src/compositor/extensions/extensions.pri +++ b/src/compositor/extensions/extensions.pri @@ -49,11 +49,13 @@ qtHaveModule(quick):contains(QT_CONFIG, opengl) { HEADERS += \ extensions/qwaylandquickshellsurfaceitem.h \ extensions/qwaylandquickshellsurfaceitem_p.h \ + extensions/qwaylandivisurfaceintegration_p.h \ extensions/qwaylandwlshellintegration_p.h \ extensions/qwaylandxdgshellv5integration_p.h \ SOURCES += \ extensions/qwaylandquickshellsurfaceitem.cpp \ + extensions/qwaylandivisurfaceintegration.cpp \ extensions/qwaylandwlshellintegration.cpp \ extensions/qwaylandxdgshellv5integration.cpp \ diff --git a/src/compositor/extensions/qwaylandiviapplication.cpp b/src/compositor/extensions/qwaylandiviapplication.cpp index c3eea08d7..30784e4ec 100644 --- a/src/compositor/extensions/qwaylandiviapplication.cpp +++ b/src/compositor/extensions/qwaylandiviapplication.cpp @@ -91,6 +91,15 @@ QByteArray QWaylandIviApplication::interfaceName() } /*! + * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceRequested(object surface, int iviId, object resource) + * + * This signal is emitted when the client has requested an \c ivi_surface to be associated + * with \a surface, which is identified by \a id. The handler for this signal is + * expected to create the ivi surface and initialize it within the scope of the + * signal emission. If no ivi surface is created, a default one will be created instead. + */ + +/*! * \fn void QWaylandWlShell::iviSurfaceRequested(QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) * * This signal is emitted when the client has requested an \c ivi_surface to be associated @@ -100,6 +109,13 @@ QByteArray QWaylandIviApplication::interfaceName() */ /*! + * \qmlsignal void QtWaylandCompositor::IviApplication::iviSurfaceCreated(object *iviSurface) + * + * This signal is emitted when an IviSurface has been created. The supplied \a iviSurface is + * most commonly used to instantiate a ShellSurfaceItem. + */ + +/*! * \fn void QtWaylandCompositor::IviApplication::iviSurfaceCreated(QWaylandIviSurface *iviSurface) * * This signal is emitted when an IviSurface has been created. diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp index 4708243a6..bed3eb057 100644 --- a/src/compositor/extensions/qwaylandivisurface.cpp +++ b/src/compositor/extensions/qwaylandivisurface.cpp @@ -37,6 +37,7 @@ #include "qwaylandivisurface.h" #include "qwaylandivisurface_p.h" #include "qwaylandiviapplication_p.h" +#include "qwaylandivisurfaceintegration_p.h" #include <QtWaylandCompositor/QWaylandResource> @@ -68,6 +69,13 @@ QWaylandIviSurface::QWaylandIviSurface(QWaylandIviApplication *application, QWay } /*! + * \qmlmethod void QtWaylandCompositor::IviSurface::initialize(object iviApplication, object surface, int iviId, object resource) + * + * Initializes the IviSurface, associating it with the given \a iviApplication, \a surface, + * \a client, \a iviId, and \a resource. + */ + +/*! * Initializes the QWaylandIviSurface, associating it with the given \a iviApplication, \a surface, * \a iviId, and \a resource. */ @@ -89,6 +97,12 @@ void QWaylandIviSurface::initialize(QWaylandIviApplication *iviApplication, QWay } /*! + * \qmlproperty object QtWaylandCompositor::IviSurface::surface + * + * This property holds the surface associated with this IviSurface. + */ + +/*! * \property QWaylandIviSurface::surface * * This property holds the surface associated with this QWaylandIviSurface. @@ -100,6 +114,13 @@ QWaylandSurface *QWaylandIviSurface::surface() const } /*! + * \qmlproperty int QtWaylandCompositor::IviSurface::iviId + * \readonly + * + * This property holds the ivi id id of this IviSurface. + */ + +/*! * \property QWaylandClient::iviId * * This property holds the ivi id of this QWaylandIviSurface. @@ -143,6 +164,12 @@ QWaylandIviSurface *QWaylandIviSurface::fromResource(wl_resource *resource) } /*! + * \qmlmethod int QtWaylandCompositor::IviSurface::sendConfigure(size size) + * + * Sends a configure event to the client, telling it to resize the surface to the given \a size. + */ + +/*! * Sends a configure event to the client, telling it to resize the surface to the given \a size. */ void QWaylandIviSurface::sendConfigure(const QSize &size) @@ -154,7 +181,7 @@ void QWaylandIviSurface::sendConfigure(const QSize &size) #ifdef QT_WAYLAND_COMPOSITOR_QUICK QWaylandQuickShellIntegration *QWaylandIviSurface::createIntegration(QWaylandQuickShellSurfaceItem *item) { - return nullptr; // TODO + return new QtWayland::IviSurfaceIntegration(item); } #endif diff --git a/src/compositor/extensions/qwaylandivisurfaceintegration.cpp b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp new file mode 100644 index 000000000..3a3d9c1c9 --- /dev/null +++ b/src/compositor/extensions/qwaylandivisurfaceintegration.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWaylandCompositor module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandivisurfaceintegration_p.h" + +#include <QtWaylandCompositor/QWaylandCompositor> +#include <QtWaylandCompositor/QWaylandIviSurface> +#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> +#include <QtWaylandCompositor/QWaylandSeat> + +QT_BEGIN_NAMESPACE + +namespace QtWayland { + +IviSurfaceIntegration::IviSurfaceIntegration(QWaylandQuickShellSurfaceItem *item) + : QWaylandQuickShellIntegration(item) + , m_item(item) + , m_shellSurface(qobject_cast<QWaylandIviSurface *>(item->shellSurface())) +{ + m_item->setSurface(m_shellSurface->surface()); + connect(m_shellSurface, &QWaylandIviSurface::destroyed, this, &IviSurfaceIntegration::handleIviSurfaceDestroyed); +} + +void IviSurfaceIntegration::handleIviSurfaceDestroyed() +{ + m_shellSurface = nullptr; +} + +} + +QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandivisurfaceintegration_p.h b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h new file mode 100644 index 000000000..534caf642 --- /dev/null +++ b/src/compositor/extensions/qwaylandivisurfaceintegration_p.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWaylandCompositor module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDIVISURFACEINTEGRATION_H +#define QWAYLANDIVISURFACEINTEGRATION_H + +#include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h> + +#include <QtWaylandCompositor/QWaylandIviSurface> + +QT_BEGIN_NAMESPACE + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +namespace QtWayland { + +class IviSurfaceIntegration : public QWaylandQuickShellIntegration +{ + Q_OBJECT +public: + IviSurfaceIntegration(QWaylandQuickShellSurfaceItem *item); + +private Q_SLOTS: + void handleIviSurfaceDestroyed(); + +private: + QWaylandQuickShellSurfaceItem *m_item; + QWaylandIviSurface *m_shellSurface; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDIVISURFACEINTEGRATION_H diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp index e8204f7f2..28c517fd5 100644 --- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp +++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp @@ -56,6 +56,8 @@ #include <QtWaylandCompositor/QWaylandWlShell> #include <QtWaylandCompositor/QWaylandTextInputManager> #include <QtWaylandCompositor/QWaylandXdgShellV5> +#include <QtWaylandCompositor/QWaylandIviApplication> +#include <QtWaylandCompositor/QWaylandIviSurface> #include <QtWaylandCompositor/qwaylandexport.h> #include "qwaylandmousetracker_p.h" @@ -64,6 +66,7 @@ QT_BEGIN_NAMESPACE Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(QWaylandQuickCompositor) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQtWindowManager) +Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIviApplication) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlShell) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV5) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandTextInputManager) @@ -133,6 +136,8 @@ public: //This should probably be somewhere else qmlRegisterType<QWaylandQtWindowManagerQuickExtension>(uri, 1, 0, "QtWindowManager"); + qmlRegisterType<QWaylandIviApplicationQuickExtension>(uri, 1, 0, "IviApplication"); + qmlRegisterType<QWaylandIviSurface>(uri, 1, 0, "IviSurface"); qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell"); qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface"); qmlRegisterType<QWaylandQuickShellSurfaceItem>(uri, 1, 0, "ShellSurfaceItem"); |