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 #include <QNetworkProxy> |
|
27 #include <QNetworkProxyFactory> |
27 |
28 |
28 #include "gameuiconfig.h" |
29 #include "gameuiconfig.h" |
29 #include "hwform.h" |
30 #include "hwform.h" |
30 #include "pageoptions.h" |
31 #include "pageoptions.h" |
31 #include "pagevideos.h" |
32 #include "pagevideos.h" |
222 |
223 |
223 #ifdef SPARKLE_ENABLED |
224 #ifdef SPARKLE_ENABLED |
224 setValue("misc/autoUpdate", isAutoUpdateEnabled()); |
225 setValue("misc/autoUpdate", isAutoUpdateEnabled()); |
225 #endif |
226 #endif |
226 |
227 |
227 int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex(); |
228 { // setup proxy |
228 setValue("proxy/type", proxyType); |
229 int proxyType = Form->ui.pageOptions->cbProxyType->currentIndex(); |
229 |
230 setValue("proxy/type", proxyType); |
230 if(proxyType > 0) |
231 |
231 { |
232 if(proxyType > 1) |
232 setValue("proxy/host", Form->ui.pageOptions->leProxy->text()); |
233 { |
233 setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value()); |
234 setValue("proxy/host", Form->ui.pageOptions->leProxy->text()); |
234 setValue("proxy/login", Form->ui.pageOptions->leProxyLogin->text()); |
235 setValue("proxy/port", Form->ui.pageOptions->sbProxyPort->value()); |
235 setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text()); |
236 setValue("proxy/login", Form->ui.pageOptions->leProxyLogin->text()); |
236 } |
237 setValue("proxy/password", Form->ui.pageOptions->leProxyPassword->text()); |
237 |
238 } |
238 const QNetworkProxy::ProxyType proxyTypesMap[] = { |
239 |
239 QNetworkProxy::NoProxy |
240 QNetworkProxy proxy; |
240 , QNetworkProxy::Socks5Proxy |
241 |
241 , QNetworkProxy::HttpProxy}; |
242 if(proxyType == 1) |
242 |
243 { |
243 QNetworkProxy proxy; |
244 // use system proxy settings |
244 proxy.setType(proxyTypesMap[proxyType]); |
245 proxy = QNetworkProxyFactory::systemProxyForQuery().at(0); |
245 proxy.setHostName(Form->ui.pageOptions->leProxy->text()); |
246 } else |
246 proxy.setPort(Form->ui.pageOptions->sbProxyPort->value()); |
247 { |
247 proxy.setUser(Form->ui.pageOptions->leProxyLogin->text()); |
248 const QNetworkProxy::ProxyType proxyTypesMap[] = { |
248 proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text()); |
249 QNetworkProxy::NoProxy |
249 QNetworkProxy::setApplicationProxy(proxy); |
250 , QNetworkProxy::NoProxy // dummy value |
250 |
251 , QNetworkProxy::Socks5Proxy |
|
252 , QNetworkProxy::HttpProxy}; |
|
253 |
|
254 proxy.setType(proxyTypesMap[proxyType]); |
|
255 proxy.setHostName(Form->ui.pageOptions->leProxy->text()); |
|
256 proxy.setPort(Form->ui.pageOptions->sbProxyPort->value()); |
|
257 proxy.setUser(Form->ui.pageOptions->leProxyLogin->text()); |
|
258 proxy.setPassword(Form->ui.pageOptions->leProxyPassword->text()); |
|
259 } |
|
260 |
|
261 QNetworkProxy::setApplicationProxy(proxy); |
|
262 } |
251 |
263 |
252 { // save colors |
264 { // save colors |
253 QStandardItemModel * model = DataManager::instance().colorsModel(); |
265 QStandardItemModel * model = DataManager::instance().colorsModel(); |
254 for(int i = model->rowCount() - 1; i >= 0; --i) |
266 for(int i = model->rowCount() - 1; i >= 0; --i) |
255 setValue(QString("colors/color%1").arg(i), model->item(i)->data()); |
267 setValue(QString("colors/color%1").arg(i), model->item(i)->data()); |