| 40 | } |
| 41 | |
| 42 | void ProgressWidget::watch(const Task* task) |
| 43 | { |
| 44 | if (!task) |
| 45 | return; |
| 46 | |
| 47 | if (m_task) |
| 48 | disconnect(m_task, nullptr, this, nullptr); |
| 49 | |
| 50 | m_task = task; |
| 51 | |
| 52 | connect(m_task, &Task::finished, this, &ProgressWidget::handleTaskFinish); |
| 53 | connect(m_task, &Task::status, this, &ProgressWidget::handleTaskStatus); |
| 54 | // TODO: should we connect &Task::details |
| 55 | connect(m_task, &Task::progress, this, &ProgressWidget::handleTaskProgress); |
| 56 | connect(m_task, &Task::destroyed, this, &ProgressWidget::taskDestroyed); |
| 57 | |
| 58 | if (m_task->isRunning()) |
| 59 | show(); |
| 60 | else |
| 61 | connect(m_task, &Task::started, this, &ProgressWidget::show); |
| 62 | } |
| 63 | |
| 64 | void ProgressWidget::start(const Task* task) |
| 65 | { |
no test coverage detected