1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-25 05:54:33 +00:00

- Fix DHT settings

This commit is contained in:
Christophe Dumez 2009-11-22 21:42:16 +00:00
parent d25128e0b3
commit f9399714cc
4 changed files with 41 additions and 25 deletions

View File

@ -158,7 +158,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool))); connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool)));
connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(bool))); connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(bool)));
connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool))); connect(checkRatioRemove, SIGNAL(toggled(bool)), this, SLOT(enableDeleteRatio(bool)));
connect(checkSameDHTPort, SIGNAL(toggled(bool)), this, SLOT(enableDHTPortSettings(bool))); connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableDHTSettings(bool)));
connect(checkDifferentDHTPort, SIGNAL(toggled(bool)), this, SLOT(enableDHTPortSettings(bool)));
// Proxy tab // Proxy tab
connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxyHTTP(int))); connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxyHTTP(int)));
connect(checkProxyAuth_http, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuthHTTP(bool))); connect(checkProxyAuth_http, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuthHTTP(bool)));
@ -210,7 +211,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(checkSameDHTPort, 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()));
connect(checkAzureusSpoof, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAzureusSpoof, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -702,8 +703,9 @@ void options_imp::loadOptions(){
spinMaxUploadsPerTorrent->setEnabled(false); spinMaxUploadsPerTorrent->setEnabled(false);
} }
checkDHT->setChecked(Preferences::isDHTEnabled()); checkDHT->setChecked(Preferences::isDHTEnabled());
checkSameDHTPort->setChecked(Preferences::isDHTPortSameAsBT()); enableDHTSettings(checkDHT->isChecked());
enableDHTPortSettings(checkSameDHTPort->isChecked()); checkDifferentDHTPort->setChecked(!Preferences::isDHTPortSameAsBT());
enableDHTPortSettings(checkDifferentDHTPort->isChecked());
spinDHTPort->setValue(Preferences::getDHTPort()); spinDHTPort->setValue(Preferences::getDHTPort());
checkLSD->setChecked(Preferences::isLSDEnabled()); checkLSD->setChecked(Preferences::isLSDEnabled());
checkAzureusSpoof->setChecked(Preferences::isUtorrentSpoofingEnabled()); checkAzureusSpoof->setChecked(Preferences::isUtorrentSpoofingEnabled());
@ -1097,6 +1099,17 @@ void options_imp::enableDHTPortSettings(bool checked) {
} }
} }
void options_imp::enableDHTSettings(bool checked) {
if(checked){
checkDifferentDHTPort->setEnabled(true);
enableDHTPortSettings(checkDifferentDHTPort->isChecked());
}else{
checkDifferentDHTPort->setEnabled(false);
enableDHTPortSettings(false);
}
}
void options_imp::enableDeleteRatio(bool checked){ void options_imp::enableDeleteRatio(bool checked){
if(checked){ if(checked){
spinMaxRatio->setEnabled(true); spinMaxRatio->setEnabled(true);
@ -1200,7 +1213,7 @@ bool options_imp::addTorrentsInPause() const {
} }
bool options_imp::isDHTPortSameAsBT() const { bool options_imp::isDHTPortSameAsBT() const {
return checkSameDHTPort->isChecked(); return !checkDifferentDHTPort->isChecked();
} }
// Proxy settings // Proxy settings

View File

@ -151,6 +151,7 @@ protected slots:
void enableDeleteRatio(bool checked); void enableDeleteRatio(bool checked);
void enableFilter(bool checked); void enableFilter(bool checked);
void enableRSS(bool checked); void enableRSS(bool checked);
void enableDHTSettings(bool checked);
void enableDHTPortSettings(bool checked); void enableDHTPortSettings(bool checked);
void enableQueueingSystem(bool checked); void enableQueueingSystem(bool checked);
void setStyle(int style); void setStyle(int style);

View File

@ -118,6 +118,8 @@ public:
container->setFixedHeight(24); container->setFixedHeight(24);
bar->setContentsMargins(12, 0, 12, 0); bar->setContentsMargins(12, 0, 12, 0);
bar->setFixedHeight(26); bar->setFixedHeight(26);
// Is DHT enabled
DHTLbl->setVisible(Preferences::isDHTEnabled());
refreshTimer = new QTimer(bar); refreshTimer = new QTimer(bar);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar())); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar()));
refreshTimer->start(1500); refreshTimer->start(1500);

View File

@ -626,8 +626,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>216</width> <width>620</width>
<height>147</height> <height>149</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
@ -1082,7 +1082,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>
@ -1503,8 +1503,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>488</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_19"> <layout class="QVBoxLayout" name="verticalLayout_19">
@ -1525,9 +1525,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkSameDHTPort"> <widget class="QCheckBox" name="checkDifferentDHTPort">
<property name="text"> <property name="text">
<string>Use the same port for DHT and Bittorrent</string> <string>Use a different port for DHT and Bittorrent</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@ -2401,8 +2401,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>218</width> <width>620</width>
<height>220</height> <height>488</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -2415,14 +2415,14 @@
<string>Enable Web User Interface</string> <string>Enable Web User Interface</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupWebUiServer"> <widget class="QGroupBox" name="groupWebUiServer">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="title"> <property name="title">
<string>HTTP Server</string> <string>HTTP Server</string>
@ -2431,7 +2431,7 @@
<item> <item>
<widget class="QLabel" name="lblWebUiPort"> <widget class="QLabel" name="lblWebUiPort">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Port:</string> <string>Port:</string>
@ -2441,7 +2441,7 @@
<item> <item>
<widget class="QSpinBox" name="spinWebUiPort"> <widget class="QSpinBox" name="spinWebUiPort">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>65535</number> <number>65535</number>
@ -2470,7 +2470,7 @@
<item> <item>
<widget class="QGroupBox" name="groupWebUiAuth"> <widget class="QGroupBox" name="groupWebUiAuth">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="title"> <property name="title">
<string>Authentication</string> <string>Authentication</string>
@ -2481,7 +2481,7 @@
<item> <item>
<widget class="QLabel" name="lblWebUiUsername"> <widget class="QLabel" name="lblWebUiUsername">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Username:</string> <string>Username:</string>
@ -2491,7 +2491,7 @@
<item> <item>
<widget class="QLabel" name="lblWebUiPassword"> <widget class="QLabel" name="lblWebUiPassword">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Password:</string> <string>Password:</string>
@ -2505,7 +2505,7 @@
<item> <item>
<widget class="QLineEdit" name="textWebUiUsername"> <widget class="QLineEdit" name="textWebUiUsername">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -2521,7 +2521,7 @@
<item> <item>
<widget class="QLineEdit" name="textWebUiPassword"> <widget class="QLineEdit" name="textWebUiPassword">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -2583,8 +2583,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>451</width> <width>620</width>
<height>195</height> <height>488</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_24"> <layout class="QVBoxLayout" name="verticalLayout_24">