diff options
| author | Stenzek <stenzek@users.noreply.github.com> | 2018-02-03 00:55:45 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-03 00:55:45 +1000 |
| commit | e20eac72f4fd29da7df6db80bc82191eebd9f1b3 (patch) | |
| tree | 4c3c564335196dc47e360508df9ddea8837eb3fe /Source/Core | |
| parent | 3e494baff2634e43e6ceec764471da362dc58ef9 (diff) | |
| parent | 28ad12bf308326d1ad8aaf7fc04a6e657338b215 (diff) | |
Merge pull request #6347 from spycrab/qt_update_defiso
Qt/Settings: Update default gamelist path textbox when changed
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt2/GameList/GameList.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/DolphinQt2/Settings.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/DolphinQt2/Settings.h | 3 | ||||
| -rw-r--r-- | Source/Core/DolphinQt2/Settings/PathPane.cpp | 6 |
4 files changed, 22 insertions, 3 deletions
diff --git a/Source/Core/DolphinQt2/GameList/GameList.cpp b/Source/Core/DolphinQt2/GameList/GameList.cpp index c84e05d69d..e9ee5ddeaf 100644 --- a/Source/Core/DolphinQt2/GameList/GameList.cpp +++ b/Source/Core/DolphinQt2/GameList/GameList.cpp @@ -368,7 +368,7 @@ void GameList::UninstallWAD() void GameList::SetDefaultISO() { - SConfig::GetInstance().m_strDefaultISO = GetSelectedGame()->GetFilePath().toStdString(); + Settings::Instance().SetDefaultGame(GetSelectedGame()->GetFilePath()); } void GameList::OpenContainingFolder() diff --git a/Source/Core/DolphinQt2/Settings.cpp b/Source/Core/DolphinQt2/Settings.cpp index 433dd3ab95..d93a338f71 100644 --- a/Source/Core/DolphinQt2/Settings.cpp +++ b/Source/Core/DolphinQt2/Settings.cpp @@ -72,6 +72,20 @@ void Settings::RemovePath(const QString& qpath) emit PathRemoved(qpath); } +QString Settings::GetDefaultGame() const +{ + return QString::fromStdString(SConfig::GetInstance().m_strDefaultISO); +} + +void Settings::SetDefaultGame(QString path) +{ + if (GetDefaultGame() != path) + { + SConfig::GetInstance().m_strDefaultISO = path.toStdString(); + emit DefaultGameChanged(path); + } +} + bool Settings::GetPreferredView() const { return QSettings().value(QStringLiteral("PreferredView"), true).toBool(); diff --git a/Source/Core/DolphinQt2/Settings.h b/Source/Core/DolphinQt2/Settings.h index 7ae4340f7b..3cdc10959e 100644 --- a/Source/Core/DolphinQt2/Settings.h +++ b/Source/Core/DolphinQt2/Settings.h @@ -53,6 +53,8 @@ public: void RemovePath(const QString& path); bool GetPreferredView() const; void SetPreferredView(bool list); + QString GetDefaultGame() const; + void SetDefaultGame(QString path); // Emulation int GetStateSlot() const; @@ -96,6 +98,7 @@ signals: void ThemeChanged(); void PathAdded(const QString&); void PathRemoved(const QString&); + void DefaultGameChanged(const QString&); void HideCursorChanged(); void VolumeChanged(int volume); void NANDRefresh(); diff --git a/Source/Core/DolphinQt2/Settings/PathPane.cpp b/Source/Core/DolphinQt2/Settings/PathPane.cpp index 12faaa8af0..76ca08edfa 100644 --- a/Source/Core/DolphinQt2/Settings/PathPane.cpp +++ b/Source/Core/DolphinQt2/Settings/PathPane.cpp @@ -97,9 +97,11 @@ QGridLayout* PathPane::MakePathsLayout() QGridLayout* layout = new QGridLayout; layout->setColumnStretch(1, 1); - m_game_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strDefaultISO)); + m_game_edit = new QLineEdit(Settings::Instance().GetDefaultGame()); connect(m_game_edit, &QLineEdit::editingFinished, - [=] { SConfig::GetInstance().m_strDefaultISO = m_game_edit->text().toStdString(); }); + [this] { Settings::Instance().SetDefaultGame(m_game_edit->text()); }); + connect(&Settings::Instance(), &Settings::DefaultGameChanged, + [this](const QString& path) { m_game_edit->setText(path); }); QPushButton* game_open = new QPushButton; connect(game_open, &QPushButton::clicked, this, &PathPane::BrowseDefaultGame); layout->addWidget(new QLabel(tr("Default ISO:")), 0, 0); |
