diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 097f1415f..c1825c01e 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -95,25 +95,7 @@ Bittorrent::Bittorrent() version << VERSION_MINOR; version << VERSION_BUGFIX; version << VERSION_TYPE; -#ifdef CLIENT_USURPATION - QString peer_id = Preferences::getPeerID(); - if(peer_id.size() != 2) peer_id = "qB"; - if(peer_id != "qB") { - QStringList peer_ver = Preferences::getClientVersion().split('.'); - while(peer_ver.size() < 4) { - peer_ver << "0"; - } - for(int i=0; isetLayout(adv_layout); connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton())); -#ifndef CLIENT_USURPATION - groupBox_usurpation->setVisible(false); -#endif - // Adapt size show(); loadWindowState(); @@ -452,26 +448,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ settings.setValue(QString::fromUtf8("sameDHTPortAsBT"), isDHTPortSameAsBT()); settings.setValue(QString::fromUtf8("DHTPort"), getDHTPort()); settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled()); -#ifndef CLIENT_USURPATION - // Peer ID usurpation - switch(comboPeerID->currentIndex()) { - case 3: // KTorrent - Preferences::setPeerID("KT"); - Preferences::setClientVersion(client_version->text()); - break; - case 2: // uTorrent - Preferences::setPeerID("UT"); - Preferences::setClientVersion(client_version->text()); - Preferences::setClientBuild(client_build->text()); - break; - case 1: // Vuze - Preferences::setPeerID("AZ"); - Preferences::setClientVersion(client_version->text()); - break; - default: //qBittorrent - Preferences::setPeerID("qB"); - } -#endif settings.setValue(QString::fromUtf8("Encryption"), getEncryptionSetting()); Preferences::setMaxRatio(getMaxRatio()); Preferences::setMaxRatioAction(comboRatioLimitAct->currentIndex()); @@ -761,34 +737,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ spinDHTPort->setValue(Preferences::getDHTPort()); checkPeX->setChecked(Preferences::isPeXEnabled()); checkLSD->setChecked(Preferences::isLSDEnabled()); - // Peer ID usurpation -#ifdef CLIENT_USURPATION - QString peer_id = Preferences::getPeerID(); - if(peer_id == "UT") { - // uTorrent - comboPeerID->setCurrentIndex(2); - enableSpoofingSettings(2); - client_version->setText(Preferences::getClientVersion()); - client_build->setText(Preferences::getClientBuild()); - } else { - if(peer_id == "AZ") { - // Vuze - comboPeerID->setCurrentIndex(1); - enableSpoofingSettings(1); - client_version->setText(Preferences::getClientVersion()); - } else { - if(peer_id == "KT") { - comboPeerID->setCurrentIndex(3); - enableSpoofingSettings(3); - client_version->setText(Preferences::getClientVersion()); - } else { - // qBittorrent - comboPeerID->setCurrentIndex(0); - enableSpoofingSettings(0); - } - } - } -#endif comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting()); // Ratio limit floatValue = Preferences::getMaxRatio(); @@ -833,62 +781,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ return spinPort->value(); } - void options_imp::enableSpoofingSettings(int index) { - switch(index) { - case 0: // qBittorrent - resetPeerVersion_button->setEnabled(false); - version_label->setEnabled(false); - client_version->setEnabled(false); - client_version->clear(); - build_label->setEnabled(false); - client_build->setEnabled(false); - client_build->clear(); - break; - case 1: // Vuze - resetPeerVersion_button->setEnabled(true); - version_label->setEnabled(true); - client_version->setEnabled(true); - client_version->setText(Preferences::getDefaultClientVersion("AZ")); - build_label->setEnabled(false); - client_build->setEnabled(false); - client_build->clear(); - break; - case 2: // uTorrent - resetPeerVersion_button->setEnabled(true); - version_label->setEnabled(true); - client_version->setEnabled(true); - client_version->setText(Preferences::getDefaultClientVersion("UT")); - build_label->setEnabled(true); - client_build->setEnabled(true); - client_build->setText(Preferences::getDefaultClientBuild("UT")); - break; - case 3: // KTorrent - resetPeerVersion_button->setEnabled(true); - version_label->setEnabled(true); - client_version->setEnabled(true); - client_version->setText(Preferences::getDefaultClientVersion("KT")); - build_label->setEnabled(false); - client_build->setEnabled(false); - client_build->clear(); - break; - } - } - - void options_imp::on_resetPeerVersion_button_clicked() { - switch(comboPeerID->currentIndex()) { - case 1: // Vuze - client_version->setText(Preferences::getDefaultClientVersion("AZ")); - break; - case 3: // KTorrent - client_version->setText(Preferences::getDefaultClientVersion("KT")); - break; - case 2: // uTorrent - client_version->setText(Preferences::getDefaultClientVersion("UT")); - client_build->setText(Preferences::getDefaultClientBuild("UT")); - break; - } - } - void options_imp::on_randomButton_clicked() { // Range [1024: 65535] spinPort->setValue(rand() % 64512 + 1024); diff --git a/src/options_imp.h b/src/options_imp.h index ee7205332..ca9765c81 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -136,7 +136,6 @@ protected slots: void enableMaxConnecsLimitPerTorrent(bool checked); void enableMaxUploadsLimitPerTorrent(bool checked); void enableMaxRatio(bool checked); - void enableSpoofingSettings(int index); void setStyle(QString style); void on_buttonBox_accepted(); void closeEvent(QCloseEvent *e); @@ -161,7 +160,6 @@ protected slots: public slots: void setLocale(QString locale); void useStyle(); - void on_resetPeerVersion_button_clicked(); signals: void status_changed() const; diff --git a/src/preferences.h b/src/preferences.h index 744470c34..cd814a040 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -582,74 +582,6 @@ public: settings.setValue(QString::fromUtf8("Preferences/Bittorrent/MaxUploadsPerTorrent"), val); } - static QString getPeerID() { - QIniSettings settings("qBittorrent", "qBittorrent"); - return settings.value(QString::fromUtf8("Preferences/Bittorrent/PeerID"), "qB").toString(); - } - - static void setPeerID(QString peer_id) { - QIniSettings settings("qBittorrent", "qBittorrent"); - settings.setValue(QString::fromUtf8("Preferences/Bittorrent/PeerID"), peer_id); - } - - static QString getDefaultClientVersion(QString peer_id) { - if(peer_id == "UT") { - // uTorrent - return "1.8.5"; - } - // Azureus - if(peer_id == "AZ") { - return "4.3.0.4"; - } - // KTorrent - if(peer_id == "KT") { - return "3.3.2"; - } - // qBittorrent - return QString(VERSION); - } - - static QString getDefaultClientBuild(QString peer_id) { - if(peer_id == "UT") { - return "17414"; - } - return ""; - } - - static QString getClientVersion() { - QIniSettings settings("qBittorrent", "qBittorrent"); - QString peer_id = getPeerID(); - if(peer_id == "qB") - return QString(VERSION); - QString version = settings.value(QString::fromUtf8("Preferences/Bittorrent/PeerVersion"), QString()).toString(); - if(version.isEmpty()) { - version = getDefaultClientVersion(peer_id); - } - return version; - } - - static void setClientVersion(QString version) { - QIniSettings settings("qBittorrent", "qBittorrent"); - settings.setValue(QString::fromUtf8("Preferences/Bittorrent/PeerVersion"), version); - } - - static QString getClientBuild() { - QIniSettings settings("qBittorrent", "qBittorrent"); - QString peer_id = getPeerID(); - if(peer_id != "UT") - return ""; - QString build = settings.value(QString::fromUtf8("Preferences/Bittorrent/PeerBuild"), QString()).toString(); - if(build.isEmpty()) { - build = getDefaultClientBuild(peer_id); - } - return build; - } - - static void setClientBuild(QString build) { - QIniSettings settings("qBittorrent", "qBittorrent"); - settings.setValue(QString::fromUtf8("Preferences/Bittorrent/PeerBuild"), build); - } - static bool isDHTEnabled() { QIniSettings settings("qBittorrent", "qBittorrent"); return settings.value(QString::fromUtf8("Preferences/Bittorrent/DHT"), true).toBool(); diff --git a/src/src.pro b/src/src.pro index 70bdd017a..6769d177f 100644 --- a/src/src.pro +++ b/src/src.pro @@ -421,7 +421,4 @@ SOURCES += main.cpp \ } } -# NO CLIENT USURPATION -# DEFINES += CLIENT_USURPATION - DESTDIR = . diff --git a/src/webui/preferences_content.html b/src/webui/preferences_content.html index a3363f647..fe0d3cf88 100644 --- a/src/webui/preferences_content.html +++ b/src/webui/preferences_content.html @@ -75,23 +75,6 @@
-