void QwwTaskPanel::removeTask(int index) { if (index < 0 || index>=m_tasks.count()) return; Task *tsk = static_cast<Task*>(m_tasks.at(index)); m_tasks.removeAt(index); if (m_tasks.count()<=index) { setCurrentIndex(m_tasks.count()-1); } QWidget *body = tsk->body(); body->setParent(this); delete tsk; }
void Task::loop() { uint8_t oldSREG = SREG; cli(); Task* current = rlr; SREG = oldSREG; if (current != 0) { int t = current->body(); uint8_t oldSREG = SREG; cli(); current->state = suspended; rlr = current->next; if (t >= 0) { current->doWakeup(t); } SREG = oldSREG; } }
QWidget * QwwTaskPanel::task(int index) const { if (index < 0 || index>=m_tasks.count()) return 0; Task *tsk = static_cast<Task*>(m_tasks.at(index)); return tsk ? tsk->body() : 0; }