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 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
LocalFileDownloader::LocalFileDownloader(QObject *parent = 0)
Creates a local file downloader with the parent parent.
[override virtual slot]
void LocalFileDownloader::cancelDownload()
Reimplements: FileDownloader::cancelDownload().
Cancels copying the file.
[virtual]
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]
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)
Called when the download timer event event occurs.