summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/blackberry/qbbnativeinterface.cpp
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire@kdab.com>2012-03-27 15:41:00 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-04-03 13:08:44 (GMT)
commit3bb80da20a985ccdef5e946a88d57146849bdadf (patch)
treed936beec0fd6de5ab90d955a1af9113dcacce9d4 /src/plugins/platforms/blackberry/qbbnativeinterface.cpp
parent45c6fc890c226c9021d41373c7718d596eb888d1 (diff)
downloadQt-3bb80da20a985ccdef5e946a88d57146849bdadf.zip
Qt-3bb80da20a985ccdef5e946a88d57146849bdadf.tar.gz
Qt-3bb80da20a985ccdef5e946a88d57146849bdadf.tar.bz2
Add a native interface with the ability to query the window group
The window group is needed by QtMobility, as the BB multimedia API requires the window group when creating a video overlay window Change-Id: Ifc029c31b5a1750631a6b397f7c33aa31e483c81 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/plugins/platforms/blackberry/qbbnativeinterface.cpp')
-rw-r--r--src/plugins/platforms/blackberry/qbbnativeinterface.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/plugins/platforms/blackberry/qbbnativeinterface.cpp b/src/plugins/platforms/blackberry/qbbnativeinterface.cpp
new file mode 100644
index 0000000..8cd931b
--- /dev/null
+++ b/src/plugins/platforms/blackberry/qbbnativeinterface.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+**
+** Contact: Research In Motion <blackberry-qt@qnx.com>
+** Contact: Klarälvdalens Datakonsult AB <info@kdab.com>
+**
+** This file is part of the QtCore module 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.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbbnativeinterface.h"
+
+#include "qbbintegration.h"
+#include "qbbscreen.h"
+#include <QtGui/QWidget>
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+QBBNativeInterface::QBBNativeInterface(QBBIntegration *integration)
+ : mIntegration(integration)
+{
+}
+
+void *QBBNativeInterface::nativeResourceForWidget(const QByteArray &resource, QWidget *widget)
+{
+ if (resource == "windowGroup" && widget) {
+ const QWidget * const nativeWidget = widget->nativeParentWidget();
+ const screen_window_t window = reinterpret_cast<screen_window_t>(nativeWidget->winId());
+ const QBBScreen * const screen = mIntegration->screenForWindow(window);
+ if (screen) {
+ // We can't just call data() instead of constData() here, since that would detach
+ // and the lifetime of the char * would not be long enough. Therefore the const_cast.
+ return const_cast<char *>(screen->rootWindow()->groupName().constData());
+ }
+ }
+
+ return 0;
+}
+
+QT_END_NAMESPACE