diff --git a/Changelog b/Changelog index da0d3f5b6..53e3a1b56 100644 --- a/Changelog +++ b/Changelog @@ -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 diff --git a/src/downloadthread.cpp b/src/downloadthread.cpp index c17b5b651..c4251f0e1 100644 --- a/src/downloadthread.cpp +++ b/src/downloadthread.cpp @@ -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); } diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 81324d017..65cbbf78d 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -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()); diff --git a/src/options_imp.h b/src/options_imp.h index be43f2444..68758167d 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -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); diff --git a/src/preferences.h b/src/preferences.h index 925f23a93..bbc556520 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -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); } diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index f0fe86a5e..2d446b3fb 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -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: diff --git a/src/qtlibtorrent/qbtsession.h b/src/qtlibtorrent/qbtsession.h index 91553255d..22024c344 100644 --- a/src/qtlibtorrent/qbtsession.h +++ b/src/qtlibtorrent/qbtsession.h @@ -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); diff --git a/src/ui/options.ui b/src/ui/options.ui index 2263f37d0..a644d0814 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -155,15 +155,6 @@ ItemIsSelectable|ItemIsEnabled - - - Proxy - - - - :/Icons/oxygen/proxy.png:/Icons/oxygen/proxy.png - - Web UI @@ -210,9 +201,9 @@ 0 - -40 - 503 - 446 + 0 + 507 + 430 @@ -514,8 +505,8 @@ 0 - -269 - 503 + 0 + 507 698 @@ -949,11 +940,11 @@ QGroupBox { 0 0 - 519 - 398 + 507 + 485 - + @@ -1163,6 +1154,201 @@ QGroupBox { + + + + true + + + Proxy server + + + + + + + + Type: + + + + + + + + (None) + + + + + SOCKS4 + + + + + SOCKS5 + + + + + HTTP + + + + + + + + false + + + Host: + + + + + + + false + + + + + + 75 + + + QLineEdit::Normal + + + + + + + false + + + Port: + + + + + + + false + + + 1 + + + 65535 + + + 8080 + + + + + + + Qt::Horizontal + + + + 21 + 29 + + + + + + + + + + + + false + + + Authentication + + + + + + + + + false + + + Username: + + + + + + + false + + + + + + 1000 + + + QLineEdit::Normal + + + + + + + false + + + Password: + + + + + + + false + + + + + + 1000 + + + QLineEdit::Password + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + @@ -1202,19 +1388,6 @@ QGroupBox { - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -1236,7 +1409,7 @@ QGroupBox { 0 0 - 519 + 524 406 @@ -1488,12 +1661,6 @@ QGroupBox { - - hh:mm - - - false - + + hh:mm + + + false + @@ -1515,9 +1688,6 @@ QGroupBox { - - hh:mm - + + hh:mm + @@ -1625,8 +1798,8 @@ QGroupBox { 0 0 - 552 - 430 + 570 + 422 @@ -1996,453 +2169,35 @@ QGroupBox { - + - + true - + 0 0 - 484 - 308 + 524 + 406 - + - + - HTTP Communications (trackers, Web seeds, search engine) + Enable Web User Interface (Remote control) + + + true - - - - - - - Type: - - - - - - - - (None) - - - - - HTTP - - - - - SOCKS5 - - - - - - - - false - - - Host: - - - - - - - false - - - - - - 75 - - - QLineEdit::Normal - - - - - - - false - - - Port: - - - - - - - false - - - 1 - - - 65535 - - - 8080 - - - - - - - Qt::Horizontal - - - - 21 - 29 - - - - - - - - - - - - false - - - Authentication - - - - - - - - - false - - - Username: - - - - - - - false - - - - - - 1000 - - - QLineEdit::Normal - - - - - - - false - - - Password: - - - - - - - false - - - - - - 1000 - - - QLineEdit::Password - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - true - - - Peer Communications - - - - - - - - Type: - - - - - - - - (None) - - - - - SOCKS4 - - - - - SOCKS5 - - - - - HTTP - - - - - - - - false - - - Host: - - - - - - - false - - - - - - 75 - - - QLineEdit::Normal - - - - - - - false - - - Port: - - - - - - - false - - - 1 - - - 65535 - - - 8080 - - - - - - - Qt::Horizontal - - - - 21 - 29 - - - - - - - - - - - - false - - - Authentication - - - - - - - - - false - - - Username: - - - - - - - false - - - - - - 1000 - - - QLineEdit::Normal - - - - - - - false - - - Password: - - - - - - - false - - - - - - 1000 - - - QLineEdit::Password - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 180 - - - - - - - - - - - - - - - - true - - - - - 0 - 0 - 386 - 229 - - - - - - - Enable Web User Interface (Remote control) - - - true - - - false - - + + false + + @@ -2589,8 +2344,8 @@ QGroupBox { 0 0 - 98 - 28 + 524 + 406 diff --git a/src/webui/eventmanager.cpp b/src/webui/eventmanager.cpp index 1f6c01608..78d2b3117 100644 --- a/src/webui/eventmanager.cpp +++ b/src/webui/eventmanager.cpp @@ -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(); diff --git a/src/webui/html/preferences_content.html b/src/webui/html/preferences_content.html index 03b86672a..011bd8858 100644 --- a/src/webui/html/preferences_content.html +++ b/src/webui/html/preferences_content.html @@ -172,25 +172,7 @@