From 400e59201bf93dc9519cc4cf58286863330dc4eb Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Mon, 19 Mar 2012 17:13:13 +0100 Subject: Initial implementation of QQnxServices Extends platform services for QNX devices. Change-Id: I1eb685cdb38591cd73eaaf40ffb5691db0142953 Reviewed-by: Jeff Kehres Reviewed-by: Sean Harmer Reviewed-by: Kevin Krammer Reviewed-by: Robin Burchell --- src/plugins/platforms/qnx/qnx.pro | 10 ++++ src/plugins/platforms/qnx/qqnxintegration.cpp | 17 ++++++ src/plugins/platforms/qnx/qqnxintegration.h | 4 ++ src/plugins/platforms/qnx/qqnxservices.cpp | 81 +++++++++++++++++++++++++++ src/plugins/platforms/qnx/qqnxservices.h | 64 +++++++++++++++++++++ 5 files changed, 176 insertions(+) create mode 100644 src/plugins/platforms/qnx/qqnxservices.cpp create mode 100644 src/plugins/platforms/qnx/qqnxservices.h (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index cf82084de0..588464fc47 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -37,6 +37,7 @@ SOURCES = main.cpp \ qqnxclipboard.cpp \ qqnxrootwindow.cpp + HEADERS = qqnxbuffer.h \ qqnxeventthread.h \ qqnxkeytranslator.h \ @@ -51,6 +52,11 @@ HEADERS = qqnxbuffer.h \ qqnxclipboard.h \ qqnxrootwindow.h +CONFIG(blackberry) { + SOURCES += qqnxservices.cpp + HEADERS += qqnxservices.h +} + CONFIG(qqnx_imf) { DEFINES += QQNX_IMF HEADERS += qqnxinputcontext_imf.h @@ -64,6 +70,10 @@ QMAKE_CXXFLAGS += -I./private LIBS += -lpps -lscreen -lEGL -lclipboard +CONFIG(blackberry) { + LIBS += -lbps +} + include (../../../platformsupport/eglconvenience/eglconvenience.pri) include (../../../platformsupport/fontdatabases/fontdatabases.pri) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index cb7f14f963..5ef34f3aea 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -50,6 +50,7 @@ #include "qqnxvirtualkeyboard.h" #include "qqnxclipboard.h" #include "qqnxglcontext.h" +#include "qqnxservices.h" #if defined(QQnx_IMF) #include "qqnxinputcontext_imf.h" @@ -82,6 +83,7 @@ QQnxIntegration::QQnxIntegration() , m_fontDatabase(new QGenericUnixFontDatabase()) , m_paintUsingOpenGL(false) , m_eventDispatcher(createUnixEventDispatcher()) + , m_services(0) #ifndef QT_NO_CLIPBOARD , m_clipboard(0) #endif @@ -124,6 +126,11 @@ QQnxIntegration::QQnxIntegration() // Set up the input context m_inputContext = new QQnxInputContext; + + // Create services handling class +#ifdef Q_OS_BLACKBERRY + m_services = new QQnxServices; +#endif } QQnxIntegration::~QQnxIntegration() @@ -154,6 +161,11 @@ QQnxIntegration::~QQnxIntegration() // Cleanup global OpenGL resources QQnxGLContext::shutdown(); + // Destroy services class +#ifdef Q_OS_BLACKBERRY + delete m_services; +#endif + #if defined(QQNXINTEGRATION_DEBUG) qDebug() << "QQnx: platform plugin shutdown end"; #endif @@ -266,6 +278,11 @@ QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const return QPlatformIntegration::styleHint(hint); } +QPlatformServices * QQnxIntegration::services() const +{ + return m_services; +} + QWindow *QQnxIntegration::window(screen_window_t qnxWindow) { #if defined(QQNXINTEGRATION_DEBUG) diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index 892bb6e16f..6aa16100ad 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -54,6 +54,7 @@ class QQnxEventThread; class QQnxInputContext; class QQnxNavigatorEventHandler; class QQnxWindow; +class QQnxServices; #ifndef QT_NO_CLIPBOARD class QQnxClipboard; @@ -91,6 +92,8 @@ public: bool paintUsingOpenGL() const { return m_paintUsingOpenGL; } + virtual QPlatformServices *services() const; + static QWindow *window(screen_window_t qnxWindow); private: @@ -104,6 +107,7 @@ private: QPlatformFontDatabase *m_fontDatabase; bool m_paintUsingOpenGL; QAbstractEventDispatcher *m_eventDispatcher; + QQnxServices *m_services; #ifndef QT_NO_CLIPBOARD mutable QQnxClipboard* m_clipboard; #endif diff --git a/src/plugins/platforms/qnx/qqnxservices.cpp b/src/plugins/platforms/qnx/qqnxservices.cpp new file mode 100644 index 0000000000..a1a27906ae --- /dev/null +++ b/src/plugins/platforms/qnx/qqnxservices.cpp @@ -0,0 +1,81 @@ +/*************************************************************************** +** +** Copyright (C) 2011 - 2012 Research In Motion +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qqnxservices.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QQnxServices::QQnxServices() +{ + bps_initialize(); +} + +QQnxServices::~QQnxServices() +{ + bps_shutdown(); +} + +bool QQnxServices::openUrl(const QUrl &url) +{ + return navigatorInvoke(url); +} + +bool QQnxServices::openDocument(const QUrl &url) +{ + return navigatorInvoke(url); +} + +bool QQnxServices::navigatorInvoke(const QUrl &url) +{ + if (!url.isValid() || url.isRelative()) + return false; + + int ret = navigator_invoke(url.toString().toUtf8(), 0); + + return (ret == BPS_SUCCESS); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxservices.h b/src/plugins/platforms/qnx/qqnxservices.h new file mode 100644 index 0000000000..36eb8edf65 --- /dev/null +++ b/src/plugins/platforms/qnx/qqnxservices.h @@ -0,0 +1,64 @@ +/*************************************************************************** +** +** Copyright (C) 2011 - 2012 Research In Motion +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 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 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQNXSERVICES_H +#define QQNXSERVICES_H + +#include + +QT_BEGIN_NAMESPACE + +class QQnxServices : public QPlatformServices +{ +public: + QQnxServices(); + ~QQnxServices(); + + bool openUrl(const QUrl &url); + bool openDocument(const QUrl &url); + +private: + bool navigatorInvoke(const QUrl &url); +}; + +QT_END_NAMESPACE + +#endif // QQNXSERVICES_H -- cgit v1.2.3