diff --git a/Source/Core/DolphinWX/Config/ConfigMain.cpp b/Source/Core/DolphinWX/Config/ConfigMain.cpp index 334ef7df97..3bd1bb9520 100644 --- a/Source/Core/DolphinWX/Config/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Config/ConfigMain.cpp @@ -19,15 +19,20 @@ #include "DolphinWX/Config/PathConfigPane.h" #include "DolphinWX/Config/WiiConfigPane.h" +// Sent by child panes to signify that the game list should +// be updated when this modal dialog closes. +wxDEFINE_EVENT(wxDOLPHIN_CFG_REFRESH_LIST, wxCommandEvent); + CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { // Control refreshing of the ISOs list - bRefreshList = false; + m_refresh_game_list_on_close = false; Bind(wxEVT_CLOSE_WINDOW, &CConfigMain::OnClose, this); Bind(wxEVT_BUTTON, &CConfigMain::OnOk, this, wxID_OK); + Bind(wxDOLPHIN_CFG_REFRESH_LIST, &CConfigMain::OnSetRefreshGameListOnClose, this); CreateGUIControls(); } @@ -79,7 +84,7 @@ void CConfigMain::CreateGUIControls() void CConfigMain::OnClose(wxCloseEvent& WXUNUSED(event)) { - EndModal((bRefreshList) ? wxID_OK : wxID_CANCEL); + EndModal((m_refresh_game_list_on_close) ? wxID_OK : wxID_CANCEL); } void CConfigMain::OnOk(wxCommandEvent& WXUNUSED(event)) @@ -89,3 +94,8 @@ void CConfigMain::OnOk(wxCommandEvent& WXUNUSED(event)) // Save the config. Dolphin crashes too often to only save the settings on closing SConfig::GetInstance().SaveSettings(); } + +void CConfigMain::OnSetRefreshGameListOnClose(wxCommandEvent& WXUNUSED(event)) +{ + m_refresh_game_list_on_close = true; +} diff --git a/Source/Core/DolphinWX/Config/ConfigMain.h b/Source/Core/DolphinWX/Config/ConfigMain.h index c7875d76c9..7cc22584df 100644 --- a/Source/Core/DolphinWX/Config/ConfigMain.h +++ b/Source/Core/DolphinWX/Config/ConfigMain.h @@ -11,6 +11,8 @@ class wxNotebook; class wxPanel; class wxWindow; +wxDECLARE_EVENT(wxDOLPHIN_CFG_REFRESH_LIST, wxCommandEvent); + class CConfigMain : public wxDialog { public: @@ -40,8 +42,9 @@ private: void CreateGUIControls(); void OnClose(wxCloseEvent& event); void OnOk(wxCommandEvent& event); + void OnSetRefreshGameListOnClose(wxCommandEvent& event); wxNotebook* Notebook; - bool bRefreshList; + bool m_refresh_game_list_on_close; }; diff --git a/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp b/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp index 729dcab754..57f47adf1c 100644 --- a/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/GameCubeConfigPane.cpp @@ -20,6 +20,7 @@ #include "Core/HW/EXI.h" #include "Core/HW/GCMemcard.h" #include "DolphinWX/WxUtils.h" +#include "DolphinWX/Config/ConfigMain.h" #include "DolphinWX/Config/GameCubeConfigPane.h" #define DEV_NONE_STR _trans("") @@ -206,7 +207,7 @@ void GameCubeConfigPane::OnSystemLanguageChange(wxCommandEvent& event) { SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = m_system_lang_choice->GetSelection(); - // TODO: Signal back to config_main to set bRefreshList to true. + AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST)); } void GameCubeConfigPane::OnSkipBiosCheckBoxChanged(wxCommandEvent& event) diff --git a/Source/Core/DolphinWX/Config/PathConfigPane.cpp b/Source/Core/DolphinWX/Config/PathConfigPane.cpp index f35faccc21..92ff816912 100644 --- a/Source/Core/DolphinWX/Config/PathConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/PathConfigPane.cpp @@ -19,6 +19,7 @@ #include "DolphinWX/Frame.h" #include "DolphinWX/Main.h" #include "DolphinWX/WxUtils.h" +#include "DolphinWX/Config/ConfigMain.h" #include "DolphinWX/Config/PathConfigPane.h" PathConfigPane::PathConfigPane(wxWindow* panel, wxWindowID id) @@ -118,7 +119,7 @@ void PathConfigPane::OnRecursiveISOCheckBoxChanged(wxCommandEvent& event) { SConfig::GetInstance().m_RecursiveISOFolder = m_recursive_iso_paths_checkbox->IsChecked(); - // TODO: Fire an event back to ConfigMain, setting bRefreshList to true. + AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST)); } void PathConfigPane::OnAddISOPath(wxCommandEvent& event) @@ -134,7 +135,7 @@ void PathConfigPane::OnAddISOPath(wxCommandEvent& event) } else { - // TODO: Send event back to ConfigMain setting bRefreshList to true. + AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST)); m_iso_paths_listbox->Append(dialog.GetPath()); } } @@ -144,7 +145,7 @@ void PathConfigPane::OnAddISOPath(wxCommandEvent& event) void PathConfigPane::OnRemoveISOPath(wxCommandEvent& event) { - // TODO: Set event back to ConfigMain to set bRefreshList to true. + AddPendingEvent(wxCommandEvent(wxDOLPHIN_CFG_REFRESH_LIST)); m_iso_paths_listbox->Delete(m_iso_paths_listbox->GetSelection()); // This seems to not be activated on Windows when it should be. wxw bug?