Changeset 9b513f6
- Timestamp:
- 10/05/17 22:50:44 (5 years ago)
- Branches:
- master
- Children:
- e618f18
- Parents:
- 68efead
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/app/appsettings.cpp
r68efead r9b513f6 37 37 } 38 38 39 //QNetworkProxy::ProxyType 40 int AppSettings::proxyType() 39 QNetworkProxy::ProxyType AppSettings::proxyType() 41 40 { 42 return mSettings.value(PROXY_TYPE_SETTING).toInt(); 41 bool ok; 42 int proxyType = mSettings.value(PROXY_TYPE_SETTING).toInt(&ok); 43 if (!ok || proxyType < 0 || proxyType > 5) return QNetworkProxy::DefaultProxy; 44 return QNetworkProxy::ProxyType(proxyType); 43 45 } 44 46 … … 58 60 } 59 61 60 // QNetworkProxy::ProxyType 61 void AppSettings::setProxyType(const int aType) 62 void AppSettings::setProxyType(QNetworkProxy::ProxyType aProxyType) 62 63 { 63 mSettings.setValue(PROXY_TYPE_SETTING, a Type);64 mSettings.setValue(PROXY_TYPE_SETTING, aProxyType); 64 65 } 65 66 -
src/app/appsettings.h
r68efead r9b513f6 37 37 static QString proxyAddress(); 38 38 static quint16 proxyPort(); 39 static int proxyType(); // QNetworkProxy::ProxyType39 static QNetworkProxy::ProxyType proxyType(); 40 40 static bool isDirectConnection(); 41 41 42 42 static void setProxyAddress(const QString &aAddress); 43 43 static void setProxyPort(const quint16 aPort); 44 static void setProxyType( const int aProxyType); // QNetworkProxy::ProxyType44 static void setProxyType(QNetworkProxy::ProxyType aProxyType); 45 45 static void setDirectConnection(bool aDirectConnection); 46 46 static int preEventAlarmSec() {return 60*15;} ///< seconds that alarm should ring before an event starts -
src/gui/settingsdialog.cpp
r68efead r9b513f6 36 36 address->setText(AppSettings::proxyAddress()); 37 37 port->setValue(AppSettings::proxyPort()); 38 const int proxyType = AppSettings::proxyType(); // QNetworkProxy::ProxyType39 proxyTypeHTTP->setChecked(proxyType != 1); // HTTP=3, but we enable it by default, i.e.unless SOCKS5=140 proxyTypeSOCKS5->setChecked(proxyType == 1);38 const QNetworkProxy::ProxyType proxyType = AppSettings::proxyType(); 39 proxyTypeHTTP->setChecked(proxyType != QNetworkProxy::Socks5Proxy); // we enable it by default unless SOCKS5=1 40 proxyTypeSOCKS5->setChecked(proxyType == QNetworkProxy::Socks5Proxy); 41 41 directConnection->setChecked(AppSettings::isDirectConnection()); 42 42 proxyWidget->setDisabled(directConnection->isChecked()); … … 49 49 AppSettings::setProxyAddress(address->text()); 50 50 AppSettings::setProxyPort(port->value()); 51 AppSettings::setProxyType(proxyTypeHTTP->isChecked() ? 3 : proxyTypeSOCKS5->isChecked() ? 1 : 0);51 AppSettings::setProxyType(proxyTypeHTTP->isChecked() ? QNetworkProxy::HttpProxy : proxyTypeSOCKS5->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::DefaultProxy); 52 52 AppSettings::setDirectConnection(directConnection->isChecked()); 53 53 }
Note: See TracChangeset
for help on using the changeset viewer.