20#ifndef LIBREPCB_CORE_NETWORKREQUESTBASE_H
21#define LIBREPCB_CORE_NETWORKREQUESTBASE_H
65 const QByteArray& postData = QByteArray()) noexcept;
76 void setHeaderField(const QByteArray& name, const QByteArray& value) noexcept;
136 void start() noexcept;
147 void abort() noexcept;
180 void progress(qint64 bytesReceived, qint64 bytesTotal,
int percent);
212 QString contentType) noexcept = 0;
219 qint64 bytesTotal) noexcept;
224 void finalize(const QString& errorMsg,
225 const QString& contentType = QString()) noexcept;
Base class for network requests which are processed in the network access manager.
Definition networkrequestbase.h:57
QUrl mUrl
Definition networkrequestbase.h:231
void replyFinishedSlot() noexcept
Definition networkrequestbase.cpp:278
virtual void finalizeRequest()=0
std::unique_ptr< QNetworkReply > mReply
Definition networkrequestbase.h:239
void setMinimumCacheTime(int seconds) noexcept
Set the minimum time the request should be cached.
Definition networkrequestbase.cpp:104
void startRequested()
Internal signal, don't use it from outside.
void replyErrorSlot(QNetworkReply::NetworkError code) noexcept
Definition networkrequestbase.cpp:260
QByteArray mPostData
Definition networkrequestbase.h:232
qint64 mExpectedContentSize
Definition networkrequestbase.h:233
NetworkRequestBase()=delete
void aborted()
Request aborted signal (emitted right before finished())
NetworkRequestBase(const NetworkRequestBase &other)=delete
void errored(QString errorMsg)
Request errored signal (emitted right before finished())
void replyDownloadProgressSlot(qint64 bytesReceived, qint64 bytesTotal) noexcept
Definition networkrequestbase.cpp:236
void useBrowserUserAgent() noexcept
Use a typical browser user agent for this request.
Definition networkrequestbase.cpp:110
void replyReadyReadSlot() noexcept
Definition networkrequestbase.cpp:254
virtual void prepareRequest()=0
void finished(bool success)
Request finished signal.
virtual void fetchNewData(QIODevice &device) noexcept=0
void progressPercent(int percent)
Reply content download progress signal (simple)
virtual void emitSuccessfullyFinishedSignals(QString contentType) noexcept=0
static QString getUserAgent() noexcept
Definition networkrequestbase.cpp:399
void setCacheLoadControl(QNetworkRequest::CacheLoadControl value) noexcept
Set the cache load control attribute.
Definition networkrequestbase.cpp:91
void setExpectedReplyContentSize(qint64 bytes) noexcept
Set the expected size of the requested content.
Definition networkrequestbase.cpp:98
bool mErrored
Definition networkrequestbase.h:242
void executeRequest() noexcept
Definition networkrequestbase.cpp:146
void setHeaderField(const QByteArray &name, const QByteArray &value) noexcept
Set a HTTP header field for the network request.
Definition networkrequestbase.cpp:84
void succeeded()
Request succeeded signal (emitted right before finished())
void progress(qint64 bytesReceived, qint64 bytesTotal, int percent)
Reply content download progress signal (extended)
void uploadProgressSlot(qint64 bytesSent, qint64 bytesTotal) noexcept
Definition networkrequestbase.cpp:217
void replySslErrorsSlot(const QList< QSslError > &errors) noexcept
Definition networkrequestbase.cpp:267
QList< QUrl > mRedirectedUrls
Definition networkrequestbase.h:237
void finalize(const QString &errorMsg, const QString &contentType=QString()) noexcept
Definition networkrequestbase.cpp:336
static QString formatFileSize(qint64 bytes) noexcept
Definition networkrequestbase.cpp:387
void abort() noexcept
Abort downloading the requested content.
Definition networkrequestbase.cpp:133
bool mStarted
Definition networkrequestbase.h:240
bool mFinished
Definition networkrequestbase.h:243
void progressState(QString state)
Reply progress / state changed signal.
QNetworkRequest mRequest
Definition networkrequestbase.h:238
bool mAborted
Definition networkrequestbase.h:241
int mMinimumCacheTime
Definition networkrequestbase.h:234
void start() noexcept
Start downloading the requested content.
Definition networkrequestbase.cpp:118
Definition occmodel.cpp:76