From 5ddfe819e93462eff396c24d10c0446c4cd9b0ac Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 18 Jan 2011 10:40:26 +1000 Subject: Rename Image::cached to 'cached' (and QDeclarativePixmap::Cached also) This is to keep consistent property naming consistent. E.g. Image has 'smooth', 'mirror' properties rather than 'smoothed', 'mirrored'. For consistency QDeclarativePixmap::Cached was renamed as well. Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeborderimage.cpp | 8 ++++---- src/declarative/graphicsitems/qdeclarativeimage.cpp | 6 +++--- src/declarative/graphicsitems/qdeclarativeimagebase.cpp | 16 ++++++++-------- src/declarative/graphicsitems/qdeclarativeimagebase_p.h | 8 ++++---- .../graphicsitems/qdeclarativeimagebase_p_p.h | 4 ++-- src/declarative/util/qdeclarativepixmapcache.cpp | 8 ++++---- src/declarative/util/qdeclarativepixmapcache_p.h | 2 +- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 14 +++++++------- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 49ee357..3832813 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -313,8 +313,8 @@ void QDeclarativeBorderImage::load() QDeclarativePixmap::Options options; if (d->async) options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; + if (d->cache) + options |= QDeclarativePixmap::Cache; d->pix.load(qmlEngine(this), d->url, options); if (d->pix.isLoading()) { @@ -442,8 +442,8 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma QDeclarativePixmap::Options options; if (d->async) options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; + if (d->cache) + options |= QDeclarativePixmap::Cache; d->pix.load(qmlEngine(this), d->sciurl, options); if (d->pix.isLoading()) { diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 71a4f0c..2c9bde5 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -459,11 +459,11 @@ QRectF QDeclarativeImage::boundingRect() const */ /*! - \qmlproperty bool Image::cached + \qmlproperty bool Image::cache \since Quick 1.1 - Specifies that the image should be cached. The default value is - true. Setting \a cached to false is useful when dealing with large images, + Specifies whether the image should be cached. The default value is + true. Setting \a cache to false is useful when dealing with large images, to make sure that they aren't cached at the expense of small 'ui element' images. */ diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index b99ed4b..7ce357b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -128,20 +128,20 @@ QSize QDeclarativeImageBase::sourceSize() const return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight()); } -bool QDeclarativeImageBase::cached() const +bool QDeclarativeImageBase::cache() const { Q_D(const QDeclarativeImageBase); - return d->cached; + return d->cache; } -void QDeclarativeImageBase::setCached(bool cached) +void QDeclarativeImageBase::setCache(bool cache) { Q_D(QDeclarativeImageBase); - if (d->cached == cached) + if (d->cache == cache) return; - d->cached = cached; - emit cachedChanged(); + d->cache = cache; + emit cacheChanged(); if (isComponentComplete()) load(); } @@ -184,8 +184,8 @@ void QDeclarativeImageBase::load() QDeclarativePixmap::Options options; if (d->async) options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; + if (d->cache) + options |= QDeclarativePixmap::Cache; d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), options); if (d->pix.isLoading()) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index ad2e370..4d2aa04 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -58,7 +58,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) - Q_PROPERTY(bool cached READ cached WRITE setCached NOTIFY cachedChanged) // ### VERSIONING: Only in QtQuick 1.1 + Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged) // ### VERSIONING: Only in QtQuick 1.1 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) // ### VERSIONING: Only in QtQuick 1.1 @@ -74,8 +74,8 @@ public: bool asynchronous() const; void setAsynchronous(bool); - bool cached() const; - void setCached(bool); + bool cache() const; + void setCache(bool); virtual void setSourceSize(const QSize&); QSize sourceSize() const; @@ -89,7 +89,7 @@ Q_SIGNALS: void statusChanged(QDeclarativeImageBase::Status); void progressChanged(qreal progress); void asynchronousChanged(); - void cachedChanged(); + void cacheChanged(); void mirrorChanged(); protected: diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index 475e7cd..39cf44e 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -71,7 +71,7 @@ public: progress(0.0), explicitSourceSize(false), async(false), - cached(true), + cache(true), mirror(false) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; @@ -84,7 +84,7 @@ public: QSize sourcesize; bool explicitSourceSize : 1; bool async : 1; - bool cached : 1; + bool cache : 1; bool mirror: 1; }; diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index aef24c6..5190eab 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -959,7 +959,7 @@ QRect QDeclarativePixmap::rect() const void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url) { - load(engine, url, QSize(), QDeclarativePixmap::Cached); + load(engine, url, QSize(), QDeclarativePixmap::Cache); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDeclarativePixmap::Options options) @@ -969,7 +969,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDecl void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) { - load(engine, url, size, QDeclarativePixmap::Cached); + load(engine, url, size, QDeclarativePixmap::Cache); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, QDeclarativePixmap::Options options) @@ -994,7 +994,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const bool ok = false; d = createPixmapDataSync(engine, url, requestSize, &ok); if (ok) { - if (options & QDeclarativePixmap::Cached) + if (options & QDeclarativePixmap::Cache) d->addToCache(); return; } @@ -1008,7 +1008,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine); d = new QDeclarativePixmapData(url, requestSize); - if (options & QDeclarativePixmap::Cached) + if (options & QDeclarativePixmap::Cache) d->addToCache(); d->reply = reader->getImage(d); diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index b16f1bf..1cf76dd 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -68,7 +68,7 @@ public: enum Option { Asynchronous = 0x00000001, - Cached = 0x00000002 + Cache = 0x00000002 }; Q_DECLARE_FLAGS(Options, Option) diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 7bb629e..c277eb7 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -126,7 +126,7 @@ void tst_qdeclarativeimage::imageSource_data() QTest::addColumn("height"); QTest::addColumn("remote"); QTest::addColumn("async"); - QTest::addColumn("cached"); + QTest::addColumn("cache"); QTest::addColumn("error"); QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << ""; @@ -151,7 +151,7 @@ void tst_qdeclarativeimage::imageSource() QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); - QFETCH(bool, cached); + QFETCH(bool, cache); QFETCH(QString, error); TestHTTPServer server(SERVER_PORT); @@ -165,8 +165,8 @@ void tst_qdeclarativeimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: " - + (async ? QLatin1String("true") : QLatin1String("false")) + "; cached: " - + (cached ? QLatin1String("true") : QLatin1String("false")) + " }"; + + (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: " + + (cache ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -177,10 +177,10 @@ void tst_qdeclarativeimage::imageSource() else QVERIFY(obj->asynchronous() == false); - if (cached) - QVERIFY(obj->cached() == true); + if (cache) + QVERIFY(obj->cache() == true); else - QVERIFY(obj->cached() == false); + QVERIFY(obj->cache() == false); if (remote || async) QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); -- cgit v0.12