Skip to content

Commit

Permalink
Move WebView to an extension plugin.
Browse files Browse the repository at this point in the history
Using WebView now requires:

import org.webkit 1.0

Task-number: QT-2995
  • Loading branch information
Warwick Allison committed Mar 2, 2010
1 parent 26e6b83 commit feb79bb
Show file tree
Hide file tree
Showing 44 changed files with 257 additions and 262 deletions.
1 change: 1 addition & 0 deletions demos/declarative/flickr/common/ImageDetails.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

Flipable {
id: container
Expand Down
1 change: 1 addition & 0 deletions demos/declarative/webbrowser/content/FlickableWebView.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

Flickable {
property alias title: webView.title
Expand Down
1 change: 1 addition & 0 deletions demos/declarative/webbrowser/webbrowser.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

import "content"

Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/autosize.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

// The WebView size is determined by the width, height,
// preferredWidth, and preferredHeight properties.
Expand Down
2 changes: 1 addition & 1 deletion examples/declarative/webview/content/FieldText.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Item {
font.bold: true
text: label
opacity: textEdit.text == '' ? 1 : 0
opacity: Behavior {
Behavior on opacity {
NumberAnimation {
property: "opacity"
duration: 250
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/content/Mapping/Map.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

Item {
id: page
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/evalandattach.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

Item {
height: 640
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/googleMaps.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// order to create a Map.

import Qt 4.6
import org.webkit 1.0
import "content/Mapping"

Map {
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/inline-html.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

// Inline HTML with loose formatting can be
// set on the html property.
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/newwindows.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// allow it on WebView with settings.javascriptCanOpenWindows: true

import Qt 4.6
import org.webkit 1.0

Grid {
columns: 3
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/qdeclarative-in-html.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

// The WebView supports QML data through the HTML OBJECT tag
Rectangle {
Expand Down
1 change: 1 addition & 0 deletions examples/declarative/webview/transparent.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

// The WebView background is transparent
// if the HTML does not specify a background
Expand Down
1 change: 1 addition & 0 deletions imports/org/webkit/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plugin webkitqmlplugin
7 changes: 0 additions & 7 deletions src/declarative/graphicsitems/graphicsitems.pri
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,3 @@ SOURCES += \
$$PWD/qdeclarativegraphicsobjectcontainer.cpp \
$$PWD/qdeclarativeparticles.cpp \
$$PWD/qdeclarativelayoutitem.cpp \

contains(QT_CONFIG, webkit) {
QT+=webkit
SOURCES += $$PWD/qdeclarativewebview.cpp
HEADERS += $$PWD/qdeclarativewebview_p.h
HEADERS += $$PWD/qdeclarativewebview_p_p.h
}
3 changes: 0 additions & 3 deletions src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ void QDeclarativeItemModule::defineModule()
QML_REGISTER_TYPE(Qt,4,6,VisibleArea,QDeclarativeFlickableVisibleArea);
QML_REGISTER_TYPE(Qt,4,6,VisualDataModel,QDeclarativeVisualDataModel);
QML_REGISTER_TYPE(Qt,4,6,VisualItemModel,QDeclarativeVisualItemModel);
#ifdef QT_WEBKIT_LIB
QML_REGISTER_TYPE(Qt,4,6,WebView,QDeclarativeWebView);
#endif

QML_REGISTER_NOCREATE_TYPE(QDeclarativeAnchors);
QML_REGISTER_NOCREATE_TYPE(QGraphicsEffect);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/qdeclarativemodules/qdeclarativemodules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ TEMPLATE = subdirs
SUBDIRS += widgets

contains(QT_CONFIG, multimedia): SUBDIRS += multimedia
contains(QT_CONFIG, webkit): SUBDIRS += webkitqmlplugin

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the test suite of the Qt Toolkit.
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
Expand Down Expand Up @@ -38,29 +38,29 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TESTTYPES_H
#define TESTTYPES_H

#include <private/qdeclarativewebview_p.h>
#include <QtDeclarative/qdeclarativeextensionplugin.h>
#include <QtDeclarative/qdeclarative.h>

class MyWebView : public QDeclarativeWebView
#include "qdeclarativewebview_p.h"
#include "qdeclarativewebview_p_p.h"

QT_BEGIN_NAMESPACE

class WebKitQmlPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
Q_PROPERTY(int pixelsPainted READ pixelsPainted);

public:
MyWebView() : pp(0) {}

int pixelsPainted() const { return pp; }

void drawContents(QPainter *p, const QRect &r);

private:
int pp;
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit"));
qmlRegisterType<QDeclarativeWebView>(uri,1,0,"WebView");
}
};

QML_DECLARE_TYPE(MyWebView);
QT_END_NAMESPACE

#include "plugin.moc"

void registerTypes();
Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin));

#endif // TESTTYPES_H
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
#include "qdeclarativewebview_p.h"
#include "qdeclarativewebview_p_p.h"

#include "qdeclarativepainteditem_p_p.h"
#include <private/qdeclarativepainteditem_p_p.h>

#include <qdeclarative.h>
#include <qdeclarativeengine.h>
#include <qdeclarativestate_p.h>
#include <private/qdeclarativestate_p.h>

#include <QDebug>
#include <QPen>
Expand All @@ -61,7 +61,7 @@
#include <QtWebKit/QWebFrame>
#include <QtWebKit/QWebElement>
#include <QtWebKit/QWebSettings>
#include <qlistmodelinterface_p.h>
#include <private/qlistmodelinterface_p.h>

QT_BEGIN_NAMESPACE

Expand Down Expand Up @@ -128,6 +128,8 @@ class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate
usually laying out the web content to fit the preferredWidth.
\qml
import org.webkit 1.0
WebView {
url: "http://www.nokia.com"
width: 490
Expand Down Expand Up @@ -929,7 +931,7 @@ QWebPage *QDeclarativeWebView::page() const
}
\endqml
*/
QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const
QObject *QDeclarativeWebView::settingsObject() const
{
Q_D(const QDeclarativeWebView);
d->settings.s = page()->settings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#ifndef QDECLARATIVEWEBVIEW_H
#define QDECLARATIVEWEBVIEW_H

#include "qdeclarativepainteditem_p.h"
#include <private/qdeclarativepainteditem_p.h>

#include <QtGui/QAction>
#include <QtCore/QUrl>
Expand Down Expand Up @@ -82,7 +82,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage


class QDeclarativeWebViewAttached;
class QDeclarativeWebSettings;

//### TODO: browser plugins

Expand Down Expand Up @@ -112,7 +111,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem
Q_PROPERTY(QAction* forward READ forwardAction CONSTANT)
Q_PROPERTY(QAction* stop READ stopAction CONSTANT)

Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT)
Q_PROPERTY(QObject* settings READ settingsObject CONSTANT)

Q_PROPERTY(QDeclarativeListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)

Expand Down Expand Up @@ -169,7 +168,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem

QWebHistory *history() const;
QWebSettings *settings() const;
QDeclarativeWebSettings *settingsObject() const;
QObject *settingsObject() const;

bool renderingEnabled() const;
void setRenderingEnabled(bool);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
TARGET = webkitqmlplugin
include(../../qpluginbase.pri)

contains(QT_CONFIG, webkit) {
QT += webkit declarative

SOURCES += qdeclarativewebview.cpp plugin.cpp
HEADERS += qdeclarativewebview_p.h
HEADERS += qdeclarativewebview_p_p.h

QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/org/webkit
target.path = $$[QT_INSTALL_IMPORTS]/org/webkit

qmldir.files += $$QT_BUILD_TREE/imports/org/webkit/qmldir
qmldir.path += $$[QT_INSTALL_IMPORTS]/org/webkit

INSTALLS += target qmldir
}
1 change: 1 addition & 0 deletions tests/auto/declarative/qdeclarativewebview/data/basic.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

WebView {
url: "basic.html"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

WebView {
url: "elements.html"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

WebView {
url: "javaScript.html"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

WebView {
url: "does-not-exist.html"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Demonstrates opening new WebViews from HTML

import Qt 4.6
import org.webkit 1.0

Grid {
columns: 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

Item {
width: 240
Expand Down Expand Up @@ -30,4 +31,4 @@ Item {
pressGrabTime: 200
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Qt 4.6
import org.webkit 1.0

WebView {
html: "<p>This is a <b>string</b> set on the WebView"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative
contains(QT_CONFIG,webkit): QT += webkit
macx:CONFIG -= app_bundle

SOURCES += tst_qdeclarativewebview.cpp testtypes.cpp
HEADERS += testtypes.h
SOURCES += tst_qdeclarativewebview.cpp

# Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
52 changes: 0 additions & 52 deletions tests/auto/declarative/qdeclarativewebview/testtypes.cpp

This file was deleted.

Loading

0 comments on commit feb79bb

Please sign in to comment.