mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 04:24:23 +00:00
Simplified proxy settings
Fix deprecation warnings with libtorrent v0.15.4+
This commit is contained in:
parent
299b0f90bc
commit
a3db4790a7
@ -10,6 +10,7 @@
|
||||
- FEATURE: Bring up the connection settings when clicking on the connection status icon
|
||||
- FEATURE: Major code refactoring and optimization
|
||||
- FEATURE: Added "Amount downloaded/left" columns to transfer list
|
||||
- FEATURE: Simplified proxy settings
|
||||
- COSMETIC: Replaced message box by on-screen notification for download errors
|
||||
- COSMETIC: Improved the torrent creation tool appearance
|
||||
- OTHERS: Dropped support for Qt <= 4.4
|
||||
|
@ -177,31 +177,26 @@ void downloadThread::checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal)
|
||||
|
||||
void downloadThread::applyProxySettings() {
|
||||
QNetworkProxy proxy;
|
||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
||||
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), 0).toInt();
|
||||
if(intValue > 0) {
|
||||
const Preferences pref;
|
||||
if(pref.isProxyEnabled()) {
|
||||
// Proxy enabled
|
||||
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
|
||||
proxy.setHostName(IP);
|
||||
QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString();
|
||||
qDebug("Using proxy: %s", qPrintable(IP));
|
||||
proxy.setPort(port.toUShort());
|
||||
proxy.setHostName(pref.getProxyIp());
|
||||
proxy.setPort(pref.getProxyPort());
|
||||
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||
if(intValue == Proxy::SOCKS5 || intValue == Proxy::SOCKS5_PW) {
|
||||
qDebug("Proxy is SOCKS5, not HTTP");
|
||||
const int proxy_type = pref.getProxyType();
|
||||
if(proxy_type == Proxy::SOCKS5 || proxy_type == Proxy::SOCKS5_PW) {
|
||||
qDebug() << Q_FUNC_INFO << "using SOCKS proxy";
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
} else {
|
||||
qDebug() << Q_FUNC_INFO << "using HTTP proxy";
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
}
|
||||
// Authentication?
|
||||
if(intValue > 2) {
|
||||
if(pref.isProxyAuthEnabled()) {
|
||||
qDebug("Proxy requires authentication, authenticating");
|
||||
QString username = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), QString()).toString();
|
||||
proxy.setUser(username);
|
||||
QString password = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString();
|
||||
proxy.setPassword(password);
|
||||
proxy.setUser(pref.getProxyUsername());
|
||||
proxy.setPassword(pref.getProxyPassword());
|
||||
}
|
||||
|
||||
} else {
|
||||
proxy.setType(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
@ -166,10 +166,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool)));
|
||||
connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableMaxRatio(bool)));
|
||||
// Proxy tab
|
||||
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableHTTPProxy(int)));
|
||||
connect(checkProxyAuth_http, SIGNAL(toggled(bool)), this, SLOT(enableHTTPProxyAuth(bool)));
|
||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enablePeerProxy(int)));
|
||||
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enablePeerProxyAuth(bool)));
|
||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
||||
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuth(bool)));
|
||||
|
||||
// Apply button is activated when a value is changed
|
||||
// General tab
|
||||
@ -232,12 +230,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
connect(spinMaxRatio, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(comboRatioLimitAct, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
// Proxy tab
|
||||
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(textProxyIP_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(spinProxyPort_http, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(checkProxyAuth_http, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(textProxyUsername_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(textProxyPassword_http, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
@ -418,18 +410,12 @@ void options_imp::saveOptions(){
|
||||
pref.setSchedulerStartTime(schedule_from->time());
|
||||
pref.setSchedulerEndTime(schedule_to->time());
|
||||
pref.setSchedulerDays((scheduler_days)schedule_days->currentIndex());
|
||||
pref.setPeerProxyType(getPeerProxyType());
|
||||
pref.setPeerProxyIp(getPeerProxyIp());
|
||||
pref.setPeerProxyPort(getPeerProxyPort());
|
||||
pref.setPeerProxyAuthEnabled(isPeerProxyAuthEnabled());
|
||||
pref.setPeerProxyUsername(getPeerProxyUsername());
|
||||
pref.setPeerProxyPassword(getPeerProxyPassword());
|
||||
pref.setHTTPProxyType(getHTTPProxyType());
|
||||
pref.setHTTPProxyIp(getHTTPProxyIp());
|
||||
pref.setHTTPProxyPort(getHTTPProxyPort());
|
||||
pref.setHTTPProxyAuthEnabled(isHTTPProxyAuthEnabled());
|
||||
pref.setHTTPProxyUsername(getHTTPProxyUsername());
|
||||
pref.setHTTPProxyPassword(getHTTPProxyPassword());
|
||||
pref.setProxyType(getProxyType());
|
||||
pref.setProxyIp(getProxyIp());
|
||||
pref.setProxyPort(getProxyPort());
|
||||
pref.setProxyAuthEnabled(isProxyAuthEnabled());
|
||||
pref.setProxyUsername(getProxyUsername());
|
||||
pref.setProxyPassword(getProxyPassword());
|
||||
// End Connection preferences
|
||||
// Bittorrent preferences
|
||||
pref.setMaxConnecs(getMaxConnecs());
|
||||
@ -480,18 +466,18 @@ bool options_imp::isFilteringEnabled() const{
|
||||
return checkIPFilter->isChecked();
|
||||
}
|
||||
|
||||
int options_imp::getPeerProxyType() const{
|
||||
int options_imp::getProxyType() const{
|
||||
switch(comboProxyType->currentIndex()) {
|
||||
case 1:
|
||||
return Proxy::SOCKS4;
|
||||
break;
|
||||
case 2:
|
||||
if(isPeerProxyAuthEnabled()){
|
||||
if(isProxyAuthEnabled()){
|
||||
return Proxy::SOCKS5_PW;
|
||||
}
|
||||
return Proxy::SOCKS5;
|
||||
case 3:
|
||||
if(isPeerProxyAuthEnabled()){
|
||||
if(isProxyAuthEnabled()){
|
||||
return Proxy::HTTP_PW;
|
||||
}
|
||||
return Proxy::HTTP;
|
||||
@ -500,25 +486,6 @@ int options_imp::getPeerProxyType() const{
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getHTTPProxyType() const {
|
||||
switch(comboProxyType_http->currentIndex()) {
|
||||
case 1: {
|
||||
if(isHTTPProxyAuthEnabled()){
|
||||
return Proxy::HTTP_PW;
|
||||
}
|
||||
return Proxy::HTTP;
|
||||
}
|
||||
case 2: {
|
||||
if(isHTTPProxyAuthEnabled()) {
|
||||
return Proxy::SOCKS5_PW;
|
||||
}
|
||||
return Proxy::SOCKS5;
|
||||
}
|
||||
default:
|
||||
return -1; // Disabled
|
||||
}
|
||||
}
|
||||
|
||||
QString options_imp::getStyle() const{
|
||||
return comboStyle->itemText(comboStyle->currentIndex());
|
||||
}
|
||||
@ -529,10 +496,6 @@ void options_imp::setStyle(QString style) {
|
||||
comboStyle->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
bool options_imp::isHTTPProxyAuthEnabled() const{
|
||||
return checkProxyAuth_http->isChecked();
|
||||
}
|
||||
|
||||
void options_imp::loadOptions(){
|
||||
int intValue;
|
||||
float floatValue;
|
||||
@ -638,7 +601,7 @@ void options_imp::loadOptions(){
|
||||
schedule_to->setTime(pref.getSchedulerEndTime());
|
||||
schedule_days->setCurrentIndex((int)pref.getSchedulerDays());
|
||||
|
||||
intValue = pref.getPeerProxyType();
|
||||
intValue = pref.getProxyType();
|
||||
switch(intValue) {
|
||||
case Proxy::SOCKS4:
|
||||
comboProxyType->setCurrentIndex(1);
|
||||
@ -654,37 +617,16 @@ void options_imp::loadOptions(){
|
||||
default:
|
||||
comboProxyType->setCurrentIndex(0);
|
||||
}
|
||||
enablePeerProxy(comboProxyType->currentIndex());
|
||||
enableProxy(comboProxyType->currentIndex());
|
||||
//if(isProxyEnabled()) {
|
||||
// Proxy is enabled, save settings
|
||||
textProxyIP->setText(pref.getPeerProxyIp());
|
||||
spinProxyPort->setValue(pref.getPeerProxyPort());
|
||||
checkProxyAuth->setChecked(pref.isPeerProxyAuthEnabled());
|
||||
textProxyUsername->setText(pref.getPeerProxyUsername());
|
||||
textProxyPassword->setText(pref.getPeerProxyPassword());
|
||||
enablePeerProxyAuth(checkProxyAuth->isChecked());
|
||||
textProxyIP->setText(pref.getProxyIp());
|
||||
spinProxyPort->setValue(pref.getProxyPort());
|
||||
checkProxyAuth->setChecked(pref.isProxyAuthEnabled());
|
||||
textProxyUsername->setText(pref.getProxyUsername());
|
||||
textProxyPassword->setText(pref.getProxyPassword());
|
||||
enableProxyAuth(checkProxyAuth->isChecked());
|
||||
//}
|
||||
intValue = pref.getHTTPProxyType();
|
||||
switch(intValue) {
|
||||
case Proxy::HTTP:
|
||||
case Proxy::HTTP_PW:
|
||||
comboProxyType_http->setCurrentIndex(1);
|
||||
break;
|
||||
case Proxy::SOCKS5:
|
||||
case Proxy::SOCKS5_PW:
|
||||
comboProxyType_http->setCurrentIndex(2);
|
||||
break;
|
||||
default:
|
||||
comboProxyType_http->setCurrentIndex(0);
|
||||
}
|
||||
enableHTTPProxy(comboProxyType_http->currentIndex());
|
||||
textProxyUsername_http->setText(pref.getHTTPProxyUsername());
|
||||
textProxyPassword_http->setText(pref.getHTTPProxyPassword());
|
||||
textProxyIP_http->setText(pref.getHTTPProxyIp());
|
||||
spinProxyPort_http->setValue(pref.getHTTPProxyPort());
|
||||
checkProxyAuth_http->setChecked(pref.isHTTPProxyAuthEnabled());
|
||||
enableHTTPProxyAuth(checkProxyAuth_http->isChecked());
|
||||
// End HTTPProxy
|
||||
// End Connection preferences
|
||||
// Bittorrent preferences
|
||||
intValue = pref.getMaxConnecs();
|
||||
@ -987,7 +929,7 @@ void options_imp::enableMaxRatio(bool checked){
|
||||
comboRatioLimitAct->setEnabled(checked);
|
||||
}
|
||||
|
||||
void options_imp::enablePeerProxy(int index){
|
||||
void options_imp::enableProxy(int index){
|
||||
if(index){
|
||||
//enable
|
||||
lblProxyIP->setEnabled(true);
|
||||
@ -1011,32 +953,13 @@ void options_imp::enablePeerProxy(int index){
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableHTTPProxy(int index){
|
||||
bool enable = (index > 0);
|
||||
lblProxyIP_http->setEnabled(enable);
|
||||
textProxyIP_http->setEnabled(enable);
|
||||
lblProxyPort_http->setEnabled(enable);
|
||||
spinProxyPort_http->setEnabled(enable);
|
||||
checkProxyAuth_http->setEnabled(enable);
|
||||
|
||||
if(!enable)
|
||||
checkProxyAuth_http->setChecked(false);
|
||||
}
|
||||
|
||||
void options_imp::enablePeerProxyAuth(bool checked){
|
||||
void options_imp::enableProxyAuth(bool checked){
|
||||
lblProxyUsername->setEnabled(checked);
|
||||
lblProxyPassword->setEnabled(checked);
|
||||
textProxyUsername->setEnabled(checked);
|
||||
textProxyPassword->setEnabled(checked);
|
||||
}
|
||||
|
||||
void options_imp::enableHTTPProxyAuth(bool checked){
|
||||
lblProxyUsername_http->setEnabled(checked);
|
||||
lblProxyPassword_http->setEnabled(checked);
|
||||
textProxyUsername_http->setEnabled(checked);
|
||||
textProxyPassword_http->setEnabled(checked);
|
||||
}
|
||||
|
||||
bool options_imp::isSlashScreenDisabled() const {
|
||||
return !checkShowSplash->isChecked();
|
||||
}
|
||||
@ -1054,62 +977,36 @@ bool options_imp::isDHTPortSameAsBT() const {
|
||||
}
|
||||
|
||||
// Proxy settings
|
||||
bool options_imp::isPeerProxyEnabled() const{
|
||||
bool options_imp::isProxyEnabled() const{
|
||||
return comboProxyType->currentIndex();
|
||||
}
|
||||
|
||||
bool options_imp::isHTTPProxyEnabled() const {
|
||||
return comboProxyType_http->currentIndex();
|
||||
}
|
||||
|
||||
bool options_imp::isPeerProxyAuthEnabled() const{
|
||||
bool options_imp::isProxyAuthEnabled() const{
|
||||
return checkProxyAuth->isChecked();
|
||||
}
|
||||
|
||||
QString options_imp::getPeerProxyIp() const{
|
||||
QString options_imp::getProxyIp() const{
|
||||
QString ip = textProxyIP->text();
|
||||
ip = ip.trimmed();
|
||||
return ip;
|
||||
}
|
||||
|
||||
QString options_imp::getHTTPProxyIp() const{
|
||||
QString ip = textProxyIP_http->text();
|
||||
ip = ip.trimmed();
|
||||
return ip;
|
||||
}
|
||||
|
||||
unsigned short options_imp::getPeerProxyPort() const{
|
||||
unsigned short options_imp::getProxyPort() const{
|
||||
return spinProxyPort->value();
|
||||
}
|
||||
|
||||
unsigned short options_imp::getHTTPProxyPort() const{
|
||||
return spinProxyPort_http->value();
|
||||
}
|
||||
|
||||
QString options_imp::getPeerProxyUsername() const{
|
||||
QString options_imp::getProxyUsername() const{
|
||||
QString username = textProxyUsername->text();
|
||||
username = username.trimmed();
|
||||
return username;
|
||||
}
|
||||
|
||||
QString options_imp::getHTTPProxyUsername() const{
|
||||
QString username = textProxyUsername_http->text();
|
||||
username = username.trimmed();
|
||||
return username;
|
||||
}
|
||||
|
||||
QString options_imp::getPeerProxyPassword() const{
|
||||
QString options_imp::getProxyPassword() const{
|
||||
QString password = textProxyPassword->text();
|
||||
password = password.trimmed();
|
||||
return password;
|
||||
}
|
||||
|
||||
QString options_imp::getHTTPProxyPassword() const{
|
||||
QString password = textProxyPassword_http->text();
|
||||
password = password.trimmed();
|
||||
return password;
|
||||
}
|
||||
|
||||
// Locale Settings
|
||||
QString options_imp::getLocale() const{
|
||||
return locales.at(comboI18n->currentIndex());
|
||||
|
@ -96,20 +96,13 @@ protected:
|
||||
int getEncryptionSetting() const;
|
||||
float getMaxRatio() const;
|
||||
// Proxy options
|
||||
QString getHTTPProxyIp() const;
|
||||
unsigned short getHTTPProxyPort() const;
|
||||
QString getHTTPProxyUsername() const;
|
||||
QString getHTTPProxyPassword() const;
|
||||
int getHTTPProxyType() const;
|
||||
bool isPeerProxyEnabled() const;
|
||||
bool isHTTPProxyEnabled() const;
|
||||
bool isPeerProxyAuthEnabled() const;
|
||||
bool isHTTPProxyAuthEnabled() const;
|
||||
QString getPeerProxyIp() const;
|
||||
unsigned short getPeerProxyPort() const;
|
||||
QString getPeerProxyUsername() const;
|
||||
QString getPeerProxyPassword() const;
|
||||
int getPeerProxyType() const;
|
||||
bool isProxyEnabled() const;
|
||||
bool isProxyAuthEnabled() const;
|
||||
QString getProxyIp() const;
|
||||
unsigned short getProxyPort() const;
|
||||
QString getProxyUsername() const;
|
||||
QString getProxyPassword() const;
|
||||
int getProxyType() const;
|
||||
// IP Filter
|
||||
bool isFilteringEnabled() const;
|
||||
QString getFilter() const;
|
||||
@ -126,10 +119,8 @@ protected:
|
||||
protected slots:
|
||||
void enableUploadLimit(bool checked);
|
||||
void enableDownloadLimit(bool checked);
|
||||
void enablePeerProxy(int comboIndex);
|
||||
void enablePeerProxyAuth(bool checked);
|
||||
void enableHTTPProxy(int comboIndex);
|
||||
void enableHTTPProxyAuth(bool checked);
|
||||
void enableProxy(int comboIndex);
|
||||
void enableProxyAuth(bool checked);
|
||||
void enableMaxConnecsLimit(bool checked);
|
||||
void enableMaxConnecsLimitPerTorrent(bool checked);
|
||||
void enableMaxUploadsLimitPerTorrent(bool checked);
|
||||
|
@ -423,107 +423,55 @@ public:
|
||||
}
|
||||
|
||||
// Proxy options
|
||||
bool isHTTPProxyEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), 0).toInt() > 0;
|
||||
}
|
||||
|
||||
bool isHTTPProxyAuthEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Authentication"), false).toBool();
|
||||
}
|
||||
|
||||
void setHTTPProxyAuthEnabled(bool enabled) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/HTTPProxy/Authentication"), enabled);
|
||||
}
|
||||
|
||||
QString getHTTPProxyIp() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
|
||||
}
|
||||
|
||||
void setHTTPProxyIp(const QString &ip) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), ip);
|
||||
}
|
||||
|
||||
unsigned short getHTTPProxyPort() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toInt();
|
||||
}
|
||||
|
||||
void setHTTPProxyPort(unsigned short port) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), port);
|
||||
}
|
||||
|
||||
QString getHTTPProxyUsername() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), QString()).toString();
|
||||
}
|
||||
|
||||
void setHTTPProxyUsername(const QString &username) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), username);
|
||||
}
|
||||
|
||||
QString getHTTPProxyPassword() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString();
|
||||
}
|
||||
|
||||
void setHTTPProxyPassword(const QString &password) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), password);
|
||||
}
|
||||
|
||||
int getHTTPProxyType() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), 0).toInt();
|
||||
}
|
||||
|
||||
void setHTTPProxyType(int type) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), type);
|
||||
}
|
||||
|
||||
bool isPeerProxyEnabled() const {
|
||||
bool isProxyEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt() > 0;
|
||||
}
|
||||
|
||||
bool isPeerProxyAuthEnabled() const {
|
||||
bool isProxyAuthEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/Proxy/Authentication"), false).toBool();
|
||||
}
|
||||
|
||||
void setPeerProxyAuthEnabled(bool enabled) {
|
||||
void setProxyAuthEnabled(bool enabled) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/Proxy/Authentication"), enabled);
|
||||
}
|
||||
|
||||
QString getPeerProxyIp() const {
|
||||
QString getProxyIp() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString();
|
||||
}
|
||||
|
||||
void setPeerProxyIp(const QString &ip) {
|
||||
void setProxyIp(const QString &ip) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/Proxy/IP"), ip);
|
||||
}
|
||||
|
||||
unsigned short getPeerProxyPort() const {
|
||||
unsigned short getProxyPort() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toInt();
|
||||
}
|
||||
|
||||
void setPeerProxyPort(unsigned short port) {
|
||||
void setProxyPort(unsigned short port) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/Proxy/Port"), port);
|
||||
}
|
||||
|
||||
QString getPeerProxyUsername() const {
|
||||
QString getProxyUsername() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString();
|
||||
}
|
||||
|
||||
void setPeerProxyUsername(const QString &username) {
|
||||
void setProxyUsername(const QString &username) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/Proxy/Username"), username);
|
||||
}
|
||||
|
||||
QString getPeerProxyPassword() const {
|
||||
QString getProxyPassword() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString();
|
||||
}
|
||||
|
||||
void setPeerProxyPassword(const QString &password) {
|
||||
void setProxyPassword(const QString &password) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/Proxy/Password"), password);
|
||||
}
|
||||
|
||||
int getPeerProxyType() const {
|
||||
int getProxyType() const {
|
||||
return value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
|
||||
}
|
||||
|
||||
void setPeerProxyType(int type) {
|
||||
void setProxyType(int type) {
|
||||
setValue(QString::fromUtf8("Preferences/Connection/ProxyType"), type);
|
||||
}
|
||||
|
||||
|
@ -517,20 +517,20 @@ void QBtSession::configureSession() {
|
||||
}
|
||||
// * Proxy settings
|
||||
proxy_settings proxySettings;
|
||||
if(pref.isPeerProxyEnabled()) {
|
||||
if(pref.isProxyEnabled()) {
|
||||
qDebug("Enabling P2P proxy");
|
||||
proxySettings.hostname = pref.getPeerProxyIp().toStdString();
|
||||
proxySettings.hostname = pref.getProxyIp().toStdString();
|
||||
qDebug("hostname is %s", proxySettings.hostname.c_str());
|
||||
proxySettings.port = pref.getPeerProxyPort();
|
||||
proxySettings.port = pref.getProxyPort();
|
||||
qDebug("port is %d", proxySettings.port);
|
||||
if(pref.isPeerProxyAuthEnabled()) {
|
||||
proxySettings.username = pref.getPeerProxyUsername().toStdString();
|
||||
proxySettings.password = pref.getPeerProxyPassword().toStdString();
|
||||
if(pref.isProxyAuthEnabled()) {
|
||||
proxySettings.username = pref.getProxyUsername().toStdString();
|
||||
proxySettings.password = pref.getProxyPassword().toStdString();
|
||||
qDebug("username is %s", proxySettings.username.c_str());
|
||||
qDebug("password is %s", proxySettings.password.c_str());
|
||||
}
|
||||
}
|
||||
switch(pref.getPeerProxyType()) {
|
||||
switch(pref.getProxyType()) {
|
||||
case Proxy::HTTP:
|
||||
qDebug("type: http");
|
||||
proxySettings.type = proxy_settings::http;
|
||||
@ -552,39 +552,7 @@ void QBtSession::configureSession() {
|
||||
default:
|
||||
proxySettings.type = proxy_settings::none;
|
||||
}
|
||||
setPeerProxySettings(proxySettings);
|
||||
// HTTP Proxy
|
||||
proxy_settings http_proxySettings;
|
||||
qDebug("HTTP Communications proxy type: %d", pref.getHTTPProxyType());
|
||||
switch(pref.getHTTPProxyType()) {
|
||||
case Proxy::HTTP_PW:
|
||||
http_proxySettings.type = proxy_settings::http_pw;
|
||||
http_proxySettings.username = pref.getHTTPProxyUsername().toStdString();
|
||||
http_proxySettings.password = pref.getHTTPProxyPassword().toStdString();
|
||||
http_proxySettings.hostname = pref.getHTTPProxyIp().toStdString();
|
||||
http_proxySettings.port = pref.getHTTPProxyPort();
|
||||
break;
|
||||
case Proxy::HTTP:
|
||||
http_proxySettings.type = proxy_settings::http;
|
||||
http_proxySettings.hostname = pref.getHTTPProxyIp().toStdString();
|
||||
http_proxySettings.port = pref.getHTTPProxyPort();
|
||||
break;
|
||||
case Proxy::SOCKS5:
|
||||
http_proxySettings.type = proxy_settings::socks5;
|
||||
http_proxySettings.hostname = pref.getHTTPProxyIp().toStdString();
|
||||
http_proxySettings.port = pref.getHTTPProxyPort();
|
||||
break;
|
||||
case Proxy::SOCKS5_PW:
|
||||
http_proxySettings.type = proxy_settings::socks5_pw;
|
||||
http_proxySettings.username = pref.getHTTPProxyUsername().toStdString();
|
||||
http_proxySettings.password = pref.getHTTPProxyPassword().toStdString();
|
||||
http_proxySettings.hostname = pref.getHTTPProxyIp().toStdString();
|
||||
http_proxySettings.port = pref.getHTTPProxyPort();
|
||||
break;
|
||||
default:
|
||||
http_proxySettings.type = proxy_settings::none;
|
||||
}
|
||||
setHTTPProxySettings(http_proxySettings);
|
||||
setProxySettings(proxySettings);
|
||||
// Tracker
|
||||
if(pref.isTrackerEnabled()) {
|
||||
if(!m_tracker) {
|
||||
@ -1890,15 +1858,10 @@ void QBtSession::setSessionSettings(const session_settings &sessionSettings) {
|
||||
}
|
||||
|
||||
// Set Proxy
|
||||
void QBtSession::setPeerProxySettings(const proxy_settings &proxySettings) {
|
||||
qDebug("Set Peer Proxy settings");
|
||||
s->set_peer_proxy(proxySettings);
|
||||
s->set_dht_proxy(proxySettings);
|
||||
}
|
||||
|
||||
void QBtSession::setHTTPProxySettings(const proxy_settings &proxySettings) {
|
||||
s->set_tracker_proxy(proxySettings);
|
||||
s->set_web_seed_proxy(proxySettings);
|
||||
void QBtSession::setProxySettings(const proxy_settings &proxySettings) {
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
s->set_proxy(proxySettings);
|
||||
// Define environment variable
|
||||
QString proxy_str;
|
||||
switch(proxySettings.type) {
|
||||
case proxy_settings::http_pw:
|
||||
|
@ -133,8 +133,7 @@ public slots:
|
||||
void setUploadRateLimit(long rate);
|
||||
void setMaxRatio(float ratio);
|
||||
void setDHTPort(int dht_port);
|
||||
void setPeerProxySettings(const proxy_settings &proxySettings);
|
||||
void setHTTPProxySettings(const proxy_settings &proxySettings);
|
||||
void setProxySettings(const proxy_settings &proxySettings);
|
||||
void setSessionSettings(const session_settings &sessionSettings);
|
||||
void startTorrentsInPause(bool b);
|
||||
void setDefaultTempPath(QString temppath);
|
||||
|
@ -155,15 +155,6 @@
|
||||
<set>ItemIsSelectable|ItemIsEnabled</set>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/Icons/oxygen/proxy.png</normaloff>:/Icons/oxygen/proxy.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Web UI</string>
|
||||
@ -210,9 +201,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-40</y>
|
||||
<width>503</width>
|
||||
<height>446</height>
|
||||
<y>0</y>
|
||||
<width>507</width>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -514,8 +505,8 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-269</y>
|
||||
<width>503</width>
|
||||
<y>0</y>
|
||||
<width>507</width>
|
||||
<height>698</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -949,11 +940,11 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>519</width>
|
||||
<height>398</height>
|
||||
<width>507</width>
|
||||
<height>485</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_28">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
@ -1163,6 +1154,201 @@ QGroupBox {
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupProxy">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Proxy server</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="ProxyType_lbl">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboProxyType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>(None)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SOCKS4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SOCKS5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTTP</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblProxyIP">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="textProxyIP">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>75</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblProxyPort">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinProxyPort">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8080</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>29</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkProxyAuth">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblProxyUsername">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="textProxyUsername">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblProxyPassword">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="textProxyPassword">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="checkIPFilter">
|
||||
<property name="title">
|
||||
@ -1202,19 +1388,6 @@ QGroupBox {
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -1236,7 +1409,7 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>519</width>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1488,12 +1661,6 @@ QGroupBox {
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="schedule_from">
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="time">
|
||||
<time>
|
||||
<hour>8</hour>
|
||||
@ -1501,6 +1668,12 @@ QGroupBox {
|
||||
<second>0</second>
|
||||
</time>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1515,9 +1688,6 @@ QGroupBox {
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="schedule_to">
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
<property name="time">
|
||||
<time>
|
||||
<hour>20</hour>
|
||||
@ -1525,6 +1695,9 @@ QGroupBox {
|
||||
<second>0</second>
|
||||
</time>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1625,8 +1798,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>552</width>
|
||||
<height>430</height>
|
||||
<width>570</width>
|
||||
<height>422</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@ -1996,424 +2169,6 @@ QGroupBox {
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabOptionPage5">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_5">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>484</width>
|
||||
<height>308</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>HTTP Communications (trackers, Web seeds, search engine)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_27">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="ProxyType_lbl_2">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboProxyType_http">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>(None)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTTP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SOCKS5</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblProxyIP_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="textProxyIP_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>75</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblProxyPort_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinProxyPort_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8080</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>29</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_11">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkProxyAuth_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_10">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblProxyUsername_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="textProxyUsername_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblProxyPassword_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="textProxyPassword_http">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupProxy">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Peer Communications</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="ProxyType_lbl">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboProxyType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>(None)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SOCKS4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SOCKS5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HTTP</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblProxyIP">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="textProxyIP">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>75</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblProxyPort">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinProxyPort">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8080</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>29</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_13">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkProxyAuth">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_12">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblProxyUsername">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="textProxyUsername">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblProxyPassword">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="textProxyPassword">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>180</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabOptionPage7">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
@ -2426,8 +2181,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>386</width>
|
||||
<height>229</height>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
@ -2589,8 +2344,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||
|
@ -234,29 +234,17 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
||||
pref.setEncryptionSetting(m["encryption"].toInt());
|
||||
// Proxy
|
||||
if(m.contains("proxy_type"))
|
||||
pref.setPeerProxyType(m["proxy_type"].toInt());
|
||||
pref.setProxyType(m["proxy_type"].toInt());
|
||||
if(m.contains("proxy_ip"))
|
||||
pref.setPeerProxyIp(m["proxy_ip"].toString());
|
||||
pref.setProxyIp(m["proxy_ip"].toString());
|
||||
if(m.contains("proxy_port"))
|
||||
pref.setPeerProxyPort(m["proxy_port"].toUInt());
|
||||
pref.setProxyPort(m["proxy_port"].toUInt());
|
||||
if(m.contains("proxy_auth_enabled"))
|
||||
pref.setPeerProxyAuthEnabled(m["proxy_auth_enabled"].toBool());
|
||||
pref.setProxyAuthEnabled(m["proxy_auth_enabled"].toBool());
|
||||
if(m.contains("proxy_username"))
|
||||
pref.setPeerProxyUsername(m["proxy_username"].toString());
|
||||
pref.setProxyUsername(m["proxy_username"].toString());
|
||||
if(m.contains("proxy_password"))
|
||||
pref.setPeerProxyPassword(m["proxy_password"].toString());
|
||||
if(m.contains("http_proxy_type"))
|
||||
pref.setHTTPProxyType(m["http_proxy_type"].toInt());
|
||||
if(m.contains("http_proxy_ip"))
|
||||
pref.setHTTPProxyIp(m["http_proxy_ip"].toString());
|
||||
if(m.contains("http_proxy_port"))
|
||||
pref.setHTTPProxyPort(m["http_proxy_port"].toUInt());
|
||||
if(m.contains("http_proxy_auth_enabled"))
|
||||
pref.setHTTPProxyAuthEnabled(m["http_proxy_auth_enabled"].toBool());
|
||||
if(m.contains("http_proxy_username"))
|
||||
pref.setHTTPProxyUsername(m["http_proxy_username"].toString());
|
||||
if(m.contains("http_proxy_password"))
|
||||
pref.setHTTPProxyPassword(m["http_proxy_password"].toString());
|
||||
pref.setProxyPassword(m["proxy_password"].toString());
|
||||
// IP Filter
|
||||
if(m.contains("ip_filter_enabled"))
|
||||
pref.setFilteringEnabled(m["ip_filter_enabled"].toBool());
|
||||
@ -320,18 +308,12 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
||||
data["lsd"] = pref.isLSDEnabled();
|
||||
data["encryption"] = pref.getEncryptionSetting();
|
||||
// Proxy
|
||||
data["proxy_type"] = pref.getPeerProxyType();
|
||||
data["proxy_ip"] = pref.getPeerProxyIp();
|
||||
data["proxy_port"] = pref.getPeerProxyPort();
|
||||
data["proxy_auth_enabled"] = pref.isPeerProxyAuthEnabled();
|
||||
data["proxy_username"] = pref.getPeerProxyUsername();
|
||||
data["proxy_password"] = pref.getPeerProxyPassword();
|
||||
data["http_proxy_type"] = pref.getHTTPProxyType();
|
||||
data["http_proxy_ip"] = pref.getHTTPProxyIp();
|
||||
data["http_proxy_port"] = pref.getHTTPProxyPort();
|
||||
data["http_proxy_auth_enabled"] = pref.isHTTPProxyAuthEnabled();
|
||||
data["http_proxy_username"] = pref.getHTTPProxyUsername();
|
||||
data["http_proxy_password"] = pref.getHTTPProxyPassword();
|
||||
data["proxy_type"] = pref.getProxyType();
|
||||
data["proxy_ip"] = pref.getProxyIp();
|
||||
data["proxy_port"] = pref.getProxyPort();
|
||||
data["proxy_auth_enabled"] = pref.isProxyAuthEnabled();
|
||||
data["proxy_username"] = pref.getProxyUsername();
|
||||
data["proxy_password"] = pref.getProxyPassword();
|
||||
// IP Filter
|
||||
data["ip_filter_enabled"] = pref.isFilteringEnabled();
|
||||
data["ip_filter_path"] = pref.getFilter();
|
||||
|
@ -172,25 +172,7 @@
|
||||
</div>
|
||||
|
||||
<div id="ProxyTab" class="PrefTab invisible">
|
||||
<fieldset>
|
||||
<legend><b>_(HTTP Communications (trackers, Web seeds, search engine))</b></legend>
|
||||
<div style="padding-left: 30px;">
|
||||
_(Type:) <select id ="http_proxy_type_select" onchange="updateHTTPProxySettings();">
|
||||
<option value="none">_((None))</option>
|
||||
<option value="http">_(HTTP)</option>
|
||||
<option value="socks5">_(SOCKS5)</option>
|
||||
</select>
|
||||
_(Host:) <input type="text" id="http_proxy_host_text" />
|
||||
_(Port:) <input type="text" id="http_proxy_port_value" style="width: 4em;"/><br/><br/>
|
||||
<input type="checkbox" id="http_proxy_auth_checkbox" onclick="updateHTTPProxyAuthSettings();" /> _(Authentication)<br/>
|
||||
<table>
|
||||
<tr><td style="padding-left: 10px;">_(Username:)</td><td><input type="text" id="http_proxy_username_text" /></td></tr>
|
||||
<tr><td style="padding-left: 10px;">_(Password:)</td><td><input type="password" id="http_proxy_password_text" /></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><b>_(Peer Communications)</b></legend>
|
||||
<legend><b>_(Proxy server)</b></legend>
|
||||
<div style="padding-left: 30px;">
|
||||
_(Type:) <select id ="peer_proxy_type_select" onchange="updatePeerProxySettings();">
|
||||
<option value="none">_((None))</option>
|
||||
@ -394,31 +376,6 @@
|
||||
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked'))
|
||||
ip_filter_enabled = 1;
|
||||
var ip_filter_path = $('ipfilter_text').get('value');
|
||||
// HTTP Proxy
|
||||
var http_proxy_type_str = $('http_proxy_type_select').get('value');
|
||||
var http_proxy_type = -1;
|
||||
var http_proxy_auth_enabled = 0;
|
||||
if(http_proxy_type_str == "http") {
|
||||
if($defined($('http_proxy_auth_checkbox').get('checked')) && $('http_proxy_auth_checkbox').get('checked')) {
|
||||
http_proxy_type = 3;
|
||||
http_proxy_auth_enabled = 1;
|
||||
} else {
|
||||
http_proxy_type = 1;
|
||||
}
|
||||
} else {
|
||||
if(http_proxy_type_str == "socks5") {
|
||||
if($defined($('http_proxy_auth_checkbox').get('checked')) && $('http_proxy_auth_checkbox').get('checked')) {
|
||||
http_proxy_type = 4;
|
||||
http_proxy_auth_enabled = 1;
|
||||
} else {
|
||||
http_proxy_type = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
var http_proxy_ip = $('http_proxy_host_text').get('value');
|
||||
var http_proxy_port = $('http_proxy_port_value').get('value');
|
||||
var http_proxy_username = $('http_proxy_username_text').get('value');
|
||||
var http_proxy_password = $('http_proxy_password_text').get('value');
|
||||
// Peer Proxy
|
||||
var proxy_type_str = $('peer_proxy_type_select').get('value');
|
||||
var proxy_type = -1;
|
||||
@ -515,12 +472,6 @@
|
||||
dict.set('proxy_auth_enabled', proxy_auth_enabled);
|
||||
dict.set('proxy_username', proxy_username);
|
||||
dict.set('proxy_password', proxy_password);
|
||||
dict.set('http_proxy_type', http_proxy_type);
|
||||
dict.set('http_proxy_ip', http_proxy_ip);
|
||||
dict.set('http_proxy_port', http_proxy_port);
|
||||
dict.set('http_proxy_auth_enabled', http_proxy_auth_enabled);
|
||||
dict.set('http_proxy_username', http_proxy_username);
|
||||
dict.set('http_proxy_password', http_proxy_password);
|
||||
// Web UI
|
||||
dict.set('web_ui_port', webui_port);
|
||||
dict.set('web_ui_username', webui_username);
|
||||
@ -655,29 +606,6 @@ updateDHTPortSettings = function() {
|
||||
}
|
||||
}
|
||||
|
||||
updateHTTPProxySettings = function() {
|
||||
if($('http_proxy_type_select').get('value') != "none") {
|
||||
$('http_proxy_host_text').removeProperty('disabled');
|
||||
$('http_proxy_port_value').removeProperty('disabled');
|
||||
$('http_proxy_auth_checkbox').removeProperty('disabled');
|
||||
} else {
|
||||
$('http_proxy_host_text').set('disabled', 'true');
|
||||
$('http_proxy_port_value').set('disabled', 'true');
|
||||
$('http_proxy_auth_checkbox').set('disabled', 'true');
|
||||
$('http_proxy_auth_checkbox').removeProperty('checked');
|
||||
}
|
||||
}
|
||||
|
||||
updateHTTPProxyAuthSettings = function() {
|
||||
if($defined($('http_proxy_auth_checkbox').get('checked')) && $('http_proxy_auth_checkbox').get('checked')) {
|
||||
$('http_proxy_username_text').removeProperty('disabled');
|
||||
$('http_proxy_password_text').removeProperty('disabled');
|
||||
} else {
|
||||
$('http_proxy_username_text').set('disabled', 'true');
|
||||
$('http_proxy_password_text').set('disabled', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
updatePeerProxySettings = function() {
|
||||
if($('peer_proxy_type_select').get('value') != "none") {
|
||||
$('peer_proxy_host_text').removeProperty('disabled');
|
||||
@ -962,30 +890,6 @@ loadPreferences = function() {
|
||||
updatePeerProxyAuthSettings();
|
||||
$('peer_proxy_username_text').set('value', pref.proxy_username);
|
||||
$('peer_proxy_password_text').set('value', pref.proxy_password);
|
||||
// HTTP PROXY
|
||||
switch(pref.http_proxy_type.toInt()) {
|
||||
case 1: //HTTP
|
||||
case 3: // HTTP_PW
|
||||
$('http_proxy_type_select').set('value', 'http');
|
||||
break;
|
||||
case 2: // SOCKS5
|
||||
case 4: // SOCKS5_PW
|
||||
$('http_proxy_type_select').set('value', 'socks5');
|
||||
break;
|
||||
default: // NONE
|
||||
$('http_proxy_type_select').set('value', 'none');
|
||||
}
|
||||
updateHTTPProxySettings();
|
||||
$('http_proxy_host_text').set('value', pref.http_proxy_ip);
|
||||
$('http_proxy_port_value').set('value', pref.http_proxy_port);
|
||||
if(pref.http_proxy_auth_enabled) {
|
||||
$('http_proxy_auth_checkbox').set('checked', 'checked');
|
||||
} else {
|
||||
$('http_proxy_auth_checkbox').removeProperty('checked');
|
||||
}
|
||||
updateHTTPProxyAuthSettings();
|
||||
$('http_proxy_username_text').set('value', pref.http_proxy_username);
|
||||
$('http_proxy_password_text').set('value', pref.http_proxy_password);
|
||||
// Web UI
|
||||
$('webui_port_value').set('value', pref.web_ui_port);
|
||||
$('webui_username_text').set('value', pref.web_ui_username);
|
||||
|
Loading…
x
Reference in New Issue
Block a user