diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2025-06-07 17:24:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-07 17:24:50 +0200 |
| commit | 1b1ca019a4523ab798be40cf01b856d7e8b3d700 (patch) | |
| tree | ed10eed9a657b62ffc8d003aa334d6b3d9547cb2 /Source/Core | |
| parent | 185b080f0388c4e39c4c5669f9ae13ddad4c3e63 (diff) | |
| parent | 2de9122b5f19e8f0c25762e431a7254999a07177 (diff) | |
Merge pull request #13724 from SuperSamus/gamelist-properties-noduplicates
GameList: Prevent opening Properties multiple times for the same game
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt/Config/PropertiesDialog.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/PropertiesDialog.h | 4 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/GameList/GameList.cpp | 9 |
3 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/DolphinQt/Config/PropertiesDialog.cpp b/Source/Core/DolphinQt/Config/PropertiesDialog.cpp index f95edf40c6..7957380bbe 100644 --- a/Source/Core/DolphinQt/Config/PropertiesDialog.cpp +++ b/Source/Core/DolphinQt/Config/PropertiesDialog.cpp @@ -25,7 +25,7 @@ #include "UICommon/GameFile.h" PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& game) - : StackedSettingsWindow{parent} + : StackedSettingsWindow{parent}, m_filepath(game.GetFilePath()) { setWindowTitle(QStringLiteral("%1: %2 - %3") .arg(QString::fromStdString(game.GetFileName()), diff --git a/Source/Core/DolphinQt/Config/PropertiesDialog.h b/Source/Core/DolphinQt/Config/PropertiesDialog.h index 9079ed925a..3d8236bbe4 100644 --- a/Source/Core/DolphinQt/Config/PropertiesDialog.h +++ b/Source/Core/DolphinQt/Config/PropertiesDialog.h @@ -17,6 +17,7 @@ class PropertiesDialog final : public StackedSettingsWindow Q_OBJECT public: explicit PropertiesDialog(QWidget* parent, const UICommon::GameFile& game); + const std::string& GetFilePath() const { return m_filepath; } signals: void OpenGeneralSettings(); @@ -24,4 +25,7 @@ signals: #ifdef USE_RETRO_ACHIEVEMENTS void OpenAchievementSettings(); #endif // USE_RETRO_ACHIEVEMENTS + +private: + const std::string m_filepath; }; diff --git a/Source/Core/DolphinQt/GameList/GameList.cpp b/Source/Core/DolphinQt/GameList/GameList.cpp index 81805c219d..7ec2f1f263 100644 --- a/Source/Core/DolphinQt/GameList/GameList.cpp +++ b/Source/Core/DolphinQt/GameList/GameList.cpp @@ -566,6 +566,15 @@ void GameList::OpenProperties() if (!game) return; + auto property_windows = this->findChildren<PropertiesDialog*>(); + auto it = + std::ranges::find(property_windows, game->GetFilePath(), &PropertiesDialog::GetFilePath); + if (it != property_windows.end()) + { + (*it)->raise(); + return; + } + PropertiesDialog* properties = new PropertiesDialog(this, *game); connect(properties, &PropertiesDialog::OpenGeneralSettings, this, &GameList::OpenGeneralSettings); |
