diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-24 03:54:07 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-24 03:54:07 (GMT) |
commit | 678c4bc25da24def57d57f9c94d4163320f5e67c (patch) | |
tree | f0f5a09625947ea7d5b5747faf5ccd5ce7b13312 /tools/qmlviewer/qmlviewer.cpp | |
parent | 525e6674b002180d691a2d8a787dc512c259ae95 (diff) | |
download | Qt-678c4bc25da24def57d57f9c94d4163320f5e67c.zip Qt-678c4bc25da24def57d57f9c94d4163320f5e67c.tar.gz Qt-678c4bc25da24def57d57f9c94d4163320f5e67c.tar.bz2 |
Centralize QNetworkRequest attribute setting, turn on pipelining.
... in two places.
Qt expects the "application" to configure caching, proxy, pipelining, etc.,
on a QNetworkAccessManager, so now we do that in the two most important
cases: the loader example and qmlviewer tool.
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r-- | tools/qmlviewer/qmlviewer.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index ae61fd0..272ebcb 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -191,6 +191,19 @@ private: QString customargs; }; +class ConfiguredNetworkAccessManager : public QNetworkAccessManager { +public: + ConfiguredNetworkAccessManager() { } + + QNetworkReply *createRequest (Operation op, const QNetworkRequest &req, QIODevice * outgoingData) + { + QNetworkRequest request = req; + request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); + request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); + return QNetworkAccessManager::createRequest(op,request,outgoingData); + } +}; + QString QmlViewer::getVideoFileName() { QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames"); @@ -240,6 +253,7 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); canvas->setContentResizable(!skin || !scaleSkin); + canvas->engine()->setNetworkAccessManager(new ConfiguredNetworkAccessManager); canvas->setFocus(); QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize))); @@ -966,7 +980,7 @@ void QmlViewer::setupProxy() else proxyFactory->unsetHttpProxy(); nam->setProxyFactory(proxyFactory); - } +} void QmlViewer::setNetworkCacheSize(int size) { |