qTbot 0.87.9547b0c
qTbot is base back end library for your c++ Qt projects.
ifile.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2024 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8#ifndef IFILE_H
9#define IFILE_H
10
11#include "qnetworkreply.h"
12#include <qTbot/global.h>
13#include <QFile>
14
15namespace qTbot {
16
20class QTBOT_EXPORT iFile: public QObject
21{
22 Q_OBJECT
23public:
24
28 enum Type {
32 Ram
33 };
34
35 iFile(const QSharedPointer<QNetworkReply>& replay);
36
41 float uploadProgress() const;
42
47 void setUploadProgress(float newUploadProgress);
48
53 float downloadProgress() const;
54
59 void setDownloadProgress(float newDownloadProgress);
60
65 int error() const;
66
71 void setError(int newError);
72
77 const QSharedPointer<QNetworkReply>& replay() const;
78
83 virtual Type type() const = 0;
84
89 bool isFinished() const;
90
95 void setDownloadRequest(const QSharedPointer<QNetworkReply>& replay);
96protected:
97
102 void setFinished(bool newFinished);
103
104protected slots:
108 virtual void handleReadReady() = 0;
109
113 virtual void handleFinished();
114
119 virtual void handleError(QNetworkReply::NetworkError error);
120
121private slots:
122
128 void handleUploadProgressChanged(qint64 bytesSent, qint64 bytesTotal);
129
135 void handleDownloadProgressChanged(qint64 bytesReceived, qint64 bytesTotal);
136
137signals:
142
147
152
157
162
163private:
164 float _uploadProgress = 0;
165 float _downloadProgress = 0;
166 int _error = 0;
167 bool _finished = false;
168
169 QSharedPointer<QNetworkReply> _replay;
170
171 friend class ITelegramBot;
172};
173}
174#endif // IFILE_H
The ITelegramBot class This is base implementation of the all telegramm bots.
The iFile class This is main interface for all implementations of the files.
Definition ifile.h:21
void errorChanged()
Signal emitted when the error code changes.
void uploadProgressChanged()
Signal emitted when the upload progress changes.
Type
The Type enum is type of the file object.
Definition ifile.h:28
@ Local
This is local file, all receive bytes will be save directed into file.
Definition ifile.h:30
virtual Type type() const =0
type This is type of the file object.
void downloadProgressChanged()
Signal emitted when the download progress changes.
virtual void handleReadReady()=0
Slot to handle when data is ready to be read.
void finishedChanged()
Signal emitted when the associated finished changes.
void replayChanged()
Signal emitted when the associated QNetworkReply changes.
#define QTBOT_EXPORT
Definition global.h:18