From f9399714cc39a21a919ca48fb99846d3c4f3d53b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 22 Nov 2009 21:42:16 +0000 Subject: [PATCH] - Fix DHT settings --- src/options_imp.cpp | 23 ++++++++++++++++++----- src/options_imp.h | 1 + src/statusbar.h | 2 ++ src/ui/options.ui | 40 ++++++++++++++++++++-------------------- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 3cddbffbe..33b2024fe 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -158,7 +158,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool))); connect(checkRatioLimit, SIGNAL(toggled(bool)), this, SLOT(enableShareRatio(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 connect(comboProxyType_http, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxyHTTP(int))); 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(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), 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(checkLSD, 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); } checkDHT->setChecked(Preferences::isDHTEnabled()); - checkSameDHTPort->setChecked(Preferences::isDHTPortSameAsBT()); - enableDHTPortSettings(checkSameDHTPort->isChecked()); + enableDHTSettings(checkDHT->isChecked()); + checkDifferentDHTPort->setChecked(!Preferences::isDHTPortSameAsBT()); + enableDHTPortSettings(checkDifferentDHTPort->isChecked()); spinDHTPort->setValue(Preferences::getDHTPort()); checkLSD->setChecked(Preferences::isLSDEnabled()); 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){ if(checked){ spinMaxRatio->setEnabled(true); @@ -1200,7 +1213,7 @@ bool options_imp::addTorrentsInPause() const { } bool options_imp::isDHTPortSameAsBT() const { - return checkSameDHTPort->isChecked(); + return !checkDifferentDHTPort->isChecked(); } // Proxy settings diff --git a/src/options_imp.h b/src/options_imp.h index 335b3a1d2..1ae1c828f 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -151,6 +151,7 @@ protected slots: void enableDeleteRatio(bool checked); void enableFilter(bool checked); void enableRSS(bool checked); + void enableDHTSettings(bool checked); void enableDHTPortSettings(bool checked); void enableQueueingSystem(bool checked); void setStyle(int style); diff --git a/src/statusbar.h b/src/statusbar.h index c45f460e9..b9ab7e72d 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -118,6 +118,8 @@ public: container->setFixedHeight(24); bar->setContentsMargins(12, 0, 12, 0); bar->setFixedHeight(26); + // Is DHT enabled + DHTLbl->setVisible(Preferences::isDHTEnabled()); refreshTimer = new QTimer(bar); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refreshStatusBar())); refreshTimer->start(1500); diff --git a/src/ui/options.ui b/src/ui/options.ui index c62abcbf2..c6a067c38 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -626,8 +626,8 @@ 0 0 - 216 - 147 + 620 + 149 @@ -1082,7 +1082,7 @@ 0 0 - 451 + 602 513 @@ -1503,8 +1503,8 @@ 0 0 - 468 - 347 + 620 + 488 @@ -1525,9 +1525,9 @@ - + - Use the same port for DHT and Bittorrent + Use a different port for DHT and Bittorrent true @@ -2401,8 +2401,8 @@ 0 0 - 218 - 220 + 620 + 488 @@ -2415,14 +2415,14 @@ Enable Web User Interface - true + false - true + false HTTP Server @@ -2431,7 +2431,7 @@ - true + false Port: @@ -2441,7 +2441,7 @@ - true + false 65535 @@ -2470,7 +2470,7 @@ - true + false Authentication @@ -2481,7 +2481,7 @@ - true + false Username: @@ -2491,7 +2491,7 @@ - true + false Password: @@ -2505,7 +2505,7 @@ - true + false @@ -2521,7 +2521,7 @@ - true + false @@ -2583,8 +2583,8 @@ 0 0 - 451 - 195 + 620 + 488