Initial implementation of QQnxServices

Extends platform services for QNX devices.

Change-Id: I1eb685cdb38591cd73eaaf40ffb5691db0142953
Reviewed-by: Jeff Kehres <jkehres@rim.com>
Reviewed-by: Sean Harmer <sh@theharmers.co.uk>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
Rafael Roquetto 2012-03-19 17:13:13 +01:00 committed by Qt by Nokia
parent 3b69fa6bc7
commit 400e59201b
5 changed files with 176 additions and 0 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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 <bps/navigator.h>
#include <stdbool.h>
#include <sys/platform.h>
#include <QUrl>
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

View File

@ -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 <QtGui/QPlatformServices>
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