Browse Source

Making alternate download/upload configuration behave like global download/upload configuration so as to allow boundless down/up

adaptive-webui-19844
LazyBui 10 years ago
parent
commit
23ec562375
  1. 152
      src/gui/options.ui
  2. 45
      src/gui/options_imp.cpp
  3. 1
      src/gui/options_imp.h

152
src/gui/options.ui

@ -181,7 +181,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>458</width> <width>458</width>
<height>587</height> <height>611</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
@ -520,7 +520,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>458</width> <width>458</width>
<height>905</height> <height>933</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -1037,8 +1037,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>357</width> <width>458</width>
<height>498</height> <height>556</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -1538,8 +1538,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>275</width> <width>458</width>
<height>396</height> <height>407</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_33"> <layout class="QVBoxLayout" name="verticalLayout_33">
@ -1716,13 +1716,6 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_8"> <layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Upload:</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinUploadLimitAlt"> <widget class="QSpinBox" name="spinUploadLimitAlt">
<property name="minimum"> <property name="minimum">
@ -1743,15 +1736,11 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Download:</string>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="spinDownloadLimitAlt"> <widget class="QSpinBox" name="spinDownloadLimitAlt">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>
@ -1770,6 +1759,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkUploadLimitAlt">
<property name="text">
<string>Upload:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkDownloadLimitAlt">
<property name="text">
<string>Download:</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
@ -1816,6 +1822,12 @@
<property name="wrapping"> <property name="wrapping">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="displayFormat">
<string notr="true">hh:mm</string>
</property>
<property name="calendarPopup">
<bool>false</bool>
</property>
<property name="time"> <property name="time">
<time> <time>
<hour>8</hour> <hour>8</hour>
@ -1823,12 +1835,6 @@
<second>0</second> <second>0</second>
</time> </time>
</property> </property>
<property name="displayFormat">
<string notr="true">hh:mm</string>
</property>
<property name="calendarPopup">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1846,6 +1852,9 @@
<property name="wrapping"> <property name="wrapping">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="displayFormat">
<string notr="true">hh:mm</string>
</property>
<property name="time"> <property name="time">
<time> <time>
<hour>20</hour> <hour>20</hour>
@ -1853,9 +1862,6 @@
<second>0</second> <second>0</second>
</time> </time>
</property> </property>
<property name="displayFormat">
<string notr="true">hh:mm</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -1956,8 +1962,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>418</width> <width>458</width>
<height>442</height> <height>381</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
@ -2310,8 +2316,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>330</width> <width>458</width>
<height>480</height> <height>494</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -2687,8 +2693,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>474</width>
<height>28</height> <height>316</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_36"/> <layout class="QVBoxLayout" name="verticalLayout_36"/>
@ -2791,12 +2797,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>496</x> <x>544</x>
<y>66</y> <y>172</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>643</x> <x>603</x>
<y>74</y> <y>171</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -2807,12 +2813,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>494</x> <x>544</x>
<y>97</y> <y>198</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>611</x> <x>603</x>
<y>99</y> <y>197</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -2823,12 +2829,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>510</x> <x>544</x>
<y>123</y> <y>250</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>616</x> <x>603</x>
<y>126</y> <y>249</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -2839,12 +2845,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>552</x> <x>509</x>
<y>441</y> <y>372</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>612</x> <x>584</x>
<y>443</y> <y>373</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -2855,12 +2861,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>552</x> <x>509</x>
<y>441</y> <y>372</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>788</x> <x>721</x>
<y>444</y> <y>373</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -2875,8 +2881,8 @@
<y>147</y> <y>147</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>430</x> <x>711</x>
<y>176</y> <y>172</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -2896,5 +2902,37 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>checkDownloadLimitAlt</sender>
<signal>toggled(bool)</signal>
<receiver>spinDownloadLimitAlt</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>398</x>
<y>292</y>
</hint>
<hint type="destinationlabel">
<x>477</x>
<y>292</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkUploadLimitAlt</sender>
<signal>toggled(bool)</signal>
<receiver>spinUploadLimitAlt</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>398</x>
<y>263</y>
</hint>
<hint type="destinationlabel">
<x>477</x>
<y>263</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>

45
src/gui/options_imp.cpp

@ -186,6 +186,8 @@ options_imp::options_imp(QWidget *parent):
connect(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkUPnP, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDownloadLimit, 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(spinUploadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinDownloadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinDownloadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinUploadLimitAlt, 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->setuTPEnabled(checkuTP->isChecked());
pref->setuTPRateLimited(checkLimituTPConnections->isChecked()); pref->setuTPRateLimited(checkLimituTPConnections->isChecked());
pref->includeOverheadInLimits(checkLimitTransportOverhead->isChecked()); pref->includeOverheadInLimits(checkLimitTransportOverhead->isChecked());
pref->setAltGlobalDownloadLimit(spinDownloadLimitAlt->value()); const QPair<int, int> alt_down_up_limit = getAltGlobalBandwidthLimits();
pref->setAltGlobalUploadLimit(spinUploadLimitAlt->value()); pref->setAltGlobalDownloadLimit(alt_down_up_limit.first);
pref->setAltGlobalUploadLimit(alt_down_up_limit.second);
pref->setSchedulerEnabled(check_schedule->isChecked()); pref->setSchedulerEnabled(check_schedule->isChecked());
pref->setSchedulerStartTime(schedule_from->time()); pref->setSchedulerStartTime(schedule_from->time());
pref->setSchedulerEndTime(schedule_to->time()); pref->setSchedulerEndTime(schedule_to->time());
@ -626,8 +629,29 @@ void options_imp::loadOptions() {
checkUploadLimit->setChecked(false); checkUploadLimit->setChecked(false);
spinUploadLimit->setEnabled(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 // Options
checkuTP->setChecked(pref->isuTPEnabled()); checkuTP->setChecked(pref->isuTPEnabled());
checkLimituTPConnections->setChecked(pref->isuTPRateLimited()); checkLimituTPConnections->setChecked(pref->isuTPRateLimited());
@ -831,6 +855,19 @@ QPair<int,int> options_imp::getGlobalBandwidthLimits() const {
return qMakePair(DL, UP); return qMakePair(DL, UP);
} }
// Return alternate Download & Upload limits in kbps
// [download,upload]
QPair<int,int> 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 { bool options_imp::startMinimized() const {
return checkStartMinimized->isChecked(); return checkStartMinimized->isChecked();
} }

1
src/gui/options_imp.h

@ -118,6 +118,7 @@ private:
int getPort() const; int getPort() const;
bool isUPnPEnabled() const; bool isUPnPEnabled() const;
QPair<int,int> getGlobalBandwidthLimits() const; QPair<int,int> getGlobalBandwidthLimits() const;
QPair<int,int> getAltGlobalBandwidthLimits() const;
// Bittorrent options // Bittorrent options
int getMaxConnecs() const; int getMaxConnecs() const;
int getMaxConnecsPerTorrent() const; int getMaxConnecsPerTorrent() const;

Loading…
Cancel
Save