diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-12-04 00:30:01 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-12-04 00:30:01 (GMT) |
commit | 6b35bde56028997a9a676f5135f0525575937dba (patch) | |
tree | 018388fc2ae820c14dd95dd93c2bada1a600399f /src/declarative/util | |
parent | a53133f18cb123f390ca0b33e3ff9490fdb85b8d (diff) | |
parent | 436b0fff9d9ba95c0fe582f3b71d15d5a9a8535f (diff) | |
download | Qt-6b35bde56028997a9a676f5135f0525575937dba.zip Qt-6b35bde56028997a9a676f5135f0525575937dba.tar.gz Qt-6b35bde56028997a9a676f5135f0525575937dba.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qmlanimation_p_p.h | 16 | ||||
-rw-r--r-- | src/declarative/util/qmlpixmapcache.cpp | 70 | ||||
-rw-r--r-- | src/declarative/util/qmltransition.cpp | 7 |
3 files changed, 48 insertions, 45 deletions
diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index 5dac59a..0b65c27 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -205,14 +205,14 @@ public: connectedTimeLine(false), componentComplete(true), startOnCompletion(false), target(0), group(0) {} - bool running; - bool paused; - bool alwaysRunToEnd; - bool repeat; - bool connectedTimeLine; - - bool componentComplete; - bool startOnCompletion; + bool running:1; + bool paused:1; + bool alwaysRunToEnd:1; + bool repeat:1; + bool connectedTimeLine:1; + + bool componentComplete:1; + bool startOnCompletion:1; void commence(); diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp index 29720d8..16e3dc8 100644 --- a/src/declarative/util/qmlpixmapcache.cpp +++ b/src/declarative/util/qmlpixmapcache.cpp @@ -150,59 +150,62 @@ bool QmlPixmapCache::find(const QUrl& url, QPixmap *pixmap) QmlPerfTimer<QmlPerf::PixmapLoad> perf; #endif - QString key = url.toString(); bool ok = true; - if (!QPixmapCache::find(key,pixmap)) { #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML - QString lf = toLocalFileOrQrc(url); - if (!lf.isEmpty()) { + QString lf = toLocalFileOrQrc(url); + if (!lf.isEmpty()) { + if (!QPixmapCache::find(lf,pixmap)) { QFile f(lf); if (f.open(QIODevice::ReadOnly)) { if (!readImage(&f, pixmap)) { qWarning() << "Format error loading" << url; *pixmap = QPixmap(); ok = false; + } else { + QPixmapCache::insert(lf, *pixmap); + ok = !pixmap->isNull(); } } else { *pixmap = QPixmap(); ok = false; } - } else + } else { + ok = !pixmap->isNull(); + } + return ok; + } #endif - { - QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); - if (iter == qfxActiveNetworkReplies.end()) { - // API usage error - qWarning() << "QmlPixmapCache: URL not loaded" << url; + + QString key = url.toString(); + if (!QPixmapCache::find(key,pixmap)) { + QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + if (iter == qfxActiveNetworkReplies.end()) { + // API usage error + qWarning() << "QmlPixmapCache: URL not loaded" << url; + ok = false; + } else { + if ((*iter)->reply->error()) { + qWarning() << "Network error loading" << url << (*iter)->reply->errorString(); + *pixmap = QPixmap(); + ok = false; + } else if (!readImage((*iter)->reply, pixmap)) { + qWarning() << "Format error loading" << url; + *pixmap = QPixmap(); ok = false; } else { - if ((*iter)->reply->error()) { - qWarning() << "Network error loading" << url << (*iter)->reply->errorString(); - *pixmap = QPixmap(); - ok = false; - } else if (!readImage((*iter)->reply, pixmap)) { - qWarning() << "Format error loading" << url; - *pixmap = QPixmap(); - ok = false; - } else { - if ((*iter)->refCount > 1) - (*iter)->pixmap = *pixmap; - } - (*iter)->release(); + if ((*iter)->refCount > 1) + (*iter)->pixmap = *pixmap; } + (*iter)->release(); } QPixmapCache::insert(key, *pixmap); } else { ok = !pixmap->isNull(); -#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML - if (url.scheme()!=QLatin1String("file")) -#endif + // We may be the second finder. Still need to check for active replies. - { - QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); - if (iter != qfxActiveNetworkReplies.end()) - (*iter)->release(); - } + QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key); + if (iter != qfxActiveNetworkReplies.end()) + (*iter)->release(); } return ok; } @@ -226,8 +229,7 @@ QNetworkReply *QmlPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap * #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML QString lf = toLocalFileOrQrc(url); if (!lf.isEmpty()) { - QString key = url.toString(); - if (!QPixmapCache::find(key,pixmap)) { + if (!QPixmapCache::find(lf,pixmap)) { bool loaded = true; QFile f(lf); if (f.open(QIODevice::ReadOnly)) { @@ -242,7 +244,7 @@ QNetworkReply *QmlPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap * loaded = false; } if (loaded) - QPixmapCache::insert(key, *pixmap); + QPixmapCache::insert(lf, *pixmap); if (ok) *ok = loaded; } return 0; diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp index a9c9596..ec92cf9 100644 --- a/src/declarative/util/qmltransition.cpp +++ b/src/declarative/util/qmltransition.cpp @@ -72,7 +72,7 @@ class ParallelAnimationWrapper : public QParallelAnimationGroup { Q_OBJECT public: - ParallelAnimationWrapper(QObject *parent) : QParallelAnimationGroup(parent) {} + ParallelAnimationWrapper(QObject *parent = 0) : QParallelAnimationGroup(parent) {} QmlTransitionPrivate *trans; protected: virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); @@ -97,8 +97,7 @@ public: void init() { - Q_Q(QmlTransition); - group = new ParallelAnimationWrapper(q); + group = new ParallelAnimationWrapper; group->trans = this; } @@ -147,6 +146,8 @@ QmlTransition::QmlTransition(QObject *parent) QmlTransition::~QmlTransition() { + Q_D(QmlTransition); + delete d->group; } void QmlTransition::stop() |