WebContent becomes WebView.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=877511
This commit is contained in:
Kevin Ottens 2008-10-29 17:53:30 +00:00
parent f66b4d819b
commit ef6cefb06c
5 changed files with 48 additions and 48 deletions

View File

@ -85,7 +85,7 @@ set(plasma_LIB_SRCS
widgets/tabbar.cpp
widgets/treeview.cpp
widgets/textedit.cpp
widgets/webcontent.cpp
widgets/webview.cpp
)
#NEPOMUK_GENERATE_FROM_ONTOLOGY(
@ -199,7 +199,7 @@ install(FILES
widgets/tabbar.h
widgets/treeview.h
widgets/textedit.h
widgets/webcontent.h
widgets/webview.h
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/widgets COMPONENT Devel)
install(FILES
@ -267,7 +267,7 @@ includes/UiLoader
includes/View
includes/Version
includes/Wallpaper
includes/WebContent
includes/WebView
DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma COMPONENT Devel)
if(QT_QTOPENGL_FOUND AND OPENGL_FOUND)

View File

@ -1 +0,0 @@
#include "../../plasma/widgets/webcontent.h"

1
includes/WebView Normal file
View File

@ -0,0 +1 @@
#include "../../plasma/widgets/webview.h"

View File

@ -29,15 +29,15 @@
#include <KDE/KDebug>
#include "plasma/widgets/webcontent.h"
#include "plasma/widgets/webview.h"
namespace Plasma
{
class WebContentPrivate
class WebViewPrivate
{
public:
WebContentPrivate(WebContent *parent)
WebViewPrivate(WebView *parent)
: q(parent)
{
}
@ -46,26 +46,26 @@ public:
void updateRequested(const QRect &dirtyRect);
void scrollRequested(int dx, int dy, const QRect &scrollRect);
WebContent *q;
WebView *q;
QWebPage *page;
bool loaded;
};
WebContent::WebContent(QGraphicsItem *parent)
WebView::WebView(QGraphicsItem *parent)
: QGraphicsWidget(parent),
d(new WebContentPrivate(this))
d(new WebViewPrivate(this))
{
d->page = 0;
d->loaded = false;
setPage(new QWebPage(this));
}
WebContent::~WebContent()
WebView::~WebView()
{
delete d;
}
void WebContent::setUrl(const QUrl &url)
void WebView::setUrl(const QUrl &url)
{
d->loaded = false;
if (d->page) {
@ -73,7 +73,7 @@ void WebContent::setUrl(const QUrl &url)
}
}
void WebContent::setHtml(const QByteArray &html, const QUrl &baseUrl)
void WebView::setHtml(const QByteArray &html, const QUrl &baseUrl)
{
d->loaded = false;
if (d->page) {
@ -81,7 +81,7 @@ void WebContent::setHtml(const QByteArray &html, const QUrl &baseUrl)
}
}
void WebContent::setHtml(const QString &html, const QUrl &baseUrl)
void WebView::setHtml(const QString &html, const QUrl &baseUrl)
{
d->loaded = false;
if (d->page) {
@ -89,7 +89,7 @@ void WebContent::setHtml(const QString &html, const QUrl &baseUrl)
}
}
QRectF WebContent::geometry() const
QRectF WebView::geometry() const
{
if (d->loaded && d->page) {
return d->page->mainFrame()->geometry();
@ -98,7 +98,7 @@ QRectF WebContent::geometry() const
return QGraphicsWidget::geometry();
}
void WebContent::setPage(QWebPage *page)
void WebView::setPage(QWebPage *page)
{
if (page == d->page) {
return;
@ -122,17 +122,17 @@ void WebContent::setPage(QWebPage *page)
}
}
QWebPage *WebContent::page() const
QWebPage *WebView::page() const
{
return d->page;
}
QWebFrame *WebContent::mainFrame() const
QWebFrame *WebView::mainFrame() const
{
return d->page ? d->page->mainFrame() : 0;
}
void WebContent::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void WebView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(widget)
@ -142,7 +142,7 @@ void WebContent::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
}
}
void WebContent::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void WebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (!d->page) {
QGraphicsWidget::mouseMoveEvent(event);
@ -157,7 +157,7 @@ void WebContent::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
void WebContent::mousePressEvent(QGraphicsSceneMouseEvent *event)
void WebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (!d->page) {
QGraphicsWidget::mousePressEvent(event);
@ -172,7 +172,7 @@ void WebContent::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
void WebContent::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
void WebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if (!d->page) {
QGraphicsWidget::mouseDoubleClickEvent(event);
@ -187,7 +187,7 @@ void WebContent::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
}
}
void WebContent::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void WebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (!d->page) {
QGraphicsWidget::mouseReleaseEvent(event);
@ -202,7 +202,7 @@ void WebContent::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
void WebContent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void WebView::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
if (!d->page) {
QGraphicsWidget::contextMenuEvent(event);
@ -217,7 +217,7 @@ void WebContent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
}
}
void WebContent::wheelEvent(QGraphicsSceneWheelEvent *event)
void WebView::wheelEvent(QGraphicsSceneWheelEvent *event)
{
if (!d->page) {
QGraphicsWidget::wheelEvent(event);
@ -236,7 +236,7 @@ void WebContent::wheelEvent(QGraphicsSceneWheelEvent *event)
}
}
void WebContent::keyPressEvent(QKeyEvent * event)
void WebView::keyPressEvent(QKeyEvent * event)
{
if (!d->page) {
QGraphicsWidget::keyPressEvent(event);
@ -250,7 +250,7 @@ void WebContent::keyPressEvent(QKeyEvent * event)
}
}
void WebContent::keyReleaseEvent(QKeyEvent * event)
void WebView::keyReleaseEvent(QKeyEvent * event)
{
if (!d->page) {
QGraphicsWidget::keyReleaseEvent(event);
@ -264,7 +264,7 @@ void WebContent::keyReleaseEvent(QKeyEvent * event)
}
}
void WebContent::focusInEvent(QFocusEvent * event)
void WebView::focusInEvent(QFocusEvent * event)
{
if (d->page) {
d->page->event(event);
@ -273,7 +273,7 @@ void WebContent::focusInEvent(QFocusEvent * event)
QGraphicsWidget::focusInEvent(event);
}
void WebContent::focusOutEvent(QFocusEvent * event)
void WebView::focusOutEvent(QFocusEvent * event)
{
if (d->page) {
d->page->event(event);
@ -282,7 +282,7 @@ void WebContent::focusOutEvent(QFocusEvent * event)
QGraphicsWidget::focusOutEvent(event);
}
void WebContent::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
void WebView::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
{
if (!d->page) {
QGraphicsWidget::dragEnterEvent(event);
@ -298,7 +298,7 @@ void WebContent::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
}
}
void WebContent::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
void WebView::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
{
if (!d->page) {
QGraphicsWidget::dragLeaveEvent(event);
@ -313,7 +313,7 @@ void WebContent::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
}
}
void WebContent::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
void WebView::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
{
if (!d->page) {
QGraphicsWidget::dragMoveEvent(event);
@ -331,7 +331,7 @@ void WebContent::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
}
}
void WebContent::dropEvent(QGraphicsSceneDragDropEvent * event)
void WebView::dropEvent(QGraphicsSceneDragDropEvent * event)
{
if (!d->page) {
QGraphicsWidget::dropEvent(event);
@ -347,20 +347,20 @@ void WebContent::dropEvent(QGraphicsSceneDragDropEvent * event)
}
}
void WebContent::setGeometry(const QRectF &geometry)
void WebView::setGeometry(const QRectF &geometry)
{
QGraphicsWidget::setGeometry(geometry);
d->page->setViewportSize(geometry.size().toSize());
}
void WebContentPrivate::loadingFinished(bool success)
void WebViewPrivate::loadingFinished(bool success)
{
loaded = success;
emit q->loadFinished(success);
q->update();
}
void WebContentPrivate::updateRequested(const QRect &dirtyRect)
void WebViewPrivate::updateRequested(const QRect &dirtyRect)
{
if (loaded && page) {
q->update(QRectF(dirtyRect.topLeft().x(), dirtyRect.topLeft().y(),
@ -368,12 +368,12 @@ void WebContentPrivate::updateRequested(const QRect &dirtyRect)
}
}
void WebContentPrivate::scrollRequested(int dx, int dy, const QRect &scrollRect)
void WebViewPrivate::scrollRequested(int dx, int dy, const QRect &scrollRect)
{
updateRequested(scrollRect);
}
} // namespace Plasma
#include "webcontent.moc"
#include "webview.moc"

View File

@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_WEBCONTENT_H
#define PLASMA_WEBCONTENT_H
#ifndef PLASMA_WEBVIEW_H
#define PLASMA_WEBVIEW_H
#include <plasma/plasma_export.h>
#include <QtCore/QUrl>
@ -35,20 +35,20 @@ class QRect;
namespace Plasma
{
class WebContentPrivate;
class WebViewPrivate;
/**
* @class WebContent plasma/widgets/webcontent.h <Plasma/Widgets/WebContent>
* @class WebView plasma/widgets/webcontent.h <Plasma/Widgets/WebView>
*
* @short Provides a widget to display html content in Plasma.
*/
class PLASMA_EXPORT WebContent : public QGraphicsWidget
class PLASMA_EXPORT WebView : public QGraphicsWidget
{
Q_OBJECT
public:
explicit WebContent(QGraphicsItem *parent = 0);
~WebContent();
explicit WebView(QGraphicsItem *parent = 0);
~WebView();
/**
* Sets the URL to display. Loading may happen asynchronously.
@ -82,7 +82,7 @@ class PLASMA_EXPORT WebContent : public QGraphicsWidget
/**
* Sets the page to use in this item. The owner of the webpage remains,
* however if this WebContent object is the owner of the current page,
* however if this WebView object is the owner of the current page,
* then the current page is deleted
*
* @param page the page to set in this view
@ -147,8 +147,8 @@ class PLASMA_EXPORT WebContent : public QGraphicsWidget
Q_PRIVATE_SLOT(d, void updateRequested(const QRect& dirtyRect))
Q_PRIVATE_SLOT(d, void scrollRequested(int dx, int dy, const QRect &scrollRect))
WebContentPrivate * const d;
friend class WebContentPrivate;
WebViewPrivate * const d;
friend class WebViewPrivate;
};
} // namespace Plasma