| 829 | } |
| 830 | |
| 831 | void MainWindow::runModalTask(Task* task) |
| 832 | { |
| 833 | connect(task, &Task::failed, |
| 834 | [this](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); }); |
| 835 | connect(task, &Task::succeeded, [this, task]() { |
| 836 | QStringList warnings = task->warnings(); |
| 837 | if (warnings.count()) { |
| 838 | CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show(); |
| 839 | } |
| 840 | }); |
| 841 | connect(task, &Task::aborted, [this] { |
| 842 | CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information) |
| 843 | ->show(); |
| 844 | }); |
| 845 | ProgressDialog loadDialog(this); |
| 846 | loadDialog.setSkipButton(true, tr("Abort")); |
| 847 | loadDialog.execWithTask(task); |
| 848 | } |
| 849 | |
| 850 | void MainWindow::instanceFromInstanceTask(InstanceTask* rawTask) |
| 851 | { |
nothing calls this directly
no test coverage detected