Browse Source

- Fix for queueing system

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
3f5340523f
  1. 3
      src/GUI.cpp
  2. 47
      src/options.ui
  3. 15
      src/options_imp.cpp
  4. 1
      src/options_imp.h

3
src/GUI.cpp

@ -1047,9 +1047,10 @@ void GUI::configureSession(bool deleteOptions) {
downloadingTorrentTab->hidePriorityColumn(false); downloadingTorrentTab->hidePriorityColumn(false);
} }
int max_torrents = options->getMaxActiveTorrents(); int max_torrents = options->getMaxActiveTorrents();
int max_uploads = options->getMaxActiveUploads();
int max_downloads = options->getMaxActiveDownloads(); int max_downloads = options->getMaxActiveDownloads();
sessionSettings.active_downloads = max_downloads; sessionSettings.active_downloads = max_downloads;
sessionSettings.active_seeds = -1; sessionSettings.active_seeds = max_uploads;
sessionSettings.active_limit = max_torrents; sessionSettings.active_limit = max_torrents;
sessionSettings.dont_count_slow_torrents = false; sessionSettings.dont_count_slow_torrents = false;
BTSession->setQueueingEnabled(true); BTSession->setQueueingEnabled(true);

47
src/options.ui

@ -1940,7 +1940,50 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum" > <property name="minimum" >
<number>1</number> <number>-1</number>
</property>
<property name="maximum" >
<number>999</number>
</property>
<property name="value" >
<number>3</number>
</property>
</widget>
</item>
<item>
<spacer>
<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>
</item>
<item>
<layout class="QHBoxLayout" name="_2" >
<item>
<widget class="QLabel" name="label_max_active_up" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Maximum active uploads:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinMaxActiveUploads" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="minimum" >
<number>-1</number>
</property> </property>
<property name="maximum" > <property name="maximum" >
<number>999</number> <number>999</number>
@ -1983,7 +2026,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimum" > <property name="minimum" >
<number>1</number> <number>-1</number>
</property> </property>
<property name="maximum" > <property name="maximum" >
<number>999</number> <number>999</number>

15
src/options_imp.cpp

@ -381,10 +381,8 @@ void options_imp::saveOptions(){
settings.beginGroup("Queueing"); settings.beginGroup("Queueing");
settings.setValue(QString::fromUtf8("QueueingEnabled"), isQueueingSystemEnabled()); settings.setValue(QString::fromUtf8("QueueingEnabled"), isQueueingSystemEnabled());
settings.setValue(QString::fromUtf8("MaxActiveDownloads"), spinMaxActiveDownloads->value()); settings.setValue(QString::fromUtf8("MaxActiveDownloads"), spinMaxActiveDownloads->value());
if(spinMaxActiveTorrents->value() >= spinMaxActiveDownloads->value()) settings.setValue(QString::fromUtf8("MaxActiveUploads"), spinMaxActiveUploads->value());
settings.setValue(QString::fromUtf8("MaxActiveTorrents"), spinMaxActiveTorrents->value()); settings.setValue(QString::fromUtf8("MaxActiveTorrents"), spinMaxActiveTorrents->value());
else
settings.setValue(QString::fromUtf8("MaxActiveTorrents"), spinMaxActiveDownloads->value());
// End Queueing system preferences // End Queueing system preferences
settings.endGroup(); settings.endGroup();
// Web UI // Web UI
@ -700,6 +698,7 @@ void options_imp::loadOptions(){
if(isQueueingSystemEnabled()) { if(isQueueingSystemEnabled()) {
enableQueueingSystem(2); // Enable enableQueueingSystem(2); // Enable
spinMaxActiveDownloads->setValue(settings.value(QString::fromUtf8("MaxActiveDownloads"), 3).toInt()); spinMaxActiveDownloads->setValue(settings.value(QString::fromUtf8("MaxActiveDownloads"), 3).toInt());
spinMaxActiveUploads->setValue(settings.value(QString::fromUtf8("MaxActiveUploads"), 3).toInt());
spinMaxActiveTorrents->setValue(settings.value(QString::fromUtf8("MaxActiveTorrents"), 5).toInt()); spinMaxActiveTorrents->setValue(settings.value(QString::fromUtf8("MaxActiveTorrents"), 5).toInt());
} else { } else {
enableQueueingSystem(0); // Disable enableQueueingSystem(0); // Disable
@ -731,6 +730,10 @@ int options_imp::getMaxActiveDownloads() const {
return spinMaxActiveDownloads->value(); return spinMaxActiveDownloads->value();
} }
int options_imp::getMaxActiveUploads() const {
return spinMaxActiveUploads->value();
}
int options_imp::getMaxActiveTorrents() const { int options_imp::getMaxActiveTorrents() const {
return spinMaxActiveTorrents->value(); return spinMaxActiveTorrents->value();
} }
@ -920,13 +923,17 @@ void options_imp::enableQueueingSystem(int checkBoxValue) {
if(checkBoxValue != 2) { if(checkBoxValue != 2) {
//Disable //Disable
spinMaxActiveDownloads->setEnabled(false); spinMaxActiveDownloads->setEnabled(false);
spinMaxActiveUploads->setEnabled(false);
label_max_active_dl->setEnabled(false); label_max_active_dl->setEnabled(false);
label_max_active_up->setEnabled(false);
maxActiveTorrents_lbl->setEnabled(false); maxActiveTorrents_lbl->setEnabled(false);
spinMaxActiveTorrents->setEnabled(false); spinMaxActiveTorrents->setEnabled(false);
}else{ }else{
//enable //enable
spinMaxActiveDownloads->setEnabled(true); spinMaxActiveDownloads->setEnabled(true);
spinMaxActiveUploads->setEnabled(true);
label_max_active_dl->setEnabled(true); label_max_active_dl->setEnabled(true);
label_max_active_up->setEnabled(true);
maxActiveTorrents_lbl->setEnabled(true); maxActiveTorrents_lbl->setEnabled(true);
spinMaxActiveTorrents->setEnabled(true); spinMaxActiveTorrents->setEnabled(true);
} }

1
src/options_imp.h

@ -118,6 +118,7 @@ class options_imp : public QDialog, private Ui::Dialog {
// Queueing system // Queueing system
bool isQueueingSystemEnabled() const; bool isQueueingSystemEnabled() const;
int getMaxActiveDownloads() const; int getMaxActiveDownloads() const;
int getMaxActiveUploads() const;
int getMaxActiveTorrents() const; int getMaxActiveTorrents() const;
bool isWebUiEnabled() const; bool isWebUiEnabled() const;
quint16 webUiPort() const; quint16 webUiPort() const;

Loading…
Cancel
Save