changed build system, added rpm spec; closes #2
This commit is contained in:
BIN
src/indicator.gif
Normal file
BIN
src/indicator.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
57
src/makefile.am
Normal file
57
src/makefile.am
Normal file
@@ -0,0 +1,57 @@
|
||||
## @file
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
## 1 2 3 4 5 6 7 8
|
||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
if USE_QT
|
||||
UISOURCES = proxyface/proxy.ui proxyface/proxyauth.ui
|
||||
RESOURCES = resources.cxx
|
||||
MOCHEADER = proxyface/proxy.hxx proxyface/autoproxy.hxx proxyface/proxyauth.hxx
|
||||
LANGUAGES = proxy_de.qm proxy_en.qm proxy_fr.qm proxy_it.qm
|
||||
LANG_TS = proxy_de.ts proxy_en.ts proxy_fr.ts proxy_it.ts
|
||||
UIHEADER = proxyface/ui_proxy.hxx proxyface/ui_proxyauth.hxx
|
||||
MOCSOURCES = proxyface/moc_proxy.cxx proxyface/moc_autoproxy.cxx proxyface/moc_proxyauth.cxx
|
||||
endif
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = @PACKAGENAME@.pc
|
||||
pkgconfig2dir = $(datarootdir)/pkgconfig
|
||||
pkgconfig2_DATA = $(pkgconfig_DATA)
|
||||
|
||||
pkgdata_DATA = ${LANGUAGES}
|
||||
|
||||
EXTRA_DIST = ${UISOURCES} $(pkgconfig_DATA).in version.cxx.in
|
||||
|
||||
BUILT_SOURCES = ${UIHEADER} ${MOCSOURCES} ${LANGUAGES} ${RESOURCES} version.cxx
|
||||
|
||||
proxyfacedir = ${includedir}/proxyface
|
||||
proxyface_HEADERS = proxyface/unix.hxx proxyface/windoze.hxx proxyface/qtproxy.hxx \
|
||||
${MOCHEADER} ${UIHEADER}
|
||||
|
||||
lib_LTLIBRARIES = libproxyface.la
|
||||
|
||||
libproxyface_la_SOURCES = ${MOCSOURCES} ${LANGUAGES} ${RESOURCES} version.cxx
|
||||
libproxyface_la_LDFLAGS = -version-info ${LIB_VERSION}
|
||||
|
||||
AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir}
|
||||
|
||||
%.cxx: %.qrc
|
||||
${RCC} -o $@ $<
|
||||
|
||||
moc_%.cxx: %.hxx
|
||||
${MOC} -DMOC ${CPPFLAGS} ${AM_CPPFLAGS} -o $@ $<
|
||||
|
||||
ui_%.hxx: %.ui
|
||||
${UIC} -o $@ $<
|
||||
|
||||
%.ts: ${UISOURCES} ${MOCHEADER} ${proxyface_HEADERS}
|
||||
${LUPDATE} ${LUPDATE_ARGS} $^ -ts $@
|
||||
|
||||
%.qm: %.ts
|
||||
${LRELEASE} $< -qm $@
|
||||
|
||||
CLEANFILES = ${UIHEADER} ${MOCSOURCES}
|
||||
DISTCLEANFILES = $(pkgconfig_DATA)
|
||||
MAINTAINERCLEANFILES = makefile.in
|
203
src/proxy_de.ts
Normal file
203
src/proxy_de.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="de">
|
||||
<context>
|
||||
<name>Proxy</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="306"/>
|
||||
<source>Netzwerk Einstellungen</source>
|
||||
<translation>Netzwerk Einstellungen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="26"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="307"/>
|
||||
<source>Proxy Konfiguration</source>
|
||||
<translation>Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="41"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="308"/>
|
||||
<source>Typ:</source>
|
||||
<translation>Typ:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="58"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="311"/>
|
||||
<source>direkt oder automatisch</source>
|
||||
<translation>automatisch / benutze Systemeinstellungen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="63"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="312"/>
|
||||
<source>HTTP</source>
|
||||
<translation>HTTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="68"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="313"/>
|
||||
<source>Socks5</source>
|
||||
<translation>Socks5</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="108"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="316"/>
|
||||
<source>Host:</source>
|
||||
<translation>Host:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="134"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="317"/>
|
||||
<source>Verbindung testen</source>
|
||||
<translation>Verbindung testen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="142"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="318"/>
|
||||
<source>Test-URL:</source>
|
||||
<translation>Test-URL:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://update.swisssign.com</source>
|
||||
<translation type="obsolete">http://update.swisssign.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://google.com</source>
|
||||
<translation type="obsolete">http://google.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://heise.de</source>
|
||||
<translation type="obsolete">http://heise.de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="165"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="319"/>
|
||||
<source>Testen</source>
|
||||
<translation>Testen</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="193"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="320"/>
|
||||
<source><span style="color:green;font-size:x-large">✔</span></source>
|
||||
<translation><span style="color:green;font-size:x-large">✔</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="209"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="321"/>
|
||||
<source>Internetverbindung vorhanden</source>
|
||||
<translation>Verbindung erfolgreich</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="229"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="322"/>
|
||||
<source><span style="color:red;font-size:x-large">✘</span></source>
|
||||
<translation><span style="color:red;font-size:x-large">✘</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="245"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="323"/>
|
||||
<source>Keine Internetverbindung</source>
|
||||
<translation>Verbindung fehlgeschlagen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><span style=" font-size:x-large; color:red;">?</span></source>
|
||||
<translation type="obsolete"><span style=" font-size:x-large; color:red;">?</span></translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="284"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="325"/>
|
||||
<source>Prüfe Internetverbindung ...</source>
|
||||
<translation>Prüfe...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="314"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="326"/>
|
||||
<source>Einstellungen speichern</source>
|
||||
<translation>Einstellungen speichern</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL:</source>
|
||||
<translation type="obsolete">Adresse:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="82"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="315"/>
|
||||
<source>Port:</source>
|
||||
<translation>Port:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Einstellungen lokal speichern</source>
|
||||
<translation type="obsolete">Einstellungen lokal speichern</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Speichern</source>
|
||||
<translation type="obsolete">Speichern</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Wenn Sie die Einstellungen speichern, werden sie auf diesem Computer in Ihrem Profil abgelegt.</source>
|
||||
<translation type="obsolete">Einstellungen werden nur auf diesem Computer gespeichert.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loeschen</source>
|
||||
<translation type="obsolete">Entfernen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyAuth</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="14"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="106"/>
|
||||
<source>Proxy Authentication</source>
|
||||
<translation>Proxy Anmeldung benötigt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="107"/>
|
||||
<source>Please logon to:</source>
|
||||
<translation>Ameldung für</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="27"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="108"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="36"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="109"/>
|
||||
<source>Username:</source>
|
||||
<translatorcomment>Benutzername:</translatorcomment>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="46"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="110"/>
|
||||
<source>Password:</source>
|
||||
<translation>Passwort:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>gui::Proxy</name>
|
||||
<message>
|
||||
<source>Kein Proxy</source>
|
||||
<translation type="obsolete">Kein Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HTTP:</source>
|
||||
<translation type="obsolete">HTTP:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Socks5Proxy:</source>
|
||||
<translation type="obsolete">Socks5Proxy:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>System</source>
|
||||
<translation type="obsolete">System</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1:%2</source>
|
||||
<comment>proxy host/port</comment>
|
||||
<translation type="obsolete">%1:%2</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
202
src/proxy_en.ts
Normal file
202
src/proxy_en.ts
Normal file
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="en">
|
||||
<context>
|
||||
<name>Proxy</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="306"/>
|
||||
<source>Netzwerk Einstellungen</source>
|
||||
<translation>Network Settings</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="26"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="307"/>
|
||||
<source>Proxy Konfiguration</source>
|
||||
<translation>Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="41"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="308"/>
|
||||
<source>Typ:</source>
|
||||
<translation>Type:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="58"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="311"/>
|
||||
<source>direkt oder automatisch</source>
|
||||
<translation>automatic / use system settings</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="63"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="312"/>
|
||||
<source>HTTP</source>
|
||||
<translation>HTTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="68"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="313"/>
|
||||
<source>Socks5</source>
|
||||
<translation>Socks5</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="108"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="316"/>
|
||||
<source>Host:</source>
|
||||
<translation>Host:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="134"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="317"/>
|
||||
<source>Verbindung testen</source>
|
||||
<translation>Connection test</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="142"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="318"/>
|
||||
<source>Test-URL:</source>
|
||||
<translation>Test URL:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://update.swisssign.com</source>
|
||||
<translation type="obsolete">http://update.swisssign.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://google.com</source>
|
||||
<translation type="obsolete">http://google.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://heise.de</source>
|
||||
<translation type="obsolete">http://heise.de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="165"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="319"/>
|
||||
<source>Testen</source>
|
||||
<translation>Test</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="193"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="320"/>
|
||||
<source><span style="color:green;font-size:x-large">✔</span></source>
|
||||
<translation><span style="color:green;font-size:x-large">✔</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="209"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="321"/>
|
||||
<source>Internetverbindung vorhanden</source>
|
||||
<translation>Connection successful</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="229"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="322"/>
|
||||
<source><span style="color:red;font-size:x-large">✘</span></source>
|
||||
<translation><span style="color:red;font-size:x-large">✘</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="245"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="323"/>
|
||||
<source>Keine Internetverbindung</source>
|
||||
<translation>Connection error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><span style=" font-size:x-large; color:red;">?</span></source>
|
||||
<translation type="obsolete"><span style=" font-size:x-large; color:red;">?</span></translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="284"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="325"/>
|
||||
<source>Prüfe Internetverbindung ...</source>
|
||||
<translation>Checking...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="314"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="326"/>
|
||||
<source>Einstellungen speichern</source>
|
||||
<translation>Save settings</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL:</source>
|
||||
<translation type="obsolete">Address:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="82"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="315"/>
|
||||
<source>Port:</source>
|
||||
<translation>Port:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Einstellungen lokal speichern</source>
|
||||
<translation type="obsolete">Save settings locally</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Speichern</source>
|
||||
<translation type="obsolete">Save</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Wenn Sie die Einstellungen speichern, werden sie auf diesem Computer in Ihrem Profil abgelegt.</source>
|
||||
<translation type="obsolete">Settings will be saved on this computer only.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loeschen</source>
|
||||
<translation type="obsolete">Remove</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyAuth</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="14"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="106"/>
|
||||
<source>Proxy Authentication</source>
|
||||
<translation>Proxy login required</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="107"/>
|
||||
<source>Please logon to:</source>
|
||||
<translation>Login for</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="27"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="108"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="36"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="109"/>
|
||||
<source>Username:</source>
|
||||
<translation>User:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="46"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="110"/>
|
||||
<source>Password:</source>
|
||||
<translation>Password:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>gui::Proxy</name>
|
||||
<message>
|
||||
<source>Kein Proxy</source>
|
||||
<translation type="obsolete">No proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HTTP:</source>
|
||||
<translation type="obsolete">HTTP:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Socks5Proxy:</source>
|
||||
<translation type="obsolete">Socks5Proxy:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>System</source>
|
||||
<translation type="obsolete">System</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1:%2</source>
|
||||
<comment>proxy host/port</comment>
|
||||
<translation type="obsolete">%1:%2</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
202
src/proxy_fr.ts
Normal file
202
src/proxy_fr.ts
Normal file
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="fr">
|
||||
<context>
|
||||
<name>Proxy</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="306"/>
|
||||
<source>Netzwerk Einstellungen</source>
|
||||
<translation>Configuration du réseau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="26"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="307"/>
|
||||
<source>Proxy Konfiguration</source>
|
||||
<translation>Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="41"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="308"/>
|
||||
<source>Typ:</source>
|
||||
<translation>Type:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="58"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="311"/>
|
||||
<source>direkt oder automatisch</source>
|
||||
<translation>automatique / utiliser paramètres système </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="63"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="312"/>
|
||||
<source>HTTP</source>
|
||||
<translation>HTTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="68"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="313"/>
|
||||
<source>Socks5</source>
|
||||
<translation>Socks5</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="108"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="316"/>
|
||||
<source>Host:</source>
|
||||
<translation>Hôte:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="134"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="317"/>
|
||||
<source>Verbindung testen</source>
|
||||
<translation>Tester la liaison</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="142"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="318"/>
|
||||
<source>Test-URL:</source>
|
||||
<translation>Test de l'URL:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://update.swisssign.com</source>
|
||||
<translation type="obsolete">http://update.swisssign.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://google.com</source>
|
||||
<translation type="obsolete">http://google.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://heise.de</source>
|
||||
<translation type="obsolete">http://heise.de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="165"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="319"/>
|
||||
<source>Testen</source>
|
||||
<translation>Tester</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="193"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="320"/>
|
||||
<source><span style="color:green;font-size:x-large">✔</span></source>
|
||||
<translation><span style="color:green;font-size:x-large">✔</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="209"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="321"/>
|
||||
<source>Internetverbindung vorhanden</source>
|
||||
<translation>Connexion réussie</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="229"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="322"/>
|
||||
<source><span style="color:red;font-size:x-large">✘</span></source>
|
||||
<translation><span style="color:red;font-size:x-large">✘</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="245"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="323"/>
|
||||
<source>Keine Internetverbindung</source>
|
||||
<translation>Erreur de connexion</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><span style=" font-size:x-large; color:red;">?</span></source>
|
||||
<translation type="obsolete"><span style=" font-size:x-large; color:red;">?</span></translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="284"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="325"/>
|
||||
<source>Prüfe Internetverbindung ...</source>
|
||||
<translation>Vérification...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="314"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="326"/>
|
||||
<source>Einstellungen speichern</source>
|
||||
<translation>Enregistrer les paramètres</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL:</source>
|
||||
<translation type="obsolete">Adresse:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="82"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="315"/>
|
||||
<source>Port:</source>
|
||||
<translation>Port:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Einstellungen lokal speichern</source>
|
||||
<translation type="obsolete">Enregistrer les paramètres localement</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Speichern</source>
|
||||
<translation type="obsolete">Salve</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Wenn Sie die Einstellungen speichern, werden sie auf diesem Computer in Ihrem Profil abgelegt.</source>
|
||||
<translation type="obsolete">Les paramètres seront enregistre seulement sur cet ordinateur.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loeschen</source>
|
||||
<translation type="obsolete">Enlever</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyAuth</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="14"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="106"/>
|
||||
<source>Proxy Authentication</source>
|
||||
<translation>Login requis au proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="107"/>
|
||||
<source>Please logon to:</source>
|
||||
<translation>Login pour</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="27"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="108"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="36"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="109"/>
|
||||
<source>Username:</source>
|
||||
<translation>Utilisateur:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="46"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="110"/>
|
||||
<source>Password:</source>
|
||||
<translation>Mot de passe:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>gui::Proxy</name>
|
||||
<message>
|
||||
<source>Kein Proxy</source>
|
||||
<translation type="obsolete">Pas de Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HTTP:</source>
|
||||
<translation type="obsolete">HTTP:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Socks5Proxy:</source>
|
||||
<translation type="obsolete">Socks5Proxy:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>System</source>
|
||||
<translation type="obsolete">Système</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1:%2</source>
|
||||
<comment>proxy host/port</comment>
|
||||
<translation type="obsolete">%1:%2</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
202
src/proxy_it.ts
Normal file
202
src/proxy_it.ts
Normal file
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="it">
|
||||
<context>
|
||||
<name>Proxy</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="306"/>
|
||||
<source>Netzwerk Einstellungen</source>
|
||||
<translation>Configurazione rete </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="26"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="307"/>
|
||||
<source>Proxy Konfiguration</source>
|
||||
<translation>Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="41"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="308"/>
|
||||
<source>Typ:</source>
|
||||
<translation>Typo:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="58"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="311"/>
|
||||
<source>direkt oder automatisch</source>
|
||||
<translation>automatico / impostazioni sistema</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="63"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="312"/>
|
||||
<source>HTTP</source>
|
||||
<translation>HTTP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="68"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="313"/>
|
||||
<source>Socks5</source>
|
||||
<translation>Socks5</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="108"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="316"/>
|
||||
<source>Host:</source>
|
||||
<translation>Host:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="134"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="317"/>
|
||||
<source>Verbindung testen</source>
|
||||
<translation>Test di connessione</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="142"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="318"/>
|
||||
<source>Test-URL:</source>
|
||||
<translation>Testare URL:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://update.swisssign.com</source>
|
||||
<translation type="obsolete">http://update.swisssign.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://google.com</source>
|
||||
<translation type="obsolete">http://google.com</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>http://heise.de</source>
|
||||
<translation type="obsolete">http://heise.de</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="165"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="319"/>
|
||||
<source>Testen</source>
|
||||
<translation>Test</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="193"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="320"/>
|
||||
<source><span style="color:green;font-size:x-large">✔</span></source>
|
||||
<translation><span style="color:green;font-size:x-large">✔</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="209"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="321"/>
|
||||
<source>Internetverbindung vorhanden</source>
|
||||
<translation>Connessione riuscita</translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="229"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="322"/>
|
||||
<source><span style="color:red;font-size:x-large">✘</span></source>
|
||||
<translation><span style="color:red;font-size:x-large">✘</span></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="245"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="323"/>
|
||||
<source>Keine Internetverbindung</source>
|
||||
<translation>Errore connessione</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><span style=" font-size:x-large; color:red;">?</span></source>
|
||||
<translation type="obsolete"><span style=" font-size:x-large; color:red;">?</span></translation>
|
||||
</message>
|
||||
<message utf8="true">
|
||||
<location filename="proxyface/proxy.ui" line="284"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="325"/>
|
||||
<source>Prüfe Internetverbindung ...</source>
|
||||
<translation>Controllo... </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="314"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="326"/>
|
||||
<source>Einstellungen speichern</source>
|
||||
<translation>Salva impostazioni</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>URL:</source>
|
||||
<translation type="obsolete">Indirizzo:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxy.ui" line="82"/>
|
||||
<location filename="proxyface/ui_proxy.hxx" line="315"/>
|
||||
<source>Port:</source>
|
||||
<translation>Porta:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Einstellungen lokal speichern</source>
|
||||
<translation type="obsolete">Salvare i parametri localmente</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Speichern</source>
|
||||
<translation type="obsolete">Salve</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Wenn Sie die Einstellungen speichern, werden sie auf diesem Computer in Ihrem Profil abgelegt.</source>
|
||||
<translation type="obsolete">I parametri verranno salvati solo su questo computer.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loeschen</source>
|
||||
<translation type="obsolete">Eliminazione</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ProxyAuth</name>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="14"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="106"/>
|
||||
<source>Proxy Authentication</source>
|
||||
<translation>Necessario login proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="20"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="107"/>
|
||||
<source>Please logon to:</source>
|
||||
<translation>Login per</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="27"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="108"/>
|
||||
<source>...</source>
|
||||
<translation>...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="36"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="109"/>
|
||||
<source>Username:</source>
|
||||
<translation>Utente:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="proxyface/proxyauth.ui" line="46"/>
|
||||
<location filename="proxyface/ui_proxyauth.hxx" line="110"/>
|
||||
<source>Password:</source>
|
||||
<translation>Password:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>gui::Proxy</name>
|
||||
<message>
|
||||
<source>Kein Proxy</source>
|
||||
<translation type="obsolete">Senza Proxy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HTTP:</source>
|
||||
<translation type="obsolete">HTTP:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Socks5Proxy:</source>
|
||||
<translation type="obsolete">Socks5Proxy:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>System</source>
|
||||
<translation type="obsolete">Sistema</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1:%2</source>
|
||||
<comment>proxy host/port</comment>
|
||||
<translation type="obsolete">%1:%2</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
11
src/proxyface.pc.in
Normal file
11
src/proxyface.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@PACKAGENAME@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: @PACKAGENAME@
|
||||
Description: C++/Qt/libproxy/WinHTTP GUI/WPAD Proxy Interface
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lproxyface
|
||||
Libs.private:
|
||||
Cflags: -I${includedir}
|
587
src/proxyface/autoproxy.hxx
Normal file
587
src/proxyface/autoproxy.hxx
Normal file
@@ -0,0 +1,587 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#ifndef PROXYFACE_HXX
|
||||
#define PROXYFACE_HXX
|
||||
|
||||
#ifdef QT_NETWORK_LIB
|
||||
#include <QtNetwork/QNetworkProxy>
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QtNetwork/QAuthenticator>
|
||||
#include <QtNetwork/QSslError>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QDebug>
|
||||
#ifndef Q_OS_WIN32
|
||||
#include <QtCore/QThread>
|
||||
#endif
|
||||
#include <map>
|
||||
#ifndef PROXYFACE_LOG
|
||||
#define PROXYFACE_LOG qDebug()<<__PRETTY_FUNCTION__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
//! auto proxy configuration
|
||||
namespace proxy {
|
||||
|
||||
std::string version();
|
||||
|
||||
//! exceptions
|
||||
namespace exc {
|
||||
|
||||
//! unspecific error
|
||||
class error: std::exception {
|
||||
public:
|
||||
virtual const char* what() const throw() {
|
||||
return "Auto Proxy Detection Error";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//! Proxy types
|
||||
enum Type {
|
||||
DIRECT, //< direct connection, no proxy
|
||||
DEFAULT, //< default proxy
|
||||
HTTP, //< HTTP proxy host
|
||||
SOCKS //<SOCKS5 proxy
|
||||
};
|
||||
|
||||
//! One proxy
|
||||
struct Proxy {
|
||||
Proxy(): type(DIRECT), port(0) {}
|
||||
Proxy(Type t, std::string h, unsigned int p): type(t), host(h), port(p) {}
|
||||
Proxy(Type t, std::string h, std::string p): type(t), host(h), port(0) {
|
||||
std::stringstream(p)>>port;
|
||||
}
|
||||
Type type;
|
||||
std::string host;
|
||||
unsigned int port;
|
||||
};
|
||||
|
||||
//! List of proxies, type -> url and port
|
||||
typedef std::list<Proxy> List;
|
||||
|
||||
/*! @page dyn Interaction Diagrams
|
||||
|
||||
@section dynState State Diagram
|
||||
|
||||
@dot
|
||||
digraph A {
|
||||
// actors
|
||||
"start" [shape="circle"];
|
||||
|
||||
// loops
|
||||
subgraph clusterMainLoop {
|
||||
label="Main Loop";
|
||||
"«thread loop»";
|
||||
"«timer loop»";
|
||||
"«network loop»";
|
||||
}
|
||||
|
||||
node [shape=box];
|
||||
|
||||
|
||||
// method declarations
|
||||
"Interface::proxy" [URL="\ref Interface::proxy"];
|
||||
"Interface::ping" [URL="\ref Interface::ping"];
|
||||
"Interface::run" [URL="\ref Interface::run"];
|
||||
"Interface::setupProxyCheck" [URL="\ref Interface::setupProxyCheck"];
|
||||
|
||||
// slot declarations
|
||||
{
|
||||
node [shape=octagon];
|
||||
"Interface::timeout" [URL="\ref Interface::timeout"];
|
||||
"Interface::threadFinished" [URL="\ref Interface::threadFinished"];
|
||||
"Interface::replyFinished" [URL="\ref Interface::replyFinished"];
|
||||
"Interface::uploadProgress" [URL="\ref Interface::uploadProgress"];
|
||||
"Interface::downloadProgress"
|
||||
[URL="\ref Interface::downloadProgress"];
|
||||
"Interface::sslErrors" [URL="\ref Interface::sslErrors"];
|
||||
}
|
||||
|
||||
// signal declarations
|
||||
{
|
||||
node [shape=invhouse];
|
||||
"Interface::ProxyError" [URL="\ref Interface::ProxyError"];
|
||||
"Interface::authenticationRequired"
|
||||
[URL="\ref Interface::authenticationRequired"];
|
||||
"Interface::proxyAuthenticationRequired"
|
||||
[URL="\ref Interface::proxyAuthenticationRequired"];
|
||||
"Interface::temporaryError" [URL="\ref Interface::temporaryError"];
|
||||
"Interface::proxyFound" [URL="\ref Interface::proxyFound"];
|
||||
}
|
||||
|
||||
// method interactions
|
||||
"start" -> { "Interface::proxy" "Interface::ping"};
|
||||
"Interface::ping" -> "Interface::setupProxyCheck";
|
||||
"Interface::proxy" -> "Interface::timeout" [label="for test only:\ndirect call, no _timeout1"];
|
||||
"Interface::run" -> "«thread loop»" [label="proxies(url)",URL="\ref Interface::proxies"];
|
||||
"Interface::setupProxyCheck" -> "Interface::threadFinished";
|
||||
|
||||
// networkmanager
|
||||
"Interface::setupProxyCheck" -> "QNetworkAccessManager" [label="new"];
|
||||
"QNetworkAccessManager" -> "«network loop»" [label="QNetworkReply* QNetworkAccessManager::get()"];
|
||||
|
||||
// slot interactions
|
||||
"Interface::timeout" -> "Interface::run" [label="first time\n(own thread)"];
|
||||
"Interface::timeout" -> "Interface::ProxyError" [label="second time"];
|
||||
"Interface::threadFinished" -> "Interface::setupProxyCheck" [label="1.) for all proxies"];
|
||||
"Interface::threadFinished" -> "«timer loop»" [label="2.) _timeout2.start()"];
|
||||
"Interface::replyFinished" -> "Interface::temporaryError" [label="error"];
|
||||
"Interface::temporaryError" -> "«network loop»" [label="wait for timeout"];
|
||||
"Interface::replyFinished" -> "Interface::proxyFound" [label="success"];
|
||||
|
||||
// signaling objects
|
||||
"«timer loop»" -> "Interface::timeout" [label="_timeout1",URL="\ref Interface::_timeout1"];
|
||||
"«timer loop»" -> "Interface::timeout" [label="_timeout2",URL="\ref Interface::_timeout2"];
|
||||
"«thread loop»" -> {
|
||||
"Interface::threadFinished";
|
||||
} [label="finished"];
|
||||
"«network loop»" -> {
|
||||
"Interface::replyFinished";
|
||||
"Interface::uploadProgress";
|
||||
"Interface::downloadProgress";
|
||||
"Interface::authenticationRequired";
|
||||
"Interface::proxyAuthenticationRequired";
|
||||
"Interface::sslErrors";
|
||||
}
|
||||
|
||||
}
|
||||
@enddot
|
||||
|
||||
@section dynMSC Message State Chart
|
||||
|
||||
@msc
|
||||
|||;
|
||||
application, Interface, QNetworkAccessManager, QNetworkReply;
|
||||
application -> Interface [label="Interface()"];
|
||||
application -> Interface [label="proxy(url)"];
|
||||
|||;
|
||||
--- [label="for each proxy"];
|
||||
Interface -> QNetworkAccessManager [label="new"];
|
||||
QNetworkAccessManager -> QNetworkReply [label="get(url)"];
|
||||
Interface -> Interface [label="_timeout2.start()"];
|
||||
--- [label=""];
|
||||
|||;
|
||||
QNetworkReply -> Interface [label="replyFinished()"];
|
||||
Interface -> application [label="proxyFound()"];
|
||||
|||;
|
||||
@endmsc */
|
||||
|
||||
//! Unified Interface for accessing proxy::Face
|
||||
/*! Abstract interface, impementation for Unix and Windoze differs.
|
||||
|
||||
Instanciate proxy::Face, which is a typedef to your
|
||||
platform's implementation.
|
||||
|
||||
@code
|
||||
proxy::Face pf; // keep for program life time (because of caching)
|
||||
proxy::List pf.proxies("http://swisssign.com");
|
||||
[...] // set proxy, read from http://swisssign.com
|
||||
@endcode
|
||||
|
||||
@example getproxylist.cxx */
|
||||
class Interface
|
||||
#ifdef QT_NETWORK_LIB
|
||||
#ifdef Q_OS_WIN32
|
||||
: public QObject
|
||||
#else
|
||||
: public QThread
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#ifdef QT_NETWORK_LIB
|
||||
Q_OBJECT
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
//! Keep your instance as long as possible, because of caching.
|
||||
Interface()
|
||||
#ifdef QT_NETWORK_LIB
|
||||
: _timeout1Paused(false), _timeout2Paused(false)
|
||||
#endif
|
||||
{
|
||||
#ifdef QT_NETWORK_LIB
|
||||
PROXYFACE_LOG;
|
||||
if (!connect(&_timeout1, SIGNAL(timeout()), SLOT(timeout())))
|
||||
qFatal("connect failed");
|
||||
if (!connect(&_timeout2, SIGNAL(timeout()), SLOT(timeout())))
|
||||
qFatal("connect failed");
|
||||
#ifndef Q_OS_WIN32
|
||||
if (!connect(this, SIGNAL(finished()), SLOT(threadFinished())))
|
||||
qFatal("connect failed");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~Interface() {}
|
||||
|
||||
//! Get list of proxies for a given URL.
|
||||
virtual List proxies(const std::string& url) = 0;
|
||||
#ifdef QT_NETWORK_LIB
|
||||
//! Reset, stop all outstanding checks
|
||||
void reset() {
|
||||
_timeout1.stop();
|
||||
_timeout2.stop();
|
||||
for (Requests::iterator it(_requests.begin());
|
||||
it!=_requests.end(); ++it)
|
||||
clean(it->second.first);
|
||||
_requests.clear();
|
||||
}
|
||||
|
||||
//! Pause timeouts and restart them later.
|
||||
/*! Use while waiting for user input at proxy authentication.
|
||||
@see restart() */
|
||||
void pause() {
|
||||
if (_timeout1.isActive()) {
|
||||
_timeout1.stop();
|
||||
_timeout1Paused = true;
|
||||
}
|
||||
if (_timeout2.isActive()) {
|
||||
_timeout2.stop();
|
||||
_timeout2Paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
//! Restart paused timeouts.
|
||||
/*! Use while waiting for user input at proxy authentication.
|
||||
@see pause() */
|
||||
void restart() {
|
||||
if (_timeout1Paused) {
|
||||
_timeout1.start();
|
||||
_timeout1Paused = false;
|
||||
}
|
||||
if (_timeout2Paused) {
|
||||
_timeout2.start();
|
||||
_timeout2Paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
//! Network Ping: Check access to a given address using default proxy.
|
||||
void ping(const std::string& url, int timeout2=30000) {
|
||||
if (_requests.size() || _timeout1.isActive() || _timeout2.isActive())
|
||||
// detection is already running, wait for that, don't restart
|
||||
return;
|
||||
reset();
|
||||
_timeout2.setSingleShot(true);
|
||||
_timeout2.setInterval(timeout2);
|
||||
_url = url;
|
||||
_direct = false; // simulate second try
|
||||
QNetworkProxy defaultProxy;
|
||||
setupProxyCheck(defaultProxy, url);
|
||||
_timeout2.start();
|
||||
}
|
||||
|
||||
void ping(const QUrl& url, int timeout2=30000) {
|
||||
ping(url.toString().toStdString(), timeout2);
|
||||
}
|
||||
|
||||
void ping(const QString& url, int timeout2=30000) {
|
||||
ping(url.toStdString(), timeout2);
|
||||
}
|
||||
|
||||
//! If Qt Network is available you may check the proxies found
|
||||
/*! First checks for direct access to the target. If this is not
|
||||
possible, starts scan for proxies.
|
||||
|
||||
Returns immediately and signals proxyFound() if a valid
|
||||
configuration has been found, or proxyError() in case of
|
||||
timeout. You should wait for either of the signals, before you
|
||||
can call this method again.
|
||||
|
||||
@param url the url to find a proxy for
|
||||
@param timeout [ms] time to give up search */
|
||||
void proxy(const std::string& url,
|
||||
int timeout1=5000, int timeout2=30000) {
|
||||
PROXYFACE_LOG;
|
||||
qDebug()<<"Search proxy for URL, direct and default"
|
||||
<<"url="<<url.data()<<"timeout1="<<timeout1;
|
||||
reset();
|
||||
_url = url;
|
||||
_direct = true; // first try direct access
|
||||
QNetworkProxy directProxy(QNetworkProxy::NoProxy);
|
||||
setupProxyCheck(directProxy, url);
|
||||
QNetworkProxy defaultProxy;
|
||||
setupProxyCheck(defaultProxy, url);
|
||||
_timeout2.setSingleShot(true);
|
||||
_timeout2.setInterval(timeout2);
|
||||
_timeout1.setSingleShot(true);
|
||||
_timeout1.setInterval(timeout1);
|
||||
timeout();
|
||||
// @todo add again after test _timeout1.start();
|
||||
}
|
||||
|
||||
//! If Qt Network is available you may check the proxies found
|
||||
/*! @copydoc proxy(const std::string&, int) */
|
||||
void proxy(const QUrl& url, int timeout1=5000, int timeout2=30000) {
|
||||
PROXYFACE_LOG;
|
||||
proxy(url.toString().toStdString(), timeout1, timeout2);
|
||||
}
|
||||
|
||||
//! If Qt Network is available you may check the proxies found
|
||||
/*! @copydoc proxy(const std::string&, int) */
|
||||
void proxy(const QString& url, int timeout1=5000, int timeout2=30000) {
|
||||
PROXYFACE_LOG;
|
||||
proxy(url.toStdString(), timeout1, timeout2);
|
||||
}
|
||||
|
||||
static QString toString(const QNetworkProxy& p) {
|
||||
switch (p.type()) {
|
||||
case QNetworkProxy::NoProxy:
|
||||
return QString("direct://");
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
if (QNetworkProxy::applicationProxy().type()
|
||||
!=QNetworkProxy::DefaultProxy)
|
||||
return QString("Default Proxy: %1")
|
||||
.arg(toString(QNetworkProxy::applicationProxy()));
|
||||
else
|
||||
return QString("Default Proxy: **ERROR**"
|
||||
" application proxy is configured as"
|
||||
" QNetworkProxy::DefaultProxy");
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
return QString("socks://%1:%2").arg(p.hostName()).arg(p.port());
|
||||
case QNetworkProxy::HttpProxy:
|
||||
return QString("http://%1:%2").arg(p.hostName()).arg(p.port());
|
||||
case QNetworkProxy::HttpCachingProxy:
|
||||
return QString("http-cache://%1:%2").arg(p.hostName())
|
||||
.arg(p.port());
|
||||
case QNetworkProxy::FtpCachingProxy:
|
||||
return QString("ftp-cache://%1:%2").arg(p.hostName()).arg(p.port());
|
||||
}
|
||||
return QString("**ERROR** illegal proxy type");
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
//! Signals a valid proxy for the URL requested earlier.
|
||||
void proxyFound(const QUrl&, const QNetworkProxy&);
|
||||
//! Signals a timeout, and no valid proxy for the URL requested earlier.
|
||||
void proxyError(QNetworkReply::NetworkError);
|
||||
//! Signals an error during proxy detection.
|
||||
void temporaryError(QNetworkReply::NetworkError, QString, QString);
|
||||
void authenticationRequired(QNetworkReply*, QAuthenticator*);
|
||||
void proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*);
|
||||
|
||||
private:
|
||||
|
||||
void setupProxyCheck(const QNetworkProxy& prxy, const std::string& url) {
|
||||
PROXYFACE_LOG;
|
||||
qDebug()<<"Testing proxy for url:"<<toString(prxy)<<"url="<<url.data();
|
||||
QNetworkAccessManager* manager(new QNetworkAccessManager);
|
||||
QNetworkProxy p(prxy.type()==QNetworkProxy::DefaultProxy
|
||||
?QNetworkProxy::applicationProxy():prxy);
|
||||
qDebug()<<"Testing proxy for url:"<<toString(p)<<"url="<<url.data();
|
||||
manager->setProxy(p);
|
||||
if (!connect(manager, SIGNAL(finished(QNetworkReply*)),
|
||||
SLOT(replyFinished(QNetworkReply*))))
|
||||
qFatal("connect failed");
|
||||
if (!connect(manager,
|
||||
SIGNAL(authenticationRequired(QNetworkReply*,
|
||||
QAuthenticator*)),
|
||||
SIGNAL(authenticationRequired(QNetworkReply*,
|
||||
QAuthenticator*))))
|
||||
qFatal("connect failed");
|
||||
if (!connect(manager,
|
||||
SIGNAL(proxyAuthenticationRequired
|
||||
(const QNetworkProxy&, QAuthenticator*)),
|
||||
SIGNAL(proxyAuthenticationRequired
|
||||
(const QNetworkProxy&, QAuthenticator*))))
|
||||
qFatal("connect failed");
|
||||
if (!connect(manager,
|
||||
SIGNAL(proxyAuthenticationRequired
|
||||
(const QNetworkProxy&, QAuthenticator*)),
|
||||
SLOT(proxyAuthenticationRequiredLog
|
||||
(const QNetworkProxy&, QAuthenticator*))))
|
||||
qFatal("connect failed");
|
||||
if (!connect(manager,
|
||||
SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
|
||||
SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&))))
|
||||
qFatal("connect failed");
|
||||
QNetworkReply* reply(0);
|
||||
_requests.insert
|
||||
(std::make_pair(reply=manager->get
|
||||
(QNetworkRequest
|
||||
(QUrl(QString::fromStdString(url)))),
|
||||
std::make_pair(manager, prxy)));
|
||||
if (!connect(reply, SIGNAL(uploadProgress(qint64, qint64)),
|
||||
SLOT(uploadProgress(qint64, qint64))))
|
||||
qFatal("connect failed");
|
||||
if (!connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
SLOT(downloadProgress(qint64, qint64))))
|
||||
qFatal("connect failed");
|
||||
}
|
||||
|
||||
void clean(QNetworkAccessManager* manager) {
|
||||
if (!disconnect(manager, SIGNAL(finished(QNetworkReply*)),
|
||||
this, SLOT(replyFinished(QNetworkReply*))))
|
||||
qFatal("disconnect failed");
|
||||
disconnect(manager,
|
||||
SIGNAL(authenticationRequired(QNetworkReply*,
|
||||
QAuthenticator*)),
|
||||
this,
|
||||
SIGNAL(authenticationRequired(QNetworkReply*,
|
||||
QAuthenticator*)));
|
||||
disconnect(manager,
|
||||
SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
|
||||
QAuthenticator*)),
|
||||
this,
|
||||
SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
|
||||
QAuthenticator*)));
|
||||
disconnect(manager,
|
||||
SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
|
||||
QAuthenticator*)),
|
||||
this,
|
||||
SLOT(proxyAuthenticationRequiredLog(const QNetworkProxy&,
|
||||
QAuthenticator*)));
|
||||
disconnect(manager,
|
||||
SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
|
||||
this,
|
||||
SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&)));
|
||||
//delete manager;
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
void uploadProgress(qint64 a, qint64 b) {
|
||||
qDebug()<<"upload: "<<a<<"/"<<b;
|
||||
}
|
||||
|
||||
void downloadProgress(qint64 a, qint64 b) {
|
||||
qDebug()<<"download: "<<a<<"/"<<b;
|
||||
}
|
||||
|
||||
void proxyAuthenticationRequiredLog(const QNetworkProxy&,
|
||||
QAuthenticator* auth) {
|
||||
qDebug()<<"proxyAuthenticationRequired for "<<auth->realm();
|
||||
}
|
||||
|
||||
void timeout() {
|
||||
PROXYFACE_LOG;
|
||||
reset();
|
||||
qDebug()<<"Proxy detection timed out"<<"url="<<_url.data();
|
||||
if (_direct) {
|
||||
qDebug()<<"Direct or preconfigured proxy not available,"
|
||||
" try autoproxy negotiation";
|
||||
_direct = false;
|
||||
#ifndef Q_OS_WIN32
|
||||
start(); // autoproxy detection in own thread
|
||||
#else
|
||||
run();
|
||||
#endif
|
||||
} else {
|
||||
qDebug()<<"No proxy at all, giving up - offline?";
|
||||
proxyError(QNetworkReply::TimeoutError);
|
||||
}
|
||||
}
|
||||
|
||||
void replyFinished(QNetworkReply* reply) {
|
||||
PROXYFACE_LOG;
|
||||
qDebug()<<"Proxydetection got reply with status:"
|
||||
<<reply->error()<<reply->errorString();
|
||||
if (reply->error()!=QNetworkReply::NoError) {
|
||||
temporaryError(reply->error(), reply->errorString(),
|
||||
toString(_requests[reply].second));
|
||||
return; // wait for timeout
|
||||
}
|
||||
QNetworkProxy prxy(_requests[reply].second);
|
||||
QUrl url(reply->url());
|
||||
reset();
|
||||
qDebug()<<"SUCCESS - Valid proxy found for url:"
|
||||
<<"url="<<url<<"proxy="<<toString(prxy);
|
||||
proxyFound(url, prxy);
|
||||
}
|
||||
|
||||
void sslErrors(QNetworkReply*, const QList<QSslError>& l) {
|
||||
PROXYFACE_LOG;
|
||||
qDebug()<<"## "<<__PRETTY_FUNCTION__;
|
||||
for (QList<QSslError>::const_iterator it(l.begin()); it!=l.end(); ++it)
|
||||
qDebug()<<" SSL-Error -> "<<it->errorString();
|
||||
}
|
||||
|
||||
void threadFinished() {
|
||||
PROXYFACE_LOG;
|
||||
for (List::const_iterator it(_proxies.begin());
|
||||
it!=_proxies.end(); ++it) {
|
||||
QNetworkProxy prxy((it->type==DEFAULT?QNetworkProxy::DefaultProxy
|
||||
:(it->type==HTTP?QNetworkProxy::HttpProxy
|
||||
:(it->type==SOCKS?QNetworkProxy::Socks5Proxy
|
||||
:QNetworkProxy::NoProxy))),
|
||||
QString::fromStdString(it->host), it->port);
|
||||
setupProxyCheck(prxy, _url);
|
||||
}
|
||||
/// @todo add again after test QNetworkProxy directProxy(QNetworkProxy::NoProxy);
|
||||
/// @todo add again after test setupProxyCheck(directProxy, _url);
|
||||
/// @todo add again after test QNetworkProxy defaultProxy;
|
||||
/// @todo add again after test setupProxyCheck(defaultProxy, _url);
|
||||
_timeout2.start();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void run() {
|
||||
PROXYFACE_LOG;
|
||||
_proxies = proxies(_url);
|
||||
#ifdef Q_OS_WIN32
|
||||
threadFinished();
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map
|
||||
<QNetworkReply*, std::pair<QNetworkAccessManager*, QNetworkProxy> >
|
||||
Requests;
|
||||
Requests _requests;
|
||||
bool _direct;
|
||||
QTimer _timeout1;
|
||||
QTimer _timeout2;
|
||||
bool _timeout1Paused;
|
||||
bool _timeout2Paused;
|
||||
List _proxies;
|
||||
std::string _url;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
# ifdef WIN32
|
||||
# ifdef QT_NETWORK_LIB
|
||||
// use Qt if available
|
||||
# include <proxyface/qtproxy.hxx>
|
||||
namespace proxy {
|
||||
typedef QtProxy Face;
|
||||
}
|
||||
# else
|
||||
// use windoze proprietary winhttp
|
||||
# include <proxyface/windoze.hxx>
|
||||
namespace proxy {
|
||||
typedef Windoze Face;
|
||||
}
|
||||
# endif
|
||||
# else
|
||||
# if defined(QT_NETWORK_LIB) && defined(Q_OS_MAC)
|
||||
// use Qt if available (not yet linux)
|
||||
# include <proxyface/qtproxy.hxx>
|
||||
namespace proxy {
|
||||
typedef QtProxy Face;
|
||||
}
|
||||
# else
|
||||
// no Qt support, nor proprietary: use http://code.google.com/p/libproxy
|
||||
# include <proxyface/unix.hxx>
|
||||
namespace proxy {
|
||||
typedef Unix Face;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
232
src/proxyface/proxy.hxx
Normal file
232
src/proxyface/proxy.hxx
Normal file
@@ -0,0 +1,232 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#ifndef PROXY_HXX
|
||||
#define PROXY_HXX
|
||||
|
||||
#include <proxyface/autoproxy.hxx>
|
||||
#include <proxyface/ui_proxy.hxx>
|
||||
#include <proxyface/proxyauth.hxx>
|
||||
|
||||
#include <QtGui/QMovie>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtNetwork/QNetworkProxy>
|
||||
#include <QtNetwork/QAuthenticator>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <cassert>
|
||||
|
||||
namespace gui {
|
||||
|
||||
class Proxy: public QDialog, public Ui::Proxy {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
Proxy(QString testUrl, QWidget* p=0):
|
||||
QDialog(p), _lastDefaultProxy(QNetworkProxy()),
|
||||
_proxyAuth(this), _found(false) {
|
||||
setupUi(this);
|
||||
_testUrl->insertItem(0, testUrl);
|
||||
_internetWait->setMovie(new QMovie(":/icons/indicator.gif"));
|
||||
_internetWait->movie()->start();
|
||||
QSettings s("SwissSign", "ProxySettings");
|
||||
_save->setChecked(s.contains("default-type"));
|
||||
_type->setCurrentIndex(s.value("default-type", 0).toInt());
|
||||
_url->setText(s.value("default-server", QString()).toString());
|
||||
_port->setValue(s.value("default-port", 0).toInt());
|
||||
_lastDefaultProxy = QNetworkProxy();
|
||||
_lastType = _type->currentIndex();
|
||||
_lastUrl = _url->text();
|
||||
_lastPort = _port->value();
|
||||
if (!connect(&_auto, SIGNAL(proxyFound(const QUrl&,
|
||||
const QNetworkProxy&)),
|
||||
SIGNAL(proxyFound(const QUrl&, const QNetworkProxy&))))
|
||||
qFatal("cannot if (!connect");
|
||||
if (!connect(&_auto, SIGNAL(proxyFound(const QUrl&,
|
||||
const QNetworkProxy&)),
|
||||
SLOT(proxyFoundSlot(const QUrl&, const QNetworkProxy&))))
|
||||
qFatal("cannot connect");
|
||||
if (!connect(&_auto, SIGNAL(proxyError(QNetworkReply::NetworkError)),
|
||||
SIGNAL(proxyError(QNetworkReply::NetworkError))))
|
||||
qFatal("cannot connect");
|
||||
if (!connect(&_auto, SIGNAL(proxyError(QNetworkReply::NetworkError)),
|
||||
SLOT(proxyErrorSlot(QNetworkReply::NetworkError))))
|
||||
qFatal("cannot connect");
|
||||
if (!connect(&_auto, SIGNAL(temporaryError(QNetworkReply::NetworkError,
|
||||
QString, QString)),
|
||||
SIGNAL(temporaryError(QNetworkReply::NetworkError,
|
||||
QString, QString))))
|
||||
qFatal("cannot connect");
|
||||
if (!connect(&_auto, SIGNAL(proxyAuthenticationRequired
|
||||
(const QNetworkProxy&, QAuthenticator*)),
|
||||
SLOT(proxyAuthenticationRequired(const QNetworkProxy&,
|
||||
QAuthenticator*))))
|
||||
qFatal("cannot connect");
|
||||
if (!connect(&_auto, SIGNAL(authenticationRequired
|
||||
(QNetworkReply*, QAuthenticator*)),
|
||||
SLOT(authenticationRequired
|
||||
(QNetworkReply*, QAuthenticator*))))
|
||||
qFatal("cannot connect");
|
||||
acceptValues();
|
||||
}
|
||||
|
||||
void checkUrl(const QString& url) {
|
||||
if (_testUrl->findText(url)==-1)
|
||||
_testUrl->addItem(url);
|
||||
_testUrl->setCurrentIndex(_testUrl->findText(url));
|
||||
acceptValues();
|
||||
}
|
||||
|
||||
void ping() {
|
||||
_auto.ping(_testUrl->currentText());
|
||||
}
|
||||
|
||||
void retry() {
|
||||
on__test_clicked();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
_type->setCurrentIndex(_lastType);
|
||||
_url->setText(_lastUrl);
|
||||
_port->setValue(_lastPort);
|
||||
QNetworkProxy::setApplicationProxy(_lastDefaultProxy);
|
||||
acceptValues();
|
||||
}
|
||||
|
||||
void acceptValues() {
|
||||
on__test_clicked();
|
||||
switch (_type->currentIndex()) {
|
||||
case 0: try {
|
||||
_url->setEnabled(false);
|
||||
_port->setEnabled(false);
|
||||
_url->setText("");
|
||||
_port->setValue(0);
|
||||
} catch (...) {} break;
|
||||
}
|
||||
if (_save->isChecked()) {
|
||||
QSettings s("SwissSign", "ProxySettings");
|
||||
s.setValue("default-type", _type->currentIndex());
|
||||
s.setValue("default-server", _url->text());
|
||||
s.setValue("default-port", _port->value());
|
||||
} else {
|
||||
QSettings s("SwissSign", "ProxySettings");
|
||||
s.clear();
|
||||
}
|
||||
_lastDefaultProxy = QNetworkProxy();
|
||||
_lastType = _type->currentIndex();
|
||||
_lastUrl = _url->text();
|
||||
_lastPort = _port->value();
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
void detecting();
|
||||
void proxyFound(const QUrl&, const QNetworkProxy&);
|
||||
void proxyError(QNetworkReply::NetworkError);
|
||||
void temporaryError(QNetworkReply::NetworkError, QString, QString);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
void proxyAuthenticationRequired(const QNetworkProxy& p,
|
||||
QAuthenticator* auth) {
|
||||
qDebug()<<"proxyAuthenticationRequired";
|
||||
_proxyAuth._realm->setText(auth->realm());
|
||||
_auto.pause();
|
||||
if (_found || _proxyAuth.exec()==QDialog::Accepted) {
|
||||
auth->setUser(_proxyAuth._username->text());
|
||||
auth->setPassword(_proxyAuth._password->text());
|
||||
_found = false;
|
||||
}
|
||||
_auto.restart();
|
||||
}
|
||||
|
||||
void authenticationRequired(QNetworkReply*, QAuthenticator* auth) {
|
||||
}
|
||||
|
||||
void proxyFoundSlot(const QUrl&, const QNetworkProxy& p) {
|
||||
_found = true;
|
||||
_stackInternet->setCurrentIndex(SERVER_FOUND);
|
||||
QNetworkProxy prx(p.type()==QNetworkProxy::DefaultProxy
|
||||
?QNetworkProxy::applicationProxy():p);
|
||||
if (prx.type()==QNetworkProxy::DefaultProxy) return;
|
||||
if (!_url->isEnabled()) _url->setText(prx.hostName());
|
||||
if (!_port->isEnabled()) _port->setValue(prx.port());
|
||||
if (p.type()==QNetworkProxy::DefaultProxy) return;
|
||||
prx.setUser(_proxyAuth._username->text());
|
||||
prx.setPassword(_proxyAuth._password->text());
|
||||
QNetworkProxy::setApplicationProxy(prx);
|
||||
}
|
||||
|
||||
void proxyErrorSlot(QNetworkReply::NetworkError){
|
||||
_stackInternet->setCurrentIndex(SERVER_NOT_FOUND);
|
||||
}
|
||||
|
||||
void on__type_currentIndexChanged(int index) {
|
||||
_url->setEnabled(index!=0);
|
||||
_port->setEnabled(index!=0);
|
||||
}
|
||||
|
||||
void on__test_clicked() {
|
||||
_auto.reset();
|
||||
_stackInternet->setCurrentIndex(WAITING_FOR_SERVER);
|
||||
detecting();
|
||||
switch (_type->currentIndex()) {
|
||||
case 0: try {
|
||||
QNetworkProxy::setApplicationProxy
|
||||
(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
_auto.proxy(_testUrl->currentText());
|
||||
} catch (...) {} break;
|
||||
case 1: {
|
||||
QNetworkProxy::setApplicationProxy
|
||||
(QNetworkProxy
|
||||
(QNetworkProxy::HttpProxy, _url->text(), _port->value()));
|
||||
_auto.ping(_testUrl->currentText());
|
||||
} break;
|
||||
case 2: {
|
||||
QNetworkProxy::setApplicationProxy
|
||||
(QNetworkProxy
|
||||
(QNetworkProxy::Socks5Proxy, _url->text(), _port->value(),
|
||||
"marwae", "marwae"));
|
||||
_auto.ping(_testUrl->currentText());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void accept() {
|
||||
acceptValues();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
virtual void reject() {
|
||||
reset();
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
enum Network {SERVER_FOUND = 0, SERVER_NOT_FOUND, WAITING_FOR_SERVER};
|
||||
|
||||
private:
|
||||
|
||||
proxy::Face _auto;
|
||||
int _lastType;
|
||||
QString _lastUrl;
|
||||
int _lastPort;
|
||||
QNetworkProxy _lastDefaultProxy;
|
||||
ProxyAuth _proxyAuth;
|
||||
bool _found;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
379
src/proxyface/proxy.ui
Normal file
379
src/proxyface/proxy.ui
Normal file
@@ -0,0 +1,379 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Proxy</class>
|
||||
<widget class="QDialog" name="Proxy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Netzwerk Einstellungen</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Proxy Konfiguration</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Typ:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>_type</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="_type">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>direkt oder automatisch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTTP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Socks5</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>_port</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="_url">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>_url</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="_port">
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>80</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Verbindung testen</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Test-URL:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>_testUrl</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="_testUrl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="_test">
|
||||
<property name="text">
|
||||
<string>Testen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="_stackInternet">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_11">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><span style="color:green;font-size:x-large">✔</span></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Internetverbindung vorhanden</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_12">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><span style="color:red;font-size:x-large">✘</span></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Keine Internetverbindung</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Seite_7">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="_internetWait">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/icons/indicator-0.jpg</pixmap>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_37">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prüfe Internetverbindung ...</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_save">
|
||||
<property name="text">
|
||||
<string>Einstellungen speichern</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="_buttons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>_type</tabstop>
|
||||
<tabstop>_url</tabstop>
|
||||
<tabstop>_port</tabstop>
|
||||
<tabstop>_testUrl</tabstop>
|
||||
<tabstop>_test</tabstop>
|
||||
<tabstop>_save</tabstop>
|
||||
<tabstop>_buttons</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>_buttons</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Proxy</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>342</x>
|
||||
<y>345</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_buttons</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Proxy</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>410</x>
|
||||
<y>345</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
22
src/proxyface/proxyauth.hxx
Normal file
22
src/proxyface/proxyauth.hxx
Normal file
@@ -0,0 +1,22 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#ifndef __PROXYAUTH_HXX__
|
||||
#define __PROXYAUTH_HXX__
|
||||
|
||||
#include <proxyface/ui_proxyauth.hxx>
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
class ProxyAuth: public QDialog, public Ui::ProxyAuth {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProxyAuth(QWidget* p): QDialog(p) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
119
src/proxyface/proxyauth.ui
Normal file
119
src/proxyface/proxyauth.ui
Normal file
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProxyAuth</class>
|
||||
<widget class="QDialog" name="ProxyAuth">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>384</width>
|
||||
<height>173</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Proxy Authentication</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Please logon to:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="_realm">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="_username"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="_password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>11</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ProxyAuth</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ProxyAuth</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
65
src/proxyface/qtproxy.hxx
Normal file
65
src/proxyface/qtproxy.hxx
Normal file
@@ -0,0 +1,65 @@
|
||||
/*! @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) {
|
||||
|
||||
qDebug()<<"************ QTPROXY ********************";
|
||||
qDebug()<<"************ QTPROXY ********************";
|
||||
|
||||
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;
|
||||
}
|
||||
qDebug()<<QString("************ QTPROXY: %1:%2")
|
||||
.arg(proxy->hostName()).arg(proxy->port());
|
||||
res.push_back
|
||||
(Proxy(type, proxy->hostName().toStdString(), proxy->port()));
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
62
src/proxyface/unix.hxx
Normal file
62
src/proxyface/unix.hxx
Normal file
@@ -0,0 +1,62 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#ifndef PROXY_LINUX
|
||||
#define PROXY_LINUX
|
||||
|
||||
extern "C" {
|
||||
#include <proxy.h>
|
||||
}
|
||||
|
||||
#include <iostream> // debug
|
||||
|
||||
namespace proxy {
|
||||
|
||||
class Unix: public Interface {
|
||||
|
||||
public:
|
||||
|
||||
Unix(): _factory(px_proxy_factory_new()) {}
|
||||
|
||||
virtual ~Unix() {
|
||||
px_proxy_factory_free(_factory);
|
||||
}
|
||||
|
||||
//! Implemented using http://code.google.com/p/libproxy/
|
||||
virtual List proxies(const std::string& url) {
|
||||
List res;
|
||||
char** proxies(px_proxy_factory_get_proxies
|
||||
(_factory, const_cast<char*>(url.data())));
|
||||
for (int i(0); proxies[i]; ++i) {
|
||||
std::string proxy(proxies[i]);
|
||||
Type type(proxy.find("http://")==0?HTTP:
|
||||
(proxy.find("socks://")==0?SOCKS:DIRECT));
|
||||
if (proxy.find("://")!=std::string::npos)
|
||||
proxy=proxy.substr(proxy.find("://")+3);
|
||||
std::string::size_type oldpos(0);
|
||||
std::string port((oldpos=proxy.rfind(":"))!=std::string::npos
|
||||
?proxy.substr(oldpos+1):std::string());
|
||||
std::string host(proxy.substr(0, proxy.rfind(":")));
|
||||
std::cout<<"Proxy found: "<<host<<", port="<<port<<", type"<<type
|
||||
<<std::endl;
|
||||
res.push_back(Proxy(type, host, port));
|
||||
}
|
||||
for (int i(0); proxies[i]; ++i)
|
||||
delete proxies[i];
|
||||
delete proxies;
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
pxProxyFactory* _factory;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
91
src/proxyface/windoze.hxx
Normal file
91
src/proxyface/windoze.hxx
Normal file
@@ -0,0 +1,91 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
#ifndef PROXY_WINDOZE_HXX
|
||||
#define PROXY_WINDOZE_HXX
|
||||
|
||||
#include <windows.h>
|
||||
#include <winhttp.h>
|
||||
|
||||
#include <iostream> // debug
|
||||
|
||||
namespace proxy {
|
||||
|
||||
class Windoze: public Interface {
|
||||
|
||||
public:
|
||||
|
||||
Windoze() {}
|
||||
|
||||
virtual ~Windoze() {}
|
||||
|
||||
//! Implemented using M$ WinHTTP
|
||||
virtual List proxies(const std::string& url) {
|
||||
|
||||
List res;
|
||||
|
||||
WINHTTP_PROXY_INFO proxyInfo;
|
||||
ZeroMemory(&proxyInfo, sizeof(proxyInfo));
|
||||
HINTERNET hHttpSession(WinHttpOpen(L"WinHTTP AutoProxy/1.0",
|
||||
WINHTTP_ACCESS_TYPE_NO_PROXY,
|
||||
WINHTTP_NO_PROXY_NAME,
|
||||
WINHTTP_NO_PROXY_BYPASS,
|
||||
0));
|
||||
try {
|
||||
if (!hHttpSession) throw exc::error();
|
||||
|
||||
WINHTTP_AUTOPROXY_OPTIONS AutoProxyOptions;
|
||||
ZeroMemory(&AutoProxyOptions, sizeof(AutoProxyOptions));
|
||||
AutoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;
|
||||
AutoProxyOptions.dwAutoDetectFlags =
|
||||
WINHTTP_AUTO_DETECT_TYPE_DHCP | WINHTTP_AUTO_DETECT_TYPE_DNS_A;
|
||||
AutoProxyOptions.fAutoLogonIfChallenged = FALSE;
|
||||
|
||||
if (!WinHttpGetProxyForUrl(hHttpSession,
|
||||
std::wstring(url.begin(),
|
||||
url.end()).data(),
|
||||
&AutoProxyOptions, &proxyInfo))
|
||||
throw exc::error();
|
||||
|
||||
std::wstring list(proxyInfo.lpszProxy);
|
||||
std::wcout<<"LIST=\""<<list<<"\""<<std::endl;
|
||||
for (std::wstring::size_type oldpos(0), pos(0);
|
||||
(pos=list.find(L";", oldpos)), oldpos!=std::wstring::npos;
|
||||
oldpos=(pos!=std::wstring::npos?pos+1:pos)) {
|
||||
std::wstring proxy(list.substr(oldpos, pos-oldpos));
|
||||
std::wstring port((oldpos=proxy.rfind(L":"))!=std::wstring::npos
|
||||
?proxy.substr(oldpos+1):std::wstring());
|
||||
std::wstring host(proxy.substr(0, proxy.rfind(L":")));
|
||||
Type type(DIRECT);
|
||||
switch (proxyInfo.dwAccessType) { //! @todo use or remove
|
||||
case WINHTTP_ACCESS_TYPE_NO_PROXY: type=DIRECT; break;
|
||||
case WINHTTP_ACCESS_TYPE_DEFAULT_PROXY: type=DEFAULT; break;
|
||||
case WINHTTP_ACCESS_TYPE_NAMED_PROXY: type=HTTP; break;
|
||||
}
|
||||
if (host.size()>0)
|
||||
res.push_back(Proxy(type,
|
||||
std::string(host.begin(), host.end()),
|
||||
std::string(port.begin(), port.end())));
|
||||
}
|
||||
if (!res.size()) res.push_back(Proxy());
|
||||
|
||||
if (proxyInfo.lpszProxy) GlobalFree(proxyInfo.lpszProxy);
|
||||
if (proxyInfo.lpszProxyBypass) GlobalFree(proxyInfo.lpszProxyBypass);
|
||||
if (hHttpSession) WinHttpCloseHandle(hHttpSession);
|
||||
} catch (...) {
|
||||
if (proxyInfo.lpszProxy) GlobalFree(proxyInfo.lpszProxy);
|
||||
if (proxyInfo.lpszProxyBypass) GlobalFree(proxyInfo.lpszProxyBypass);
|
||||
if (hHttpSession) WinHttpCloseHandle(hHttpSession);
|
||||
if (!res.size()) res.push_back(Proxy()); // try direct acces
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
5
src/resources.qrc
Normal file
5
src/resources.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/icons" >
|
||||
<file>indicator.gif</file>
|
||||
</qresource>
|
||||
</RCC>
|
17
src/version.cxx.in
Normal file
17
src/version.cxx.in
Normal file
@@ -0,0 +1,17 @@
|
||||
/*! @file
|
||||
|
||||
@id $Id$
|
||||
*/
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace proxy {
|
||||
std::string version() {
|
||||
return "@PACKAGENAME@-@VERSION@";
|
||||
}
|
||||
const std::string WHAT("#(@) @PACKAGENAME@-@VERSION@");
|
||||
const std::string IDENT("$Id: @PACKAGENAME@-@VERSION@ $");
|
||||
}
|
Reference in New Issue
Block a user