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>();
48 d->managerPrivate =
manager->d_func();
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());
147 if (
d->realFile->thread() ==
thread())
148 d->realFile->close();
162 if (!
d->isFinished || !
d->realFile || !
d->realFile->isOpen())
185 if (!
d->isFinished || !
d->realFile || !
d->realFile->isOpen())
189 d->realFile->close();
199void QNetworkReplyFileImpl::fileOpenFinished(
bool isOpen)
203 const auto fileSize =
size();
213#include "moc_qnetworkreplyfileimpl_p.cpp"
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\inmodule QtCore \reentrant
QDateTime lastModified() const
Returns the date and time when the file was last modified.
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory.
qint64 size() const
Returns the file size in bytes.
bool exists() const
Returns true if the file exists; otherwise returns false.
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 error(QNetworkReply::NetworkError error, const QString &message)
void headerRead(QNetworkRequest::KnownHeaders header, const QVariant &value)
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 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 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.
QVariant header(QNetworkRequest::KnownHeaders header) const
Returns the value of the known header header, if that header was sent by the remote server.
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 setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
Sets the known header header to be of value value.
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
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isEmpty() const
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.
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
Combined button and popup list for selecting options.
#define Q_ARG(Type, data)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
QFileInfo fi("c:/temp/foo")
[newstuff]
QNetworkAccessManager manager