mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Remove deprecated feature of separate DHT port.
This commit is contained in:
parent
08e14cdc26
commit
e2748ec3ac
@ -1948,73 +1948,13 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="checkDHT">
|
<widget class="QCheckBox" name="checkDHT">
|
||||||
<property name="title">
|
<property name="text">
|
||||||
<string>Enable DHT (decentralized network) to find more peers</string>
|
<string>Enable DHT (decentralized network) to find more peers</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="checkDifferentDHTPort">
|
|
||||||
<property name="title">
|
|
||||||
<string>Use a different port for DHT and BitTorrent</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="dh_port_lbl">
|
|
||||||
<property name="text">
|
|
||||||
<string>DHT port:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinDHTPort">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>65525</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>6881</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -206,8 +206,6 @@ options_imp::options_imp(QWidget *parent):
|
|||||||
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkPeX, 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()));
|
connect(checkLSD, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(comboEncryption, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
connect(comboEncryption, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
@ -432,8 +430,6 @@ void options_imp::saveOptions() {
|
|||||||
pref.setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
pref.setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
||||||
pref.setDHTEnabled(isDHTEnabled());
|
pref.setDHTEnabled(isDHTEnabled());
|
||||||
pref.setPeXEnabled(checkPeX->isChecked());
|
pref.setPeXEnabled(checkPeX->isChecked());
|
||||||
pref.setDHTPortSameAsBT(isDHTPortSameAsBT());
|
|
||||||
pref.setDHTPort(getDHTPort());
|
|
||||||
pref.setLSDEnabled(isLSDEnabled());
|
pref.setLSDEnabled(isLSDEnabled());
|
||||||
pref.setEncryptionSetting(getEncryptionSetting());
|
pref.setEncryptionSetting(getEncryptionSetting());
|
||||||
pref.enableAnonymousMode(checkAnonymousMode->isChecked());
|
pref.enableAnonymousMode(checkAnonymousMode->isChecked());
|
||||||
@ -695,8 +691,6 @@ void options_imp::loadOptions() {
|
|||||||
spinMaxUploadsPerTorrent->setEnabled(false);
|
spinMaxUploadsPerTorrent->setEnabled(false);
|
||||||
}
|
}
|
||||||
checkDHT->setChecked(pref.isDHTEnabled());
|
checkDHT->setChecked(pref.isDHTEnabled());
|
||||||
checkDifferentDHTPort->setChecked(!pref.isDHTPortSameAsBT());
|
|
||||||
spinDHTPort->setValue(pref.getDHTPort());
|
|
||||||
checkPeX->setChecked(pref.isPeXEnabled());
|
checkPeX->setChecked(pref.isPeXEnabled());
|
||||||
checkLSD->setChecked(pref.isLSDEnabled());
|
checkLSD->setChecked(pref.isLSDEnabled());
|
||||||
comboEncryption->setCurrentIndex(pref.getEncryptionSetting());
|
comboEncryption->setCurrentIndex(pref.getEncryptionSetting());
|
||||||
@ -825,10 +819,6 @@ bool options_imp::systrayIntegration() const {
|
|||||||
return checkShowSystray->isChecked();
|
return checkShowSystray->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
int options_imp::getDHTPort() const {
|
|
||||||
return spinDHTPort->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return Share ratio
|
// Return Share ratio
|
||||||
qreal options_imp::getMaxRatio() const {
|
qreal options_imp::getMaxRatio() const {
|
||||||
if (checkMaxRatio->isChecked()) {
|
if (checkMaxRatio->isChecked()) {
|
||||||
@ -979,10 +969,6 @@ bool options_imp::addTorrentsInPause() const {
|
|||||||
return checkStartPaused->isChecked();
|
return checkStartPaused->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool options_imp::isDHTPortSameAsBT() const {
|
|
||||||
return !checkDifferentDHTPort->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proxy settings
|
// Proxy settings
|
||||||
bool options_imp::isProxyEnabled() const {
|
bool options_imp::isProxyEnabled() const {
|
||||||
return comboProxyType->currentIndex();
|
return comboProxyType->currentIndex();
|
||||||
@ -1342,7 +1328,6 @@ void options_imp::toggleAnonymousMode(bool enabled)
|
|||||||
if (enabled) {
|
if (enabled) {
|
||||||
// Disable DHT, LSD, UPnP / NAT-PMP
|
// Disable DHT, LSD, UPnP / NAT-PMP
|
||||||
checkDHT->setEnabled(false);
|
checkDHT->setEnabled(false);
|
||||||
checkDifferentDHTPort->setEnabled(false);
|
|
||||||
checkDHT->setChecked(false);
|
checkDHT->setChecked(false);
|
||||||
checkLSD->setEnabled(false);
|
checkLSD->setEnabled(false);
|
||||||
checkLSD->setChecked(false);
|
checkLSD->setChecked(false);
|
||||||
@ -1350,7 +1335,6 @@ void options_imp::toggleAnonymousMode(bool enabled)
|
|||||||
checkUPnP->setChecked(false);
|
checkUPnP->setChecked(false);
|
||||||
} else {
|
} else {
|
||||||
checkDHT->setEnabled(true);
|
checkDHT->setEnabled(true);
|
||||||
checkDifferentDHTPort->setEnabled(true);
|
|
||||||
checkLSD->setEnabled(true);
|
checkLSD->setEnabled(true);
|
||||||
checkUPnP->setEnabled(true);
|
checkUPnP->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,6 @@ private:
|
|||||||
int getMaxUploads() const;
|
int getMaxUploads() const;
|
||||||
int getMaxUploadsPerTorrent() const;
|
int getMaxUploadsPerTorrent() const;
|
||||||
bool isDHTEnabled() const;
|
bool isDHTEnabled() const;
|
||||||
bool isDHTPortSameAsBT() const;
|
|
||||||
int getDHTPort() const;
|
|
||||||
bool isLSDEnabled() const;
|
bool isLSDEnabled() const;
|
||||||
int getEncryptionSetting() const;
|
int getEncryptionSetting() const;
|
||||||
qreal getMaxRatio() const;
|
qreal getMaxRatio() const;
|
||||||
|
@ -658,22 +658,6 @@ public:
|
|||||||
setValue(QString::fromUtf8("Preferences/Bittorrent/PeX"), enabled);
|
setValue(QString::fromUtf8("Preferences/Bittorrent/PeX"), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDHTPortSameAsBT() const {
|
|
||||||
return value(QString::fromUtf8("Preferences/Bittorrent/sameDHTPortAsBT"), true).toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDHTPortSameAsBT(bool same) {
|
|
||||||
setValue(QString::fromUtf8("Preferences/Bittorrent/sameDHTPortAsBT"), same);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getDHTPort() const {
|
|
||||||
return value(QString::fromUtf8("Preferences/Bittorrent/DHTPort"), 6881).toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDHTPort(int port) {
|
|
||||||
setValue(QString::fromUtf8("Preferences/Bittorrent/DHTPort"), port);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isLSDEnabled() const {
|
bool isLSDEnabled() const {
|
||||||
return value(QString::fromUtf8("Preferences/Bittorrent/LSD"), true).toBool();
|
return value(QString::fromUtf8("Preferences/Bittorrent/LSD"), true).toBool();
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ QBtSession::QBtSession()
|
|||||||
: m_scanFolders(ScanFoldersModel::instance(this)),
|
: m_scanFolders(ScanFoldersModel::instance(this)),
|
||||||
preAllocateAll(false), global_ratio_limit(-1),
|
preAllocateAll(false), global_ratio_limit(-1),
|
||||||
LSDEnabled(false),
|
LSDEnabled(false),
|
||||||
DHTEnabled(false), current_dht_port(0), queueingEnabled(false),
|
DHTEnabled(false), queueingEnabled(false),
|
||||||
m_torrentExportEnabled(false),
|
m_torrentExportEnabled(false),
|
||||||
m_finishedTorrentExportEnabled(false)
|
m_finishedTorrentExportEnabled(false)
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
@ -488,25 +488,7 @@ void QBtSession::configureSession() {
|
|||||||
// * Max uploads per torrent limit
|
// * Max uploads per torrent limit
|
||||||
setMaxUploadsPerTorrent(pref.getMaxUploadsPerTorrent());
|
setMaxUploadsPerTorrent(pref.getMaxUploadsPerTorrent());
|
||||||
// * DHT
|
// * DHT
|
||||||
if (pref.isDHTEnabled()) {
|
enableDHT(pref.isDHTEnabled());
|
||||||
// Set DHT Port
|
|
||||||
if (enableDHT(true)) {
|
|
||||||
int dht_port = 0;
|
|
||||||
#if LIBTORRENT_VERSION_NUM < 10000
|
|
||||||
if (!pref.isDHTPortSameAsBT())
|
|
||||||
dht_port = pref.getDHTPort();
|
|
||||||
setDHTPort(dht_port);
|
|
||||||
#endif
|
|
||||||
if (dht_port == 0) dht_port = new_listenPort;
|
|
||||||
addConsoleMessage(tr("DHT support [ON], port: UDP/%1").arg(dht_port), QString::fromUtf8("blue"));
|
|
||||||
} else {
|
|
||||||
addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("red"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
enableDHT(false);
|
|
||||||
addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// * PeX
|
// * PeX
|
||||||
if (PeXEnabled) {
|
if (PeXEnabled) {
|
||||||
addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue"));
|
addConsoleMessage(tr("PeX support [ON]"), QString::fromUtf8("blue"));
|
||||||
@ -1531,7 +1513,7 @@ void QBtSession::saveSessionState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable DHT
|
// Enable DHT
|
||||||
bool QBtSession::enableDHT(bool b) {
|
void QBtSession::enableDHT(bool b) {
|
||||||
if (b) {
|
if (b) {
|
||||||
if (!DHTEnabled) {
|
if (!DHTEnabled) {
|
||||||
try {
|
try {
|
||||||
@ -1543,20 +1525,23 @@ bool QBtSession::enableDHT(bool b) {
|
|||||||
s->add_dht_router(std::make_pair(std::string("dht.transmissionbt.com"), 6881));
|
s->add_dht_router(std::make_pair(std::string("dht.transmissionbt.com"), 6881));
|
||||||
s->add_dht_router(std::make_pair(std::string("dht.aelitis.com"), 6881)); // Vuze
|
s->add_dht_router(std::make_pair(std::string("dht.aelitis.com"), 6881)); // Vuze
|
||||||
DHTEnabled = true;
|
DHTEnabled = true;
|
||||||
|
addConsoleMessage(tr("DHT support [ON]"), QString::fromUtf8("blue"));
|
||||||
qDebug("DHT enabled");
|
qDebug("DHT enabled");
|
||||||
}catch(std::exception &e) {
|
}
|
||||||
|
catch(std::exception &e) {
|
||||||
qDebug("Could not enable DHT, reason: %s", e.what());
|
qDebug("Could not enable DHT, reason: %s", e.what());
|
||||||
return false;
|
addConsoleMessage(tr("DHT support [OFF]. Reason: %1").arg(misc::toQString(e.what())), QString::fromUtf8("red"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (DHTEnabled) {
|
if (DHTEnabled) {
|
||||||
DHTEnabled = false;
|
DHTEnabled = false;
|
||||||
s->stop_dht();
|
s->stop_dht();
|
||||||
|
addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("blue"));
|
||||||
qDebug("DHT disabled");
|
qDebug("DHT disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QBtSession::getRealRatio(const libtorrent::torrent_status &status) const {
|
qreal QBtSession::getRealRatio(const libtorrent::torrent_status &status) const {
|
||||||
@ -2000,20 +1985,6 @@ void QBtSession::updateRatioTimer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_NUM < 10000
|
|
||||||
// Set DHT port (>= 1 or 0 if same as BT)
|
|
||||||
void QBtSession::setDHTPort(int dht_port) {
|
|
||||||
if (dht_port >= 0) {
|
|
||||||
if (dht_port == current_dht_port) return;
|
|
||||||
struct dht_settings DHTSettings;
|
|
||||||
DHTSettings.service_port = dht_port;
|
|
||||||
s->set_dht_settings(DHTSettings);
|
|
||||||
current_dht_port = dht_port;
|
|
||||||
qDebug("Set DHT Port to %d", dht_port);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Enable IP Filtering
|
// Enable IP Filtering
|
||||||
void QBtSession::enableIPFilter(const QString &filter_path, bool force) {
|
void QBtSession::enableIPFilter(const QString &filter_path, bool force) {
|
||||||
qDebug("Enabling IPFiler");
|
qDebug("Enabling IPFiler");
|
||||||
|
@ -150,9 +150,6 @@ public slots:
|
|||||||
void setMaxRatioPerTorrent(const QString &hash, qreal ratio);
|
void setMaxRatioPerTorrent(const QString &hash, qreal ratio);
|
||||||
qreal getMaxRatioPerTorrent(const QString &hash, bool *usesGlobalRatio) const;
|
qreal getMaxRatioPerTorrent(const QString &hash, bool *usesGlobalRatio) const;
|
||||||
void removeRatioPerTorrent(const QString &hash);
|
void removeRatioPerTorrent(const QString &hash);
|
||||||
#if LIBTORRENT_VERSION_NUM < 10000
|
|
||||||
void setDHTPort(int dht_port);
|
|
||||||
#endif
|
|
||||||
void setProxySettings(libtorrent::proxy_settings proxySettings);
|
void setProxySettings(libtorrent::proxy_settings proxySettings);
|
||||||
void setSessionSettings(const libtorrent::session_settings &sessionSettings);
|
void setSessionSettings(const libtorrent::session_settings &sessionSettings);
|
||||||
void setDefaultSavePath(const QString &savepath);
|
void setDefaultSavePath(const QString &savepath);
|
||||||
@ -167,7 +164,7 @@ public slots:
|
|||||||
void setUploadLimit(QString hash, long val);
|
void setUploadLimit(QString hash, long val);
|
||||||
void enableUPnP(bool b);
|
void enableUPnP(bool b);
|
||||||
void enableLSD(bool b);
|
void enableLSD(bool b);
|
||||||
bool enableDHT(bool b);
|
void enableDHT(bool b);
|
||||||
#ifdef DISABLE_GUI
|
#ifdef DISABLE_GUI
|
||||||
void addConsoleMessage(QString msg, QString color=QString::null);
|
void addConsoleMessage(QString msg, QString color=QString::null);
|
||||||
#else
|
#else
|
||||||
@ -287,7 +284,6 @@ private:
|
|||||||
int high_ratio_action;
|
int high_ratio_action;
|
||||||
bool LSDEnabled;
|
bool LSDEnabled;
|
||||||
bool DHTEnabled;
|
bool DHTEnabled;
|
||||||
int current_dht_port;
|
|
||||||
bool PeXEnabled;
|
bool PeXEnabled;
|
||||||
bool queueingEnabled;
|
bool queueingEnabled;
|
||||||
bool appendLabelToSavePath;
|
bool appendLabelToSavePath;
|
||||||
|
@ -106,8 +106,6 @@ QByteArray prefjson::getPreferences()
|
|||||||
data["scheduler_days"] = pref.getSchedulerDays();
|
data["scheduler_days"] = pref.getSchedulerDays();
|
||||||
// Bittorrent
|
// Bittorrent
|
||||||
data["dht"] = pref.isDHTEnabled();
|
data["dht"] = pref.isDHTEnabled();
|
||||||
data["dhtSameAsBT"] = pref.isDHTPortSameAsBT();
|
|
||||||
data["dht_port"] = pref.getDHTPort();
|
|
||||||
data["pex"] = pref.isPeXEnabled();
|
data["pex"] = pref.isPeXEnabled();
|
||||||
data["lsd"] = pref.isLSDEnabled();
|
data["lsd"] = pref.isLSDEnabled();
|
||||||
data["encryption"] = pref.getEncryptionSetting();
|
data["encryption"] = pref.getEncryptionSetting();
|
||||||
@ -270,10 +268,6 @@ void prefjson::setPreferences(const QString& json)
|
|||||||
// Bittorrent
|
// Bittorrent
|
||||||
if (m.contains("dht"))
|
if (m.contains("dht"))
|
||||||
pref.setDHTEnabled(m["dht"].toBool());
|
pref.setDHTEnabled(m["dht"].toBool());
|
||||||
if (m.contains("dhtSameAsBT"))
|
|
||||||
pref.setDHTPortSameAsBT(m["dhtSameAsBT"].toBool());
|
|
||||||
if (m.contains("dht_port"))
|
|
||||||
pref.setDHTPort(m["dht_port"].toInt());
|
|
||||||
if (m.contains("pex"))
|
if (m.contains("pex"))
|
||||||
pref.setPeXEnabled(m["pex"].toBool());
|
pref.setPeXEnabled(m["pex"].toBool());
|
||||||
qDebug("Pex support: %d", (int)m["pex"].toBool());
|
qDebug("Pex support: %d", (int)m["pex"].toBool());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user