InputCommon: Rename class InputPlugin to InputConfig

This commit is contained in:
Lioncash
2014-08-31 00:04:15 -04:00
parent ea7eee1f58
commit 1a3ebbb831
12 changed files with 85 additions and 88 deletions

View File

@ -105,7 +105,7 @@ extern "C" {
#include "DolphinWX/resources/Dolphin.c" // NOLINT: Dolphin icon
};
class InputPlugin;
class InputConfig;
class wxFrame;
// Create menu items
@ -1222,7 +1222,7 @@ void CFrame::OnConfigDSP(wxCommandEvent& WXUNUSED (event))
void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
{
InputPlugin *const pad_plugin = Pad::GetPlugin();
InputConfig* const pad_plugin = Pad::GetConfig();
bool was_init = false;
if (g_controller_interface.IsInit()) // check if game is running
{
@ -1250,7 +1250,7 @@ void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
{
InputPlugin *const wiimote_plugin = Wiimote::GetPlugin();
InputConfig* const wiimote_plugin = Wiimote::GetConfig();
bool was_init = false;
if (g_controller_interface.IsInit()) // check if game is running
{

View File

@ -133,10 +133,10 @@ void PadSettingSpin::UpdateValue()
setting->SetValue(float(((wxSpinCtrl*)wxcontrol)->GetValue()) / 100);
}
ControlDialog::ControlDialog(GamepadPage* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref)
ControlDialog::ControlDialog(GamepadPage* const parent, InputConfig& config, ControllerInterface::ControlReference* const ref)
: wxDialog(parent, -1, _("Configure Control"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, control_reference(ref)
, m_plugin(plugin)
, m_config(config)
, m_parent(parent)
{
m_devq = m_parent->controller->default_device;
@ -177,7 +177,7 @@ void InputConfigDialog::UpdateProfileComboBox()
{
std::string pname(File::GetUserPath(D_CONFIG_IDX));
pname += PROFILES_PATH;
pname += m_plugin.profile_name;
pname += m_config.profile_name;
CFileSearch::XStringVector exts;
exts.push_back("*.ini");
@ -210,7 +210,7 @@ void InputConfigDialog::UpdateControlReferences()
void InputConfigDialog::ClickSave(wxCommandEvent& event)
{
m_plugin.SaveConfig();
m_config.SaveConfig();
event.Skip();
}
@ -298,7 +298,7 @@ void GamepadPage::ClearAll(wxCommandEvent&)
// no point in using the real ControllerInterface i guess
ControllerInterface face;
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
controller->UpdateReferences(face);
UpdateGUI();
@ -308,7 +308,7 @@ void GamepadPage::LoadDefaults(wxCommandEvent&)
{
controller->LoadDefaults(g_controller_interface);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
controller->UpdateReferences(g_controller_interface);
UpdateGUI();
@ -318,7 +318,7 @@ bool ControlDialog::Validate()
{
control_reference->expression = WxStrToStr(textctrl->GetValue());
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -337,7 +337,7 @@ void GamepadPage::SetDevice(wxCommandEvent&)
controller->UpdateDefaultDevice();
// update references
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
controller->UpdateReferences(g_controller_interface);
}
@ -356,7 +356,7 @@ void ControlDialog::ClearControl(wxCommandEvent&)
{
control_reference->expression.clear();
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -418,7 +418,7 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&)
textctrl->WriteText(expr);
control_reference->expression = textctrl->GetValue();
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -453,7 +453,7 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
textctrl->WriteText(expr);
control_reference->expression = textctrl->GetValue();
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
UpdateGUI();
@ -461,19 +461,19 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
void GamepadPage::AdjustSetting(wxCommandEvent& event)
{
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
((PadSetting*)((wxControl*)event.GetEventObject())->GetClientData())->UpdateValue();
}
void GamepadPage::AdjustControlOption(wxCommandEvent&)
{
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
m_control_dialog->control_reference->range = (ControlState)(m_control_dialog->range_slider->GetValue()) / SLIDER_TICK_COUNT;
}
void GamepadPage::ConfigControl(wxEvent& event)
{
m_control_dialog = new ControlDialog(this, m_plugin, ((ControlButton*)event.GetEventObject())->control_reference);
m_control_dialog = new ControlDialog(this, m_config, ((ControlButton*)event.GetEventObject())->control_reference);
m_control_dialog->ShowModal();
m_control_dialog->Destroy();
@ -487,7 +487,7 @@ void GamepadPage::ClearControl(wxEvent& event)
btn->control_reference->expression.clear();
btn->control_reference->range = 1.0f;
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
controller->UpdateReferences(g_controller_interface);
// update changes
@ -507,7 +507,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
// This makes the "waiting" text work on Linux. true (only if needed) prevents crash on Windows
wxTheApp->Yield(true);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
Device::Control* const ctrl = control_reference->Detect(DETECT_WAIT_TIME, dev);
// if we got input, select it in the list
@ -531,7 +531,7 @@ void GamepadPage::DetectControl(wxCommandEvent& event)
// This makes the "waiting" text work on Linux. true (only if needed) prevents crash on Windows
wxTheApp->Yield(true);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
Device::Control* const ctrl = btn->control_reference->Detect(DETECT_WAIT_TIME, dev);
// if we got input, update expression and reference
@ -635,7 +635,7 @@ void GamepadPage::GetProfilePath(std::string& path)
path = File::GetUserPath(D_CONFIG_IDX);
path += PROFILES_PATH;
path += m_plugin.profile_name;
path += m_config.profile_name;
path += '/';
path += WxStrToStr(profile_cbox->GetValue());
path += ".ini";
@ -653,7 +653,7 @@ void GamepadPage::LoadProfile(wxCommandEvent&)
IniFile inifile;
inifile.Load(fname);
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
controller->LoadConfig(inifile.GetOrCreateSection("Profile"));
controller->UpdateReferences(g_controller_interface);
@ -716,7 +716,7 @@ void InputConfigDialog::UpdateDeviceComboBox()
void GamepadPage::RefreshDevices(wxCommandEvent&)
{
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
// refresh devices
g_controller_interface.Shutdown();
@ -932,14 +932,14 @@ ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow
Add(stacked_groups, 0, /*wxEXPAND|*/wxBOTTOM|wxRIGHT, 5);
}
GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog)
GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const unsigned int pad_num, InputConfigDialog* const config_dialog)
: wxPanel(parent, wxID_ANY)
,controller(plugin.controllers[pad_num])
,controller(config.controllers[pad_num])
, m_config_dialog(config_dialog)
, m_plugin(plugin)
, m_config(config)
{
wxBoxSizer* control_group_sizer = new ControlGroupsSizer(m_plugin.controllers[pad_num], this, this, &control_groups);
wxBoxSizer* control_group_sizer = new ControlGroupsSizer(m_config.controllers[pad_num], this, this, &control_groups);
wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Profile"));
@ -1001,16 +1001,16 @@ GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned i
};
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num)
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config, const std::string& name, const int tab_num)
: wxDialog(parent, wxID_ANY, wxGetTranslation(StrToWxStr(name)), wxPoint(128,-1))
, m_plugin(plugin)
, m_config(config)
{
m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT);
for (unsigned int i = 0; i < std::min(plugin.controllers.size(), (size_t)MAX_WIIMOTES); ++i)
for (unsigned int i = 0; i < std::min(config.controllers.size(), (size_t)MAX_WIIMOTES); ++i)
{
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_plugin, i, this);
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_config, i, this);
m_padpages.push_back(gp);
m_pad_notebook->AddPage(gp, wxString::Format("%s %u", wxGetTranslation(StrToWxStr(m_plugin.gui_name)), 1+i));
m_pad_notebook->AddPage(gp, wxString::Format("%s %u", wxGetTranslation(StrToWxStr(m_config.gui_name)), 1+i));
}
m_pad_notebook->SetSelection(tab_num);

View File

@ -28,7 +28,7 @@
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "InputCommon/ControllerInterface/Device.h"
class InputPlugin;
class InputConfig;
class wxComboBox;
class wxCommandEvent;
class wxEvent;
@ -95,7 +95,7 @@ class GamepadPage;
class ControlDialog : public wxDialog
{
public:
ControlDialog(GamepadPage* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref);
ControlDialog(GamepadPage* const parent, InputConfig& config, ControllerInterface::ControlReference* const ref);
wxStaticBoxSizer* CreateControlChooser(GamepadPage* const parent);
@ -113,7 +113,7 @@ public:
void AppendControl(wxCommandEvent& event);
ControllerInterface::ControlReference* const control_reference;
InputPlugin& m_plugin;
InputConfig& m_config;
wxComboBox* device_cbox;
wxTextCtrl* textctrl;
@ -173,7 +173,7 @@ class GamepadPage : public wxPanel
friend class ControlDialog;
public:
GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog);
GamepadPage(wxWindow* parent, InputConfig& config, const unsigned int pad_num, InputConfigDialog* const config_dialog);
void UpdateGUI();
@ -212,13 +212,13 @@ private:
ControlDialog* m_control_dialog;
InputConfigDialog* const m_config_dialog;
InputPlugin &m_plugin;
InputConfig& m_config;
};
class InputConfigDialog : public wxDialog
{
public:
InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num = 0);
InputConfigDialog(wxWindow* const parent, InputConfig& config, const std::string& name, const int tab_num = 0);
//~InputConfigDialog();
bool Destroy() override;
@ -235,6 +235,6 @@ private:
wxNotebook* m_pad_notebook;
std::vector<GamepadPage*> m_padpages;
InputPlugin& m_plugin;
InputConfig& m_config;
wxTimer* m_update_timer;
};

View File

@ -28,11 +28,11 @@
#include "DolphinWX/InputConfigDiag.h"
#include "DolphinWX/WiimoteConfigDiag.h"
class InputPlugin;
class InputConfig;
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin)
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputConfig& config)
: wxDialog(parent, -1, _("Dolphin Wiimote Configuration"))
, m_plugin(plugin)
, m_config(config)
{
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
@ -230,7 +230,7 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin
void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
{
InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_plugin, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_config, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
m_emu_config_diag->ShowModal();
m_emu_config_diag->Destroy();
}

View File

@ -9,14 +9,14 @@
#include "Core/ConfigManager.h"
#include "Core/HW/Wiimote.h"
class InputPlugin;
class InputConfig;
class wxButton;
class wxWindow;
class WiimoteConfigDiag : public wxDialog
{
public:
WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin);
WiimoteConfigDiag(wxWindow* const parent, InputConfig& config);
void RefreshRealWiimotes(wxCommandEvent& event);
@ -61,7 +61,7 @@ public:
private:
void Cancel(wxCommandEvent& event);
InputPlugin& m_plugin;
InputConfig& m_config;
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];