20#ifndef LIBREPCB_CORE_NETWORKREQUESTBASE_H
21#define LIBREPCB_CORE_NETWORKREQUESTBASE_H
63 const QByteArray& postData = QByteArray()) noexcept;
74 void setHeaderField(const QByteArray& name, const QByteArray& value) noexcept;
134 void start() noexcept;
145 void abort() noexcept;
178 void progress(qint64 bytesReceived, qint64 bytesTotal,
int percent);
210 QString contentType) noexcept = 0;
217 qint64 bytesTotal) noexcept;
222 void finalize(const QString& errorMsg,
223 const QString& contentType = QString()) noexcept;
Base class for network requests which are processed in the network access manager.
Definition: networkrequestbase.h:55
QUrl mUrl
Definition: networkrequestbase.h:229
void replyFinishedSlot() noexcept
Definition: networkrequestbase.cpp:287
virtual void finalizeRequest()=0
void setMinimumCacheTime(int seconds) noexcept
Set the minimum time the request should be cached.
Definition: networkrequestbase.cpp:106
void startRequested()
Internal signal, don't use it from outside.
void replyErrorSlot(QNetworkReply::NetworkError code) noexcept
Definition: networkrequestbase.cpp:269
QByteArray mPostData
Definition: networkrequestbase.h:230
qint64 mExpectedContentSize
Definition: networkrequestbase.h:231
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:245
void useBrowserUserAgent() noexcept
Use a typical browser user agent for this request.
Definition: networkrequestbase.cpp:112
QScopedPointer< QNetworkReply > mReply
Definition: networkrequestbase.h:237
void replyReadyReadSlot() noexcept
Definition: networkrequestbase.cpp:263
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:408
void setCacheLoadControl(QNetworkRequest::CacheLoadControl value) noexcept
Set the cache load control attribute.
Definition: networkrequestbase.cpp:93
void setExpectedReplyContentSize(qint64 bytes) noexcept
Set the expected size of the requested content.
Definition: networkrequestbase.cpp:100
bool mErrored
Definition: networkrequestbase.h:240
void executeRequest() noexcept
Definition: networkrequestbase.cpp:148
void setHeaderField(const QByteArray &name, const QByteArray &value) noexcept
Set a HTTP header field for the network request.
Definition: networkrequestbase.cpp:86
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:226
void replySslErrorsSlot(const QList< QSslError > &errors) noexcept
Definition: networkrequestbase.cpp:276
QList< QUrl > mRedirectedUrls
Definition: networkrequestbase.h:235
void finalize(const QString &errorMsg, const QString &contentType=QString()) noexcept
Definition: networkrequestbase.cpp:345
static QString formatFileSize(qint64 bytes) noexcept
Definition: networkrequestbase.cpp:396
void abort() noexcept
Abort downloading the requested content.
Definition: networkrequestbase.cpp:135
bool mStarted
Definition: networkrequestbase.h:238
bool mFinished
Definition: networkrequestbase.h:241
void progressState(QString state)
Reply progress / state changed signal.
QNetworkRequest mRequest
Definition: networkrequestbase.h:236
bool mAborted
Definition: networkrequestbase.h:239
int mMinimumCacheTime
Definition: networkrequestbase.h:232
void start() noexcept
Start downloading the requested content.
Definition: networkrequestbase.cpp:120
Definition: occmodel.cpp:77