mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-12 10:17:47 +00:00
Merge pull request #13724 from SuperSamus/gamelist-properties-noduplicates
GameList: Prevent opening Properties multiple times for the same game
This commit is contained in:
commit
1b1ca019a4
@ -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()),
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user