summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/extra/qmlgraphicsparticles.cpp10
-rw-r--r--src/declarative/graphicsitems/graphicsitems.pri2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage.cpp14
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimagebase.cpp10
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h2
-rw-r--r--src/declarative/util/qmlpixmapcache.cpp (renamed from src/declarative/graphicsitems/qmlgraphicspixmapcache.cpp)15
-rw-r--r--src/declarative/util/qmlpixmapcache_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspixmapcache_p.h)10
-rw-r--r--src/declarative/util/util.pri6
8 files changed, 35 insertions, 34 deletions
diff --git a/src/declarative/extra/qmlgraphicsparticles.cpp b/src/declarative/extra/qmlgraphicsparticles.cpp
index aba7e27..0349a4e 100644
--- a/src/declarative/extra/qmlgraphicsparticles.cpp
+++ b/src/declarative/extra/qmlgraphicsparticles.cpp
@@ -50,7 +50,7 @@
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
-#include <private/qmlgraphicspixmapcache_p.h>
+#include <private/qmlpixmapcache_p.h>
#include <private/qfxperf_p_p.h>
#include <private/qmlanimation_p_p.h>
#include <QNetworkReply>
@@ -619,7 +619,7 @@ QmlGraphicsParticles::~QmlGraphicsParticles()
{
Q_D(QmlGraphicsParticles);
if (d->pendingPixmapCache)
- QmlGraphicsPixmapCache::cancelGet(d->url, this);
+ QmlPixmapCache::cancelGet(d->url, this);
}
/*!
@@ -641,7 +641,7 @@ void QmlGraphicsParticles::imageLoaded()
{
Q_D(QmlGraphicsParticles);
d->pendingPixmapCache = false;
- QmlGraphicsPixmapCache::find(d->url, &d->image);
+ QmlPixmapCache::find(d->url, &d->image);
d->paintItem->updateSize();
d->paintItem->update();
}
@@ -654,7 +654,7 @@ void QmlGraphicsParticles::setSource(const QUrl &name)
return;
if (d->pendingPixmapCache) {
- QmlGraphicsPixmapCache::cancelGet(d->url, this);
+ QmlPixmapCache::cancelGet(d->url, this);
d->pendingPixmapCache = false;
}
if (name.isEmpty()) {
@@ -665,7 +665,7 @@ void QmlGraphicsParticles::setSource(const QUrl &name)
} else {
d->url = name;
Q_ASSERT(!name.isRelative());
- QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->url, &d->image);
+ QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->image);
if (reply) {
connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
d->pendingPixmapCache = true;
diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri
index 15d775c..cf71451 100644
--- a/src/declarative/graphicsitems/graphicsitems.pri
+++ b/src/declarative/graphicsitems/graphicsitems.pri
@@ -39,7 +39,6 @@ HEADERS += \
graphicsitems/qmlgraphicstextedit_p_p.h \
graphicsitems/qmlgraphicstext_p.h \
graphicsitems/qmlgraphicstext_p_p.h \
- graphicsitems/qmlgraphicspixmapcache_p.h \
graphicsitems/qmlgraphicsvisualitemmodel_p.h \
graphicsitems/qmlgraphicslistview_p.h \
graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h \
@@ -70,7 +69,6 @@ SOURCES += \
graphicsitems/qmlgraphicstextinput.cpp \
graphicsitems/qmlgraphicstext.cpp \
graphicsitems/qmlgraphicstextedit.cpp \
- graphicsitems/qmlgraphicspixmapcache.cpp \
graphicsitems/qmlgraphicsvisualitemmodel.cpp \
graphicsitems/qmlgraphicslistview.cpp \
graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp \
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
index ed39a2b..89bbe91 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
@@ -80,7 +80,7 @@ QmlGraphicsBorderImage::~QmlGraphicsBorderImage()
if (d->sciReply)
d->sciReply->deleteLater();
if (d->sciPendingPixmapCache)
- QmlGraphicsPixmapCache::cancelGet(d->sciurl, this);
+ QmlPixmapCache::cancelGet(d->sciurl, this);
}
/*!
\qmlproperty enum BorderImage::status
@@ -160,11 +160,11 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url)
}
if (d->pendingPixmapCache) {
- QmlGraphicsPixmapCache::cancelGet(d->url, this);
+ QmlPixmapCache::cancelGet(d->url, this);
d->pendingPixmapCache = false;
}
if (d->sciPendingPixmapCache) {
- QmlGraphicsPixmapCache::cancelGet(d->sciurl, this);
+ QmlPixmapCache::cancelGet(d->sciurl, this);
d->sciPendingPixmapCache = false;
}
@@ -203,7 +203,7 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url)
this, SLOT(sciRequestFinished()));
}
} else {
- QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->url, &d->pix);
+ QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->pix);
if (reply) {
d->pendingPixmapCache = true;
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
@@ -320,7 +320,7 @@ void QmlGraphicsBorderImage::setGridScaledImage(const QmlGraphicsGridScaledImage
d->verticalTileMode = sci.verticalTileRule();
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
- QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->sciurl, &d->pix);
+ QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->sciurl, &d->pix);
if (reply) {
d->sciPendingPixmapCache = true;
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
@@ -348,10 +348,10 @@ void QmlGraphicsBorderImage::requestFinished()
if (d->url.path().endsWith(QLatin1String(".sci"))) {
d->sciPendingPixmapCache = false;
- QmlGraphicsPixmapCache::find(d->sciurl, &d->pix);
+ QmlPixmapCache::find(d->sciurl, &d->pix);
} else {
d->pendingPixmapCache = false;
- if (!QmlGraphicsPixmapCache::find(d->url, &d->pix))
+ if (!QmlPixmapCache::find(d->url, &d->pix))
d->status = Error;
}
setImplicitWidth(d->pix.width());
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
index 283fb04..e86b53d 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
@@ -45,7 +45,7 @@
#include <QNetworkReply>
#include <QFile>
#include <QtDeclarative/qmlengine.h>
-#include <private/qmlgraphicspixmapcache_p.h>
+#include <private/qmlpixmapcache_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +65,7 @@ QmlGraphicsImageBase::~QmlGraphicsImageBase()
{
Q_D(QmlGraphicsImageBase);
if (d->pendingPixmapCache)
- QmlGraphicsPixmapCache::cancelGet(d->url, this);
+ QmlPixmapCache::cancelGet(d->url, this);
}
QmlGraphicsImageBase::Status QmlGraphicsImageBase::status() const
@@ -95,7 +95,7 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
return;
if (d->pendingPixmapCache) {
- QmlGraphicsPixmapCache::cancelGet(d->url, this);
+ QmlPixmapCache::cancelGet(d->url, this);
d->pendingPixmapCache = false;
}
@@ -117,7 +117,7 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
update();
} else {
d->status = Loading;
- QNetworkReply *reply = QmlGraphicsPixmapCache::get(qmlEngine(this), d->url, &d->pix);
+ QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->pix);
if (reply) {
d->pendingPixmapCache = true;
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
@@ -147,7 +147,7 @@ void QmlGraphicsImageBase::requestFinished()
d->pendingPixmapCache = false;
- if (!QmlGraphicsPixmapCache::find(d->url, &d->pix))
+ if (!QmlPixmapCache::find(d->url, &d->pix))
d->status = Error;
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
diff --git a/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h b/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
index b66a5a5..d4ae0a6 100644
--- a/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
@@ -44,7 +44,7 @@
#include <QtCore/QString>
#include <QtCore/QObject>
-#include <private/qmlgraphicspixmapcache_p.h>
+#include <private/qmlpixmapcache_p.h>
#include <QtDeclarative/qml.h>
#include "qmlgraphicsborderimage_p.h"
diff --git a/src/declarative/graphicsitems/qmlgraphicspixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp
index fdf489c..f5904c0 100644
--- a/src/declarative/graphicsitems/qmlgraphicspixmapcache.cpp
+++ b/src/declarative/util/qmlpixmapcache.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlgraphicspixmapcache_p.h"
+#include "qmlpixmapcache_p.h"
#include <QImageReader>
#include <QHash>
#include <QNetworkReply>
@@ -50,6 +50,7 @@
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
+
class QSharedNetworkReply;
typedef QHash<QString, QSharedNetworkReply *> QmlGraphicsSharedNetworkReplyHash;
static QmlGraphicsSharedNetworkReplyHash qfxActiveNetworkReplies;
@@ -118,7 +119,7 @@ static bool readImage(QIODevice *dev, QPixmap *pixmap)
/*!
\internal
- \class QmlGraphicsPixmapCache
+ \class QmlPixmapCache
\brief Enacapsultes a pixmap for QmlGraphics items.
This class is NOT reentrant.
@@ -140,7 +141,7 @@ static QString toLocalFileOrQrc(const QUrl& url)
Returns true if the image was loaded without error.
*/
-bool QmlGraphicsPixmapCache::find(const QUrl& url, QPixmap *pixmap)
+bool QmlPixmapCache::find(const QUrl& url, QPixmap *pixmap)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
QmlPerfTimer<QmlPerf::PixmapLoad> perf;
@@ -169,7 +170,7 @@ bool QmlGraphicsPixmapCache::find(const QUrl& url, QPixmap *pixmap)
QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key);
if (iter == qfxActiveNetworkReplies.end()) {
// API usage error
- qWarning() << "QmlGraphicsPixmapCache: URL not loaded" << url;
+ qWarning() << "QmlPixmapCache: URL not loaded" << url;
ok = false;
} else {
if ((*iter)->reply->error()) {
@@ -213,7 +214,7 @@ bool QmlGraphicsPixmapCache::find(const QUrl& url, QPixmap *pixmap)
The returned QNetworkReply will be deleted when all get() calls are
matched by a corresponding find() call.
*/
-QNetworkReply *QmlGraphicsPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap *pixmap)
+QNetworkReply *QmlPixmapCache::get(QmlEngine *engine, const QUrl& url, QPixmap *pixmap)
{
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
QString lf = toLocalFileOrQrc(url);
@@ -259,7 +260,7 @@ QNetworkReply *QmlGraphicsPixmapCache::get(QmlEngine *engine, const QUrl& url, Q
Any connections from the QNetworkReply returned by get() to \a obj will be
disconnected.
*/
-void QmlGraphicsPixmapCache::cancelGet(const QUrl& url, QObject* obj)
+void QmlPixmapCache::cancelGet(const QUrl& url, QObject* obj)
{
QString key = url.toString();
QmlGraphicsSharedNetworkReplyHash::Iterator iter = qfxActiveNetworkReplies.find(key);
@@ -274,7 +275,7 @@ void QmlGraphicsPixmapCache::cancelGet(const QUrl& url, QObject* obj)
This function is mainly for test verification. It returns the number of
requests that are still unfinished.
*/
-int QmlGraphicsPixmapCache::pendingRequests()
+int QmlPixmapCache::pendingRequests()
{
return qfxActiveNetworkReplies.count();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspixmapcache_p.h b/src/declarative/util/qmlpixmapcache_p.h
index 29de98d..e6ed452 100644
--- a/src/declarative/graphicsitems/qmlgraphicspixmapcache_p.h
+++ b/src/declarative/util/qmlpixmapcache_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSPIXMAPCACHE_H
-#define QMLGRAPHICSPIXMAPCACHE_H
+#ifndef QMLPIXMAPCACHE_H
+#define QMLPIXMAPCACHE_H
#include <QtCore/QString>
#include <QtGui/QPixmap>
@@ -53,13 +53,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QmlEngine;
class QNetworkReply;
-class Q_DECLARATIVE_EXPORT QmlGraphicsPixmapCache
+class Q_DECLARATIVE_EXPORT QmlPixmapCache
{
public:
static QNetworkReply *get(QmlEngine *, const QUrl& url, QPixmap *pixmap);
static void cancelGet(const QUrl& url, QObject* obj);
- static bool find(const QUrl& url, QPixmap *pixmap); // url must have been passed to QmlGraphicsPixmapCache::get, and any returned reply finished.
+ static bool find(const QUrl& url, QPixmap *pixmap); // url must have been passed to QmlPixmapCache::get, and any returned reply finished.
static int pendingRequests(); // mainly for test verification
};
@@ -68,4 +68,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLGRAPHICSPIXMAPCACHE_H
+#endif // QMLPIXMAPCACHE_H
diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri
index 87ccb58..f955ef6 100644
--- a/src/declarative/util/util.pri
+++ b/src/declarative/util/util.pri
@@ -20,7 +20,8 @@ SOURCES += \
util/qmltimeline.cpp \
util/qmltimer.cpp \
util/qmlbind.cpp \
- util/qmlpropertymap.cpp
+ util/qmlpropertymap.cpp \
+ util/qmlpixmapcache.cpp
HEADERS += \
util/qmlview.h \
@@ -47,4 +48,5 @@ HEADERS += \
util/qmltimeline_p_p.h \
util/qmltimer_p.h \
util/qmlbind_p.h \
- util/qmlpropertymap_p.h
+ util/qmlpropertymap_p.h \
+ util/qmlpixmapcache_p.h