summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-08-31 03:23:40 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-08-31 03:23:40 (GMT)
commit33b1332d1b8593f488cf5f926315a6df68eee7df (patch)
tree93e8337a555e343b281b62994b6848b4e564fbb4 /src
parent3928cb20ecc63ed21cdb122388b200c9ab8e7cad (diff)
downloadQt-33b1332d1b8593f488cf5f926315a6df68eee7df.zip
Qt-33b1332d1b8593f488cf5f926315a6df68eee7df.tar.gz
Qt-33b1332d1b8593f488cf5f926315a6df68eee7df.tar.bz2
Revert "Add 'cached' property to Image."
This will have to go in 4.8. This reverts commit 3928cb20ecc63ed21cdb122388b200c9ab8e7cad.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp14
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp25
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h4
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp22
-rw-r--r--src/declarative/util/qdeclarativepixmapcache_p.h12
7 files changed, 17 insertions, 74 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 7299664..f16770b 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -211,12 +211,7 @@ void QDeclarativeBorderImage::load()
}
} else {
- QDeclarativePixmap::Options options;
- if (d->async)
- options |= QDeclarativePixmap::Asynchronous;
- if (d->cached)
- options |= QDeclarativePixmap::Cached;
- d->pix.load(qmlEngine(this), d->url, options);
+ d->pix.load(qmlEngine(this), d->url, d->async);
if (d->pix.isLoading()) {
d->pix.connectFinished(this, SLOT(requestFinished()));
@@ -333,12 +328,7 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
- QDeclarativePixmap::Options options;
- if (d->async)
- options |= QDeclarativePixmap::Asynchronous;
- if (d->cached)
- options |= QDeclarativePixmap::Cached;
- d->pix.load(qmlEngine(this), d->sciurl, options);
+ d->pix.load(qmlEngine(this), d->sciurl, d->async);
if (d->pix.isLoading()) {
static int thisRequestProgress = -1;
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 4ae0887..7a88e78 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -414,14 +414,6 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF
are always loaded asynchonously.
*/
-/*!
- \qmlproperty bool Image::cached
-
- Specifies that the image should be cached. The default value is
- true. Setting \a cached 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.
-*/
-
void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_D(QDeclarativeImage);
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 2fc935f..416604b 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -126,24 +126,6 @@ QSize QDeclarativeImageBase::sourceSize() const
return d->sourcesize.isValid() ? d->sourcesize : QSize(implicitWidth(),implicitHeight());
}
-bool QDeclarativeImageBase::cached() const
-{
- Q_D(const QDeclarativeImageBase);
- return d->cached;
-}
-
-void QDeclarativeImageBase::setCached(bool cached)
-{
- Q_D(QDeclarativeImageBase);
- if (d->cached == cached)
- return;
-
- d->cached = cached;
- emit cachedChanged();
- if (isComponentComplete())
- load();
-}
-
void QDeclarativeImageBase::load()
{
Q_D(QDeclarativeImageBase);
@@ -168,12 +150,7 @@ void QDeclarativeImageBase::load()
d->status = Loading;
emit statusChanged(d->status);
- QDeclarativePixmap::Options options;
- if (d->async)
- options |= QDeclarativePixmap::Asynchronous;
- if (d->cached)
- options |= QDeclarativePixmap::Cached;
- d->pix.load(qmlEngine(this), d->url, d->sourcesize, options);
+ d->pix.load(qmlEngine(this), d->url, d->sourcesize, d->async);
if (d->pix.isLoading()) {
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
index b6d2a44..f5896b1 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)
+
Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged)
public:
@@ -73,9 +73,6 @@ public:
bool asynchronous() const;
void setAsynchronous(bool);
- bool cached() const;
- void setCached(bool);
-
virtual void setSourceSize(const QSize&);
QSize sourceSize() const;
@@ -85,7 +82,6 @@ Q_SIGNALS:
void statusChanged(Status);
void progressChanged(qreal progress);
void asynchronousChanged();
- void cachedChanged();
protected:
virtual void load();
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
index ba9f38f..aee8b28 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
@@ -69,8 +69,7 @@ public:
QDeclarativeImageBasePrivate()
: status(QDeclarativeImageBase::Null),
progress(0.0),
- async(false),
- cached(true)
+ async(false)
{
QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents;
}
@@ -81,7 +80,6 @@ public:
qreal progress;
QSize sourcesize;
bool async : 1;
- bool cached : 1;
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index 1177d07..de2de21 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -956,20 +956,20 @@ QRect QDeclarativePixmap::rect() const
void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url)
{
- load(engine, url, QSize(), QDeclarativePixmap::Cached);
+ load(engine, url, QSize(), false);
}
-void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDeclarativePixmap::Options options)
+void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, bool async)
{
- load(engine, url, QSize(), options);
+ load(engine, url, QSize(), async);
}
void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size)
{
- load(engine, url, size, QDeclarativePixmap::Cached);
+ load(engine, url, size, false);
}
-void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, QDeclarativePixmap::Options options)
+void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, bool async)
{
if (d) { d->release(); d = 0; }
@@ -979,20 +979,19 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const
QHash<QDeclarativePixmapKey, QDeclarativePixmapData *>::Iterator iter = store->m_cache.find(key);
if (iter == store->m_cache.end()) {
- if (options & QDeclarativePixmap::Asynchronous) {
+ if (async) {
// pixmaps can only be loaded synchronously
if (url.scheme() == QLatin1String("image")
&& QDeclarativeEnginePrivate::get(engine)->getImageProviderType(url) == QDeclarativeImageProvider::Pixmap) {
- options &= ~QDeclarativePixmap::Asynchronous;
+ async = false;
}
}
- if (!(options & QDeclarativePixmap::Asynchronous)) {
+ if (!async) {
bool ok = false;
d = createPixmapDataSync(engine, url, requestSize, &ok);
if (ok) {
- if (options & QDeclarativePixmap::Cached)
- d->addToCache();
+ d->addToCache();
return;
}
if (d) // loadable, but encountered error while loading
@@ -1005,8 +1004,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const
QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine);
d = new QDeclarativePixmapData(url, requestSize);
- if (options & QDeclarativePixmap::Cached)
- d->addToCache();
+ d->addToCache();
d->reply = reader->getImage(d);
} else {
diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h
index 2c246c4..b4d88bd 100644
--- a/src/declarative/util/qdeclarativepixmapcache_p.h
+++ b/src/declarative/util/qdeclarativepixmapcache_p.h
@@ -66,12 +66,6 @@ public:
enum Status { Null, Ready, Error, Loading };
- enum Option {
- Asynchronous = 0x00000001,
- Cached = 0x00000002
- };
- Q_DECLARE_FLAGS(Options, Option)
-
bool isNull() const;
bool isReady() const;
bool isError() const;
@@ -91,9 +85,9 @@ public:
inline operator const QPixmap &() const;
void load(QDeclarativeEngine *, const QUrl &);
- void load(QDeclarativeEngine *, const QUrl &, QDeclarativePixmap::Options options);
+ void load(QDeclarativeEngine *, const QUrl &, bool);
void load(QDeclarativeEngine *, const QUrl &, const QSize &);
- void load(QDeclarativeEngine *, const QUrl &, const QSize &, QDeclarativePixmap::Options options);
+ void load(QDeclarativeEngine *, const QUrl &, const QSize &, bool);
void clear();
void clear(QObject *);
@@ -113,8 +107,6 @@ inline QDeclarativePixmap::operator const QPixmap &() const
return pixmap();
}
-Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePixmap::Options)
-
QT_END_NAMESPACE
QT_END_HEADER