diff options
author | Sergey Starosek <sergey.starosek@gmail.com> | 2014-06-26 20:20:34 +0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-26 15:44:40 -0700 |
commit | 5a98a221cc926c7a378dcce20a22284cb7d90030 (patch) | |
tree | e4665fb3560abe2c80dc7b40187132a5c3bfd8f5 /qt-ui/mainwindow.cpp | |
parent | 9fca5a51d976a9bb5127b0369f4cfe9cddfe17e2 (diff) | |
download | subsurface-5a98a221cc926c7a378dcce20a22284cb7d90030.tar.gz |
Implement proxy re-configuration
- application level proxy is reconfigured on settings saving
- tested with direct connection (no proxy), local proxy without auth
(tinyproxy) and SOCKS (ssh -D dynamic port forwarding)
- not sure about QNetworkProxy reuse between invocations
- consider using QNetworkProxyFactory (but since no plain TCP
connections are used, QNetworkProxy seems to be good choice)
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index de624a79d..10b3e5304 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -51,6 +51,7 @@ #ifndef NO_USERMANUAL #include "usermanual.h" #endif +#include <QNetworkProxy> MainWindow *MainWindow::m_Instance = NULL; @@ -828,6 +829,18 @@ void MainWindow::readSettings() default_dive_computer_product = getSetting(s, "dive_computer_product"); default_dive_computer_device = getSetting(s, "dive_computer_device"); s.endGroup(); + + QNetworkProxy proxy; + proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type)); + proxy.setHostName(prefs.proxy_host); + proxy.setPort(prefs.proxy_port); + if (prefs.proxy_auth) { + proxy.setUser(prefs.proxy_user); + proxy.setPassword(prefs.proxy_pass); + } + QNetworkProxy::setApplicationProxy(proxy); + + loadRecentFiles(&s); checkSurvey(&s); } |