MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / runModalTask

Method runModalTask

launcher/ui/MainWindow.cpp:1675–1704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1673}
1674
1675void 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
1706void MainWindow::instanceFromInstanceTask(InstanceTask *rawTask)
1707{

Callers

nothing calls this directly

Calls 6

selectableFunction · 0.85
showMethod · 0.80
setSkipButtonMethod · 0.80
execWithTaskMethod · 0.80
warningsMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected