| 1673 | } |
| 1674 | |
| 1675 | void MainWindow::runModalTask(Task *task) |
| 1676 | { |
| 1677 | ProgressDialog loadDialog(this); |
| 1678 | |
| 1679 | connect(task, &Task::failed, [this, &loadDialog](QString reason) |
| 1680 | { |
| 1681 | // FIXME: |
| 1682 | // HACK: I don't know why calling show() on this CustomMessageBox causes loadDialog to not close, |
| 1683 | // but this forces it to close BEFORE the CustomMessageBox gets opened... I think this is a bad fix |
| 1684 | loadDialog.close(); |
| 1685 | CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); |
| 1686 | }); |
| 1687 | connect(task, &Task::succeeded, [this, task]() |
| 1688 | { |
| 1689 | QStringList warnings = task->warnings(); |
| 1690 | if(warnings.count()) |
| 1691 | { |
| 1692 | CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show(); |
| 1693 | } |
| 1694 | }); |
| 1695 | connect(task, &Task::aborted, [this, &loadDialog] |
| 1696 | { |
| 1697 | // HACK: Same bad hack as above slot for Task::failed |
| 1698 | loadDialog.close(); |
| 1699 | CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information)->show(); |
| 1700 | }); |
| 1701 | loadDialog.setSkipButton(true, tr("Abort")); |
| 1702 | loadDialog.execWithTask(task); |
| 1703 | qDebug() << "MainWindow::runModalTask: execWithTask exited properly"; |
| 1704 | } |
| 1705 | |
| 1706 | void MainWindow::instanceFromInstanceTask(InstanceTask *rawTask) |
| 1707 | { |
nothing calls this directly
no test coverage detected