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)
This commit is contained in:
Dan McCarthy 2023-11-25 23:17:41 -06:00 committed by Connor McLaughlin
parent 96a9e8a090
commit 7b5d640f35
3 changed files with 17 additions and 1 deletions

View File

@ -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<Patch::PatchInfo> patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, nullptr);
u32 numberOfUnlabeledPatches = 0;
std::vector<Patch::PatchInfo> patches = Patch::GetPatchInfo(m_dialog->getSerial(), m_dialog->getDiscCRC(), false, &numberOfUnlabeledPatches);
std::vector<std::string> 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);
}

View File

@ -60,6 +60,7 @@ private Q_SLOTS:
private:
void reloadList();
void setUnlabeledPatchesWarningVisibility(bool visible);
Ui::GamePatchSettingsWidget m_ui;
SettingsWindow* m_dialog;

View File

@ -33,6 +33,13 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="unlabeledPatchWarning">
<property name="text">
<string>Any patches bundled with PCSX2 for this game will be disabled since you have unlabeled patches loaded.</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">