Qt: Fix window title when editing game specific controller config

pull/3782/head
Stenzek 1 month ago
parent 88df5c983c
commit 8013df929a
No known key found for this signature in database

@ -1323,9 +1323,10 @@ void System::UpdateFolderPaths()
return;
}
const std::string old_gamesettings(EmuFolders::GameSettings);
const std::string old_inputprofiles(EmuFolders::InputProfiles);
const std::string old_memorycards(EmuFolders::MemoryCards);
const std::string old_cheats = EmuFolders::Cheats;
const std::string old_gamesettings = EmuFolders::GameSettings;
const std::string old_inputprofiles = EmuFolders::InputProfiles;
const std::string old_memorycards = EmuFolders::MemoryCards;
// have to manually grab the lock here, because of the ReloadGameSettings() below.
{
@ -1337,7 +1338,17 @@ void System::UpdateFolderPaths()
if (IsValid())
{
if (old_gamesettings != EmuFolders::GameSettings && UpdateGameSettingsLayer())
{
if (!IsReplayingGPUDump())
Cheats::ReloadCheats(old_cheats != EmuFolders::Cheats, true, false, true, false);
ApplySettings(false);
}
else if (old_cheats != EmuFolders::Cheats)
{
if (!IsReplayingGPUDump())
Cheats::ReloadCheats(true, false, false, true, false);
}
if (!s_state.input_profile_name.empty() && old_inputprofiles != EmuFolders::InputProfiles)
{
@ -1422,7 +1433,7 @@ bool System::GetGameSettingsInterface(INISettingsInterface* sif, const GameDatab
ERROR_LOG("Failed to parse separate disc game settings ini '{}': {}", Path::GetFileName(sif->GetPath()),
error.GetDescription());
sif->Clear();
sif->ClearContentsAndDirty(true);
return false;
}
}
@ -1433,7 +1444,7 @@ bool System::GetGameSettingsInterface(INISettingsInterface* sif, const GameDatab
Path::GetFileName(sif->GetPath()));
// return empty ini struct?
sif->Clear();
sif->ClearContentsAndDirty(true);
return false;
}
}
@ -1444,7 +1455,7 @@ bool System::GetGameSettingsInterface(INISettingsInterface* sif, const GameDatab
ERROR_LOG("Failed to parse game settings ini '{}': {}", Path::GetFileName(sif->GetPath()),
error.GetDescription());
sif->Clear();
sif->ClearContentsAndDirty(true);
return false;
}
}
@ -1454,7 +1465,7 @@ bool System::GetGameSettingsInterface(INISettingsInterface* sif, const GameDatab
INFO_COLOR_LOG(StrongCyan, "No game settings found (tried '{}')", Path::GetFileName(sif->GetPath()));
// return empty ini struct?
sif->Clear();
sif->ClearContentsAndDirty(true);
return false;
}
@ -1520,15 +1531,13 @@ void System::UpdateInputSettingsLayer(std::string input_profile_name, std::uniqu
{
ERROR_LOG("Failed to parse input profile ini '{}': {}",
Path::GetFileName(s_state.input_settings_interface.GetPath()), error.GetDescription());
s_state.input_settings_interface.ClearPathAndContents();
input_profile_name = {};
s_state.input_settings_interface.ClearContentsAndDirty(true);
}
}
else
{
WARNING_LOG("No input profile found (tried '{}')", Path::GetFileName(s_state.input_settings_interface.GetPath()));
s_state.input_settings_interface.ClearPathAndContents();
input_profile_name = {};
s_state.input_settings_interface.ClearContentsAndDirty(true);
}
}
else

@ -116,8 +116,8 @@ ControllerSettingsWindow* ControllerSettingsWindow::editControllerSettingsForGam
dlg->setWindowFlag(Qt::Window);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setWindowModality(Qt::WindowModal);
dlg->setWindowTitle(parent->windowTitle());
dlg->setWindowIcon(parent->windowIcon());
dlg->setWindowTitle(parent->window()->windowTitle());
dlg->setWindowIcon(parent->window()->windowIcon());
dlg->show();
return dlg;
}

@ -314,6 +314,16 @@ void GameSummaryWidget::onSeparateDiscSettingsChanged(Qt::CheckState state)
m_dialog->setBoolSettingValue("Main", "UseSeparateConfigForDiscSet", true);
else
m_dialog->removeSettingValue("Main", "UseSeparateConfigForDiscSet");
// Need to update for all discs when clearing separate-disc-settings.
if (state == Qt::Unchecked)
{
for (const std::string_view& serial : m_dialog->getDatabaseEntry()->disc_set->serials)
{
if (serial != m_dialog->getGameSerial())
System::ReloadSettingsForPath(System::GetGameSettingsPath(serial, true));
}
}
}
void GameSummaryWidget::onChangeSerialClicked()

@ -426,6 +426,12 @@ void INISettingsInterface::Clear(bool clear_memory /* = false */)
}
}
void INISettingsInterface::ClearContentsAndDirty(bool clear_memory)
{
Clear(clear_memory);
m_dirty = false;
}
void INISettingsInterface::ClearPathAndContents()
{
Clear(true);

@ -51,6 +51,7 @@ public:
std::string SaveToString(SectionSaveOrder save_order = {}) const;
void Clear(bool clear_memory = false);
void ClearContentsAndDirty(bool clear_memory);
void ClearPathAndContents();
void CompactStrings();

Loading…
Cancel
Save