KDUpdater::LocalFileDownloader Class
class KDUpdater::LocalFileDownloaderThe LocalFileDownloader class is used to copy files from the local file system. More...
Header: | #include <LocalFileDownloader> |
Inherits: | KDUpdater::FileDownloader |
Public Functions
LocalFileDownloader(QObject *parent = 0) | |
virtual | ~LocalFileDownloader() |
Reimplemented Public Functions
virtual bool | canDownload() const override |
virtual KDUpdater::LocalFileDownloader * | clone(QObject *parent = 0) const override |
virtual QString | downloadedFileName() const override |
virtual bool | isDownloaded() const override |
virtual void | setDownloadedFileName(const QString &name) override |
Public Slots
virtual void | cancelDownload() override |
Reimplemented Protected Functions
virtual void | onError() override |
virtual void | onSuccess() override |
virtual void | timerEvent(QTimerEvent *event) override |
Detailed Description
The user of KDUpdater might be simultaneously downloading several files; sometimes in parallel to other file downloaders. If copying a local file takes a long time, it will make the other downloads hang. Therefore, a timer is used and one block of data is copied per unit time, even though QFile::copy() does the task of copying local files from one place to another.
Member Function Documentation
[explicit]
LocalFileDownloader::LocalFileDownloader(QObject *parent = 0)
Creates a local file downloader with the parent parent.
[virtual noexcept]
LocalFileDownloader::~LocalFileDownloader()
Destroys the local file downloader.
[override virtual]
bool LocalFileDownloader::canDownload() const
Reimplements: FileDownloader::canDownload() const.
Returns true
if the file exists and is readable.
[override virtual slot]
void LocalFileDownloader::cancelDownload()
Reimplements: FileDownloader::cancelDownload().
Cancels copying the file.
[override virtual]
KDUpdater::LocalFileDownloader *LocalFileDownloader::clone(QObject *parent = 0) const
Reimplements: FileDownloader::clone(QObject *parent) const.
Clones the local file downloader and assigns it the parent parent. Returns the new local file downloader.
[override virtual]
QString LocalFileDownloader::downloadedFileName() const
Reimplements: FileDownloader::downloadedFileName() const.
Returns the file name of the copied file.
See also setDownloadedFileName().
[override virtual]
bool LocalFileDownloader::isDownloaded() const
Reimplements: FileDownloader::isDownloaded() const.
Returns true
if the file is copied.
[override virtual protected]
void LocalFileDownloader::onError()
Reimplements: FileDownloader::onError().
Clears the destination file if an error occurs during copying and stops the download speed timer.
[override virtual protected]
void LocalFileDownloader::onSuccess()
Reimplements: FileDownloader::onSuccess().
Closes the destination file after it has been successfully copied and stops the download speed timer.
[override virtual]
void LocalFileDownloader::setDownloadedFileName(const QString &name)
Reimplements: FileDownloader::setDownloadedFileName(const QString &name).
Sets the file name of the copied file to name.
See also downloadedFileName().
[override virtual protected]
void LocalFileDownloader::timerEvent(QTimerEvent *event)
Reimplements: QObject::timerEvent(QTimerEvent *event).
Called when the download timer event event occurs.
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.