mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06: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:
@ -25,7 +25,7 @@
|
|||||||
#include "UICommon/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& game)
|
PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& game)
|
||||||
: StackedSettingsWindow{parent}
|
: StackedSettingsWindow{parent}, m_filepath(game.GetFilePath())
|
||||||
{
|
{
|
||||||
setWindowTitle(QStringLiteral("%1: %2 - %3")
|
setWindowTitle(QStringLiteral("%1: %2 - %3")
|
||||||
.arg(QString::fromStdString(game.GetFileName()),
|
.arg(QString::fromStdString(game.GetFileName()),
|
||||||
|
@ -17,6 +17,7 @@ class PropertiesDialog final : public StackedSettingsWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PropertiesDialog(QWidget* parent, const UICommon::GameFile& game);
|
explicit PropertiesDialog(QWidget* parent, const UICommon::GameFile& game);
|
||||||
|
const std::string& GetFilePath() const { return m_filepath; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void OpenGeneralSettings();
|
void OpenGeneralSettings();
|
||||||
@ -24,4 +25,7 @@ signals:
|
|||||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||||
void OpenAchievementSettings();
|
void OpenAchievementSettings();
|
||||||
#endif // USE_RETRO_ACHIEVEMENTS
|
#endif // USE_RETRO_ACHIEVEMENTS
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string m_filepath;
|
||||||
};
|
};
|
||||||
|
@ -566,6 +566,15 @@ void GameList::OpenProperties()
|
|||||||
if (!game)
|
if (!game)
|
||||||
return;
|
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);
|
PropertiesDialog* properties = new PropertiesDialog(this, *game);
|
||||||
|
|
||||||
connect(properties, &PropertiesDialog::OpenGeneralSettings, this, &GameList::OpenGeneralSettings);
|
connect(properties, &PropertiesDialog::OpenGeneralSettings, this, &GameList::OpenGeneralSettings);
|
||||||
|
Reference in New Issue
Block a user