diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-11-25 14:36:25 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@nokia.com> | 2011-11-28 13:15:21 +0100 |
commit | e9a5dce1593172a69fbcc1a8e2c62cc63d33b486 (patch) | |
tree | 345fbbc6e9d23d8b5dde28188365ee0996775706 /examples | |
parent | d46bf58249c264be81535ad84a3be60f289a93ca (diff) |
Update the test app to use a proxy factory as well.
Change-Id: I35fe8570b12109254a31758141e4159518ed2ac5
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/downloadspeed/main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/downloadspeed/main.cpp b/examples/downloadspeed/main.cpp index 835a38faa..f4e694c33 100644 --- a/examples/downloadspeed/main.cpp +++ b/examples/downloadspeed/main.cpp @@ -28,6 +28,8 @@ #include <QtCore/QObject> #include <QtCore/QUrl> +#include <QtNetwork/QNetworkProxy> + static QString format(double data) { if (data < 1024.0) @@ -131,6 +133,22 @@ private: // http://get.qt.nokia.com/qt/source/qt-mac-opensource-4.7.4.dmg // ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.7.4.dmg +class ProxyFactory : public KDUpdater::FileDownloaderProxyFactory +{ +public: + ProxyFactory() {} + + ProxyFactory *clone() const + { + return new ProxyFactory(); + } + + QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) + { + return QNetworkProxyFactory::systemProxyForQuery(query); + } +}; + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -143,6 +161,7 @@ int main(int argc, char *argv[]) KDUpdater::FileDownloader *loader = KDUpdater::FileDownloaderFactory::instance().create(url.scheme()); if (loader) { loader->setUrl(url); + loader->setProxyFactory(new ProxyFactory()); Receiver r; r.connect(loader, SIGNAL(downloadStarted()), &r, SLOT(downloadStarted())); |