aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-10-07 07:03:06 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2012-10-07 07:03:06 -0700
commit43de64949c96b6d708b7d8a82c3dba0f6ddf059e (patch)
tree5a5815a1ffbcc5b2b24623a121e9c4a3e2480847 /src/qt
parentee0b64853699c08602fed81cdefc62d7e8dcdce2 (diff)
parent81bbef26099eb54f4dcc32e45b5e0416857a330d (diff)
Merge pull request #1859 from Diapolo/proxy_locks
add LOCK() for proxy related data-structures
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/optionsmodel.cpp69
1 files changed, 39 insertions, 30 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index caa33414b2..756fe61ecd 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -145,18 +145,18 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
case ProxyUse:
return settings.value("fUseProxy", false);
case ProxyIP: {
- CService addrProxy;
- if (GetProxy(NET_IPV4, addrProxy))
- return QVariant(QString::fromStdString(addrProxy.ToStringIP()));
+ proxyType proxy;
+ if (GetProxy(NET_IPV4, proxy))
+ return QVariant(QString::fromStdString(proxy.first.ToStringIP()));
else
return QVariant(QString::fromStdString("127.0.0.1"));
}
case ProxyPort: {
- CService addrProxy;
- if (GetProxy(NET_IPV4, addrProxy))
- return QVariant(addrProxy.GetPort());
+ proxyType proxy;
+ if (GetProxy(NET_IPV4, proxy))
+ return QVariant(proxy.first.GetPort());
else
- return 9050;
+ return QVariant(9050);
}
case ProxySocksVersion:
return settings.value("nSocksVersion", 5);
@@ -176,6 +176,7 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
}
return QVariant();
}
+
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
bool successful = true; /* set to false on parse error */
@@ -204,29 +205,37 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
settings.setValue("fUseProxy", value.toBool());
ApplyProxySettings();
break;
- case ProxyIP:
- {
- CService addrProxy("127.0.0.1", 9050);
- GetProxy(NET_IPV4, addrProxy);
- CNetAddr addr(value.toString().toStdString());
- addrProxy.SetIP(addr);
- settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
- successful = ApplyProxySettings();
- }
- break;
- case ProxyPort:
- {
- CService addrProxy("127.0.0.1", 9050);
- GetProxy(NET_IPV4, addrProxy);
- addrProxy.SetPort(value.toInt());
- settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str());
- successful = ApplyProxySettings();
- }
- break;
- case ProxySocksVersion:
- settings.setValue("nSocksVersion", value.toInt());
- ApplyProxySettings();
- break;
+ case ProxyIP: {
+ proxyType proxy;
+ proxy.first = CService("127.0.0.1", 9050);
+ GetProxy(NET_IPV4, proxy);
+
+ CNetAddr addr(value.toString().toStdString());
+ proxy.first.SetIP(addr);
+ settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str());
+ successful = ApplyProxySettings();
+ }
+ break;
+ case ProxyPort: {
+ proxyType proxy;
+ proxy.first = CService("127.0.0.1", 9050);
+ GetProxy(NET_IPV4, proxy);
+
+ proxy.first.SetPort(value.toInt());
+ settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str());
+ successful = ApplyProxySettings();
+ }
+ break;
+ case ProxySocksVersion: {
+ proxyType proxy;
+ proxy.second = 5;
+ GetProxy(NET_IPV4, proxy);
+
+ proxy.second = value.toInt();
+ settings.setValue("nSocksVersion", proxy.second);
+ successful = ApplyProxySettings();
+ }
+ break;
case Fee:
nTransactionFee = value.toLongLong();
settings.setValue("nTransactionFee", nTransactionFee);