| 1583 | } |
| 1584 | |
| 1585 | void MainWindow::reportStateSaveError(const QString& message, std::optional<s32> slot) |
| 1586 | { |
| 1587 | const bool prompt_on_error = Host::GetBaseBoolSettingValue("UI", "PromptOnStateLoadSaveFailure", true); |
| 1588 | if (!prompt_on_error) |
| 1589 | { |
| 1590 | SaveState_ReportSaveErrorOSD(message.toStdString(), slot); |
| 1591 | return; |
| 1592 | } |
| 1593 | |
| 1594 | QString title; |
| 1595 | if (slot.has_value()) |
| 1596 | title = tr("Failed to Save State To Slot %1").arg(*slot); |
| 1597 | else |
| 1598 | title = tr("Failed to Save State"); |
| 1599 | |
| 1600 | VMLock lock(pauseAndLockVM()); |
| 1601 | |
| 1602 | QCheckBox* do_not_show_again = new QCheckBox(tr("Do not show again")); |
| 1603 | |
| 1604 | QPointer<QMessageBox> message_box = new QMessageBox(this); |
| 1605 | message_box->setWindowTitle(title); |
| 1606 | message_box->setText(message); |
| 1607 | message_box->setIcon(QMessageBox::Critical); |
| 1608 | message_box->addButton(QMessageBox::Ok); |
| 1609 | message_box->setDefaultButton(QMessageBox::Ok); |
| 1610 | message_box->setCheckBox(do_not_show_again); |
| 1611 | |
| 1612 | message_box->exec(); |
| 1613 | if (message_box.isNull()) |
| 1614 | return; |
| 1615 | |
| 1616 | if (do_not_show_again->isChecked()) |
| 1617 | { |
| 1618 | Host::SetBaseBoolSettingValue("UI", "PromptOnStateLoadSaveFailure", false); |
| 1619 | Host::CommitBaseSettingChanges(); |
| 1620 | if (m_settings_window) |
| 1621 | { |
| 1622 | InterfaceSettingsWidget* interface_settings = m_settings_window->getInterfaceSettingsWidget(); |
| 1623 | interface_settings->updatePromptOnStateLoadSaveFailureCheckbox(Qt::Unchecked); |
| 1624 | } |
| 1625 | } |
| 1626 | |
| 1627 | delete message_box; |
| 1628 | } |
| 1629 | |
| 1630 | void MainWindow::runOnUIThread(const std::function<void()>& func) |
| 1631 | { |
no test coverage detected