Browse Source

Allow the scheduler to have a start time that's after the end time. Closes #980.

adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
d0893bc1c7
  1. 2
      src/preferences/options_imp.cpp
  2. 13
      src/qtlibtorrent/bandwidthscheduler.h

2
src/preferences/options_imp.cpp

@ -1414,8 +1414,6 @@ bool options_imp::schedTimesOk() { @@ -1414,8 +1414,6 @@ bool options_imp::schedTimesOk() {
if (schedule_from->time() == schedule_to->time())
msg = tr("The start time and the end time can't be the same.");
else if (schedule_from->time() > schedule_to->time())
msg = tr("The start time can't be after the end time.");
if (!msg.isEmpty()) {
QMessageBox::critical(this, tr("Time Error"), msg);

13
src/qtlibtorrent/bandwidthscheduler.h

@ -32,8 +32,16 @@ public slots: @@ -32,8 +32,16 @@ public slots:
int sched_days = pref.getSchedulerDays();
int day = QDateTime::currentDateTime().toLocalTime().date().dayOfWeek();
bool new_mode = false;
bool reverse = false;
if (start < end && start <= now && end >= now) {
if (start > end) {
QTime temp = start;
start = end;
end = temp;
reverse = true;
}
if (start <= now && end >= now) {
switch(sched_days) {
case EVERY_DAY:
new_mode = true;
@ -53,6 +61,9 @@ public slots: @@ -53,6 +61,9 @@ public slots:
}
}
if (reverse)
new_mode = !new_mode;
if (new_mode != alt_bw_enabled)
emit switchToAlternativeMode(new_mode);

Loading…
Cancel
Save