DolphinWX: Propagate event to refresh the game list
Prior to this refactor, certain options would cause the game list to refresh when the config modal dialog is closed (such as adding a folder to the path list). This restores that functionality.
This commit is contained in:
parent
febd3909c6
commit
b459a8ec61
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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("<Nothing>")
|
||||
|
@ -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)
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue