6#include "QtCore/qdatetime.h"
8#include <QtCore/QCoreApplication>
9#include <QtCore/QFileInfo>
10#include <QtCore/QThread>
23 qRegisterMetaType<QNetworkRequest::KnownHeaders>();
24 qRegisterMetaType<QNetworkReply::NetworkError>();
51 if (
url.
host() ==
"localhost"_L1)
74 if (scheme ==
"qrc"_L1) {
77#if defined(Q_OS_ANDROID)
78 if (scheme ==
"assets"_L1)
95 realFile->moveToThread(
d->managerPrivate->createThread());
98 d->realFile = realFile;
117 .arg(
d->realFile->fileName(),
d->realFile->errorString());
151 if (
d->realFile->thread() ==
thread())
152 d->realFile->close();
166 if (!
d->isFinished || !
d->realFile || !
d->realFile->isOpen())
180 return totalSizeOpt.value_or(0);
189 if (!
d->isFinished || !
d->realFile || !
d->realFile->isOpen())
193 d->realFile->close();
203void QNetworkReplyFileImpl::fileOpenFinished(
bool isOpen)
207 const auto fileSize =
size();
217#include "moc_qnetworkreplyfileimpl_p.cpp"
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
FileError error() const
Returns the file error status.
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
void readyRead()
This signal is emitted once every time new data is available for reading from the device's current re...
bool isOpen() const
Returns true if the device is open; otherwise returns false.
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
The QNetworkAccessManager class allows the application to send network requests and receive replies.
Operation
Indicates the operation this reply is processing.
void headerRead(QHttpHeaders::WellKnownHeader, const QByteArray &value)
QPointer< QFile > realFile
QNetworkAccessManagerPrivate * managerPrivate
virtual void close() override
Closes this device for reading.
virtual qint64 readData(char *data, qint64 maxlen) override
virtual bool isSequential() const override
QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op)
virtual qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
virtual void abort() override
Aborts the operation immediately and close down any network connections still open.
qint64 size() const override
For open random-access devices, this function returns the size of the device.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
QNetworkAccessManager * manager() const
Returns the QNetworkAccessManager that was used to create this QNetworkReply object.
void setError(NetworkError errorCode, const QString &errorString)
Sets the error condition to be errorCode.
virtual void close() override
Closes this device for reading.
void setWellKnownHeader(QHttpHeaders::WellKnownHeader name, const QByteArray &value)
QHttpHeaders headers() const
void setOperation(QNetworkAccessManager::Operation operation)
Sets the associated operation for this object to be operation.
void metaDataChanged()
\omit FIXME: Update name? \endomit
void setUrl(const QUrl &url)
Sets the URL being processed to be url.
void setHeaders(const QHttpHeaders &newHeaders)
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
This signal is emitted to indicate the progress of the download part of this network request,...
void setAttribute(QNetworkRequest::Attribute code, const QVariant &value)
Sets the attribute code to have value value.
void setRequest(const QNetworkRequest &request)
Sets the associated request for this object to be request.
NetworkError
Indicates all possible error conditions found during the processing of the request.
@ ContentOperationNotPermittedError
@ ProtocolInvalidOperationError
void finished()
This signal is emitted when the reply has finished processing.
QUrl url() const
Returns the URL of the content downloaded or uploaded.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
KnownHeaders
List of known header types that QNetworkRequest parses.
@ HttpStatusCodeAttribute
@ BackgroundRequestAttribute
@ HttpReasonPhraseAttribute
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
Returns the attribute associated with the code code.
QUrl url() const
Returns the URL this network request is referring to.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QThread * thread() const
Returns the thread in which the object lives.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
static QThread * currentThread()
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
QString scheme() const
Returns the scheme of the URL.
void setHost(const QString &host, ParsingMode mode=DecodedMode)
Sets the host of the URL to host.
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_ARG(Type, data)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
QNetworkAccessManager manager