diff --git a/src/gui/options.ui b/src/gui/options.ui
index 2beb5a288..c37498f5c 100644
--- a/src/gui/options.ui
+++ b/src/gui/options.ui
@@ -181,7 +181,7 @@
0
0
458
- 587
+ 611
@@ -520,7 +520,7 @@
0
0
458
- 905
+ 933
@@ -1037,8 +1037,8 @@
0
0
- 357
- 498
+ 458
+ 556
@@ -1538,8 +1538,8 @@
0
0
- 275
- 396
+ 458
+ 407
@@ -1716,13 +1716,6 @@
-
-
-
-
-
- Upload:
-
-
-
-
@@ -1743,15 +1736,11 @@
- -
-
-
- Download:
-
-
-
-
+
+ false
+
1
@@ -1770,6 +1759,23 @@
+ -
+
+
+ Upload:
+
+
+ true
+
+
+
+ -
+
+
+ Download:
+
+
+
-
@@ -1816,6 +1822,12 @@
true
+
+ hh:mm
+
+
+ false
+
-
- hh:mm
-
-
- false
-
-
@@ -1846,6 +1852,9 @@
true
+
+ hh:mm
+
-
- hh:mm
-
-
@@ -1956,8 +1962,8 @@
0
0
- 418
- 442
+ 458
+ 381
@@ -2310,8 +2316,8 @@
0
0
- 330
- 480
+ 458
+ 494
@@ -2687,8 +2693,8 @@
0
0
- 98
- 28
+ 474
+ 316
@@ -2791,12 +2797,12 @@
setEnabled(bool)
- 496
- 66
+ 544
+ 172
- 643
- 74
+ 603
+ 171
@@ -2807,12 +2813,12 @@
setEnabled(bool)
- 494
- 97
+ 544
+ 198
- 611
- 99
+ 603
+ 197
@@ -2823,12 +2829,12 @@
setEnabled(bool)
- 510
- 123
+ 544
+ 250
- 616
- 126
+ 603
+ 249
@@ -2839,12 +2845,12 @@
setEnabled(bool)
- 552
- 441
+ 509
+ 372
- 612
- 443
+ 584
+ 373
@@ -2855,12 +2861,12 @@
setEnabled(bool)
- 552
- 441
+ 509
+ 372
- 788
- 444
+ 721
+ 373
@@ -2875,8 +2881,8 @@
147
- 430
- 176
+ 711
+ 172
@@ -2896,5 +2902,37 @@
+
+ checkDownloadLimitAlt
+ toggled(bool)
+ spinDownloadLimitAlt
+ setEnabled(bool)
+
+
+ 398
+ 292
+
+
+ 477
+ 292
+
+
+
+
+ checkUploadLimitAlt
+ toggled(bool)
+ spinUploadLimitAlt
+ setEnabled(bool)
+
+
+ 398
+ 263
+
+
+ 477
+ 263
+
+
+
diff --git a/src/gui/options_imp.cpp b/src/gui/options_imp.cpp
index cc39cc611..c07ecb15b 100644
--- a/src/gui/options_imp.cpp
+++ b/src/gui/options_imp.cpp
@@ -186,6 +186,8 @@ options_imp::options_imp(QWidget *parent):
connect(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
+ connect(checkUploadLimitAlt, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
+ connect(checkDownloadLimitAlt, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinUploadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinDownloadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinUploadLimitAlt, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
@@ -422,8 +424,9 @@ void options_imp::saveOptions() {
pref->setuTPEnabled(checkuTP->isChecked());
pref->setuTPRateLimited(checkLimituTPConnections->isChecked());
pref->includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
- pref->setAltGlobalDownloadLimit(spinDownloadLimitAlt->value());
- pref->setAltGlobalUploadLimit(spinUploadLimitAlt->value());
+ const QPair alt_down_up_limit = getAltGlobalBandwidthLimits();
+ pref->setAltGlobalDownloadLimit(alt_down_up_limit.first);
+ pref->setAltGlobalUploadLimit(alt_down_up_limit.second);
pref->setSchedulerEnabled(check_schedule->isChecked());
pref->setSchedulerStartTime(schedule_from->time());
pref->setSchedulerEndTime(schedule_to->time());
@@ -630,8 +633,29 @@ void options_imp::loadOptions() {
checkUploadLimit->setChecked(false);
spinUploadLimit->setEnabled(false);
}
- spinUploadLimitAlt->setValue(pref->getAltGlobalUploadLimit());
- spinDownloadLimitAlt->setValue(pref->getAltGlobalDownloadLimit());
+
+ intValue = pref->getAltGlobalDownloadLimit();
+ if (intValue > 0) {
+ // Enabled
+ checkDownloadLimitAlt->setChecked(true);
+ spinDownloadLimitAlt->setEnabled(true);
+ spinDownloadLimitAlt->setValue(intValue);
+ } else {
+ // Disabled
+ checkDownloadLimitAlt->setChecked(false);
+ spinDownloadLimitAlt->setEnabled(false);
+ }
+ intValue = pref->getAltGlobalUploadLimit();
+ if (intValue != -1) {
+ // Enabled
+ checkUploadLimitAlt->setChecked(true);
+ spinUploadLimitAlt->setEnabled(true);
+ spinUploadLimitAlt->setValue(intValue);
+ } else {
+ // Disabled
+ checkUploadLimitAlt->setChecked(false);
+ spinUploadLimitAlt->setEnabled(false);
+ }
// Options
checkuTP->setChecked(pref->isuTPEnabled());
checkLimituTPConnections->setChecked(pref->isuTPRateLimited());
@@ -835,6 +859,19 @@ QPair options_imp::getGlobalBandwidthLimits() const {
return qMakePair(DL, UP);
}
+// Return alternate Download & Upload limits in kbps
+// [download,upload]
+QPair options_imp::getAltGlobalBandwidthLimits() const {
+ int DL = -1, UP = -1;
+ if (checkDownloadLimitAlt->isChecked()) {
+ DL = spinDownloadLimitAlt->value();
+ }
+ if (checkUploadLimitAlt->isChecked()) {
+ UP = spinUploadLimitAlt->value();
+ }
+ return qMakePair(DL, UP);
+}
+
bool options_imp::startMinimized() const {
return checkStartMinimized->isChecked();
}
diff --git a/src/gui/options_imp.h b/src/gui/options_imp.h
index 4dbf277a5..662880b34 100644
--- a/src/gui/options_imp.h
+++ b/src/gui/options_imp.h
@@ -118,6 +118,7 @@ private:
int getPort() const;
bool isUPnPEnabled() const;
QPair getGlobalBandwidthLimits() const;
+ QPair getAltGlobalBandwidthLimits() const;
// Bittorrent options
int getMaxConnecs() const;
int getMaxConnecsPerTorrent() const;