main implementation done, to be tested; refs #6, refs #5

master
Marc Wäckerlin 14 years ago
parent 525ce86677
commit 07eca4c756
  1. 60
      proxyface/qtproxy.hxx
  2. 5
      proxyface/resources.qrc

@ -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 <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkProxyFactory>
#include <QtNetwork/QNetworkProxyQuery>
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<QNetworkProxy> proxies
(QNetworkProxyFactory::systemProxyForQuery
(QUrl(QString::fromStdString(url))));
for (QList<QNetworkProxy>::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

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/icons" >
<file alias="indicator.gif">indicator.gif</file>
</qresource>
</RCC>
Loading…
Cancel
Save