summaryrefslogtreecommitdiffstats
path: root/tools/qmlviewer/qmlviewer.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-20 08:33:57 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-20 08:33:57 (GMT)
commitc0a02f5c67d3de5e16fd506df83fef968e09c798 (patch)
tree53643122e75a4d549159a9ec6000aa5b6c4a1e03 /tools/qmlviewer/qmlviewer.cpp
parent86529642cfdc5cc5a94b735042d0807e3b57e9e1 (diff)
parent3182e16fa31a7def9775375971bea203af419d76 (diff)
downloadQt-c0a02f5c67d3de5e16fd506df83fef968e09c798.zip
Qt-c0a02f5c67d3de5e16fd506df83fef968e09c798.tar.gz
Qt-c0a02f5c67d3de5e16fd506df83fef968e09c798.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r--tools/qmlviewer/qmlviewer.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 2eb8845..7844b5a 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -698,17 +698,22 @@ void QmlViewer::setupProxy()
nam->setProxyFactory(new SystemProxyFactory);
}
-void QmlViewer::setCacheEnabled(bool on)
+void QmlViewer::setNetworkCacheSize(int size)
{
QNetworkAccessManager * nam = canvas->engine()->networkAccessManager();
- if (on == !!nam->cache())
- return;
- if (on) {
- // Setup a caching network manager
- QNetworkDiskCache *cache = new QNetworkDiskCache;
+ QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>(nam->cache());
+ if (!cache) {
+ if (size==0)
+ return;
+ cache = new QNetworkDiskCache;
cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-duiviewer-network-cache"));
- cache->setMaximumCacheSize(8000000);
nam->setCache(cache);
+ }
+ if (size == cache->maximumCacheSize())
+ return;
+ if (size>0) {
+ // Setup a caching network manager
+ cache->setMaximumCacheSize(size);
} else {
nam->setCache(0);
}