Browse Source

- Peer Exchange can be disabled from preferences

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
755b8dec30
  1. 1
      Changelog
  2. 12
      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 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.0 * Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
- FEATURE: Torrents can be labeled/categorized - FEATURE: Torrents can be labeled/categorized
- FEATURE: Disk cache size can be set from preferences - 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 * Thu Dec 10 2009 - Christophe Dumez <chris@qbittorrent.org> - v2.0.0
- FEATURE: Added program option to disable splash screen - FEATURE: Added program option to disable splash screen

12
src/bittorrent.cpp

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

1
src/bittorrent.h

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

3
src/options_imp.cpp

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

5
src/preferences.h

@ -348,6 +348,11 @@ public:
return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHT"), true).toBool(); 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) { static void setDHTEnabled(bool enabled) {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Bittorrent/DHT"), enabled); settings.setValue(QString::fromUtf8("Preferences/Bittorrent/DHT"), enabled);

18
src/ui/options.ui

@ -639,7 +639,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>642</width> <width>642</width>
<height>457</height> <height>472</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
@ -1125,7 +1125,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>451</width> <width>602</width>
<height>513</height> <height>513</height>
</rect> </rect>
</property> </property>
@ -1546,8 +1546,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>468</width> <width>620</width>
<height>347</height> <height>490</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_19"> <layout class="QVBoxLayout" name="verticalLayout_19">
@ -1636,6 +1636,16 @@
</item> </item>
</layout> </layout>
</item> </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> <item>
<widget class="QCheckBox" name="checkLSD"> <widget class="QCheckBox" name="checkLSD">
<property name="text"> <property name="text">

Loading…
Cancel
Save