Qt 4.8
|
The QDeclarativeDataBlob encapsulates a data request that can be issued to a QDeclarativeDataLoader. More...
#include <qdeclarativetypeloader_p.h>
Public Types | |
enum | Status { Null, Loading, WaitingForDependencies, Complete, Error } |
This enum describes the status of the data blob. More... | |
enum | Type { QmlFile, JavaScriptFile, QmldirFile } |
This enum describes the type of the data blob. More... | |
Public Functions | |
void | addDependency (QDeclarativeDataBlob *) |
Wait for blob to become complete or to error. More... | |
QList< QDeclarativeError > | errors () const |
Return the errors on this blob. More... | |
QUrl | finalUrl () const |
Returns the final url of the data. More... | |
bool | isComplete () const |
Returns true if the status is Complete. More... | |
bool | isCompleteOrError () const |
Returns true if the status is Complete or Error. More... | |
bool | isError () const |
Returns true if the status is Error. More... | |
bool | isLoading () const |
Returns true if the status is Loading. More... | |
bool | isNull () const |
Returns true if the status is Null. More... | |
bool | isWaiting () const |
Returns true if the status is WaitingForDependencies. More... | |
qreal | progress () const |
Returns the data download progress from 0 to 1. More... | |
QDeclarativeDataBlob (const QUrl &, Type) | |
Create a new QDeclarativeDataBlob for url and of the provided type. More... | |
void | setError (const QDeclarativeError &) |
Mark this blob as having errors. More... | |
void | setError (const QList< QDeclarativeError > &errors) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
Status | status () const |
Returns the blob's status. More... | |
Type | type () const |
Returns the type provided to the constructor. More... | |
QUrl | url () const |
Returns the blob url passed to the constructor. More... | |
virtual | ~QDeclarativeDataBlob () |
Public Functions inherited from QDeclarativeRefCount | |
void | addref () |
QDeclarativeRefCount () | |
void | release () |
virtual | ~QDeclarativeRefCount () |
Protected Functions | |
virtual void | allDependenciesDone () |
Called when all blobs waited for have completed. More... | |
virtual void | dataReceived (const QByteArray &)=0 |
Invoked when data for the blob is received. More... | |
virtual void | dependencyComplete (QDeclarativeDataBlob *) |
Called if blob, which was previously waited for, has completed. More... | |
virtual void | dependencyError (QDeclarativeDataBlob *) |
Called if blob, which was previously waited for, has an error. More... | |
virtual void | done () |
Invoked once data has either been received or a network error occurred, and all dependencies are complete. More... | |
virtual void | downloadProgressChanged (qreal) |
Called when the download progress of this blob changes. More... | |
virtual void | networkError (QNetworkReply::NetworkError) |
Invoked if there is a network error while fetching this blob. More... | |
Private Functions | |
void | cancelAllWaitingFor () |
void | notifyAllWaitingOnMe () |
void | notifyComplete (QDeclarativeDataBlob *) |
void | tryDone () |
Properties | |
QList< QDeclarativeError > | m_errors |
QUrl | m_finalUrl |
bool | m_inCallback:1 |
bool | m_isDone:1 |
QDeclarativeDataLoader * | m_manager |
qreal | m_progress |
int | m_redirectCount:30 |
Status | m_status |
Type | m_type |
QUrl | m_url |
QList< QDeclarativeDataBlob * > | m_waitingFor |
QList< QDeclarativeDataBlob * > | m_waitingOnMe |
Friends | |
class | QDeclarativeDataLoader |
The QDeclarativeDataBlob encapsulates a data request that can be issued to a QDeclarativeDataLoader.
QDeclarativeDataBlob's are loaded by a QDeclarativeDataLoader. The user creates the QDeclarativeDataBlob and then calls QDeclarativeDataLoader::load() or QDeclarativeDataLoader::loadWithStaticData() to load it. The QDeclarativeDataLoader invokes callbacks on the QDeclarativeDataBlob as data becomes available.
Definition at line 74 of file qdeclarativetypeloader_p.h.
This enum describes the status of the data blob.
Enumerator | |
---|---|
Null | |
Loading | |
WaitingForDependencies | |
Complete | |
Error |
Definition at line 77 of file qdeclarativetypeloader_p.h.
This enum describes the type of the data blob.
Enumerator | |
---|---|
QmlFile | |
JavaScriptFile | |
QmldirFile |
Definition at line 85 of file qdeclarativetypeloader_p.h.
Create a new QDeclarativeDataBlob for url and of the provided type.
Definition at line 134 of file qdeclarativetypeloader.cpp.
|
virtual |
Definition at line 141 of file qdeclarativetypeloader.cpp.
void QDeclarativeDataBlob::addDependency | ( | QDeclarativeDataBlob * | blob | ) |
Wait for blob to become complete or to error.
If blob is already complete or in error, or this blob is already complete, this has no effect.
Definition at line 281 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::dataReceived(), and QDeclarativeTypeData::resolveTypes().
|
protectedvirtual |
Called when all blobs waited for have completed.
This occurs regardless of whether they are in error, or complete state.
The default implementation does nothing.
Reimplemented in QDeclarativeTypeData.
Definition at line 397 of file qdeclarativetypeloader.cpp.
Referenced by notifyComplete(), and QDeclarativeDataLoader::setData().
|
private |
Definition at line 422 of file qdeclarativetypeloader.cpp.
Referenced by setError(), and ~QDeclarativeDataBlob().
|
protectedpure virtual |
Invoked when data for the blob is received.
Implementors should use this callback to determine a blob's dependencies. Within this callback you may call setError() or addDependency().
Implemented in QDeclarativeQmldirData, QDeclarativeScriptData, and QDeclarativeTypeData.
Referenced by QDeclarativeDataLoader::setData().
|
protectedvirtual |
Called if blob, which was previously waited for, has completed.
The default implementation does nothing.
Definition at line 386 of file qdeclarativetypeloader.cpp.
Referenced by notifyComplete().
|
protectedvirtual |
Called if blob, which was previously waited for, has an error.
The default implementation does nothing.
Definition at line 376 of file qdeclarativetypeloader.cpp.
Referenced by notifyComplete().
|
protectedvirtual |
Invoked once data has either been received or a network error occurred, and all dependencies are complete.
You can set an error in this method, but you cannot add new dependencies. Implementors should use this callback to finalize processing of data.
The default implementation does nothing.
Reimplemented in QDeclarativeTypeData.
Definition at line 314 of file qdeclarativetypeloader.cpp.
Referenced by tryDone().
|
protectedvirtual |
Called when the download progress of this blob changes.
progress goes from 0 to 1.
Reimplemented in QDeclarativeTypeData.
Definition at line 405 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeDataLoader::load(), and QDeclarativeDataLoader::networkReplyProgress().
QList< QDeclarativeError > QDeclarativeDataBlob::errors | ( | ) | const |
Return the errors on this blob.
Definition at line 244 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::done(), QDeclarativeComponentPrivate::fromTypeData(), QDeclarativeDomDocument::load(), and setError().
QUrl QDeclarativeDataBlob::finalUrl | ( | ) | const |
Returns the final url of the data.
Initially this is the same as url(), but if a network redirect happens while fetching the data, this url is updated to reflect the new location.
Definition at line 236 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeCompiler::compileTree(), QDeclarativeTypeData::dataReceived(), QDeclarativeTypeData::done(), QDeclarativeComponentPrivate::fromTypeData(), and QDeclarativeTypeData::resolveTypes().
bool QDeclarativeDataBlob::isComplete | ( | ) | const |
Returns true if the status is Complete.
Definition at line 191 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeCompiler::buildDynamicMeta(), and isCompleteOrError().
bool QDeclarativeDataBlob::isCompleteOrError | ( | ) | const |
Returns true if the status is Complete or Error.
Definition at line 207 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::done(), QDeclarativeDomDocument::load(), QDeclarativeComponent::loadUrl(), and QDeclarativeComponent::setData().
bool QDeclarativeDataBlob::isError | ( | ) | const |
Returns true if the status is Error.
Definition at line 199 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::done(), QDeclarativeComponentPrivate::fromTypeData(), isCompleteOrError(), QDeclarativeDomDocument::load(), notifyComplete(), and QDeclarativeDataLoader::setData().
bool QDeclarativeDataBlob::isLoading | ( | ) | const |
bool QDeclarativeDataBlob::isNull | ( | ) | const |
bool QDeclarativeDataBlob::isWaiting | ( | ) | const |
Returns true if the status is WaitingForDependencies.
Definition at line 183 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeDataLoader::setData().
|
protectedvirtual |
Invoked if there is a network error while fetching this blob.
The default implementation sets an appropriate QDeclarativeError.
Definition at line 323 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeDataLoader::load(), and QDeclarativeDataLoader::networkReplyFinished().
|
private |
Definition at line 435 of file qdeclarativetypeloader.cpp.
Referenced by tryDone().
|
private |
Definition at line 446 of file qdeclarativetypeloader.cpp.
Referenced by notifyAllWaitingOnMe().
qreal QDeclarativeDataBlob::progress | ( | ) | const |
Returns the data download progress from 0 to 1.
Definition at line 215 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeComponent::loadUrl().
void QDeclarativeDataBlob::setError | ( | const QDeclarativeError & | errors | ) |
Mark this blob as having errors.
All outstanding dependencies will be cancelled. Requests to add new dependencies will be ignored. Entry into the Error state is irreversable, although you can change the specific errors by additional calls to setError.
Definition at line 256 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::compile(), QDeclarativeTypeData::dataReceived(), QDeclarativeTypeData::done(), QDeclarativeDataLoader::load(), networkError(), and QDeclarativeTypeData::resolveTypes().
void QDeclarativeDataBlob::setError | ( | const QList< QDeclarativeError > & | errors | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 266 of file qdeclarativetypeloader.cpp.
QDeclarativeDataBlob::Status QDeclarativeDataBlob::status | ( | ) | const |
Returns the blob's status.
Definition at line 159 of file qdeclarativetypeloader.cpp.
Referenced by addDependency(), QDeclarativeDataLoader::load(), QDeclarativeDataLoader::loadWithStaticData(), notifyComplete(), QDeclarativeDataLoader::setData(), and tryDone().
|
private |
Definition at line 410 of file qdeclarativetypeloader.cpp.
Referenced by notifyComplete(), QDeclarativeDataLoader::setData(), and setError().
QDeclarativeDataBlob::Type QDeclarativeDataBlob::type | ( | ) | const |
Returns the type provided to the constructor.
Definition at line 151 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::dataReceived(), QDeclarativeTypeData::done(), and QDeclarativeTypeData::resolveTypes().
QUrl QDeclarativeDataBlob::url | ( | ) | const |
Returns the blob url passed to the constructor.
If a network redirect happens while fetching the data, this url remains the same.
Definition at line 226 of file qdeclarativetypeloader.cpp.
Referenced by QDeclarativeTypeData::done(), QDeclarativeTypeData::qmldirForUrl(), and QDeclarativeTypeData::resolveTypes().
|
friend |
Definition at line 129 of file qdeclarativetypeloader_p.h.
|
private |
Definition at line 154 of file qdeclarativetypeloader_p.h.
Referenced by errors(), and setError().
|
private |
Definition at line 140 of file qdeclarativetypeloader_p.h.
Referenced by finalUrl(), networkError(), and QDeclarativeDataLoader::networkReplyFinished().
|
private |
Definition at line 151 of file qdeclarativetypeloader_p.h.
Referenced by notifyComplete(), QDeclarativeDataLoader::setData(), and setError().
|
private |
Definition at line 152 of file qdeclarativetypeloader_p.h.
Referenced by tryDone().
|
private |
Definition at line 149 of file qdeclarativetypeloader_p.h.
Referenced by QDeclarativeDataLoader::load(), and QDeclarativeDataLoader::loadWithStaticData().
|
private |
Definition at line 137 of file qdeclarativetypeloader_p.h.
Referenced by QDeclarativeDataLoader::load(), QDeclarativeDataLoader::networkReplyProgress(), and progress().
|
private |
Definition at line 150 of file qdeclarativetypeloader_p.h.
Referenced by QDeclarativeDataLoader::networkReplyFinished().
|
private |
Definition at line 136 of file qdeclarativetypeloader_p.h.
Referenced by addDependency(), isComplete(), isError(), isLoading(), isNull(), isWaiting(), QDeclarativeDataLoader::load(), QDeclarativeDataLoader::loadWithStaticData(), QDeclarativeDataLoader::setData(), setError(), status(), and tryDone().
|
private |
Definition at line 135 of file qdeclarativetypeloader_p.h.
Referenced by type().
|
private |
Definition at line 139 of file qdeclarativetypeloader_p.h.
Referenced by QDeclarativeDataLoader::load(), and url().
|
private |
Definition at line 146 of file qdeclarativetypeloader_p.h.
Referenced by addDependency(), cancelAllWaitingFor(), notifyAllWaitingOnMe(), notifyComplete(), and tryDone().
|
private |
Definition at line 143 of file qdeclarativetypeloader_p.h.
Referenced by addDependency(), cancelAllWaitingFor(), notifyAllWaitingOnMe(), and ~QDeclarativeDataBlob().