QTfrontend/gameuiconfig.cpp
branchwebgl
changeset 9950 2759212a27de
parent 9521 8054d9d775fd
parent 9547 f9e82f34c904
child 10015 4feced261c68
--- a/QTfrontend/gameuiconfig.cpp	Fri Oct 11 17:43:13 2013 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Sat Jan 04 23:55:54 2014 +0400
@@ -159,6 +159,8 @@
     Form->ui.pageOptions->leProxyLogin->setText(value("proxy/login", "").toString());
     Form->ui.pageOptions->leProxyPassword->setText(value("proxy/password", "").toString());
 
+    applyProxySettings();
+
     { // load colors
         QStandardItemModel * model = DataManager::instance().colorsModel();
         for(int i = model->rowCount() - 1; i >= 0; --i)
@@ -310,22 +312,7 @@
             setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text());
         }
 
-        QNetworkProxy proxy;
-
-        if(proxyType == PageOptions::SystemProxy)
-        {
-            // use system proxy settings
-            proxy = QNetworkProxyFactory::systemProxyForQuery().at(0);
-        } else
-        {
-            proxy.setType(proxyTypesMap[proxyType]);
-            proxy.setHostName(Form->ui.pageOptions->leProxy->text());
-            proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
-            proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
-            proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
-        }
-
-        QNetworkProxy::setApplicationProxy(proxy);
+        applyProxySettings();
     }
 
     { // save colors
@@ -665,3 +652,25 @@
     m_binds[bindID].strbind = strbind;
     setValue(QString("Binds/%1").arg(m_binds[bindID].action), strbind);
 }
+
+void GameUIConfig::applyProxySettings()
+{
+    QNetworkProxy proxy;
+
+    int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex();
+
+    if(proxyType == PageOptions::SystemProxy)
+    {
+        // use system proxy settings
+        proxy = QNetworkProxyFactory::systemProxyForQuery().at(0);
+    } else
+    {
+        proxy.setType(proxyTypesMap[proxyType]);
+        proxy.setHostName(Form->ui.pageOptions->leProxy->text());
+        proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
+        proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
+        proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
+    }
+
+    QNetworkProxy::setApplicationProxy(proxy);
+}