diff options
author | Michal Klocek <michal.klocek@qt.io> | 2020-08-11 13:28:48 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-08-18 23:23:46 +0200 |
commit | 08375ee796a545e3916feb24e0b35d561e6f0049 (patch) | |
tree | 6af02ebfebf352781213490c12c18b8d4f1fcb84 /src/webengine/api | |
parent | 75393077108480e1762612331c399a012b5feba7 (diff) | |
download | qtwebengine-08375ee796a545e3916feb24e0b35d561e6f0049.tar.gz |
Rename QWebEngineDownloadItem -> QWebEngineDownloadRequest
This fits better with other QWebEngine*Requests.
[ChangeLog] QWebEngineDownloadItem is now QWebEngineDownloadRequest,
also in qml.
Change-Id: I506e9fac746b4f23ac0936c2fbe1c7472f4fda36
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/webengine/api')
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.cpp | 28 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.h | 6 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile_p.h | 4 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 6ae997da4..2022306b0 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -54,7 +54,7 @@ #include "renderer_host/user_resource_controller_host.h" #include "web_engine_settings.h" -#include <QtWebEngineCore/private/qwebenginedownloaditem_p.h> +#include <QtWebEngineCore/private/qwebenginedownloadrequest_p.h> #include <QtWebEngineCore/qwebengineurlscheme.h> using QtWebEngineCore::ProfileAdapter; @@ -127,12 +127,12 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QQuickWebEngineProfile::downloadRequested(QWebEngineDownloadItem *download) + \fn QQuickWebEngineProfile::downloadRequested(QWebEngineDownloadRequest *download) This signal is emitted whenever a download has been triggered. The \a download argument holds the state of the download. The download has to be explicitly accepted with - \c{QWebEngineDownloadItem::accept()} or it will be + \c{QWebEngineDownloadRequest::accept()} or it will be cancelled by default. The download item is parented by the profile. If it is not accepted, it will be deleted immediately after the signal emission. @@ -140,7 +140,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QQuickWebEngineProfile::downloadFinished(QWebEngineDownloadItem *download) + \fn QQuickWebEngineProfile::downloadFinished(QWebEngineDownloadRequest *download) This signal is emitted whenever downloading stops, because it finished successfully, was cancelled, or was interrupted (for example, because connectivity was lost). @@ -236,16 +236,16 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) Q_Q(QQuickWebEngineProfile); Q_ASSERT(!m_ongoingDownloads.contains(info.id)); - QWebEngineDownloadItemPrivate *itemPrivate = new QWebEngineDownloadItemPrivate(m_profileAdapter, info.url); + QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url); itemPrivate->downloadId = info.id; - itemPrivate->downloadState = QWebEngineDownloadItem::DownloadRequested; + itemPrivate->downloadState = QWebEngineDownloadRequest::DownloadRequested; itemPrivate->startTime = info.startTime; itemPrivate->totalBytes = info.totalBytes; itemPrivate->mimeType = info.mimeType; itemPrivate->downloadDirectory = QFileInfo(info.path).path(); itemPrivate->downloadFileName = QFileInfo(info.path).fileName(); itemPrivate->suggestedFileName = info.suggestedFileName; - itemPrivate->savePageFormat = static_cast<QWebEngineDownloadItem::SavePageFormat>( + itemPrivate->savePageFormat = static_cast<QWebEngineDownloadRequest::SavePageFormat>( info.savePageFormat); itemPrivate->isSavePageDownload = info.isSavePageDownload; if (info.page && info.page->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient) @@ -253,21 +253,21 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) else itemPrivate->page = nullptr; - QWebEngineDownloadItem *download = new QWebEngineDownloadItem(itemPrivate, q); + QWebEngineDownloadRequest *download = new QWebEngineDownloadRequest(itemPrivate, q); m_ongoingDownloads.insert(info.id, download); - QObject::connect(download, &QWebEngineDownloadItem::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); }); + QObject::connect(download, &QWebEngineDownloadRequest::destroyed, q, [id = info.id, this] () { downloadDestroyed(id); }); QQmlEngine::setObjectOwnership(download, QQmlEngine::JavaScriptOwnership); Q_EMIT q->downloadRequested(download); - QWebEngineDownloadItem::DownloadState state = download->state(); + QWebEngineDownloadRequest::DownloadState state = download->state(); info.path = QDir(download->downloadDirectory()).filePath(download->downloadFileName()); info.savePageFormat = itemPrivate->savePageFormat; - info.accepted = state != QWebEngineDownloadItem::DownloadCancelled - && state != QWebEngineDownloadItem::DownloadRequested; + info.accepted = state != QWebEngineDownloadRequest::DownloadCancelled + && state != QWebEngineDownloadRequest::DownloadRequested; - if (state == QWebEngineDownloadItem::DownloadRequested) { + if (state == QWebEngineDownloadRequest::DownloadRequested) { // Delete unaccepted downloads. info.accepted = false; delete download; @@ -281,7 +281,7 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info Q_Q(QQuickWebEngineProfile); - QWebEngineDownloadItem* download = m_ongoingDownloads.value(info.id).data(); + QWebEngineDownloadRequest* download = m_ongoingDownloads.value(info.id).data(); if (!download) { downloadDestroyed(info.id); diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h index b5fae2271..ca90d7ae8 100644 --- a/src/webengine/api/qquickwebengineprofile.h +++ b/src/webengine/api/qquickwebengineprofile.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -class QWebEngineDownloadItem; +class QWebEngineDownloadRequest; class QQuickWebEngineProfilePrivate; class QQuickWebEngineScript; class QQuickWebEngineSettings; @@ -173,8 +173,8 @@ Q_SIGNALS: Q_REVISION(5) void useForGlobalCertificateVerificationChanged(); Q_REVISION(5) void downloadPathChanged(); - void downloadRequested(QWebEngineDownloadItem *download); - void downloadFinished(QWebEngineDownloadItem *download); + void downloadRequested(QWebEngineDownloadRequest *download); + void downloadFinished(QWebEngineDownloadRequest *download); Q_REVISION(5) void presentNotification(QWebEngineNotification *notification); diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h index 06754c8b3..f1fd93543 100644 --- a/src/webengine/api/qquickwebengineprofile_p.h +++ b/src/webengine/api/qquickwebengineprofile_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QWebEngineDownloadItem; +class QWebEngineDownloadRequest; class QQuickWebEngineSettings; class QQuickWebEngineViewPrivate; @@ -100,7 +100,7 @@ private: QQuickWebEngineProfile *q_ptr; QScopedPointer<QQuickWebEngineSettings> m_settings; QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; - QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads; + QMap<quint32, QPointer<QWebEngineDownloadRequest> > m_ongoingDownloads; QList<QQuickWebEngineScript *> m_userScripts; }; |