diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-22 08:55:43 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-22 08:55:57 +0100 |
commit | 2f06b5965ae564dea4d13b5c0ec79cfb58d2c74a (patch) | |
tree | 9fd7b784bc974a3b8988a28ad35c7cf8e9ea1b91 /src/qt/optionsmodel.cpp | |
parent | ceab53b41da4e812a63a7a7d6d05e9ed246a5cd5 (diff) | |
parent | 1ba3560fe870dac8d27d75671c483eaa4e0009ff (diff) |
Merge pull request #3452
1ba3560 [Qt] let OptionsModel::getProxySettings() directly query proxy (Philip Kaufmann)
Diffstat (limited to 'src/qt/optionsmodel.cpp')
-rw-r--r-- | src/qt/optionsmodel.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 1133c457b3..a18fd1d514 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -19,6 +19,7 @@ #include "walletdb.h" #endif +#include <QNetworkProxy> #include <QSettings> #include <QStringList> @@ -375,14 +376,25 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in return successful; } -bool OptionsModel::getProxySettings(QString& proxyIP, quint16 &proxyPort) const +bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const { - std::string proxy = GetArg("-proxy", ""); - if (proxy.empty()) return false; + // Directly query current base proxy, because + // GUI settings can be overridden with -proxy. + proxyType curProxy; + if (GetProxy(NET_IPV4, curProxy)) { + if (curProxy.second == 5) { + proxy.setType(QNetworkProxy::Socks5Proxy); + proxy.setHostName(QString::fromStdString(curProxy.first.ToStringIP())); + proxy.setPort(curProxy.first.GetPort()); + + return true; + } + else + return false; + } + else + proxy.setType(QNetworkProxy::NoProxy); - CService addrProxy(proxy); - proxyIP = QString(addrProxy.ToStringIP().c_str()); - proxyPort = addrProxy.GetPort(); return true; } |