diff options
| author | Léo Lam <leo@leolam.fr> | 2021-09-20 14:30:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-20 14:30:04 +0200 |
| commit | 29d236068c4b18e7ae89dbc535d9431ec738c6c9 (patch) | |
| tree | 502b980c3aeefb2152f1cac622347afaf1e435bf /Source/Core/DolphinQt/Config/ARCodeWidget.cpp | |
| parent | 28e6e8752ce709a775440138a39bce6987624ec8 (diff) | |
| parent | c40e8ee3a8f3e2e961ae5fcc4442431744741b1a (diff) | |
Merge pull request #10104 from AdmiralCurtiss/cheats-manager-ux
Cheats Manager UX improvements.
Diffstat (limited to 'Source/Core/DolphinQt/Config/ARCodeWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/ARCodeWidget.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt/Config/ARCodeWidget.cpp b/Source/Core/DolphinQt/Config/ARCodeWidget.cpp index c3ebe967d3..b45cfb3772 100644 --- a/Source/Core/DolphinQt/Config/ARCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/ARCodeWidget.cpp @@ -31,14 +31,17 @@ ARCodeWidget::ARCodeWidget(std::string game_id, u16 game_revision, bool restart_ CreateWidgets(); ConnectWidgets(); - IniFile game_ini_local; + if (!m_game_id.empty()) + { + IniFile game_ini_local; - // We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI - // will always be stored in GS/${GAMEID}.ini - game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini"); + // We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI + // will always be stored in GS/${GAMEID}.ini + game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini"); - const IniFile game_ini_default = SConfig::LoadDefaultGameIni(m_game_id, m_game_revision); - m_ar_codes = ActionReplay::LoadCodes(game_ini_default, game_ini_local); + const IniFile game_ini_default = SConfig::LoadDefaultGameIni(m_game_id, m_game_revision); + m_ar_codes = ActionReplay::LoadCodes(game_ini_default, game_ini_local); + } UpdateList(); OnSelectionChanged(); @@ -54,6 +57,11 @@ void ARCodeWidget::CreateWidgets() m_code_edit = new QPushButton(tr("&Edit Code...")); m_code_remove = new QPushButton(tr("&Remove Code")); + m_code_list->setEnabled(!m_game_id.empty()); + m_code_add->setEnabled(!m_game_id.empty()); + m_code_edit->setEnabled(!m_game_id.empty()); + m_code_remove->setEnabled(!m_game_id.empty()); + m_code_list->setContextMenuPolicy(Qt::CustomContextMenu); auto* button_layout = new QHBoxLayout; @@ -171,6 +179,9 @@ void ARCodeWidget::UpdateList() void ARCodeWidget::SaveCodes() { + if (m_game_id.empty()) + return; + const auto ini_path = std::string(File::GetUserPath(D_GAMESETTINGS_IDX)).append(m_game_id).append(".ini"); |
