17 return _uploadProgress;
21 if (qFuzzyCompare(_uploadProgress, newUploadProgress))
24 _uploadProgress = newUploadProgress;
29 return _downloadProgress;
33 if (qFuzzyCompare(_downloadProgress, newDownloadProgress))
36 _downloadProgress = newDownloadProgress;
45 if (_error == newError)
66void iFile::handleUploadProgressChanged(qint64 bytesSent, qint64 bytesTotal) {
70void iFile::handleDownloadProgressChanged(qint64 bytesReceived, qint64 bytesTotal) {
77 disconnect(_replay.get(), &QNetworkReply::finished,
80 disconnect(_replay.get(), &QNetworkReply::errorOccurred,
83 disconnect(_replay.get(), &QNetworkReply::readyRead,
86 disconnect(_replay.get(), &QNetworkReply::uploadProgress,
87 this, &iFile::handleUploadProgressChanged);
89 disconnect(_replay.get(), &QNetworkReply::downloadProgress,
90 this, &iFile::handleDownloadProgressChanged);
96 connect(
replay.get(), &QNetworkReply::finished,
99 connect(
replay.get(), &QNetworkReply::errorOccurred,
102 connect(
replay.get(), &QNetworkReply::readyRead,
105 connect(
replay.get(), &QNetworkReply::uploadProgress,
106 this, &iFile::handleUploadProgressChanged, Qt::DirectConnection);
108 connect(
replay.get(), &QNetworkReply::downloadProgress,
109 this, &iFile::handleDownloadProgressChanged, Qt::DirectConnection);
116 if (newFinished != _finished) {
117 _finished = newFinished;
void errorChanged()
Signal emitted when the error code changes.
void uploadProgressChanged()
Signal emitted when the upload progress changes.
void downloadProgressChanged()
Signal emitted when the download progress changes.
float downloadProgress() const
Get the current download progress.
virtual void handleReadReady()=0
Slot to handle when data is ready to be read.
iFile(const QSharedPointer< QNetworkReply > &replay)
void setError(int newError)
Set the error code for this file.
void setDownloadRequest(const QSharedPointer< QNetworkReply > &replay)
setDownloadRequest This method sets replay for the file.
const QSharedPointer< QNetworkReply > & replay() const
Get the shared pointer to the associated QNetworkReply.
virtual void handleError(QNetworkReply::NetworkError error)
Slot to handle errors in the network operation.
void setUploadProgress(float newUploadProgress)
Set the upload progress.
bool isFinished() const
finished return true if the request was finished else false.
void finishedChanged()
Signal emitted when the associated finished changes.
void setDownloadProgress(float newDownloadProgress)
Set the download progress.
int error() const
Get the error code associated with this file.
void setFinished(bool newFinished)
setFinished monual sets finished flag.
virtual void handleFinished()
Slot to handle when the network operation is finished.
float uploadProgress() const
Get the current upload progress.