Browse Source

- Supports SOCKS5 proxies as well as HTTP ones

- Allow to use Proxy for Trackers / Peers / Web seeds / DHT connections
- Redesigned Proxy options a little (for new features)
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
2196fcc911
  1. 11
      Changelog
  2. 17
      src/GUI.cpp
  3. 10
      src/bittorrent.cpp
  4. 2
      src/bittorrent.h
  5. 123
      src/options.ui
  6. 52
      src/options_imp.cpp
  7. 10
      src/options_imp.h

11
Changelog

@ -12,13 +12,22 @@ @@ -12,13 +12,22 @@
- FEATURE: Improved a lot the torrent creation module
- FEATURE: Allow to set upload/download limit per torrent (right click)
- FEATURE: Ask for exit confirmation only if download list is not empty
- FEATURE: Proxy is now used for tracker / web seeds / peers connections
- FEATURE: Allow to use a proxy for trackers / web seeds / peers / DHT connections
- FEATURE: Supports SOCKS5 proxies as well as HTTP ones
- FEATURE: Better systems integration (buttons, dialogs...)
- FEATURE: Fileted files are not allocated on the hard-drive anymore (if FS is compatible)
- COSMETIC: Redesigned torrent properties a little
- COSMETIC: Redesigned options a little
- COSMETIC: Display more logs messages concerning features
* Mon May 07 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.3
- BUGFIX: Fixed pause toggle on double-click in download list
- BUGFIX: The torrent size displayed now only takes unfiltered files into account
- BUGFIX: Fixed compiling errors with libtorrent svn (future v0.13 with UPnP enabled)
- BUGFIX: Remember sorted column in download list on restart
- BUGFIX: Small fix in the german translation
- BUGFIX: Some fixes in slovak translation
* Tue Apr 10 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.2
- BUGFIX: Window can now stay maximized on exit
- BUGFIX: Use PKGCONFIG again for configuring libtorrent

17
src/GUI.cpp

@ -1219,16 +1219,27 @@ void GUI::configureSession(bool deleteOptions){ @@ -1219,16 +1219,27 @@ void GUI::configureSession(bool deleteOptions){
}
// Apply Proxy settings
if(options->isProxyEnabled()){
switch(options->getProxyType()){
case HTTP_PW:
proxySettings.type = proxy_settings::http_pw;
break;
case SOCKS5:
proxySettings.type = proxy_settings::socks5;
break;
case SOCKS5_PW:
proxySettings.type = proxy_settings::socks5_pw;
break;
default:
proxySettings.type = proxy_settings::http;
}
proxySettings.hostname = options->getProxyIp().toStdString();
proxySettings.port = options->getProxyPort();
proxySettings.type = proxy_settings::http;
if(options->isProxyAuthEnabled()){
proxySettings.username = options->getProxyUsername().toStdString();
proxySettings.password = options->getProxyPassword().toStdString();
proxySettings.type = proxy_settings::http_pw;
}
}
BTSession.setProxySettings(proxySettings);
BTSession.setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT());
sessionSettings.user_agent = "qBittorrent "VERSION;
BTSession.setSessionSettings(sessionSettings);
// Scan dir stuff

10
src/bittorrent.cpp

