/* * File: QCefDownloadItem.h * Project: QCefView * Created: 13th July 2022 * Author: Sheen * Source: https://github.com/cefview/qcefview * Docs: https://cefview.github.io/QCefView/ */ #ifndef QCEFDOWNLOADITEM_H #define QCEFDOWNLOADITEM_H #pragma once #include #pragma region qt_headers #include #include #include #pragma endregion class QCefDownloadItemPrivate; /// /// Represents the download item /// class QCEFVIEW_EXPORT QCefDownloadItem { Q_DECLARE_PRIVATE(QCefDownloadItem) QScopedPointer d_ptr; Q_DISABLE_COPY(QCefDownloadItem) QCefDownloadItem(QCefDownloadItem&&) = delete; QCefDownloadItem& operator=(QCefDownloadItem&&) = delete; friend class QCefView; /// /// Constructs a download item instance /// QCefDownloadItem(); public: /// /// Destructs the download item instance /// ~QCefDownloadItem(); /// /// Starts to download the item. /// /// The full path name (must include file name) to save the downloaded item /// Whether to use the default 'Save As...' dialog or not /// /// The 'path' parameter only works when 'useDefaultDialog' is set to false. /// If you set 'useDefaultDialog' to true then you cannot control the initial /// location of the opened 'Save As...' dialog, it is determined by CEF internal implementation. /// void start(const QString& path, bool useDefaultDialog = true) const; /// /// Pauses the download /// void pause() const; /// /// Resume the download /// void resume() const; /// /// Cancels the download /// void cancel() const; /// /// Gets whether the download is started /// /// bool isStarted() const; /// /// Gets whether the download is in progress /// /// True if the download is in progress; otherwise false bool isInProgress() const; /// /// Gets whether the download is complete /// /// True if the download is complete; otherwise false bool isComplete() const; /// /// Gets whether the download has been canceled or interrupted /// /// True if the download has been canceled or interrupted; otherwise false bool isCanceled() const; /// /// Gets current download speed /// /// A simple speed estimate in bytes/s qint64 currentSpeed() const; /// /// Gets the completion percentage /// /// The rough percent complete or -1 if the receive total size is unknown int percentComplete() const; /// /// Gets total number of bytes /// /// The total number of bytes qint64 totalBytes() const; /// /// Gets number of received bytes /// /// The number of received bytes qint64 receivedBytes() const; /// /// Gets the time that the download started /// /// The time that the download started QDateTime startTime() const; /// /// Gets the time that the download ended /// /// The time that the download ended QDateTime endTime() const; /// /// Gets the full path to the downloaded or downloading file /// /// The full path to the downloaded or downloading file QString fullPath() const; /// /// Gets the unique identifier for this download /// /// The unique identifier for this download quint32 id() const; /// /// Gets the URL /// /// The the URL QString url() const; /// /// Gets the original URL before any redirections /// /// The original URL before any redirections QString originalUrl() const; /// /// Gets the suggested file name /// /// The suggested file name QString suggestedFileName() const; /// /// Gets the content disposition /// /// The the content disposition QString contentDisposition() const; /// /// Gets the mime type /// /// The mime type QString mimeType() const; }; #endif /// QCEFDOWNLOADITEM_H