QTfrontend/gameuiconfig.cpp
changeset 7700 fc44e4e33d1c
parent 7672 686ba86ae0e3
child 7702 c8906c3a2aeb
equal deleted inserted replaced
7699:2455207a2c71 7700:fc44e4e33d1c
    21 #include <QLineEdit>
    21 #include <QLineEdit>
    22 #include <QDesktopWidget>
    22 #include <QDesktopWidget>
    23 #include <QInputDialog>
    23 #include <QInputDialog>
    24 #include <QCryptographicHash>
    24 #include <QCryptographicHash>
    25 #include <QStandardItemModel>
    25 #include <QStandardItemModel>
       
    26 #include <QNetworkProxy>
    26 
    27 
    27 #include "gameuiconfig.h"
    28 #include "gameuiconfig.h"
    28 #include "hwform.h"
    29 #include "hwform.h"
    29 #include "pageoptions.h"
    30 #include "pageoptions.h"
    30 #include "pagevideos.h"
    31 #include "pagevideos.h"
   107     Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool());
   108     Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool());
   108 #endif
   109 #endif
   109 
   110 
   110     Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));
   111     Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));
   111 
   112 
       
   113     Form->ui.pageOptions->cbProxyType->setCurrentIndex(value("proxy/type", 0).toInt());
       
   114     Form->ui.pageOptions->leProxy->setText(value("proxy/host", "").toString());
       
   115     Form->ui.pageOptions->sbProxyPort->setValue(value("proxy/port", "8080").toInt());
       
   116     Form->ui.pageOptions->leProxyLogin->setText(value("proxy/login", "").toString());
       
   117     Form->ui.pageOptions->leProxyPassword->setText(value("proxy/password", "").toString());
       
   118 
   112     depth = HWApplication::desktop()->depth();
   119     depth = HWApplication::desktop()->depth();
   113     if (depth < 16) depth = 16;
   120     if (depth < 16) depth = 16;
   114     else if (depth > 16) depth = 32;
   121     else if (depth > 16) depth = 32;
   115 
   122 
   116     { // load colors
   123     { // load colors
   214     setValue("misc/locale", language());
   221     setValue("misc/locale", language());
   215 
   222 
   216 #ifdef SPARKLE_ENABLED
   223 #ifdef SPARKLE_ENABLED
   217     setValue("misc/autoUpdate", isAutoUpdateEnabled());
   224     setValue("misc/autoUpdate", isAutoUpdateEnabled());
   218 #endif
   225 #endif
       
   226 
       
   227     int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex();
       
   228     setValue("proxy/type", proxyType);
       
   229 
       
   230     if(proxyType > 0)
       
   231     {
       
   232         setValue("proxy/host", Form->ui.pageOptions->leProxy->text());
       
   233         setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value());
       
   234         setValue("proxy/login", Form->ui.pageOptions->leProxyLogin->text());
       
   235         setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text());
       
   236     }
       
   237 
       
   238     const QNetworkProxy::ProxyType proxyTypesMap[] = {
       
   239         QNetworkProxy::NoProxy
       
   240         , QNetworkProxy::Socks5Proxy
       
   241         , QNetworkProxy::HttpProxy};
       
   242 
       
   243     QNetworkProxy proxy;
       
   244     proxy.setType(proxyTypesMap[proxyType]);
       
   245     proxy.setHostName(Form->ui.pageOptions->leProxy->text());
       
   246     proxy.setPort(Form->ui.pageOptions->sbProxyPort->value());
       
   247     proxy.setUser(Form->ui.pageOptions->leProxyLogin->text());
       
   248     proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text());
       
   249     QNetworkProxy::setApplicationProxy(proxy);
       
   250 
   219 
   251 
   220     { // save colors
   252     { // save colors
   221         QStandardItemModel * model = DataManager::instance().colorsModel();
   253         QStandardItemModel * model = DataManager::instance().colorsModel();
   222         for(int i = model->rowCount() - 1; i >= 0; --i)
   254         for(int i = model->rowCount() - 1; i >= 0; --i)
   223             setValue(QString("colors/color%1").arg(i), model->item(i)->data());
   255             setValue(QString("colors/color%1").arg(i), model->item(i)->data());