From b9d99df607648953e4d0a97a04eaabdbe0d10c3b Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Tue, 13 Jul 2021 12:21:50 +0200 Subject: Remove duplicated 'downloadProgress' in favor of separate signals Change-Id: Ib825d63c89e591e740b206f43c3eadbf32319daa Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit abd050e9806123cbc6288e7d33ed01ceb2921766) Reviewed-by: Qt Cherry-pick Bot --- .../simplebrowser/doc/src/simplebrowser.qdoc | 2 +- examples/webenginewidgets/simplebrowser/downloadwidget.cpp | 4 ++-- src/core/api/qwebenginedownloadrequest.cpp | 14 -------------- src/core/api/qwebenginedownloadrequest.h | 2 -- tests/auto/quick/publicapi/tst_publicapi.cpp | 1 - 5 files changed, 3 insertions(+), 20 deletions(-) diff --git a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc index 2e68df337..b10c6d4f0 100644 --- a/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc +++ b/examples/webenginewidgets/simplebrowser/doc/src/simplebrowser.qdoc @@ -334,7 +334,7 @@ \printuntil /^\}/ The \l QWebEngineDownloadRequest object will periodically emit the \l - {QWebEngineDownloadRequest::}{downloadProgress} signal to notify potential + {QWebEngineDownloadRequest::}{receivedBytesChanged} signal to notify potential observers of the download progress and the \l {QWebEngineDownloadRequest::}{stateChanged} signal when the download is finished or when an error occurs. See \c downloadmanagerwidget.cpp for an diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp index e9caa8658..1ce97e0e9 100644 --- a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp +++ b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp @@ -72,8 +72,8 @@ DownloadWidget::DownloadWidget(QWebEngineDownloadRequest *download, QWidget *par emit removeClicked(this); }); - connect(m_download, &QWebEngineDownloadRequest::downloadProgress, - this, &DownloadWidget::updateWidget); + connect(m_download, &QWebEngineDownloadRequest::totalBytesChanged, this, &DownloadWidget::updateWidget); + connect(m_download, &QWebEngineDownloadRequest::receivedBytesChanged, this, &DownloadWidget::updateWidget); connect(m_download, &QWebEngineDownloadRequest::stateChanged, this, &DownloadWidget::updateWidget); diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index a55015f67..6efb9ce03 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -205,7 +205,6 @@ void QWebEngineDownloadRequestPrivate::update(const ProfileAdapterClient::Downlo totalBytes = info.totalBytes; Q_EMIT q->totalBytesChanged(); } - Q_EMIT q->downloadProgress(receivedBytes, totalBytes); } if (info.done) @@ -351,19 +350,6 @@ quint32 QWebEngineDownloadRequest::id() const \sa state(), DownloadState */ -/*! - \fn void QWebEngineDownloadRequest::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) - - This signal is emitted to indicate the progress of the download request. - - The \a bytesReceived parameter indicates the number of bytes received, while - \a bytesTotal indicates the total number of bytes expected to be downloaded. - If the size of the file to be downloaded is not known, \c bytesTotal will be - 0. - - \sa totalBytes(), receivedBytes() -*/ - /*! \enum QWebEngineDownloadRequest::DownloadState diff --git a/src/core/api/qwebenginedownloadrequest.h b/src/core/api/qwebenginedownloadrequest.h index 76f472b62..35b303737 100644 --- a/src/core/api/qwebenginedownloadrequest.h +++ b/src/core/api/qwebenginedownloadrequest.h @@ -150,8 +150,6 @@ public Q_SLOTS: Q_SIGNALS: void stateChanged(QWebEngineDownloadRequest::DownloadState state); - //TODO: fix it for qml - void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); void savePageFormatChanged(); void receivedBytesChanged(); void totalBytesChanged(); diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 62b8ae21c..9532dd412 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -261,7 +261,6 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineDownloadRequest.downloadDirectoryChanged() --> void" << "QWebEngineDownloadRequest.downloadFileName --> QString" << "QWebEngineDownloadRequest.downloadFileNameChanged() --> void" - << "QWebEngineDownloadRequest.downloadProgress(qlonglong,qlonglong) --> void" // FIXME << "QQuickWebEngineDownloadRequest.view --> QQuickWebEngineView*" << "QQuickWebEngineFileDialogRequest.FileModeOpen --> FileMode" << "QQuickWebEngineFileDialogRequest.FileModeOpenMultiple --> FileMode" -- cgit v1.2.3