| 283 | } |
| 284 | |
| 285 | void MacroScheduleEntry::FastForwardTo(const QDateTime &now) |
| 286 | { |
| 287 | timesTriggered = 0; |
| 288 | lastTriggered = QDateTime(); |
| 289 | |
| 290 | if (!startDateTime.isValid()) { |
| 291 | return; |
| 292 | } |
| 293 | |
| 294 | if (!doesRepeat) { |
| 295 | // One-shot: count it as triggered if the start lies in the past. |
| 296 | if (startDateTime <= now) { |
| 297 | timesTriggered = 1; |
| 298 | lastTriggered = startDateTime; |
| 299 | } |
| 300 | return; |
| 301 | } |
| 302 | |
| 303 | // Repeating: walk intervals from startDateTime and count each one |
| 304 | // that falls at or before 'now'. |
| 305 | QDateTime t = startDateTime; |
| 306 | while (t <= now) { |
| 307 | ++timesTriggered; |
| 308 | lastTriggered = t; |
| 309 | const QDateTime next = advanceFrom(t); |
| 310 | if (!next.isValid()) { |
| 311 | break; |
| 312 | } |
| 313 | t = next; |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | QString MacroScheduleEntry::GetRepeatDescription() const |
| 318 | { |