diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2011-03-10 06:41:57 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2011-03-10 08:00:08 (GMT) |
commit | af33f9f2e7ec433b81f5c18e3e7395db4a56c5fe (patch) | |
tree | ec1442b95f958ac834bfd0c81be6f1883c377929 /src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp | |
parent | 5098b3cc1127a1a4cbd66d0eeea8f2ec5f625bb9 (diff) | |
download | Qt-af33f9f2e7ec433b81f5c18e3e7395db4a56c5fe.zip Qt-af33f9f2e7ec433b81f5c18e3e7395db4a56c5fe.tar.gz Qt-af33f9f2e7ec433b81f5c18e3e7395db4a56c5fe.tar.bz2 |
AnimatedImage does not change progress value
This fixes QTBUG-17964 and make AnimatedImage behave like Image.
Task-number: QTBUG-17964
Reviewed-By: Martin Jones
Change-Id: I33996353a3b4ee0edb03741998f3ea893d4d31e5
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index 016b87d..8cc8165 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -231,9 +231,18 @@ void QDeclarativeAnimatedImage::load() { Q_D(QDeclarativeAnimatedImage); + QDeclarativeImageBase::Status oldStatus = d->status; + qreal oldProgress = d->progress; + if (d->url.isEmpty()) { delete d->_movie; + d->setPixmap(QPixmap()); + d->progress = 0; d->status = Null; + if (d->status != oldStatus) + emit statusChanged(d->status); + if (d->progress != oldProgress) + emit progressChanged(d->progress); } else { #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url); @@ -245,7 +254,8 @@ void QDeclarativeAnimatedImage::load() delete d->_movie; d->_movie = 0; d->status = Error; - emit statusChanged(d->status); + if (d->status != oldStatus) + emit statusChanged(d->status); return; } connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), @@ -262,20 +272,25 @@ void QDeclarativeAnimatedImage::load() d->setPixmap(d->_movie->currentPixmap()); d->status = Ready; d->progress = 1.0; - emit statusChanged(d->status); - emit sourceChanged(d->url); - emit progressChanged(d->progress); + if (d->status != oldStatus) + emit statusChanged(d->status); + if (d->progress != oldProgress) + emit progressChanged(d->progress); return; } #endif d->status = Loading; + d->progress = 0; + emit statusChanged(d->status); + emit progressChanged(d->progress); QNetworkRequest req(d->url); req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); d->reply = qmlEngine(this)->networkAccessManager()->get(req); QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(movieRequestFinished())); + QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)), + this, SLOT(requestProgress(qint64,qint64))); } - emit statusChanged(d->status); } #define ANIMATEDIMAGE_MAXIMUM_REDIRECT_RECURSION 16 |