summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfximagebase.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-08-14 06:04:35 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-08-14 06:08:31 (GMT)
commitfe59969d239231ae1bfb33e702f58d124554db95 (patch)
tree8250be36f68fe0fcf8c0394c6e38cc324ea000dc /src/declarative/fx/qfximagebase.cpp
parent8ed52465b705ca4ce35d9a8d1ab61e284b0f6dc3 (diff)
downloadQt-fe59969d239231ae1bfb33e702f58d124554db95.zip
Qt-fe59969d239231ae1bfb33e702f58d124554db95.tar.gz
Qt-fe59969d239231ae1bfb33e702f58d124554db95.tar.bz2
Tidy up usage of QNetworkReply returned by QFxPixmapCache::get, update
documentation.
Diffstat (limited to 'src/declarative/fx/qfximagebase.cpp')
-rw-r--r--src/declarative/fx/qfximagebase.cpp46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/declarative/fx/qfximagebase.cpp b/src/declarative/fx/qfximagebase.cpp
index 66685c2..e3760f3 100644
--- a/src/declarative/fx/qfximagebase.cpp
+++ b/src/declarative/fx/qfximagebase.cpp
@@ -123,25 +123,25 @@ void QFxImageBase::setSource(const QUrl &url)
update();
} else {
d->status = Loading;
- d->reply = QFxPixmapCache::get(qmlEngine(this), d->url, &d->pix);
- if (d->reply) {
- connect(d->reply, SIGNAL(finished()), this, SLOT(requestFinished()));
- connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
- this, SLOT(requestProgress(qint64,qint64)));
- } else {
- //### should be unified with requestFinished
- setImplicitWidth(d->pix.width());
- setImplicitHeight(d->pix.height());
-
- if (d->status == Loading)
- d->status = Ready;
- d->progress = 1.0;
- emit statusChanged(d->status);
- emit sourceChanged(d->url);
- emit progressChanged(1.0);
- update();
- }
+ QNetworkReply *reply = QFxPixmapCache::get(qmlEngine(this), d->url, &d->pix);
+ if (reply) {
+ connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
+ connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
+ this, SLOT(requestProgress(qint64,qint64)));
+ } else {
+ //### should be unified with requestFinished
+ setImplicitWidth(d->pix.width());
+ setImplicitHeight(d->pix.height());
+
+ if (d->status == Loading)
+ d->status = Ready;
+ d->progress = 1.0;
+ emit statusChanged(d->status);
+ emit sourceChanged(d->url);
+ emit progressChanged(1.0);
+ update();
}
+ }
emit statusChanged(d->status);
}
@@ -149,14 +149,8 @@ void QFxImageBase::setSource(const QUrl &url)
void QFxImageBase::requestFinished()
{
Q_D(QFxImageBase);
- if (d->reply) {
- //###disconnect really needed?
- disconnect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
- this, SLOT(requestProgress(qint64,qint64)));
- if (d->reply->error() != QNetworkReply::NoError)
- d->status = Error;
- }
- QFxPixmapCache::find(d->url, &d->pix);
+ if (!QFxPixmapCache::find(d->url, &d->pix))
+ d->status = Error;
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());