| 187 | } |
| 188 | |
| 189 | bool ManagedPackPage::runUpdateTask(InstanceTask* task) |
| 190 | { |
| 191 | Q_ASSERT(task); |
| 192 | |
| 193 | unique_qobject_ptr<Task> wrapped_task(APPLICATION->instances()->wrapInstanceTask(task)); |
| 194 | |
| 195 | connect(task, &Task::failed, |
| 196 | [this](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show(); }); |
| 197 | connect(task, &Task::succeeded, [this, task]() { |
| 198 | QStringList warnings = task->warnings(); |
| 199 | if (warnings.count()) |
| 200 | CustomMessageBox::selectable(this, tr("Warnings"), warnings.join('\n'), QMessageBox::Warning)->show(); |
| 201 | }); |
| 202 | connect(task, &Task::aborted, [this] { |
| 203 | CustomMessageBox::selectable(this, tr("Task aborted"), tr("The task has been aborted by the user."), QMessageBox::Information) |
| 204 | ->show(); |
| 205 | }); |
| 206 | |
| 207 | ProgressDialog loadDialog(this); |
| 208 | loadDialog.setSkipButton(true, tr("Abort")); |
| 209 | loadDialog.execWithTask(task); |
| 210 | |
| 211 | return task->wasSuccessful(); |
| 212 | } |
| 213 | |
| 214 | void ManagedPackPage::suggestVersion() |
| 215 | { |
nothing calls this directly
no test coverage detected