mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 22:52:33 -06:00
Simplify uTP settings
This commit is contained in:
@@ -1405,9 +1405,9 @@ QGroupBox {
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-16</y>
|
||||
<y>0</y>
|
||||
<width>489</width>
|
||||
<height>425</height>
|
||||
<height>419</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
@@ -1520,34 +1520,14 @@ QGroupBox {
|
||||
</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>
|
||||
<widget class="QCheckBox" name="checkuTP">
|
||||
<property name="text">
|
||||
<string>Enable bandwidth management (uTP)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkLimituTPConnections">
|
||||
@@ -2214,8 +2194,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>384</height>
|
||||
<width>389</width>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
@@ -2460,8 +2440,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>384</height>
|
||||
<width>86</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||
@@ -2569,8 +2549,8 @@ QGroupBox {
|
||||
<y>157</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>574</x>
|
||||
<y>160</y>
|
||||
<x>643</x>
|
||||
<y>165</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -2613,12 +2593,12 @@ QGroupBox {
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>440</x>
|
||||
<y>364</y>
|
||||
<x>542</x>
|
||||
<y>404</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>563</x>
|
||||
<y>374</y>
|
||||
<x>598</x>
|
||||
<y>405</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -2629,12 +2609,28 @@ QGroupBox {
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>418</x>
|
||||
<y>371</y>
|
||||
<x>542</x>
|
||||
<y>404</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>707</x>
|
||||
<y>376</y>
|
||||
<x>757</x>
|
||||
<y>406</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkuTP</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>checkLimituTPConnections</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>421</x>
|
||||
<y>147</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>430</x>
|
||||
<y>176</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
||||
@@ -113,8 +113,6 @@ 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)));
|
||||
|
||||
@@ -170,7 +168,7 @@ 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(checkuTP, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
connect(checkLimituTPConnections, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
connect(checkLimitTransportOverhead, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
// Bittorrent tab
|
||||
@@ -223,7 +221,7 @@ options_imp::options_imp(QWidget *parent):
|
||||
checkAppendqB->setVisible(false);
|
||||
#endif
|
||||
#if LIBTORRENT_VERSION_MINOR < 16
|
||||
comboBTProtocol->setVisible(false);
|
||||
checkuTP->setVisible(false);
|
||||
checkLimituTPConnections->setVisible(false);
|
||||
#endif
|
||||
// Load Advanced settings
|
||||
@@ -391,7 +389,7 @@ 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.setuTPEnabled(checkuTP->isChecked());
|
||||
pref.setuTPRateLimited(checkLimituTPConnections->isChecked());
|
||||
pref.includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
|
||||
pref.setAltGlobalDownloadLimit(spinDownloadLimitAlt->value());
|
||||
@@ -586,7 +584,7 @@ void options_imp::loadOptions(){
|
||||
spinUploadLimitAlt->setValue(pref.getAltGlobalUploadLimit());
|
||||
spinDownloadLimitAlt->setValue(pref.getAltGlobalDownloadLimit());
|
||||
// Options
|
||||
comboBTProtocol->setCurrentIndex((int)pref.getBTProtocol());
|
||||
checkuTP->setChecked(pref.isuTPEnabled());
|
||||
checkLimituTPConnections->setChecked(pref.isuTPRateLimited());
|
||||
checkLimitTransportOverhead->setChecked(pref.includeOverheadInLimits());
|
||||
// Scheduler
|
||||
@@ -1204,21 +1202,3 @@ 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,7 +82,6 @@ private slots:
|
||||
void on_removeScanFolderButton_clicked();
|
||||
void on_registerDNSBtn_clicked();
|
||||
void setLocale(const QString &locale);
|
||||
void updateBTProtocolSettings(int protocol);
|
||||
|
||||
private:
|
||||
// Methods
|
||||
|
||||
@@ -64,9 +64,6 @@ enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT };
|
||||
namespace DNS {
|
||||
enum Service { DYNDNS, NOIP };
|
||||
}
|
||||
namespace BT {
|
||||
enum Protocol { TCP_uTP, TCP, uTP };
|
||||
}
|
||||
|
||||
class Preferences : public QIniSettings {
|
||||
Q_DISABLE_COPY(Preferences);
|
||||
@@ -540,12 +537,12 @@ 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();
|
||||
bool isuTPEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Bittorrent/uTP"), true).toBool();
|
||||
}
|
||||
|
||||
void setBTProtocol(int protocol) {
|
||||
setValue("Preferences/Bittorrent/Protocol", protocol);
|
||||
void setuTPEnabled(bool enabled) {
|
||||
setValue("Preferences/Bittorrent/uTP", enabled);
|
||||
}
|
||||
|
||||
bool isuTPRateLimited() const {
|
||||
|
||||
Reference in New Issue
Block a user