summaryrefslogtreecommitdiffstats
path: root/lib/widgets
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@digia.com>2013-08-02 13:12:08 +0200
committerPierre Rossi <pierre.rossi@gmail.com>2013-08-02 14:53:28 +0200
commitd7dd93cf6e3540855055ba08639161104a77bc3a (patch)
tree1777bb2722cb67ce9b06590aee131b792e8f1210 /lib/widgets
parentd1e168102555e903d41394484f5a8a0c13f1548f (diff)
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 <pierre.rossi@gmail.com>
Diffstat (limited to 'lib/widgets')
-rw-r--r--lib/widgets/Api/qwebcontentsview.cpp9
-rw-r--r--lib/widgets/Api/qwebcontentsview_p.h1
2 files changed, 8 insertions, 2 deletions
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<WebContentsAdapter> adapter;