# HG changeset patch # User unc0rr # Date 1348326898 -14400 # Node ID 78d2ac987f415d3c8e5d15897f7269e84b4112f4 # Parent c8906c3a2aeb6980b22ac58804e64322884c6d1f Make sheepluva happy diff -r c8906c3a2aeb -r 78d2ac987f41 QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Sat Sep 22 19:01:39 2012 +0400 +++ b/QTfrontend/gameuiconfig.cpp Sat Sep 22 19:14:58 2012 +0400 @@ -36,6 +36,14 @@ #include "HWApplication.h" #include "DataManager.h" + +const QNetworkProxy::ProxyType proxyTypesMap[] = { + QNetworkProxy::NoProxy + , QNetworkProxy::NoProxy // dummy value + , QNetworkProxy::Socks5Proxy + , QNetworkProxy::HttpProxy}; + + GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName) : QSettings(fileName, QSettings::IniFormat) { @@ -229,7 +237,7 @@ int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex(); setValue("proxy/type", proxyType); - if(proxyType > 1) + if(proxyType == PageOptions::Socks5Proxy || proxyType == PageOptions::HTTPProxy) { setValue("proxy/host", Form->ui.pageOptions->leProxy->text()); setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value()); @@ -239,18 +247,12 @@ QNetworkProxy proxy; - if(proxyType == 1) + if(proxyType == PageOptions::SystemProxy) { // use system proxy settings proxy = QNetworkProxyFactory::systemProxyForQuery().at(0); } else { - const QNetworkProxy::ProxyType proxyTypesMap[] = { - QNetworkProxy::NoProxy - , QNetworkProxy::NoProxy // dummy value - , QNetworkProxy::Socks5Proxy - , QNetworkProxy::HttpProxy}; - proxy.setType(proxyTypesMap[proxyType]); proxy.setHostName(Form->ui.pageOptions->leProxy->text()); proxy.setPort(Form->ui.pageOptions->sbProxyPort->value()); diff -r c8906c3a2aeb -r 78d2ac987f41 QTfrontend/ui/page/pageoptions.cpp --- a/QTfrontend/ui/page/pageoptions.cpp Sat Sep 22 19:01:39 2012 +0400 +++ b/QTfrontend/ui/page/pageoptions.cpp Sat Sep 22 19:14:58 2012 +0400 @@ -627,7 +627,7 @@ void PageOptions::onProxyTypeChanged() { - bool b = cbProxyType->currentIndex() > 1; + bool b = cbProxyType->currentIndex() != NoProxy && cbProxyType->currentIndex() != SystemProxy ; sbProxyPort->setEnabled(b); leProxy->setEnabled(b); diff -r c8906c3a2aeb -r 78d2ac987f41 QTfrontend/ui/page/pageoptions.h --- a/QTfrontend/ui/page/pageoptions.h Sat Sep 22 19:01:39 2012 +0400 +++ b/QTfrontend/ui/page/pageoptions.h Sat Sep 22 19:14:58 2012 +0400 @@ -30,6 +30,13 @@ Q_OBJECT public: + enum ProxyTypes { + NoProxy = 0, + SystemProxy = 1, + Socks5Proxy = 2, + HTTPProxy = 3 + }; + PageOptions(QWidget* parent = 0); QCheckBox *WeaponTooltip;