mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 05:38:06 -06:00
Added uTP support
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "preferences.h"
|
||||
|
||||
enum AdvSettingsCols {PROPERTY, VALUE};
|
||||
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, COUNT_OVERHEAD, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
|
||||
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
|
||||
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||
UPDATE_CHECK,
|
||||
#endif
|
||||
@@ -28,7 +28,7 @@ class AdvancedSettings: public QTableWidget {
|
||||
|
||||
private:
|
||||
QSpinBox spin_cache, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port;
|
||||
QCheckBox cb_ignore_limits_lan, cb_count_overhead, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
|
||||
QCheckBox cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
|
||||
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion;
|
||||
QComboBox combo_iface;
|
||||
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||
@@ -69,8 +69,6 @@ public slots:
|
||||
pref.setOutgoingPortsMax(outgoing_ports_max.value());
|
||||
// Ignore limits on LAN
|
||||
pref.ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked());
|
||||
// Include protocol overhead in transfer limits
|
||||
pref.includeOverheadInLimits(cb_count_overhead.isChecked());
|
||||
// Recheck torrents on completion
|
||||
pref.recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
|
||||
// Transfer list refresh interval
|
||||
@@ -170,9 +168,6 @@ private slots:
|
||||
// Ignore transfer limits on local network
|
||||
cb_ignore_limits_lan.setChecked(pref.ignoreLimitsOnLAN());
|
||||
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan);
|
||||
// Consider protocol overhead in transfer limits
|
||||
cb_count_overhead.setChecked(pref.includeOverheadInLimits());
|
||||
setRow(COUNT_OVERHEAD, tr("Include TCP/IP overhead in transfer limits"), &cb_count_overhead);
|
||||
// Recheck completed torrents
|
||||
cb_recheck_completed.setChecked(pref.recheckTorrentsOnCompletion());
|
||||
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed);
|
||||
|
||||
@@ -1405,16 +1405,16 @@ QGroupBox {
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>384</height>
|
||||
<y>-16</y>
|
||||
<width>489</width>
|
||||
<height>425</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="bandwidthBox">
|
||||
<property name="title">
|
||||
<string>Global Speed Limits</string>
|
||||
<string>Global Rate Limits</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="0" column="0">
|
||||
@@ -1513,13 +1513,66 @@ QGroupBox {
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_27">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>Protocol:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBTProtocol">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TCP and uTP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TCP only</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>uTP only</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkLimituTPConnections">
|
||||
<property name="text">
|
||||
<string>Apply rate limit to uTP connections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkLimitTransportOverhead">
|
||||
<property name="text">
|
||||
<string>Apply rate limit to transport overhead</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>Alternative Global Speed Limits</string>
|
||||
<string>Alternative Global Rate Limits</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
@@ -1625,7 +1678,7 @@ QGroupBox {
|
||||
<item>
|
||||
<widget class="QGroupBox" name="check_schedule">
|
||||
<property name="title">
|
||||
<string>Schedule the use of alternative speed limits</string>
|
||||
<string>Schedule the use of alternative rate limits</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
|
||||
@@ -113,6 +113,8 @@ options_imp::options_imp(QWidget *parent):
|
||||
comboTrayIcon->setVisible(false);
|
||||
#endif
|
||||
// Connect signals / slots
|
||||
// Speeds
|
||||
connect(comboBTProtocol, SIGNAL(currentIndexChanged(int)), SLOT(updateBTProtocolSettings(int)));
|
||||
// Proxy tab
|
||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
||||
|
||||
@@ -168,6 +170,9 @@ options_imp::options_imp(QWidget *parent):
|
||||
connect(schedule_from, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton()));
|
||||
connect(schedule_to, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton()));
|
||||
connect(schedule_days, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(comboBTProtocol, SIGNAL(currentIndexChanged(int)), SLOT(enableApplyButton()));
|
||||
connect(checkLimituTPConnections, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
connect(checkLimitTransportOverhead, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
// Bittorrent tab
|
||||
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
@@ -216,6 +221,10 @@ options_imp::options_imp(QWidget *parent):
|
||||
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
|
||||
#if LIBTORRENT_VERSION_MINOR < 15
|
||||
checkAppendqB->setVisible(false);
|
||||
#endif
|
||||
#if LIBTORRENT_VERSION_MINOR < 16
|
||||
comboBTProtocol->setVisible(false);
|
||||
checkLimituTPConnections->setVisible(false);
|
||||
#endif
|
||||
// Load Advanced settings
|
||||
QVBoxLayout *adv_layout = new QVBoxLayout();
|
||||
@@ -382,6 +391,9 @@ void options_imp::saveOptions(){
|
||||
const QPair<int, int> down_up_limit = getGlobalBandwidthLimits();
|
||||
pref.setGlobalDownloadLimit(down_up_limit.first);
|
||||
pref.setGlobalUploadLimit(down_up_limit.second);
|
||||
pref.setBTProtocol(comboBTProtocol->currentIndex());
|
||||
pref.setuTPRateLimited(checkLimituTPConnections->isChecked());
|
||||
pref.includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
|
||||
pref.setAltGlobalDownloadLimit(spinDownloadLimitAlt->value());
|
||||
pref.setAltGlobalUploadLimit(spinUploadLimitAlt->value());
|
||||
pref.setSchedulerEnabled(check_schedule->isChecked());
|
||||
@@ -573,6 +585,10 @@ void options_imp::loadOptions(){
|
||||
}
|
||||
spinUploadLimitAlt->setValue(pref.getAltGlobalUploadLimit());
|
||||
spinDownloadLimitAlt->setValue(pref.getAltGlobalDownloadLimit());
|
||||
// Options
|
||||
comboBTProtocol->setCurrentIndex((int)pref.getBTProtocol());
|
||||
checkLimituTPConnections->setChecked(pref.isuTPRateLimited());
|
||||
checkLimitTransportOverhead->setChecked(pref.includeOverheadInLimits());
|
||||
// Scheduler
|
||||
check_schedule->setChecked(pref.isSchedulerEnabled());
|
||||
schedule_from->setTime(pref.getSchedulerStartTime());
|
||||
@@ -1188,3 +1204,21 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::updateBTProtocolSettings(int protocol)
|
||||
{
|
||||
switch(protocol) {
|
||||
case BT::TCP:
|
||||
checkLimituTPConnections->setEnabled(false);
|
||||
break;
|
||||
case BT::TCP_uTP:
|
||||
checkLimituTPConnections->setEnabled(true);
|
||||
break;
|
||||
case BT::uTP:
|
||||
checkLimituTPConnections->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ private slots:
|
||||
void on_removeScanFolderButton_clicked();
|
||||
void on_registerDNSBtn_clicked();
|
||||
void setLocale(const QString &locale);
|
||||
void updateBTProtocolSettings(int protocol);
|
||||
|
||||
private:
|
||||
// Methods
|
||||
|
||||
@@ -62,7 +62,10 @@ namespace TrayIcon {
|
||||
enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT };
|
||||
}
|
||||
namespace DNS {
|
||||
enum Service { DYNDNS, NOIP };
|
||||
enum Service { DYNDNS, NOIP };
|
||||
}
|
||||
namespace BT {
|
||||
enum Protocol { TCP_uTP, TCP, uTP };
|
||||
}
|
||||
|
||||
class Preferences : public QIniSettings {
|
||||
@@ -537,6 +540,22 @@ public:
|
||||
setValue(QString::fromUtf8("Preferences/Bittorrent/MaxUploadsPerTorrent"), val);
|
||||
}
|
||||
|
||||
BT::Protocol getBTProtocol() const {
|
||||
return (BT::Protocol)value(QString::fromUtf8("Preferences/Bittorrent/Protocol"), BT::TCP_uTP).toInt();
|
||||
}
|
||||
|
||||
void setBTProtocol(int protocol) {
|
||||
setValue("Preferences/Bittorrent/Protocol", protocol);
|
||||
}
|
||||
|
||||
bool isuTPRateLimited() const {
|
||||
return value(QString::fromUtf8("Preferences/Bittorrent/uTP_rate_limiting"), false).toBool();
|
||||
}
|
||||
|
||||
void setuTPRateLimited(bool enabled) {
|
||||
setValue("Preferences/Bittorrent/uTP_rate_limiting", enabled);
|
||||
}
|
||||
|
||||
bool isDHTEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Bittorrent/DHT"), true).toBool();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user