diff --git a/proxyface/qtproxy.hxx b/proxyface/qtproxy.hxx new file mode 100644 index 0000000..e7cae2e --- /dev/null +++ b/proxyface/qtproxy.hxx @@ -0,0 +1,60 @@ +/*! @file + + @id $Id: unix.hxx 5 2009-03-11 15:37:56Z $ +*/ +// 1 2 3 4 5 6 7 8 +// 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +#ifndef PROXY_QT +#define PROXY_QT + +#include +#include +#include + +namespace proxy { + + class QtProxy: public Interface { + + public: + + QtProxy() { + QNetworkProxyFactory::setUseSystemConfiguration(true); + } + + virtual ~QtProxy() {} + + //! Implemented using Qt System Proxy + virtual List proxies(const std::string& url) { + + List res; + + QList proxies + (QNetworkProxyFactory::systemProxyForQuery + (QUrl(QString::fromStdString(url)))); + + for (QList::const_iterator proxy(proxies.begin()); + proxy!=proxies.end(); ++proxy) { + Type type; + switch (proxy->type()) { + case QNetworkProxy::NoProxy: type=DIRECT; break; + case QNetworkProxy::DefaultProxy: type=DEFAULT; break; + case QNetworkProxy::Socks5Proxy: type=SOCKS; break; + case QNetworkProxy::HttpProxy: + case QNetworkProxy::HttpCachingProxy: + case QNetworkProxy::FtpCachingProxy: + type=HTTP; + } + res.push_back + (Proxy(type, proxy->hostName().toStdString(), proxy->port())); + } + + return res; + + } + + }; + +} + +#endif diff --git a/proxyface/resources.qrc b/proxyface/resources.qrc new file mode 100644 index 0000000..2635df7 --- /dev/null +++ b/proxyface/resources.qrc @@ -0,0 +1,5 @@ + + + indicator.gif + +