| 1531 | } |
| 1532 | |
| 1533 | void MainWindow::reportStateLoadError(const QString& message, std::optional<s32> slot, bool backup) |
| 1534 | { |
| 1535 | const bool prompt_on_error = Host::GetBaseBoolSettingValue("UI", "PromptOnStateLoadSaveFailure", true); |
| 1536 | if (!prompt_on_error) |
| 1537 | { |
| 1538 | SaveState_ReportLoadErrorOSD(message.toStdString(), slot, backup); |
| 1539 | return; |
| 1540 | } |
| 1541 | |
| 1542 | QString title; |
| 1543 | if (slot.has_value()) |
| 1544 | { |
| 1545 | if (backup) |
| 1546 | title = tr("Failed to Load State From Backup Slot %1").arg(*slot); |
| 1547 | else |
| 1548 | title = tr("Failed to Load State From Slot %1").arg(*slot); |
| 1549 | } |
| 1550 | else |
| 1551 | { |
| 1552 | title = tr("Failed to Load State"); |
| 1553 | } |
| 1554 | |
| 1555 | VMLock lock(pauseAndLockVM()); |
| 1556 | |
| 1557 | QCheckBox* do_not_show_again = new QCheckBox(tr("Do not show again")); |
| 1558 | |
| 1559 | QPointer<QMessageBox> message_box = new QMessageBox(this); |
| 1560 | message_box->setWindowTitle(title); |
| 1561 | message_box->setText(message); |
| 1562 | message_box->setIcon(QMessageBox::Critical); |
| 1563 | message_box->addButton(QMessageBox::Ok); |
| 1564 | message_box->setDefaultButton(QMessageBox::Ok); |
| 1565 | message_box->setCheckBox(do_not_show_again); |
| 1566 | |
| 1567 | message_box->exec(); |
| 1568 | if (message_box.isNull()) |
| 1569 | return; |
| 1570 | |
| 1571 | if (do_not_show_again->isChecked()) |
| 1572 | { |
| 1573 | Host::SetBaseBoolSettingValue("UI", "PromptOnStateLoadSaveFailure", false); |
| 1574 | Host::CommitBaseSettingChanges(); |
| 1575 | if (m_settings_window) |
| 1576 | { |
| 1577 | InterfaceSettingsWidget* interface_settings = m_settings_window->getInterfaceSettingsWidget(); |
| 1578 | interface_settings->updatePromptOnStateLoadSaveFailureCheckbox(Qt::Unchecked); |
| 1579 | } |
| 1580 | } |
| 1581 | |
| 1582 | delete message_box; |
| 1583 | } |
| 1584 | |
| 1585 | void MainWindow::reportStateSaveError(const QString& message, std::optional<s32> slot) |
| 1586 | { |
no test coverage detected