Qt/Patches, Cheats: Reload lists if serial changes

This commit is contained in:
Silent 2024-12-27 20:22:06 +01:00 committed by Ty
parent d8e310e7bf
commit 33b366180e
5 changed files with 19 additions and 2 deletions

View File

@ -56,6 +56,7 @@ GameCheatSettingsWidget::GameCheatSettingsWidget(SettingsWindow* dialog, QWidget
m_model_proxy->setFilterFixedString(text); m_model_proxy->setFilterFixedString(text);
m_ui.cheatList->expandAll(); m_ui.cheatList->expandAll();
}); });
connect(m_dialog, &SettingsWindow::discSerialChanged, this, &GameCheatSettingsWidget::reloadList);
dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Cheats For All CRCs"), tr("Checked"), dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Cheats For All CRCs"), tr("Checked"),
tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded.")); tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded."));

View File

@ -81,6 +81,7 @@ GamePatchSettingsWidget::GamePatchSettingsWidget(SettingsWindow* dialog, QWidget
connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked); connect(m_ui.reload, &QPushButton::clicked, this, &GamePatchSettingsWidget::onReloadClicked);
connect(m_ui.allCRCsCheckbox, &QCheckBox::checkStateChanged, this, &GamePatchSettingsWidget::reloadList); connect(m_ui.allCRCsCheckbox, &QCheckBox::checkStateChanged, this, &GamePatchSettingsWidget::reloadList);
connect(m_dialog, &SettingsWindow::discSerialChanged, this, &GamePatchSettingsWidget::reloadList);
dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Patches For All CRCs"), tr("Checked"), dialog->registerWidgetHelp(m_ui.allCRCsCheckbox, tr("Show Patches For All CRCs"), tr("Checked"),
tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded.")); tr("Toggles scanning patch files for all CRCs of the game. With this enabled available patches for the game serial with different CRCs will also be loaded."));

View File

@ -156,7 +156,15 @@ void GameSummaryWidget::onDiscPathChanged(const QString& value)
// force rescan of elf to update the serial // force rescan of elf to update the serial
g_main_window->rescanFile(m_entry_path); g_main_window->rescanFile(m_entry_path);
repopulateCurrentDetails();
auto lock = GameList::GetLock();
const GameList::Entry* entry = GameList::GetEntryForPath(m_entry_path.c_str());
if (entry)
{
populateDetails(entry);
m_dialog->setSerial(entry->serial);
m_ui.checkWiki->setEnabled(!entry->serial.empty());
}
} }
void GameSummaryWidget::onDiscPathBrowseClicked() void GameSummaryWidget::onDiscPathBrowseClicked()

View File

@ -447,6 +447,12 @@ void SettingsWindow::setWindowTitle(const QString& title)
QWidget::setWindowTitle(QStringLiteral("%1 [%2]").arg(title, m_filename)); QWidget::setWindowTitle(QStringLiteral("%1 [%2]").arg(title, m_filename));
} }
void SettingsWindow::setSerial(std::string serial)
{
m_serial = std::move(serial);
emit discSerialChanged();
}
bool SettingsWindow::getEffectiveBoolValue(const char* section, const char* key, bool default_value) const bool SettingsWindow::getEffectiveBoolValue(const char* section, const char* key, bool default_value) const
{ {
bool value; bool value;

View File

@ -72,6 +72,7 @@ public:
bool eventFilter(QObject* object, QEvent* event) override; bool eventFilter(QObject* object, QEvent* event) override;
void setWindowTitle(const QString& title); void setWindowTitle(const QString& title);
void setSerial(std::string serial);
QString getCategory() const; QString getCategory() const;
void setCategory(const char* category); void setCategory(const char* category);
@ -96,7 +97,7 @@ public:
void saveAndReloadGameSettings(); void saveAndReloadGameSettings();
Q_SIGNALS: Q_SIGNALS:
void settingsResetToDefaults(); void discSerialChanged();
private Q_SLOTS: private Q_SLOTS:
void onCategoryCurrentRowChanged(int row); void onCategoryCurrentRowChanged(int row);