--- 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());
--- 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);
--- 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;