Browse Source

- qBittorrent can now identify itself as KTorrent too

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
09c7c50ad3
  1. 2
      Changelog
  2. 14
      src/bittorrent.cpp
  3. 22
      src/options_imp.cpp
  4. 9
      src/preferences.h
  5. 2
      src/src.pro
  6. 5
      src/ui/options.ui
  7. 9
      src/webui/preferences_content.html

2
Changelog

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
- FEATURE: Torrent files/folders can be renamed (torrent addition dialog or files properties)
- FEATURE: uTorrent compatible tracker list support (use torrentz.com url as a default)
- FEATURE: Better proxy support and preferences remodeling
- FEATURE: qBittorrent can identify itself as uTorrent or Vuze (Any version)
- FEATURE: qBittorrent can identify itself as uTorrent, Vuze or KTorrent (Any stable version)
- FEATURE: Torrents can be renamed in transfer list
- COSMETIC: Use checkboxes to filter torrent content instead of comboboxes
- COSMETIC: Use alternating row colors in transfer list (set in program preferences)

14
src/bittorrent.cpp

@ -62,6 +62,8 @@ @@ -62,6 +62,8 @@
#define MAX_RATIO 100.
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4, SOCKS4=5};
enum VersionType { NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL };
// Main constructor
Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit(-1), UPnPEnabled(false), NATPMPEnabled(false), LSDEnabled(false), DHTEnabled(false), current_dht_port(0), queueingEnabled(false), geoipDBLoaded(false), exiting(false) {
resolve_countries = false;
@ -73,17 +75,19 @@ Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit @@ -73,17 +75,19 @@ Bittorrent::Bittorrent() : preAllocateAll(false), addInPause(false), ratio_limit
version << VERSION_MAJOR;
version << VERSION_MINOR;
version << VERSION_BUGFIX;
version << 0;
version << VERSION_TYPE;
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() < 3) {
while(peer_ver.size() < 4) {
peer_ver << "0";
}
for(int i=0; i<peer_ver.size(); ++i) {
QString ver = peer_ver.at(i);
if(ver.size() != 1) break;
if(ver.size() != 1) {
ver.truncate(1);
}
version.replace(i, ver.toInt());
}
}
@ -343,10 +347,14 @@ void Bittorrent::configureSession() { @@ -343,10 +347,14 @@ void Bittorrent::configureSession() {
while(version.size() < 4)
version << "0";
sessionSettings.user_agent = QString("Azureus "+version.join(".")).toStdString();
} else {
if(peer_id == "KT") {
sessionSettings.user_agent = QString("KTorrent/"+Preferences::getClientVersion()).toStdString();
} else {
sessionSettings.user_agent = "qBittorrent "VERSION;
}
}
}
std::cout << "HTTP user agent is " << sessionSettings.user_agent << std::endl;
addConsoleMessage(tr("HTTP user agent is %1").arg(misc::toQString(sessionSettings.user_agent)));

22
src/options_imp.cpp

@ -439,6 +439,10 @@ void options_imp::saveOptions(){ @@ -439,6 +439,10 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("LSD"), isLSDEnabled());
// 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());
@ -724,12 +728,18 @@ void options_imp::loadOptions(){ @@ -724,12 +728,18 @@ void options_imp::loadOptions(){
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);
}
}
}
comboEncryption->setCurrentIndex(Preferences::getEncryptionSetting());
floatValue = Preferences::getDesiredRatio();
if(floatValue >= 1.) {
@ -819,6 +829,15 @@ void options_imp::enableSpoofingSettings(int index) { @@ -819,6 +829,15 @@ void options_imp::enableSpoofingSettings(int index) {
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;
}
}
@ -827,6 +846,9 @@ void options_imp::on_resetPeerVersion_button_clicked() { @@ -827,6 +846,9 @@ void options_imp::on_resetPeerVersion_button_clicked() {
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"));

9
src/preferences.h

@ -462,14 +462,17 @@ public: @@ -462,14 +462,17 @@ public:
if(peer_id == "UT") {
// uTorrent
return "1.8.5";
} else {
}
// Azureus
if(peer_id == "AZ") {
return "4.3.0.4";
} else {
return QString(VERSION);
}
// KTorrent
if(peer_id == "KT") {
return "3.3.2";
}
// qBittorrent
return QString(VERSION);
}
static QString getDefaultClientBuild(QString peer_id) {

2
src/src.pro

@ -16,6 +16,8 @@ DEFINES += VERSION=\\\"v2.1.0beta4\\\" @@ -16,6 +16,8 @@ DEFINES += VERSION=\\\"v2.1.0beta4\\\"
DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=1
DEFINES += VERSION_BUGFIX=0
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
DEFINES += VERSION_TYPE=DEVEL
# !mac:QMAKE_LFLAGS += -Wl,--as-needed
contains(DEBUG_MODE, 1) {

5
src/ui/options.ui

@ -1722,6 +1722,11 @@ QGroupBox { @@ -1722,6 +1722,11 @@ QGroupBox {
<string>µTorrent</string>
</property>
</item>
<item>
<property name="text">
<string>KTorrent</string>
</property>
</item>
</widget>
</item>
<item>

9
src/webui/preferences_content.html

@ -76,6 +76,7 @@ @@ -76,6 +76,7 @@
<option value="qB">_(qBittorrent)</option>
<option value="AZ">_(Vuze)</option>
<option value="UT">_(µTorrent)</option>
<option value="KT">_(KTorrent)</option>
</select>
&nbsp;&nbsp;
_(Version:) <input type="text" id="peer_version_text" style="width: 7em;" />
@ -513,6 +514,13 @@ updateSpoofingSettings = function() { @@ -513,6 +514,13 @@ updateSpoofingSettings = function() {
$('peer_version_text').set('value', '4.3.0.4');
$('peer_build_text').set('disabled', 'true');
$('peer_build_text').set('value', '');
} else {
if(peer_id == "KT") {
// KTorrent
$('peer_version_text').removeProperty('disabled');
$('peer_version_text').set('value', '3.3.2');
$('peer_build_text').set('disabled', 'true');
$('peer_build_text').set('value', '');
} else {
// qBittorrent
$('peer_version_text').set('disabled', 'true');
@ -521,6 +529,7 @@ updateSpoofingSettings = function() { @@ -521,6 +529,7 @@ updateSpoofingSettings = function() {
$('peer_build_text').set('value', '');
}
}
}
}
updateMaxConnecEnabled = function() {

Loading…
Cancel
Save