mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-14 08:48:17 +00:00
Allow the scheduler to have a start time that's after the end time. Closes #980.
This commit is contained in:
parent
c9a8430463
commit
d0893bc1c7
@ -1414,8 +1414,6 @@ bool options_imp::schedTimesOk() {
|
|||||||
|
|
||||||
if (schedule_from->time() == schedule_to->time())
|
if (schedule_from->time() == schedule_to->time())
|
||||||
msg = tr("The start time and the end time can't be the same.");
|
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()) {
|
if (!msg.isEmpty()) {
|
||||||
QMessageBox::critical(this, tr("Time Error"), msg);
|
QMessageBox::critical(this, tr("Time Error"), msg);
|
||||||
|
@ -32,8 +32,16 @@ public slots:
|
|||||||
int sched_days = pref.getSchedulerDays();
|
int sched_days = pref.getSchedulerDays();
|
||||||
int day = QDateTime::currentDateTime().toLocalTime().date().dayOfWeek();
|
int day = QDateTime::currentDateTime().toLocalTime().date().dayOfWeek();
|
||||||
bool new_mode = false;
|
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) {
|
switch(sched_days) {
|
||||||
case EVERY_DAY:
|
case EVERY_DAY:
|
||||||
new_mode = true;
|
new_mode = true;
|
||||||
@ -53,6 +61,9 @@ public slots:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
new_mode = !new_mode;
|
||||||
|
|
||||||
if (new_mode != alt_bw_enabled)
|
if (new_mode != alt_bw_enabled)
|
||||||
emit switchToAlternativeMode(new_mode);
|
emit switchToAlternativeMode(new_mode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user