mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 02:36:10 +03:00
- FEATURE: Allow to set a different port for DHT (UDP) than the one used for
Bittorrent
This commit is contained in:
parent
b6c6637c3b
commit
ee6bc3c2e9
6 changed files with 113 additions and 7 deletions
|
@ -5,6 +5,7 @@
|
|||
- FEATURE: Resizing a column in a search results tab affects all tabs
|
||||
- FEATURE: Search results tab columns are now remembered upon startup
|
||||
- FEATURE: Added right click menu in search engine to clear completion history
|
||||
- FEATURE: Allow to set a different port for DHT (UDP) than the one used for Bittorrent
|
||||
- BUGFIX: Provide more helpful explanation when an I/O error occured
|
||||
- BUGFIX: Stop enforcing UTF-8 and use system locale instead
|
||||
- COSMETIC: Redesigned program preferences
|
||||
|
|
|
@ -990,7 +990,7 @@ void GUI::configureSession(bool deleteOptions) {
|
|||
BTSession->setListeningPortsRange(options->getPorts());
|
||||
unsigned short new_listenPort = BTSession->getListenPort();
|
||||
if(new_listenPort != old_listenPort) {
|
||||
BTSession->addConsoleMessage(tr("qBittorrent is bind to port: %1", "e.g: qBittorrent is bind to port: 1666").arg( misc::toQString(new_listenPort)));
|
||||
BTSession->addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort)));
|
||||
}
|
||||
// * Global download limit
|
||||
QPair<int, int> limits = options->getGlobalBandwidthLimits();
|
||||
|
@ -1079,9 +1079,12 @@ void GUI::configureSession(bool deleteOptions) {
|
|||
// * DHT
|
||||
if(options->isDHTEnabled()) {
|
||||
// Set DHT Port
|
||||
BTSession->setDHTPort(new_listenPort);
|
||||
BTSession->setDHTPort(options->getDHTPort());
|
||||
if(BTSession->enableDHT(true)) {
|
||||
BTSession->addConsoleMessage(tr("DHT support [ON], port: %1").arg(new_listenPort), QString::fromUtf8("blue"));
|
||||
int dht_port = new_listenPort;
|
||||
if(options->getDHTPort())
|
||||
dht_port = options->getDHTPort();
|
||||
BTSession->addConsoleMessage(tr("DHT support [ON], port: UDP/%1").arg(dht_port), QString::fromUtf8("blue"));
|
||||
} else {
|
||||
BTSession->addConsoleMessage(tr("DHT support [OFF]"), QString::fromUtf8("red"));
|
||||
}
|
||||
|
|
|
@ -1072,9 +1072,9 @@ void bittorrent::saveTrackerFile(QString hash) {
|
|||
tracker_file.close();
|
||||
}
|
||||
|
||||
// Set DHT port (>= 1000)
|
||||
// Set DHT port (>= 1000 or 0 if same as BT)
|
||||
void bittorrent::setDHTPort(int dht_port) {
|
||||
if(dht_port >= 1000) {
|
||||
if(dht_port == 0 or dht_port >= 1000) {
|
||||
struct dht_settings DHTSettings;
|
||||
DHTSettings.service_port = dht_port;
|
||||
s->set_dht_settings(DHTSettings);
|
||||
|
|
|
@ -1429,13 +1429,13 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabOptionPage4">
|
||||
<layout class="QVBoxLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="AddBTFeaturesBox">
|
||||
<property name="title">
|
||||
<string>Bittorrent features</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkDHT">
|
||||
<property name="text">
|
||||
|
@ -1446,6 +1446,75 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkSameDHTPort">
|
||||
<property name="text">
|
||||
<string>Use the same port for DHT and Bittorrent</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>13</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="dh_port_lbl">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DHT port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinDHTPort">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65525</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6882</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>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkLSD">
|
||||
<property name="text">
|
||||
|
|
|
@ -153,6 +153,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
connect(checkMaxUploadsPerTorrent, SIGNAL(stateChanged(int)), this, SLOT(enableMaxUploadsLimitPerTorrent(int)));
|
||||
connect(checkRatioLimit, SIGNAL(stateChanged(int)), this, SLOT(enableShareRatio(int)));
|
||||
connect(checkRatioRemove, SIGNAL(stateChanged(int)), this, SLOT(enableDeleteRatio(int)));
|
||||
connect(checkSameDHTPort, SIGNAL(stateChanged(int)), this, SLOT(enableDHTPortSettings(int)));
|
||||
// Proxy tab
|
||||
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxyHTTP(int)));
|
||||
connect(checkProxyAuth_http, SIGNAL(stateChanged(int)), this, SLOT(enableProxyAuthHTTP(int)));
|
||||
|
@ -202,6 +203,8 @@ 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(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(checkSameDHTPort, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(spinDHTPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(checkLSD, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(checkAzureusSpoof, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(comboEncryption, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
|
@ -396,6 +399,8 @@ 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("sameDHTPortAsBT"), isDHTPortSameAsBT());
|
||||
settings.setValue(QString::fromUtf8("DHTPort"), getDHTPort());
|
||||
settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled());
|
||||
settings.setValue(QString::fromUtf8("AzureusSpoof"), shouldSpoofAzureus());
|
||||
settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting());
|
||||
|
@ -696,6 +701,9 @@ void options_imp::loadOptions(){
|
|||
spinMaxUploadsPerTorrent->setEnabled(false);
|
||||
}
|
||||
checkDHT->setChecked(settings.value(QString::fromUtf8("DHT"), true).toBool());
|
||||
checkSameDHTPort->setChecked(settings.value(QString::fromUtf8("sameDHTPortAsBT"), true).toBool());
|
||||
enableDHTPortSettings(checkSameDHTPort->checkState());
|
||||
spinDHTPort->setValue(settings.value(QString::fromUtf8("DHTPort"), 6882).toInt());
|
||||
checkLSD->setChecked(settings.value(QString::fromUtf8("LSD"), true).toBool());
|
||||
checkAzureusSpoof->setChecked(settings.value(QString::fromUtf8("AzureusSpoof"), false).toBool());
|
||||
comboEncryption->setCurrentIndex(settings.value(QString::fromUtf8("Encryption"), 0).toInt());
|
||||
|
@ -867,6 +875,12 @@ bool options_imp::systrayIntegration() const{
|
|||
return (!checkNoSystray->isChecked());
|
||||
}
|
||||
|
||||
int options_imp::getDHTPort() const {
|
||||
if(isDHTPortSameAsBT())
|
||||
return 0;
|
||||
return spinDHTPort->value();
|
||||
}
|
||||
|
||||
// Return Share ratio
|
||||
float options_imp::getDesiredRatio() const{
|
||||
if(checkRatioLimit->isChecked()){
|
||||
|
@ -1108,6 +1122,18 @@ void options_imp::enableShareRatio(int checkBoxValue){
|
|||
}
|
||||
}
|
||||
|
||||
void options_imp::enableDHTPortSettings(int checkBoxValue) {
|
||||
if(checkBoxValue != 2){
|
||||
//Disable
|
||||
spinDHTPort->setEnabled(false);
|
||||
dh_port_lbl->setEnabled(false);
|
||||
}else{
|
||||
//enable
|
||||
spinDHTPort->setEnabled(true);
|
||||
dh_port_lbl->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableDeleteRatio(int checkBoxValue){
|
||||
if(checkBoxValue != 2){
|
||||
//Disable
|
||||
|
@ -1214,6 +1240,10 @@ bool options_imp::addTorrentsInPause() const {
|
|||
return checkStartPaused->isChecked();
|
||||
}
|
||||
|
||||
bool options_imp::isDHTPortSameAsBT() const {
|
||||
return checkSameDHTPort->isChecked();
|
||||
}
|
||||
|
||||
// Proxy settings
|
||||
bool options_imp::isProxyEnabled() const{
|
||||
return comboProxyType->currentIndex();
|
||||
|
|
|
@ -97,6 +97,8 @@ class options_imp : public QDialog, private Ui::Dialog {
|
|||
int getMaxConnecsPerTorrent() const;
|
||||
int getMaxUploadsPerTorrent() const;
|
||||
bool isDHTEnabled() const;
|
||||
bool isDHTPortSameAsBT() const;
|
||||
int getDHTPort() const;
|
||||
bool isPeXEnabled() const;
|
||||
bool isLSDEnabled() const;
|
||||
bool isRSSEnabled() const;
|
||||
|
@ -152,6 +154,7 @@ class options_imp : public QDialog, private Ui::Dialog {
|
|||
void enableDeleteRatio(int checkBoxValue);
|
||||
void enableFilter(int checkBoxValue);
|
||||
void enableRSS(int checkBoxValue);
|
||||
void enableDHTPortSettings(int checkBoxValue);
|
||||
void enableQueueingSystem(int checkBoxValue);
|
||||
void setStyle(int style);
|
||||
void on_buttonBox_accepted();
|
||||
|
|
Loading…
Reference in a new issue