Qt: Fix game properties dialog not activating

This commit is contained in:
Stenzek 2023-12-28 17:00:47 +10:00 committed by Connor McLaughlin
parent 6c15359137
commit 367f839934
1 changed files with 6 additions and 3 deletions

View File

@ -610,18 +610,21 @@ void SettingsWindow::removeSettingValue(const char* section, const char* key)
void SettingsWindow::openGamePropertiesDialog(const GameList::Entry* game, const std::string_view& title, std::string serial, u32 disc_crc) void SettingsWindow::openGamePropertiesDialog(const GameList::Entry* game, const std::string_view& title, std::string serial, u32 disc_crc)
{ {
// check for an existing dialog with this crc std::string filename = VMManager::GetGameSettingsPath(serial, disc_crc);
// check for an existing dialog with this filename
for (SettingsWindow* dialog : s_open_game_properties_dialogs) for (SettingsWindow* dialog : s_open_game_properties_dialogs)
{ {
if (dialog->m_disc_crc == disc_crc) if (dialog->isPerGameSettings() && static_cast<INISettingsInterface*>(dialog->m_sif.get())->GetFileName() == filename)
{ {
dialog->show(); dialog->show();
dialog->raise();
dialog->activateWindow();
dialog->setFocus(); dialog->setFocus();
return; return;
} }
} }
std::string filename(VMManager::GetGameSettingsPath(serial, disc_crc));
std::unique_ptr<INISettingsInterface> sif = std::make_unique<INISettingsInterface>(filename); std::unique_ptr<INISettingsInterface> sif = std::make_unique<INISettingsInterface>(filename);
if (FileSystem::FileExists(sif->GetFileName().c_str())) if (FileSystem::FileExists(sif->GetFileName().c_str()))
sif->Load(); sif->Load();