diff options
author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
tree | f478babb801e720de7bfaee23443ffe029f58731 /Source/WebKit/qt/examples/platformplugin | |
parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebKit/qt/examples/platformplugin')
7 files changed, 798 insertions, 0 deletions
diff --git a/Source/WebKit/qt/examples/platformplugin/README b/Source/WebKit/qt/examples/platformplugin/README new file mode 100644 index 0000000..e220d04 --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/README @@ -0,0 +1,14 @@ +Platform plugin example. + +This project will create a shared library named platformplugin in directory $$[QT_INSTALL_PLUGINS]/webkit +that will provide combo boxes popups to QtWebKit. + +QtWebKit will look for the plugins automatically so there is no need to make any other configuration to +put the plugin into use. To stop using the plugin just remove the directory $$[QT_INSTALL_PLUGINS]/webkit. + +A copy of qwebkitplatformplugin.h is provided with the example, as platform plugins should not depend +on the precense of QtWebKit to build. + +This plugin can provide popups for <select multiple> elements but to use this feature QtWebKit must be +compiled with NO_LISTBOX_RENDERING enabled. + diff --git a/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp b/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp new file mode 100644 index 0000000..d991ab1 --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "WebNotificationPresenter.h" + +WebNotificationWidget::WebNotificationWidget() + : QWidget() +{ +} + +WebNotificationWidget::~WebNotificationWidget() +{ +} + +void WebNotificationWidget::showNotification(const QWebNotificationData* data) +{ + QPixmap mask; + QPainter painter(&mask); + painter.fillRect(0, 0, 300, 100, Qt::lightGray); + QBitmap bitmap(mask); + setMask(bitmap); + QGridLayout* layout = new QGridLayout(this); + layout->addWidget(new QLabel(data->title()), 0, 0, 1, 5); + int messagePosition = 0; + QPixmap pixmap; + if (data->iconData().length() && pixmap.loadFromData(data->iconData())) { + QLabel* label = new QLabel; + label->setPixmap(pixmap); + layout->addWidget(label, 1, 0, 1, 1); + messagePosition++; + } + QLabel* messageLabel = new QLabel(data->message()); + messageLabel->setMask(bitmap); + messageLabel->setWordWrap(true); + layout->addWidget(messageLabel, 1, messagePosition, 1, 5 - messagePosition); + setLayout(layout); + setFixedSize(300, 100); + show(); +} + +bool WebNotificationWidget::event(QEvent* ev) +{ + if (ev->type() == QEvent::MouseButtonRelease) { + emit notificationClicked(); + return true; + } + if (ev->type() == QEvent::Close) { + emit notificationClosed(); + return true; + } + return QWidget::event(ev); +} + diff --git a/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h b/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h new file mode 100644 index 0000000..f46e5cb --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/WebNotificationPresenter.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef WebNotificationPresenter_h +#define WebNotificationPresenter_h + +#include "qwebkitplatformplugin.h" +#include <QtGui> + +class WebNotificationWidget : public QWidget +{ + Q_OBJECT +public: + WebNotificationWidget(); + virtual ~WebNotificationWidget(); + + void showNotification(const QWebNotificationData*); + bool event(QEvent*); + +Q_SIGNALS: + void notificationClosed(); + void notificationClicked(); +}; + +class WebNotificationPresenter : public QWebNotificationPresenter +{ + Q_OBJECT +public: + WebNotificationPresenter() + : QWebNotificationPresenter() + { + m_widget = new WebNotificationWidget(); + connect(m_widget, SIGNAL(notificationClosed()), this, SIGNAL(notificationClosed())); + connect(m_widget, SIGNAL(notificationClicked()), this, SIGNAL(notificationClicked())); + } + virtual ~WebNotificationPresenter() { m_widget->close(); delete m_widget; } + + void showNotification(const QWebNotificationData* data) { m_widget->showNotification(data); } + +private: + WebNotificationWidget* m_widget; +}; + +#endif // WebNotificationsUi_h diff --git a/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp b/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp new file mode 100644 index 0000000..320079f --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#include "WebPlugin.h" + +#include <QEvent> +#include <QHBoxLayout> +#include <QKeyEvent> +#include <QListWidget> +#include <QListWidgetItem> +#include <QPainter> +#include <QtPlugin> +#include <QPushButton> +#include <QStyledItemDelegate> +#include <QVBoxLayout> + +static const int gMaemoListItemSize = 70; +static const int gMaemoListPadding = 38; +static const int gMaemoMaxVisibleItems = 5; + +void Popup::populateList() +{ + QListWidgetItem* listItem; + for (int i = 0; i < m_data.itemCount(); ++i) { + if (m_data.itemType(i) == QWebSelectData::Option) { + listItem = new QListWidgetItem(m_data.itemText(i)); + m_list->addItem(listItem); + listItem->setSelected(m_data.itemIsSelected(i)); + } else if (m_data.itemType(i) == QWebSelectData::Group) { + listItem = new QListWidgetItem(m_data.itemText(i)); + m_list->addItem(listItem); + listItem->setSelected(false); + listItem->setFlags(Qt::NoItemFlags); + } + } + connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemSelected(QListWidgetItem*))); +} + +void Popup::onItemSelected(QListWidgetItem* item) +{ + if (item->flags() != Qt::NoItemFlags) + emit itemClicked(m_list->row(item)); +} + +WebPopup::WebPopup() + : m_popup(0) +{ +} + +WebPopup::~WebPopup() +{ + if (m_popup) + m_popup->deleteLater(); +} + +Popup* WebPopup::createSingleSelectionPopup(const QWebSelectData& data) +{ + return new SingleSelectionPopup(data); +} + +Popup* WebPopup::createMultipleSelectionPopup(const QWebSelectData& data) +{ + return new MultipleSelectionPopup(data); +} + +Popup* WebPopup::createPopup(const QWebSelectData& data) +{ + Popup* result = data.multiple() ? createMultipleSelectionPopup(data) : createSingleSelectionPopup(data); + connect(result, SIGNAL(finished(int)), this, SLOT(popupClosed())); + connect(result, SIGNAL(itemClicked(int)), this, SLOT(itemClicked(int))); + return result; +} + +void WebPopup::show(const QWebSelectData& data) +{ + if (m_popup) + return; + + m_popup = createPopup(data); + m_popup->show(); +} + +void WebPopup::hide() +{ + if (!m_popup) + return; + + m_popup->accept(); +} + +void WebPopup::popupClosed() +{ + if (!m_popup) + return; + + m_popup->deleteLater(); + m_popup = 0; + emit didHide(); +} + +void WebPopup::itemClicked(int idx) +{ + emit selectItem(idx, true, false); +} + +SingleSelectionPopup::SingleSelectionPopup(const QWebSelectData& data) + : Popup(data) +{ + const char* title = "select"; + if (qstrcmp(title, "weba_ti_texlist_single")) + setWindowTitle(QString::fromUtf8(title)); + else + setWindowTitle("Select item"); + + QHBoxLayout* hLayout = new QHBoxLayout(this); + hLayout->setContentsMargins(0, 0, 0, 0); + + m_list = new QListWidget(this); + populateList(); + + hLayout->addSpacing(gMaemoListPadding); + hLayout->addWidget(m_list); + hLayout->addSpacing(gMaemoListPadding); + + connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(accept())); + + const int visibleItemCount = (m_list->count() > gMaemoMaxVisibleItems) ? gMaemoMaxVisibleItems : m_list->count(); + resize(size().width(), visibleItemCount * gMaemoListItemSize); +} + + +class MultipleItemListDelegate : public QStyledItemDelegate { +public: + MultipleItemListDelegate(QObject* parent = 0) + : QStyledItemDelegate(parent) + { + tickMark = QIcon::fromTheme("widgets_tickmark_list").pixmap(48, 48); + } + + void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const + { + QStyledItemDelegate::paint(painter, option, index); + + if (option.state & QStyle::State_Selected) + painter->drawPixmap(option.rect.width() - tickMark.rect().width(), option.rect.y() + (option.rect.height() / 2 - tickMark.rect().height() / 2), tickMark); + } + +private: + QPixmap tickMark; +}; + +MultipleSelectionPopup::MultipleSelectionPopup(const QWebSelectData& data) + : Popup(data) +{ + const char* title = "select"; + if (qstrcmp(title, "weba_ti_textlist_multi")) + setWindowTitle(QString::fromUtf8(title)); + else + setWindowTitle("Select items"); + + QHBoxLayout* hLayout = new QHBoxLayout(this); + hLayout->setContentsMargins(0, 0, 0, 0); + + m_list = new QListWidget(this); + m_list->setSelectionMode(QAbstractItemView::MultiSelection); + populateList(); + + MultipleItemListDelegate* delegate = new MultipleItemListDelegate(this); + m_list->setItemDelegate(delegate); + + hLayout->addSpacing(gMaemoListPadding); + hLayout->addWidget(m_list); + + QVBoxLayout* vLayout = new QVBoxLayout(); + + const int visibleItemCount = (m_list->count() > gMaemoMaxVisibleItems) ? gMaemoMaxVisibleItems : m_list->count(); + vLayout->addSpacing((visibleItemCount - 1) * gMaemoListItemSize); + + QPushButton* done = new QPushButton(this); + title = "done"; + if (qstrcmp(title, "wdgt_bd_done")) + done->setText(QString::fromUtf8(title)); + else + done->setText("Done"); + + done->setMinimumWidth(178); + vLayout->addWidget(done); + + hLayout->addSpacing(8); + hLayout->addLayout(vLayout); + hLayout->addSpacing(18); + + connect(done, SIGNAL(clicked()), this, SLOT(accept())); + resize(size().width(), visibleItemCount * gMaemoListItemSize); +} + +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA +FullScreenVideoWidget::FullScreenVideoWidget(QMediaPlayer* player) + : QVideoWidget() + , m_mediaPlayer(player) +{ + Q_ASSERT(m_mediaPlayer); + + setFullScreen(true); + m_mediaPlayer->setVideoOutput(this); +} + +bool FullScreenVideoWidget::event(QEvent* ev) +{ + if (ev->type() == QEvent::MouseButtonDblClick) { + emit fullScreenClosed(); + ev->accept(); + return true; + } + return QWidget::event(ev); +} + +void FullScreenVideoWidget::keyPressEvent(QKeyEvent* ev) +{ + if (ev->key() == Qt::Key_Space) { + if (m_mediaPlayer->state() == QMediaPlayer::PlayingState) + m_mediaPlayer->pause(); + else + m_mediaPlayer->play(); + ev->accept(); + return; + } +} + +FullScreenVideoHandler::FullScreenVideoHandler() + : m_mediaWidget(0) +{ +} + +FullScreenVideoHandler::~FullScreenVideoHandler() +{ + delete m_mediaWidget; +} + +bool FullScreenVideoHandler::requiresFullScreenForVideoPlayback() const +{ + return true; +} + +void FullScreenVideoHandler::enterFullScreen(QMediaPlayer* player) +{ + Q_ASSERT(player); + + m_mediaWidget = new FullScreenVideoWidget(player); + connect(m_mediaWidget, SIGNAL(fullScreenClosed()), this, SIGNAL(fullScreenClosed())); + m_mediaWidget->showFullScreen(); +} + +void FullScreenVideoHandler::exitFullScreen() +{ + m_mediaWidget->hide(); + delete m_mediaWidget; + m_mediaWidget = 0; +} +#endif + +bool WebPlugin::supportsExtension(Extension extension) const +{ + switch (extension) { + case MultipleSelections: + return true; +#if ENABLE_NOTIFICATIONS + case Notifications: + return true; +#endif + case TouchInteraction: + return true; +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA + case FullScreenVideoPlayer: + return true; +#endif + default: + return false; + } +} + +QObject* WebPlugin::createExtension(Extension extension) const +{ + switch (extension) { + case MultipleSelections: + return new WebPopup(); +#if ENABLE_NOTIFICATIONS + case Notifications: + return new WebNotificationPresenter(); +#endif + case TouchInteraction: + return new TouchModifier(); +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA + case FullScreenVideoPlayer: + return new FullScreenVideoHandler(); +#endif + default: + return 0; + } +} + +Q_EXPORT_PLUGIN2(platformplugin, WebPlugin) diff --git a/Source/WebKit/qt/examples/platformplugin/WebPlugin.h b/Source/WebKit/qt/examples/platformplugin/WebPlugin.h new file mode 100644 index 0000000..4994669 --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/WebPlugin.h @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ +#ifndef WEBPLUGIN_H +#define WEBPLUGIN_H + +#include "qwebkitplatformplugin.h" +#include "WebNotificationPresenter.h" + +#include <QDialog> +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA +#include <QVideoWidget> +#endif + +class QListWidgetItem; +class QListWidget; + +class Popup : public QDialog { + Q_OBJECT +public: + Popup(const QWebSelectData& data) : m_data(data) { setModal(true); } + +signals: + void itemClicked(int idx); + +protected slots: + void onItemSelected(QListWidgetItem* item); + +protected: + void populateList(); + + const QWebSelectData& m_data; + QListWidget* m_list; +}; + + +class SingleSelectionPopup : public Popup { + Q_OBJECT +public: + SingleSelectionPopup(const QWebSelectData& data); +}; + + +class MultipleSelectionPopup : public Popup { + Q_OBJECT +public: + MultipleSelectionPopup(const QWebSelectData& data); +}; + + +class WebPopup : public QWebSelectMethod { + Q_OBJECT +public: + WebPopup(); + ~WebPopup(); + + virtual void show(const QWebSelectData& data); + virtual void hide(); + +private slots: + void popupClosed(); + void itemClicked(int idx); + +private: + Popup* m_popup; + + Popup* createPopup(const QWebSelectData& data); + Popup* createSingleSelectionPopup(const QWebSelectData& data); + Popup* createMultipleSelectionPopup(const QWebSelectData& data); +}; + +class TouchModifier : public QWebTouchModifier +{ + Q_OBJECT +public: + unsigned hitTestPaddingForTouch(const PaddingDirection direction) const { + // Use 10 as padding in each direction but Up. + if (direction == QWebTouchModifier::Up) + return 15; + return 10; + } +}; + +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA +class FullScreenVideoWidget : public QVideoWidget { + Q_OBJECT +public: + FullScreenVideoWidget(QMediaPlayer*); + virtual ~FullScreenVideoWidget() {} + +Q_SIGNALS: + void fullScreenClosed(); + +protected: + bool event(QEvent*); + void keyPressEvent(QKeyEvent*); + +private: + QMediaPlayer* m_mediaPlayer; // not owned +}; + +class FullScreenVideoHandler : public QWebFullScreenVideoHandler { + Q_OBJECT +public: + FullScreenVideoHandler(); + virtual ~FullScreenVideoHandler(); + bool requiresFullScreenForVideoPlayback() const; + +public Q_SLOTS: + void enterFullScreen(QMediaPlayer*); + void exitFullScreen(); + +private: + FullScreenVideoWidget* m_mediaWidget; // owned +}; +#endif + +class WebPlugin : public QObject, public QWebKitPlatformPlugin +{ + Q_OBJECT + Q_INTERFACES(QWebKitPlatformPlugin) +public: + virtual bool supportsExtension(Extension extension) const; + virtual QObject* createExtension(Extension extension) const; +}; + +#endif // WEBPLUGIN_H diff --git a/Source/WebKit/qt/examples/platformplugin/platformplugin.pro b/Source/WebKit/qt/examples/platformplugin/platformplugin.pro new file mode 100644 index 0000000..ccc0b3a --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/platformplugin.pro @@ -0,0 +1,33 @@ +QT += core gui +TARGET = $$qtLibraryTarget(platformplugin) +TEMPLATE = lib +CONFIG += plugin + +## load mobilityconfig if mobility is available +load(mobilityconfig, true) + +# HTML5 Media Support +# We require QtMultimedia +!contains(DEFINES, ENABLE_VIDEO=.) { + contains(MOBILITY_CONFIG, multimedia) { + CONFIG += mobility + MOBILITY += multimedia + DEFINES -= ENABLE_VIDEO=0 + DEFINES += ENABLE_VIDEO=1 + DEFINES -= ENABLE_QT_MULTIMEDIA=0 + DEFINES += ENABLE_QT_MULTIMEDIA=1 + } +} + +DESTDIR = $$[QT_INSTALL_PLUGINS]/webkit + +SOURCES += \ + WebPlugin.cpp \ + WebNotificationPresenter.cpp + +HEADERS += \ + WebPlugin.h \ + qwebkitplatformplugin.h \ + WebNotificationPresenter.h + +!contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1 diff --git a/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h b/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h new file mode 100644 index 0000000..2a94e0c --- /dev/null +++ b/Source/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef QWEBKITPLATFORMPLUGIN_H +#define QWEBKITPLATFORMPLUGIN_H + +/* + * Warning: The contents of this file is not part of the public QtWebKit API + * and may be changed from version to version or even be completely removed. +*/ + +#include <QObject> +#include <QUrl> +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA +#include <QMediaPlayer> +#endif + +class QWebSelectData +{ +public: + virtual ~QWebSelectData() {} + + enum ItemType { Option, Group, Separator }; + + virtual ItemType itemType(int) const = 0; + virtual QString itemText(int index) const = 0; + virtual QString itemToolTip(int index) const = 0; + virtual bool itemIsEnabled(int index) const = 0; + virtual bool itemIsSelected(int index) const = 0; + virtual int itemCount() const = 0; + virtual bool multiple() const = 0; +}; + +class QWebSelectMethod : public QObject +{ + Q_OBJECT +public: + virtual ~QWebSelectMethod() {} + + virtual void show(const QWebSelectData&) = 0; + virtual void hide() = 0; + +Q_SIGNALS: + void selectItem(int index, bool allowMultiplySelections, bool shift); + void didHide(); +}; + +class QWebNotificationData +{ +public: + virtual ~QWebNotificationData() {} + + virtual const QString title() const = 0; + virtual const QString message() const = 0; + virtual const QByteArray iconData() const = 0; + virtual const QUrl openerPageUrl() const = 0; +}; + +class QWebNotificationPresenter : public QObject +{ + Q_OBJECT +public: + QWebNotificationPresenter() {} + virtual ~QWebNotificationPresenter() {} + + virtual void showNotification(const QWebNotificationData*) = 0; + +Q_SIGNALS: + void notificationClosed(); + void notificationClicked(); +}; + +class QWebHapticFeedbackPlayer: public QObject +{ + Q_OBJECT +public: + QWebHapticFeedbackPlayer() {} + virtual ~QWebHapticFeedbackPlayer() {} + + enum HapticStrength { + None, Weak, Medium, Strong + }; + + enum HapticEvent { + Press, Release + }; + + virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0; +}; + +class QWebTouchModifier : public QObject +{ + Q_OBJECT +public: + virtual ~QWebTouchModifier() {} + + enum PaddingDirection { + Up, Right, Down, Left + }; + + virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0; +}; + +#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA +class QWebFullScreenVideoHandler : public QObject { + Q_OBJECT +public: + QWebFullScreenVideoHandler() {} + virtual ~QWebFullScreenVideoHandler() {} + virtual bool requiresFullScreenForVideoPlayback() const = 0; + +Q_SIGNALS: + void fullScreenClosed(); + +public Q_SLOTS: + virtual void enterFullScreen(QMediaPlayer*) = 0; + virtual void exitFullScreen() = 0; +}; +#endif + +class QWebKitPlatformPlugin +{ +public: + virtual ~QWebKitPlatformPlugin() {} + + enum Extension { + MultipleSelections, + Notifications, + Haptics, + TouchInteraction, + FullScreenVideoPlayer + }; + + virtual bool supportsExtension(Extension extension) const = 0; + virtual QObject* createExtension(Extension extension) const = 0; +}; + +QT_BEGIN_NAMESPACE +Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.7"); +QT_END_NAMESPACE + +#endif // QWEBKITPLATFORMPLUGIN_H |