Browse Source

- Peer Exchange can be disabled from preferences

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
755b8dec30
  1. 1
      Changelog
  2. 16
      src/bittorrent.cpp
  3. 1
      src/bittorrent.h
  4. 3
      src/options_imp.cpp
  5. 5
      src/preferences.h
  6. 18
      src/ui/options.ui

1
Changelog

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
- FEATURE: Torrents can be labeled/categorized
- FEATURE: Disk cache size can be set from preferences
- FEATURE: Peer Exchange (PeX) can be disabled from preferences
* Thu Dec 10 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.0
- FEATURE: Added program option to disable splash screen

16
src/bittorrent.cpp

@ -88,7 +88,12 @@ Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit @@ -88,7 +88,12 @@ Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit
#ifdef LIBTORRENT_0_15
s->add_extension(create_lt_trackers_plugin);
#endif
s->add_extension(&create_ut_pex_plugin);
if(Preferences::isPeXEnabled()) {
PeXEnabled = true;
s->add_extension(&create_ut_pex_plugin);
} else {
PeXEnabled = false;
}
s->add_extension(&create_smart_ban_plugin);
timerAlerts = new QTimer();
connect(timerAlerts, SIGNAL(timeout()), this, SLOT(readAlerts()));
@ -361,7 +366,14 @@ void Bittorrent::configureSession() { @@ -361,7 +366,14 @@ void Bittorrent::configureSession() {
addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
}
// * PeX
addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue"));
if(PeXEnabled) {
addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue"));
} else {
addConsoleMessage(tr("PeX support [OFF]"), QString::fromUtf8("red"));
}
if(PeXEnabled != Preferences::isPeXEnabled()) {
addConsoleMessage(tr("Restart is required to toggle PeX support"), QString::fromUtf8("red"));
}
// * LSD
if(Preferences::isLSDEnabled()) {
enableLSD(true);

1
src/bittorrent.h

@ -107,6 +107,7 @@ private: @@ -107,6 +107,7 @@ private:
bool NATPMPEnabled;
bool LSDEnabled;
bool DHTEnabled;
bool PeXEnabled;
bool queueingEnabled;
QString defaultSavePath;
QString defaultTempPath;

3
src/options_imp.cpp

@ -214,6 +214,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -214,6 +214,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(spinMaxConnecPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkPeX, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDifferentDHTPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinDHTPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkLSD, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -427,6 +428,7 @@ void options_imp::saveOptions(){ @@ -427,6 +428,7 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("MaxConnecsPerTorrent"), getMaxConnecsPerTorrent());
settings.setValue(QString::fromUtf8("MaxUploadsPerTorrent"), getMaxUploadsPerTorrent());
settings.setValue(QString::fromUtf8("DHT"), isDHTEnabled());
settings.setValue(QString::fromUtf8("PeX"), checkPeX->isChecked());
settings.setValue(QString::fromUtf8("sameDHTPortAsBT"), isDHTPortSameAsBT());
settings.setValue(QString::fromUtf8("DHTPort"), getDHTPort());
settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled());
@ -713,6 +715,7 @@ void options_imp::loadOptions(){ @@ -713,6 +715,7 @@ void options_imp::loadOptions(){
checkDifferentDHTPort->setChecked(!Preferences::isDHTPortSameAsBT());
enableDHTPortSettings(checkDifferentDHTPort->isChecked());
spinDHTPort->setValue(Preferences::getDHTPort());
checkPeX->setChecked(Preferences::isPeXEnabled());
checkLSD->setChecked(Preferences::isLSDEnabled());
checkAzureusSpoof->setChecked(Preferences::isUtorrentSpoofingEnabled());
comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting());

5
src/preferences.h

@ -348,6 +348,11 @@ public: @@ -348,6 +348,11 @@ public:
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHT"), true).toBool();
}
static bool isPeXEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Bittorrent/PeX"), true).toBool();
}
static void setDHTEnabled(bool enabled) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Bittorrent/DHT"), enabled);

18
src/ui/options.ui

@ -639,7 +639,7 @@ @@ -639,7 +639,7 @@
<x>0</x>
<y>0</y>
<width>642</width>
<height>457</height>
<height>472</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
@ -1125,7 +1125,7 @@ @@ -1125,7 +1125,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>451</width>
<width>602</width>
<height>513</height>
</rect>
</property>
@ -1546,8 +1546,8 @@ @@ -1546,8 +1546,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>347</height>
<width>620</width>
<height>490</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_19">
@ -1636,6 +1636,16 @@ @@ -1636,6 +1636,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkPeX">
<property name="text">
<string>Enable Peer Exchange / PeX (requires restart)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkLSD">
<property name="text">

Loading…
Cancel
Save