mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 03:06:37 +03:00
Allow more fine tuning of uploads. Closes #684.
This commit is contained in:
parent
102b2dc738
commit
798bd2388b
5 changed files with 92 additions and 7 deletions
|
@ -1023,7 +1023,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>458</width>
|
||||
<height>472</height>
|
||||
<height>498</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
|
@ -1133,7 +1133,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="checkMaxConnecsPerTorrent">
|
||||
<property name="text">
|
||||
<string>Maximum number of connections per torrent:</string>
|
||||
|
@ -1143,7 +1143,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spinMaxConnecPerTorrent">
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
|
@ -1156,7 +1156,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkMaxUploadsPerTorrent">
|
||||
<property name="text">
|
||||
<string>Maximum number of upload slots per torrent:</string>
|
||||
|
@ -1166,7 +1166,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="spinMaxUploadsPerTorrent">
|
||||
<property name="maximum">
|
||||
<number>500</number>
|
||||
|
@ -1189,7 +1189,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -1202,7 +1202,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="4" column="2">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -1215,6 +1215,39 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="checkMaxUploads">
|
||||
<property name="text">
|
||||
<string>Global maximum number of upload slots:</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="spinMaxUploads">
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -2870,5 +2903,21 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkMaxUploads</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>spinMaxUploads</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>423</x>
|
||||
<y>224</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>571</x>
|
||||
<y>224</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -201,9 +201,11 @@ options_imp::options_imp(QWidget *parent):
|
|||
// Bittorrent tab
|
||||
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkMaxUploads, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(spinMaxConnec, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(spinMaxConnecPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(spinMaxUploads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
|
@ -449,6 +451,7 @@ void options_imp::saveOptions() {
|
|||
// Bittorrent preferences
|
||||
pref.setMaxConnecs(getMaxConnecs());
|
||||
pref.setMaxConnecsPerTorrent(getMaxConnecsPerTorrent());
|
||||
pref.setMaxUploads(getMaxUploads());
|
||||
pref.setMaxUploadsPerTorrent(getMaxUploadsPerTorrent());
|
||||
pref.setDHTEnabled(isDHTEnabled());
|
||||
pref.setPeXEnabled(checkPeX->isChecked());
|
||||
|
@ -713,6 +716,17 @@ void options_imp::loadOptions() {
|
|||
checkMaxConnecsPerTorrent->setChecked(false);
|
||||
spinMaxConnecPerTorrent->setEnabled(false);
|
||||
}
|
||||
intValue = pref.getMaxUploads();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
checkMaxUploads->setChecked(true);
|
||||
spinMaxUploads->setEnabled(true);
|
||||
spinMaxUploads->setValue(intValue);
|
||||
} else {
|
||||
// disable
|
||||
checkMaxUploads->setChecked(false);
|
||||
spinMaxUploads->setEnabled(false);
|
||||
}
|
||||
intValue = pref.getMaxUploadsPerTorrent();
|
||||
if (intValue > 0) {
|
||||
// enable
|
||||
|
@ -907,6 +921,14 @@ int options_imp::getMaxConnecsPerTorrent() const {
|
|||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxUploads() const {
|
||||
if (!checkMaxUploads->isChecked()) {
|
||||
return -1;
|
||||
}else{
|
||||
return spinMaxUploads->value();
|
||||
}
|
||||
}
|
||||
|
||||
int options_imp::getMaxUploadsPerTorrent() const {
|
||||
if (!checkMaxUploadsPerTorrent->isChecked()) {
|
||||
return -1;
|
||||
|
|
|
@ -123,6 +123,7 @@ private:
|
|||
// Bittorrent options
|
||||
int getMaxConnecs() const;
|
||||
int getMaxConnecsPerTorrent() const;
|
||||
int getMaxUploads() const;
|
||||
int getMaxUploadsPerTorrent() const;
|
||||
bool isDHTEnabled() const;
|
||||
bool isDHTPortSameAsBT() const;
|
||||
|
|
|
@ -588,6 +588,15 @@ public:
|
|||
setValue(QString::fromUtf8("Preferences/Bittorrent/MaxConnecsPerTorrent"), val);
|
||||
}
|
||||
|
||||
int getMaxUploads() const {
|
||||
return value(QString::fromUtf8("Preferences/Bittorrent/MaxUploads"), 8).toInt();
|
||||
}
|
||||
|
||||
void setMaxUploads(int val) {
|
||||
if (val <= 0) val = -1;
|
||||
setValue(QString::fromUtf8("Preferences/Bittorrent/MaxUploads"), val);
|
||||
}
|
||||
|
||||
int getMaxUploadsPerTorrent() const {
|
||||
return value(QString::fromUtf8("Preferences/Bittorrent/MaxUploadsPerTorrent"), 4).toInt();
|
||||
}
|
||||
|
|
|
@ -475,11 +475,15 @@ void QBtSession::configureSession() {
|
|||
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
|
||||
// * Max connections limit
|
||||
sessionSettings.connections_limit = pref.getMaxConnecs();
|
||||
// * Global max upload slots
|
||||
sessionSettings.unchoke_slots_limit = pref.getMaxUploads();
|
||||
#else
|
||||
// * Max Half-open connections
|
||||
s->set_max_half_open_connections(pref.getMaxHalfOpenConnections());
|
||||
// * Max connections limit
|
||||
setMaxConnections(pref.getMaxConnecs());
|
||||
// * Global max upload slots
|
||||
s->set_max_uploads(pref.getMaxUploads());
|
||||
#endif
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
// uTP
|
||||
|
|
Loading…
Reference in a new issue