@ -681,10 +681,16 @@ void bittorrent::setSessionSettings(session_settings sessionSettings){ @@ -681,10 +681,16 @@ void bittorrent::setSessionSettings(session_settings sessionSettings){
}
// Set Proxy
void bittorrent::setProxySettings(proxy_settings proxySettings){
void bittorrent::setProxySettings(proxy_settings proxySettings, bool trackers, bool peers, bool web_seeds, bool dht){
if(trackers)
s->set_tracker_proxy(proxySettings);
if(peers)
s->set_peer_proxy(proxySettings);
if(web_seeds)
s->set_web_seed_proxy(proxySettings);
s->set_tracker_proxy(proxySettings);
if(DHTEnabled && dht){
s->set_dht_proxy(proxySettings);
}
}
// Read alerts sent by the bittorrent session

2
src/bittorrent.h

@ -116,7 +116,7 @@ class bittorrent : public QObject{ @@ -116,7 +116,7 @@ class bittorrent : public QObject{
void setUploadRateLimit(int rate);
void setGlobalRatio(float ratio);
void setDHTPort(int dht_port);
void setProxySettings(proxy_settings proxySettings);
void setProxySettings(proxy_settings proxySettings, bool trackers=true, bool peers=true, bool web_seeds=true, bool dht=true);
void setSessionSettings(session_settings sessionSettings);
void setDefaultSavePath(const QString& savepath);
#ifndef NO_UPNP

123
src/options.ui

@ -1248,7 +1248,7 @@ @@ -1248,7 +1248,7 @@
<item>
<widget class="QLabel" name="lbl_ip" >
<property name="text" >
<string>Server IP:</string>
<string>Server IP or url:</string>
</property>
</widget>
</item>
@ -1310,6 +1310,50 @@ @@ -1310,6 +1310,50 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="serverType_lbl" >
<property name="text" >
<string>Proxy type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboProxyType" >
<item>
<property name="text" >
<string>HTTP</string>
</property>
</item>
<item>
<property name="text" >
<string>SOCKS5</string>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="enableProxyAuth_checkBox" >
<property name="text" >
@ -1405,6 +1449,83 @@ @@ -1405,6 +1449,83 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupProxyConnec" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>110</height>
</size>
</property>
<property name="title" >
<string>Affected connections</string>
</property>
<widget class="QCheckBox" name="checkProxyTrackers" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>341</width>
<height>22</height>
</rect>
</property>
<property name="text" >
<string>Use proxy for connections to trackers</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkProxyPeers" >
<property name="geometry" >
<rect>
<x>10</x>
<y>40</y>
<width>341</width>
<height>22</height>
</rect>
</property>
<property name="text" >
<string>Use proxy for connections to regular peers</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkProxyWebseeds" >
<property name="geometry" >
<rect>
<x>10</x>
<y>60</y>
<width>341</width>
<height>22</height>
</rect>
</property>
<property name="text" >
<string>Use proxy for connections to web seeds</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkProxyDHT" >
<property name="geometry" >
<rect>
<x>10</x>
<y>80</y>
<width>341</width>
<height>22</height>
</rect>
</property>
<property name="text" >
<string>Use proxy for DHT messages</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >

52
src/options_imp.cpp

@ -190,6 +190,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -190,6 +190,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(proxy_ip, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(proxy_username, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(proxy_password, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(comboProxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyTrackers, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyPeers, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyWebseeds, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(checkProxyDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
// Misc Settings
connect(checkAdditionDialog, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(txt_savePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@ -299,6 +304,16 @@ void options_imp::saveOptions(){ @@ -299,6 +304,16 @@ void options_imp::saveOptions(){
if(enabled){
settings.setValue("IP", getProxyIp());
settings.setValue("Port", getProxyPort());
unsigned short val = getProxyType();
if(val == HTTP || val == HTTP_PW){
settings.setValue("ProxyType", HTTP);
}else{
settings.setValue("ProxyType", SOCKS5);
}
settings.setValue("UseProxyForTrackers", useProxyForTrackers());
settings.setValue("UseProxyForPeers", useProxyForPeers());
settings.setValue("UseProxyForWebseeds", useProxyForWebseeds());
settings.setValue("UseProxyForDHT", useProxyForDHT());
enabled = isProxyAuthEnabled();
settings.beginGroup("Authentication");
settings.setValue("Enabled", enabled);
@ -347,6 +362,38 @@ bool options_imp::isFilteringEnabled() const{ @@ -347,6 +362,38 @@ bool options_imp::isFilteringEnabled() const{
return activateFilter->isChecked();
}
unsigned short options_imp::getProxyType() const{
if(comboProxyType->currentIndex() == HTTP){
if(isProxyAuthEnabled()){
return HTTP_PW;
}else{
return HTTP;
}
}else{
if(isProxyAuthEnabled()){
return SOCKS5_PW;
}else{
return SOCKS5;
}
}
}
bool options_imp::useProxyForTrackers() const{
return checkProxyTrackers->isChecked();
}
bool options_imp::useProxyForPeers() const{
return checkProxyPeers->isChecked();
}
bool options_imp::useProxyForWebseeds() const{
return checkProxyWebseeds->isChecked();
}
bool options_imp::useProxyForDHT() const{
return checkProxyDHT->isChecked();
}
QString options_imp::getStyle() const{
if(radioPlastiqueStyle->isChecked()) return "Plastique";
if(radioCleanlooksStyle->isChecked()) return "Cleanlooks";
@ -522,6 +569,11 @@ void options_imp::loadOptions(){ @@ -522,6 +569,11 @@ void options_imp::loadOptions(){
groupProxy->setEnabled(true);
proxy_ip->setText(strValue);
proxy_port->setValue(settings.value("Port", 8080).toInt());
comboProxyType->setCurrentIndex(settings.value("ProxyType", HTTP).toInt());
checkProxyTrackers->setChecked(settings.value("useProxyForTrackers", true).toBool());
checkProxyPeers->setChecked(settings.value("useProxyForPeers", true).toBool());
checkProxyWebseeds->setChecked(settings.value("useProxyForWebseeds", true).toBool());
checkProxyDHT->setChecked(settings.value("useProxyForDHT", true).toBool());
settings.beginGroup("Authentication");
if(settings.value("Enabled", false).toBool()){
enableProxyAuth_checkBox->setChecked(true);

10
src/options_imp.h

@ -27,6 +27,11 @@ @@ -27,6 +27,11 @@
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
#define HTTP 0
#define SOCKS5 1
#define HTTP_PW 2
#define SOCKS5_PW 3
using namespace libtorrent;
class options_imp : public QDialog, private Ui::Dialog{
@ -69,6 +74,11 @@ class options_imp : public QDialog, private Ui::Dialog{ @@ -69,6 +74,11 @@ class options_imp : public QDialog, private Ui::Dialog{
unsigned short getProxyPort() const;
QString getProxyUsername() const;
QString getProxyPassword() const;
unsigned short getProxyType() const;
bool useProxyForTrackers() const;
bool useProxyForPeers() const;
bool useProxyForWebseeds() const;
bool useProxyForDHT() const;
// Language Settings
QString getLocale() const;
// Misc Settings

Loading…
Cancel
Save