From d7dd93cf6e3540855055ba08639161104a77bc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Fri, 2 Aug 2013 13:12:08 +0200 Subject: Implement more detailed load information handling. Add WebContentsObserver as a base class of WebContentsDelegateQt to be able to get more information about the WebContents (loading state etc.). Also implements load finished with a success value to be able to show when a load has failed. Change-Id: Ic2ad698d180b395cf3d9fb6cd49b12c9cb4fb493 Reviewed-by: Pierre Rossi --- lib/widgets/Api/qwebcontentsview.cpp | 9 +++++++-- lib/widgets/Api/qwebcontentsview_p.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/widgets') diff --git a/lib/widgets/Api/qwebcontentsview.cpp b/lib/widgets/Api/qwebcontentsview.cpp index c1e182b3b..1479a17be 100644 --- a/lib/widgets/Api/qwebcontentsview.cpp +++ b/lib/widgets/Api/qwebcontentsview.cpp @@ -72,8 +72,6 @@ void QWebContentsViewPrivate::loadingStateChanged() if (m_isLoading != wasLoading) { if (m_isLoading) Q_EMIT q->loadStarted(); - else - Q_EMIT q->loadFinished(true); } } @@ -83,6 +81,13 @@ QRectF QWebContentsViewPrivate::viewportRect() const return q->geometry(); } +void QWebContentsViewPrivate::loadFinished(bool success) +{ + Q_Q(QWebContentsView); + m_isLoading = adapter->isLoading(); + Q_EMIT q->loadFinished(success); +} + RenderWidgetHostViewQtDelegate *QWebContentsViewPrivate::CreateRenderWidgetHostViewQtDelegate() { Q_Q(QWebContentsView); diff --git a/lib/widgets/Api/qwebcontentsview_p.h b/lib/widgets/Api/qwebcontentsview_p.h index badf72673..eade6c245 100644 --- a/lib/widgets/Api/qwebcontentsview_p.h +++ b/lib/widgets/Api/qwebcontentsview_p.h @@ -63,6 +63,7 @@ public: virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE; virtual void loadingStateChanged() Q_DECL_OVERRIDE; virtual QRectF viewportRect() const Q_DECL_OVERRIDE; + virtual void loadFinished(bool success) Q_DECL_OVERRIDE; bool m_isLoading; QScopedPointer adapter; -- cgit v1.2.3