QTfrontend/gameuiconfig.cpp
branchwebgl
changeset 9950 2759212a27de
parent 9521 8054d9d775fd
parent 9547 f9e82f34c904
child 10015 4feced261c68
equal deleted inserted replaced
9521:8054d9d775fd 9950:2759212a27de
   157     Form->ui.pageOptions->leProxy->setText(value("proxy/host", "").toString());
   157     Form->ui.pageOptions->leProxy->setText(value("proxy/host", "").toString());
   158     Form->ui.pageOptions->sbProxyPort->setValue(value("proxy/port", "8080").toInt());
   158     Form->ui.pageOptions->sbProxyPort->setValue(value("proxy/port", "8080").toInt());
   159     Form->ui.pageOptions->leProxyLogin->setText(value("proxy/login", "").toString());
   159     Form->ui.pageOptions->leProxyLogin->setText(value("proxy/login", "").toString());
   160     Form->ui.pageOptions->leProxyPassword->setText(value("proxy/password", "").toString());
   160     Form->ui.pageOptions->leProxyPassword->setText(value("proxy/password", "").toString());
   161 
   161 
       
   162     applyProxySettings();
       
   163 
   162     { // load colors
   164     { // load colors
   163         QStandardItemModel * model = DataManager::instance().colorsModel();
   165         QStandardItemModel * model = DataManager::instance().colorsModel();
   164         for(int i = model->rowCount() - 1; i >= 0; --i)
   166         for(int i = model->rowCount() - 1; i >= 0; --i)
   165             model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data()).toString()));
   167             model->item(i)->setData(QColor(value(QString("colors/color%1").arg(i), model->item(i)->data()).toString()));
   166     }
   168     }
   308             setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value());
   310             setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value());
   309             setValue("proxy/login", Form->ui.pageOptions->leProxyLogin->text());
   311             setValue("proxy/login", Form->ui.pageOptions->leProxyLogin->text());
   310             setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text());
   312             setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text());
   311         }
   313         }
   312 
   314 
   313         QNetworkProxy proxy;
   315         applyProxySettings();
   314 
       
   315         if(proxyType == PageOptions::SystemProxy)
       
   316         {
       
   317             // use system proxy settings
       
   318             proxy = QNetworkProxyFactory::systemProxyForQuery().at(0);
       
   319         } else
       
   320         {
       
   321             proxy.setType(proxyTypesMap[proxyType]);
       
   322             proxy.setHostName(Form->ui.pageOptions->leProxy->text());
       
   323             proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
       
   324             proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
       
   325             proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
       
   326         }
       
   327 
       
   328         QNetworkProxy::setApplicationProxy(proxy);
       
   329     }
   316     }
   330 
   317 
   331     { // save colors
   318     { // save colors
   332         QStandardItemModel * model = DataManager::instance().colorsModel();
   319         QStandardItemModel * model = DataManager::instance().colorsModel();
   333         for(int i = model->rowCount() - 1; i >= 0; --i)
   320         for(int i = model->rowCount() - 1; i >= 0; --i)
   663 void GameUIConfig::setBind(int bindID, QString & strbind)
   650 void GameUIConfig::setBind(int bindID, QString & strbind)
   664 {
   651 {
   665     m_binds[bindID].strbind = strbind;
   652     m_binds[bindID].strbind = strbind;
   666     setValue(QString("Binds/%1").arg(m_binds[bindID].action), strbind);
   653     setValue(QString("Binds/%1").arg(m_binds[bindID].action), strbind);
   667 }
   654 }
       
   655 
       
   656 void GameUIConfig::applyProxySettings()
       
   657 {
       
   658     QNetworkProxy proxy;
       
   659 
       
   660     int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex();
       
   661 
       
   662     if(proxyType == PageOptions::SystemProxy)
       
   663     {
       
   664         // use system proxy settings
       
   665         proxy = QNetworkProxyFactory::systemProxyForQuery().at(0);
       
   666     } else
       
   667     {
       
   668         proxy.setType(proxyTypesMap[proxyType]);
       
   669         proxy.setHostName(Form->ui.pageOptions->leProxy->text());
       
   670         proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
       
   671         proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
       
   672         proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
       
   673     }
       
   674 
       
   675     QNetworkProxy::setApplicationProxy(proxy);
       
   676 }