From 7b5d640f3590a081ce26fa67cab4079ff6fb54b2 Mon Sep 17 00:00:00 2001 From: Dan McCarthy Date: Sat, 25 Nov 2023 23:17:41 -0600 Subject: [PATCH] Qt: Add warning that unlabeled patches cause bundled patches to hide Bundled patches don't display when unlabeled patches are loaded (since we can't guarantee they don't collide). This warns the user that bundled patches are hidden when unlabeled patches are loaded. (The warning hides when no unlabeled patches are loaded) --- pcsx2-qt/Settings/GamePatchSettingsWidget.cpp | 10 +++++++++- pcsx2-qt/Settings/GamePatchSettingsWidget.h | 1 + pcsx2-qt/Settings/GamePatchSettingsWidget.ui | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp index 3e1b7ed68f..ae1650c384 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.cpp @@ -68,6 +68,8 @@ GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget m_ui.scrollArea->setFrameShape(QFrame::WinPanel); m_ui.scrollArea->setFrameShadow(QFrame::Sunken); + setUnlabeledPatchesWarningVisibility(false); + connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked); reloadList(); @@ -86,10 +88,12 @@ void GamePatchSettingsWidget::onReloadClicked() void GamePatchSettingsWidget::reloadList() { // Patches shouldn't have any unlabelled patch groups, because they're new. - std::vector patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, nullptr); + u32 numberOfUnlabeledPatches = 0; + std::vector patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, &numberOfUnlabeledPatches); std::vector enabled_list = m_dialog->getSettingsInterface()->GetStringList(Patch::PATCHES_CONFIG_SECTION, Patch::PATCH_ENABLE_CONFIG_KEY); + setUnlabeledPatchesWarningVisibility(numberOfUnlabeledPatches > 0); delete m_ui.scrollArea->takeWidget(); QWidget* container = new QWidget(m_ui.scrollArea); @@ -130,3 +134,7 @@ void GamePatchSettingsWidget::reloadList() m_ui.scrollArea->setWidget(container); } + +void GamePatchSettingsWidget::setUnlabeledPatchesWarningVisibility(bool visible) { + m_ui.unlabeledPatchWarning->setVisible(visible); +} \ No newline at end of file diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.h b/pcsx2-qt/Settings/GamePatchSettingsWidget.h index 323942f5b5..158be13977 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.h +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.h @@ -60,6 +60,7 @@ private Q_SLOTS: private: void reloadList(); + void setUnlabeledPatchesWarningVisibility(bool visible); Ui::GamePatchSettingsWidget m_ui; SettingsWindow* m_dialog; diff --git a/pcsx2-qt/Settings/GamePatchSettingsWidget.ui b/pcsx2-qt/Settings/GamePatchSettingsWidget.ui index ca59c6e793..16e9796634 100644 --- a/pcsx2-qt/Settings/GamePatchSettingsWidget.ui +++ b/pcsx2-qt/Settings/GamePatchSettingsWidget.ui @@ -33,6 +33,13 @@ + + + + Any patches bundled with PCSX2 for this game will be disabled since you have unlabeled patches loaded. + + +