Fixing or disabling the "Download Codes (WiiRD Database)" button problem

The "Download Codes (WiiRD Database)" button is enabled (and its click return silently without an effect) when "Tools → Cheats Manager" is opened when there's a running emulation for which there's no "[Gecko]" ini section, confusing the user about the reason for not downloading codes or showing an error when there's no running emulation

Solution

when there's a running emulation: fix the button

when there's no running emulation: disable the button (to indicate to the user that this button must be clicked elsewhere, in the ISO settings dialog, the user will realise or remember)
This commit is contained in:
John Peterson 2013-04-29 12:00:23 -04:00 committed by Rachel Bryk
parent 4f5832827e
commit 8dbe236606
3 changed files with 7 additions and 3 deletions

View File

@ -39,7 +39,7 @@ wxCheatsWindow::wxCheatsWindow(wxWindow* const parent)
{ {
m_gameini_path = File::GetUserPath(D_GAMECONFIG_IDX) + vol->GetUniqueID() + ".ini"; m_gameini_path = File::GetUserPath(D_GAMECONFIG_IDX) + vol->GetUniqueID() + ".ini";
m_gameini.Load(m_gameini_path); m_gameini.Load(m_gameini_path);
m_geckocode_panel->LoadCodes(m_gameini); m_geckocode_panel->LoadCodes(m_gameini, Core::g_CoreStartupParameter.GetUniqueID());
} }
} }

View File

@ -41,7 +41,8 @@ CodeConfigPanel::CodeConfigPanel(wxWindow* const parent)
// button sizer // button sizer
wxBoxSizer* const sizer_buttons = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const sizer_buttons = new wxBoxSizer(wxHORIZONTAL);
wxButton* const btn_download = new wxButton(this, -1, _("Download Codes (WiiRD Database)"), wxDefaultPosition, wxSize(128, -1)); btn_download = new wxButton(this, -1, _("Download Codes (WiiRD Database)"), wxDefaultPosition, wxSize(128, -1));
btn_download->Enable(false);
btn_download->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &CodeConfigPanel::DownloadCodes, this); btn_download->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &CodeConfigPanel::DownloadCodes, this);
sizer_buttons->AddStretchSpacer(1); sizer_buttons->AddStretchSpacer(1);
sizer_buttons->Add(btn_download, 1, wxEXPAND); sizer_buttons->Add(btn_download, 1, wxEXPAND);
@ -60,6 +61,9 @@ CodeConfigPanel::CodeConfigPanel(wxWindow* const parent)
void CodeConfigPanel::UpdateCodeList() void CodeConfigPanel::UpdateCodeList()
{ {
// disable the button if it doesn't have an effect
btn_download->Enable(!m_gameid.empty());
m_listbox_gcodes->Clear(); m_listbox_gcodes->Clear();
// add the codes to the listbox // add the codes to the listbox
std::vector<GeckoCode>::const_iterator std::vector<GeckoCode>::const_iterator

View File

@ -44,7 +44,7 @@ private:
wxTextCtrl *textctrl_notes; wxTextCtrl *textctrl_notes;
wxListBox *listbox_codes; wxListBox *listbox_codes;
} m_infobox; } m_infobox;
wxButton* btn_download;
}; };