diff --git a/TODO b/TODO
index 50d819f76..0a4cfd42d 100644
--- a/TODO
+++ b/TODO
@@ -36,7 +36,6 @@
// In v0.9.0
- Wait for libtorrent v0.12 official release
-- Add an option to disable Peer Exchange (PeX)
- Move deletion from hard drive to a thread to avoid GUI freezing
- Should create options dialog only when needed to save up some memory
- Download from RSS feeds
\ No newline at end of file
diff --git a/src/GUI.cpp b/src/GUI.cpp
index 52ebdfe6b..78a970727 100644
--- a/src/GUI.cpp
+++ b/src/GUI.cpp
@@ -66,7 +66,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
QCoreApplication::setApplicationName("qBittorrent");
readSettings();
s = new session(fingerprint("qB", VERSION_MAJOR, VERSION_MINOR, VERSION_BUGFIX, 0));
- //s = new session(fingerprint("AZ", 2, 5, 0, 0)); //Azureus fingerprint
+
// Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/qbittorrent32.png")));
actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.png")));
@@ -124,14 +124,11 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
connect(timerScan, SIGNAL(timeout()), this, SLOT(scanDirectory()));
// Set severity level of libtorrent session
s->set_severity_level(alert::info);
- // To avoid some exceptions
- fs::path::default_name_check(fs::no_check);
// DHT (Trackerless)
DHTEnabled = false;
// Configure BT session according to options
configureSession();
s->add_extension(&create_metadata_plugin);
- s->add_extension(&create_ut_pex_plugin);
// download thread
downloader = new downloadThread(this);
connect(downloader, SIGNAL(downloadFinished(QString, QString, int, QString)), this, SLOT(processDownloadedFile(QString, QString, int, QString)));
@@ -1585,6 +1582,12 @@ void GUI::configureSession(){
qDebug("Disabling DHT Support");
}
}
+ if(!options->isPeXDisabled()){
+ qDebug("Enabling Peer eXchange (PeX)");
+ s->add_extension(&create_ut_pex_plugin);
+ }else{
+ qDebug("Peer eXchange (PeX) disabled");
+ }
int dht_port = options->getDHTPort();
if(dht_port >= 1000){
struct dht_settings DHTSettings;
@@ -1610,7 +1613,6 @@ void GUI::configureSession(){
}
}
proxySettings.user_agent = "qBittorrent "VERSION;
- //proxySettings.user_agent = "Azureus";
s->set_settings(proxySettings);
// Scan dir stuff
if(options->getScanDir().isNull()){
diff --git a/src/options.ui b/src/options.ui
index 82c84d2e6..161892670 100644
--- a/src/options.ui
+++ b/src/options.ui
@@ -505,7 +505,7 @@
-
- Disable DHT (Trackerless) support
+ Disable DHT (Trackerless)
@@ -573,6 +573,13 @@
+ -
+
+
+ Disable Peer eXchange (PeX)
+
+
+
@@ -633,19 +640,6 @@
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
diff --git a/src/options_imp.cpp b/src/options_imp.cpp
index 5c4a6937c..8cff3bde8 100644
--- a/src/options_imp.cpp
+++ b/src/options_imp.cpp
@@ -123,6 +123,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(enableScan_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disableMaxConnec, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(disableDHT, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
+ connect(disablePeX, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(spin_dht_port, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
// Language
connect(combo_i18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
@@ -169,6 +170,7 @@ void options_imp::saveOptions(){
settings.setValue("PortRangeMax", getPorts().second);
settings.setValue("ShareRatio", getRatio());
settings.setValue("DHTPort", getDHTPort());
+ settings.setValue("PeXState", isPeXDisabled());
settings.setValue("ScanDir", getScanDir());
// End Main options
settings.endGroup();
@@ -244,6 +246,7 @@ bool options_imp::isFilteringEnabled() const{
void options_imp::loadOptions(){
int value;
float floatValue;
+ bool boolValue;
QString strValue;
QSettings settings("qBittorrent", "qBittorrent");
// Check if min port < max port
@@ -301,6 +304,14 @@ void options_imp::loadOptions(){
}
spin_dht_port->setValue(value);
}
+ boolValue = settings.value("PeXState", 0).toBool();
+ if(value){
+ // Pex disabled
+ disablePeX->setChecked(true);
+ }else{
+ // PeX enabled
+ disablePeX->setChecked(false);
+ }
strValue = settings.value("ScanDir", QString()).toString();
if(!strValue.isEmpty()){
enableScan_checkBox->setChecked(true);
@@ -434,6 +445,9 @@ bool options_imp::isDHTEnabled() const{
return !disableDHT->isChecked();
}
+bool options_imp::isPeXDisabled() const{
+ return disablePeX->isChecked();
+}
// Return Download & Upload limits
// [download,upload]
QPair options_imp::getLimits() const{
diff --git a/src/options_imp.h b/src/options_imp.h
index a510d3263..d57d78fbd 100644
--- a/src/options_imp.h
+++ b/src/options_imp.h
@@ -52,6 +52,7 @@ class options_imp : public QDialog, private Ui::Dialog{
QString getScanDir() const;
bool isDHTEnabled() const;
int getDHTPort() const;
+ bool isPeXDisabled() const;
// Filter Settings
bool isFilteringEnabled() const;
ip_filter getFilter() const;