Qt: Add prompt to enable cheats when list is checked
Some checks are pending
Create rolling release / Windows x64 Build (push) Waiting to run
Create rolling release / Windows x64 SSE2 Build (push) Waiting to run
Create rolling release / Windows ARM64 Build (push) Waiting to run
Create rolling release / Linux x64 AppImage (push) Waiting to run
Create rolling release / Linux x64 SSE2 AppImage (push) Waiting to run
Create rolling release / Linux Flatpak Build (push) Waiting to run
Create rolling release / MacOS Universal Build (push) Waiting to run
Create rolling release / Create Release (push) Blocked by required conditions

This commit is contained in:
Stenzek 2024-11-03 18:08:28 +10:00
parent d416ecb324
commit 8f087ab594
No known key found for this signature in database
2 changed files with 33 additions and 0 deletions

View File

@ -288,6 +288,9 @@ void GameCheatSettingsWidget::onCheatListItemChanged(QTreeWidgetItem* item, int
if (current_enabled == current_checked) if (current_enabled == current_checked)
return; return;
if (current_checked)
checkForMasterDisable();
setCheatEnabled(std::move(cheat_name), current_checked, true); setCheatEnabled(std::move(cheat_name), current_checked, true);
} }
@ -337,6 +340,33 @@ bool GameCheatSettingsWidget::shouldLoadFromDatabase() const
return m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "LoadCheatsFromDatabase", true); return m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "LoadCheatsFromDatabase", true);
} }
void GameCheatSettingsWidget::checkForMasterDisable()
{
if (m_dialog->getSettingsInterface()->GetBoolValue("Cheats", "EnableCheats", false) || m_master_enable_ignored)
return;
QMessageBox mbox;
mbox.setIcon(QMessageBox::Warning);
mbox.setWindowTitle(tr("Confirm Cheat Enable"));
mbox.setWindowIcon(QtHost::GetAppIcon());
mbox.setTextFormat(Qt::RichText);
mbox.setText(tr("<h3>Cheats are not currently enabled for this game.</h3><p>Enabling this cheat will not have any "
"effect until cheats are enabled for this game. Do you want to do this now?"));
mbox.addButton(QMessageBox::Yes);
mbox.addButton(QMessageBox::No);
QCheckBox* cb = new QCheckBox(&mbox);
cb->setText(tr("Do not show again"));
mbox.setCheckBox(cb);
const int res = mbox.exec();
if (res == QMessageBox::No)
m_master_enable_ignored = cb->isChecked();
else
m_ui.enableCheats->setChecked(true);
}
Cheats::CodeInfo* GameCheatSettingsWidget::getSelectedCode() Cheats::CodeInfo* GameCheatSettingsWidget::getSelectedCode()
{ {
const QList<QTreeWidgetItem*> selected = m_ui.cheatList->selectedItems(); const QList<QTreeWidgetItem*> selected = m_ui.cheatList->selectedItems();

View File

@ -60,6 +60,7 @@ private Q_SLOTS:
private: private:
bool shouldLoadFromDatabase() const; bool shouldLoadFromDatabase() const;
void checkForMasterDisable();
Cheats::CodeInfo* getSelectedCode(); Cheats::CodeInfo* getSelectedCode();
QTreeWidgetItem* getTreeWidgetParent(const std::string_view parent); QTreeWidgetItem* getTreeWidgetParent(const std::string_view parent);
@ -78,6 +79,8 @@ private:
UnorderedStringMap<QTreeWidgetItem*> m_parent_map; UnorderedStringMap<QTreeWidgetItem*> m_parent_map;
Cheats::CodeInfoList m_codes; Cheats::CodeInfoList m_codes;
std::vector<std::string> m_enabled_codes; std::vector<std::string> m_enabled_codes;
bool m_master_enable_ignored = false;
}; };
class CheatCodeEditorDialog : public QDialog class CheatCodeEditorDialog : public QDialog