26#include <QNetworkReply>
31#include "Downloadable_Abstract.h"
33namespace DataManagement
155 [[nodiscard]] auto downloading() ->
bool override {
return !m_networkReplyDownloadFile.isNull(); }
167 [[nodiscard]]
auto fileName() const -> QString {
return m_fileName; }
179 [[nodiscard]] auto
files() -> QStringList override;
191 [[nodiscard]] auto
remoteFileDate() const -> QDateTime {
return m_remoteFileDate; }
197 [[nodiscard]]
auto remoteFileSize() -> qint64
override {
return m_remoteFileSize; }
209 [[nodiscard]]
auto url() const -> QUrl {
return m_url; }
332 void downloadFileErrorReceiver(QNetworkReply::NetworkError code);
338 void downloadFileFinished();
343 void downloadFileProgressReceiver(qint64 bytesReceived, qint64 bytesTotal);
349 void downloadFilePartialDataReceiver();
355 void downloadHeaderFinished();
358 int m_downloadProgress{0};
362 QPointer<QNetworkReply> m_networkReplyDownloadFile;
366 QPointer<QNetworkReply> m_networkReplyDownloadHeader;
370 QPointer<QSaveFile> m_saveFile;
380 QDateTime m_remoteFileDate;
384 qint64 m_remoteFileSize{-1};
void downloadingChanged()
Notifier signal.
void remoteFileSizeChanged()
Notifier signal.
Downloadable_Abstract(QObject *parent=nullptr)
Standard constructor.
void hasFileChanged()
Notifier signal.
QBindable< bool > bindableHasFile() const
Getter method for the property with the same name.
void fileContentChanged()
Indicates that the content of a local file (or several local files) has changed.
void downloadProgressChanged(int percentage)
Download progress.
auto remoteFileSize() -> qint64 override
Getter function for the property with the same name.
auto fileContent() const -> QByteArray
Getter function for the property with the same name.
auto fileName() const -> QString
Getter function for the property with the same name.
Q_INVOKABLE void stopDownload() override
Stops download process.
~Downloadable_SingleFile() override
Standard destructor.
QByteArray fileContent
Content of the downloaded file.
auto infoText() -> QString override
Implementation of pure virtual getter method from Downloadable_Abstract.
Q_INVOKABLE void startInfoDownload()
Contacts the server and downloads information about the remote file.
QDateTime remoteFileDate
Modification date of the remote file.
auto downloadProgress() const -> int
Getter function for the property with the same name.
Downloadable_SingleFile(QUrl url, const QString &localFileName, const QGeoRectangle &bBox={}, QObject *parent=nullptr)
Standard constructor.
void setRemoteFileSize(qint64 size)
Setter function for the property with the same name.
QString fileName
File name, as set in the constructor.
QUrl url
URL, as set in the constructor.
Q_INVOKABLE void update() override
Implementation of pure virtual method from Downloadable_Abstract.
void remoteFileDateChanged()
Notifier signal for the properties remoteFileDate and remoteFileSize.
qint64 remoteFileSize
Size of the remote file.
auto updateSize() -> Units::ByteSize override
Implementation of pure virtual getter method from Downloadable_Abstract.
Q_INVOKABLE void startDownload() override
Initiate a download.
auto url() const -> QUrl
Getter function for the property with the same name.
int downloadProgress
Download progress.
auto description() -> QString override
Implementation of pure virtual getter method from Downloadable_Abstract.
auto files() -> QStringList override
Implementation of pure virtual getter method from Downloadable_Abstract.
void setRemoteFileDate(const QDateTime &date)
Setter function for the property with the same name.
Q_INVOKABLE void deleteFiles() override
Implementation of pure virtual method from Downloadable_Abstract.
Convenience class for size_t.