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

This commit is contained in:
sledgehammer999 2013-10-20 13:46:55 +03:00
parent c9a8430463
commit d0893bc1c7
2 changed files with 12 additions and 3 deletions

View File

@ -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);

View File

@ -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:
}
}
if (reverse)
new_mode = !new_mode;
if (new_mode != alt_bw_enabled)
emit switchToAlternativeMode(new_mode);