13File::File(
const QSharedPointer<QNetworkReply> &replay,
const QString &filePath):
iFile(replay) {
14 _localFile.setFileName(filePath);
16 if (!_localFile.isOpen()) {
17 _localFile.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Append);
35 auto&& bytes =
replay()->readAll();
38 _localFile.write(bytes);
The File class is implementations for local files.
void handleError(QNetworkReply::NetworkError error) override
void handleFinished() override
void handleReadReady() override
Type type() const override
type This is type of the file object.
File(const QSharedPointer< QNetworkReply > &replay, const QString &filePath)
const QFile & localFile() const
The iFile class This is main interface for all implementations of the files.
Type
The Type enum is type of the file object.
@ Local
This is local file, all receive bytes will be save directed into 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.
int error() const
Get the error code associated with this file.
virtual void handleFinished()
Slot to handle when the network operation is finished.