Commit e40ebfe6 authored by Adam Kallai's avatar Adam Kallai Committed by The Qt Project
Browse files

Fixing QQuickWebEngineView.loadingChanged public API test case


Rename QQuickWebEngineView.loadingStateChanged signal name to
QQuickWebEngineView.loadingChanged.

Change-Id: I0e01034f7b2eea57f5211ff0d8258d9f27d278f0
Reviewed-by: default avatarPeter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: default avatarJocelyn Turcotte <jocelyn.turcotte@digia.com>
Showing with 15 additions and 15 deletions
......@@ -46,12 +46,12 @@
\instantiates QQuickWebEngineLoadRequest
\inqmlmodule QtWebEngine 1.0
\brief A utility class for the WebEngineView::loadingStateChanged signal.
\brief A utility class for the WebEngineView::loadingChanged signal.
This class contains information about a requested load of a web page, like the URL and
current loading status (started, finished, failed).
\sa WebEngineView::onLoadingStateChanged
\sa WebEngineView::onLoadingChanged
*/
QQuickWebEngineLoadRequest::QQuickWebEngineLoadRequest(const QUrl& url, QQuickWebEngineView::LoadStatus status, const QString& errorString, int errorCode, QQuickWebEngineView::ErrorDomain errorDomain, QObject* parent)
: QObject(parent)
......@@ -84,7 +84,7 @@ QUrl QQuickWebEngineLoadRequest::url() const
\endlist
\sa WebEngineLoadRequest
\sa WebEngineView::onLoadingStateChanged
\sa WebEngineView::onLoadingChanged
*/
QQuickWebEngineView::LoadStatus QQuickWebEngineLoadRequest::status() const
{
......
......@@ -224,7 +224,7 @@ void QQuickWebEngineViewPrivate::loadingStateChanged()
m_isLoading = adapter->isLoading();
if (m_isLoading && !wasLoading) {
QQuickWebEngineLoadRequest loadRequest(q->url(), QQuickWebEngineView::LoadStartedStatus);
Q_EMIT q->loadingStateChanged(&loadRequest);
Q_EMIT q->loadingChanged(&loadRequest);
}
}
......@@ -251,12 +251,12 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, int error_code, cons
Q_Q(QQuickWebEngineView);
if (error_code == WebEngineError::UserAbortedError) {
QQuickWebEngineLoadRequest loadRequest(q->url(), QQuickWebEngineView::LoadStoppedStatus);
Q_EMIT q->loadingStateChanged(&loadRequest);
Q_EMIT q->loadingChanged(&loadRequest);
return;
}
if (success) {
QQuickWebEngineLoadRequest loadRequest(q->url(), QQuickWebEngineView::LoadSucceededStatus);
Q_EMIT q->loadingStateChanged(&loadRequest);
Q_EMIT q->loadingChanged(&loadRequest);
return;
}
......@@ -267,7 +267,7 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, int error_code, cons
error_description,
error_code,
static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(error_code)));
Q_EMIT q->loadingStateChanged(&loadRequest);
Q_EMIT q->loadingChanged(&loadRequest);
return;
}
......@@ -354,7 +354,7 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
// FIXME: The current loading state should be stored in the WebContentAdapter
// and it should be checked here if the signal emission is really necessary.
QQuickWebEngineLoadRequest loadRequest(adapter->activeUrl(), QQuickWebEngineView::LoadSucceededStatus);
emit q->loadingStateChanged(&loadRequest);
emit q->loadingChanged(&loadRequest);
emit q->loadProgressChanged();
}
......
......@@ -54,11 +54,11 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
Q_PROPERTY(bool loading READ isLoading NOTIFY loadingStateChanged)
Q_PROPERTY(bool loading READ isLoading NOTIFY loadingChanged)
Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY loadingStateChanged)
Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY loadingStateChanged)
Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY loadingChanged)
Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY loadingChanged)
Q_PROPERTY(bool inspectable READ inspectable WRITE setInspectable)
Q_ENUMS(LoadStatus);
Q_ENUMS(ErrorDomain);
......@@ -112,7 +112,7 @@ Q_SIGNALS:
void titleChanged();
void urlChanged();
void iconChanged();
void loadingStateChanged(QQuickWebEngineLoadRequest *loadRequest);
void loadingChanged(QQuickWebEngineLoadRequest *loadRequest);
void loadProgressChanged();
void javaScriptConsoleMessage(int level, const QString &message, int lineNumber, const QString &sourceID);
......
......@@ -83,7 +83,7 @@ WebEngineView {
TestResult { id: testResult }
onLoadingStateChanged: {
onLoadingChanged: {
loadStatus = loadRequest.status
if (loadRequest.status == WebEngineView.LoadStartedStatus)
viewportReady = false
......
......@@ -59,7 +59,7 @@ TestWebEngineView {
}
}
onLoadingStateChanged: {
onLoadingChanged: {
if (loadRequest.status == WebEngineView.LoadStartedStatus)
++numLoadStarted
if (loadRequest.status == WebEngineView.LoadSucceededStatus)
......@@ -104,7 +104,7 @@ TestWebEngineView {
function test_stopStatus() {
var url = Qt.resolvedUrl("test1.html")
webEngineView.loadingStateChanged.connect(function(loadRequest) {
webEngineView.loadingChanged.connect(function(loadRequest) {
if (loadRequest.status == WebEngineView.LoadStoppedStatus) {
compare(webEngineView.url, url)
compare(loadRequest.url, url)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment