mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
ControllerConfigDiag: Improve the UI
The ControllerConfigDiag design was getting confusing, so more significant changes needed to be done. Firstly, the GC controller and the Wiimote section layouts have been aligned for consistency. The Balance Board source chooser is a checkbox. The "general settings" that affect the SYSCONF have been moved to the Wii pane in the Config dialog. It makes more sense because those affect the Wii's settings in the NAND, unlike the other options. Another reason for moving it is that the Controller Config Dialog was getting pretty crowded, and the whole section is disabled when emulation is running, which is wasted space. The Wiimotes section is now organised by two radio buttons. One is for the Passthrough Mode, with sync/reset buttons under it; the other is the emulated Bluetooth mode, which still has the regular Wiimote source choosers, the Continuous Scanning controls and the Enable Speaker Data option (which only applies to the emulated BT mode). Hopefully this should make things a bit clearer and look cleaner. (This is a monolithic commit because separating UI changes is hard)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <wx/choice.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/stattext.h>
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
@@ -38,6 +39,9 @@ void WiiConfigPane::InitializeGUI()
|
||||
m_system_language_strings.Add(_("Traditional Chinese"));
|
||||
m_system_language_strings.Add(_("Korean"));
|
||||
|
||||
m_bt_sensor_bar_pos_strings.Add(_("Bottom"));
|
||||
m_bt_sensor_bar_pos_strings.Add(_("Top"));
|
||||
|
||||
m_screensaver_checkbox = new wxCheckBox(this, wxID_ANY, _("Enable Screen Saver"));
|
||||
m_pal60_mode_checkbox = new wxCheckBox(this, wxID_ANY, _("Use PAL60 Mode (EuRGB60)"));
|
||||
m_aspect_ratio_choice =
|
||||
@@ -46,6 +50,15 @@ void WiiConfigPane::InitializeGUI()
|
||||
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_system_language_strings);
|
||||
m_sd_card_checkbox = new wxCheckBox(this, wxID_ANY, _("Insert SD Card"));
|
||||
m_connect_keyboard_checkbox = new wxCheckBox(this, wxID_ANY, _("Connect USB Keyboard"));
|
||||
m_bt_sensor_bar_pos =
|
||||
new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_bt_sensor_bar_pos_strings);
|
||||
m_bt_sensor_bar_sens = new wxSlider(this, wxID_ANY, 0, 0, 4);
|
||||
m_bt_speaker_volume = new wxSlider(this, wxID_ANY, 0, 0, 127);
|
||||
m_bt_wiimote_motor = new wxCheckBox(this, wxID_ANY, _("Wiimote Motor"));
|
||||
|
||||
// With some GTK themes, no minimum size will be applied - so do this manually here
|
||||
m_bt_sensor_bar_sens->SetMinSize(wxSize(100, -1));
|
||||
m_bt_speaker_volume->SetMinSize(wxSize(100, -1));
|
||||
|
||||
m_screensaver_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnScreenSaverCheckBoxChanged, this);
|
||||
m_pal60_mode_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnPAL60CheckBoxChanged, this);
|
||||
@@ -54,6 +67,10 @@ void WiiConfigPane::InitializeGUI()
|
||||
m_sd_card_checkbox->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnSDCardCheckBoxChanged, this);
|
||||
m_connect_keyboard_checkbox->Bind(wxEVT_CHECKBOX,
|
||||
&WiiConfigPane::OnConnectKeyboardCheckBoxChanged, this);
|
||||
m_bt_sensor_bar_pos->Bind(wxEVT_CHOICE, &WiiConfigPane::OnSensorBarPosChanged, this);
|
||||
m_bt_sensor_bar_sens->Bind(wxEVT_SLIDER, &WiiConfigPane::OnSensorBarSensChanged, this);
|
||||
m_bt_speaker_volume->Bind(wxEVT_SLIDER, &WiiConfigPane::OnSpeakerVolumeChanged, this);
|
||||
m_bt_wiimote_motor->Bind(wxEVT_CHECKBOX, &WiiConfigPane::OnWiimoteMotorChanged, this);
|
||||
|
||||
m_screensaver_checkbox->SetToolTip(_("Dims the screen after five minutes of inactivity."));
|
||||
m_pal60_mode_checkbox->SetToolTip(_("Sets the Wii display mode to 60Hz (480i) instead of 50Hz "
|
||||
@@ -77,6 +94,35 @@ void WiiConfigPane::InitializeGUI()
|
||||
misc_settings_grid_sizer->Add(m_system_language_choice, wxGBPosition(3, 1), wxDefaultSpan, wxALL,
|
||||
5);
|
||||
|
||||
auto* const bt_sensor_bar_pos_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
bt_sensor_bar_pos_sizer->Add(new wxStaticText(this, wxID_ANY, _("Min")), 0,
|
||||
wxALIGN_CENTER_VERTICAL);
|
||||
bt_sensor_bar_pos_sizer->Add(m_bt_sensor_bar_sens);
|
||||
bt_sensor_bar_pos_sizer->Add(new wxStaticText(this, wxID_ANY, _("Max")), 0,
|
||||
wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
auto* const bt_speaker_volume_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
bt_speaker_volume_sizer->Add(new wxStaticText(this, wxID_ANY, _("Min")), 0,
|
||||
wxALIGN_CENTER_VERTICAL);
|
||||
bt_speaker_volume_sizer->Add(m_bt_speaker_volume);
|
||||
bt_speaker_volume_sizer->Add(new wxStaticText(this, wxID_ANY, _("Max")), 0,
|
||||
wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
wxGridBagSizer* const bt_settings_grid_sizer = new wxGridBagSizer();
|
||||
bt_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Sensor Bar Position:")),
|
||||
wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL,
|
||||
5);
|
||||
bt_settings_grid_sizer->Add(m_bt_sensor_bar_pos, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5);
|
||||
bt_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("IR Sensitivity:")),
|
||||
wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL,
|
||||
5);
|
||||
bt_settings_grid_sizer->Add(bt_sensor_bar_pos_sizer, wxGBPosition(1, 1), wxDefaultSpan, wxALL, 5);
|
||||
bt_settings_grid_sizer->Add(new wxStaticText(this, wxID_ANY, _("Speaker Volume:")),
|
||||
wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL | wxALL,
|
||||
5);
|
||||
bt_settings_grid_sizer->Add(bt_speaker_volume_sizer, wxGBPosition(2, 1), wxDefaultSpan, wxALL, 5);
|
||||
bt_settings_grid_sizer->Add(m_bt_wiimote_motor, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
|
||||
wxStaticBoxSizer* const misc_settings_static_sizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, this, _("Misc Settings"));
|
||||
misc_settings_static_sizer->Add(misc_settings_grid_sizer);
|
||||
@@ -86,9 +132,14 @@ void WiiConfigPane::InitializeGUI()
|
||||
device_settings_sizer->Add(m_sd_card_checkbox, 0, wxALL, 5);
|
||||
device_settings_sizer->Add(m_connect_keyboard_checkbox, 0, wxALL, 5);
|
||||
|
||||
auto* const bt_settings_static_sizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, this, _("Wii Remote Settings"));
|
||||
bt_settings_static_sizer->Add(bt_settings_grid_sizer);
|
||||
|
||||
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
main_sizer->Add(misc_settings_static_sizer, 0, wxEXPAND | wxALL, 5);
|
||||
main_sizer->Add(device_settings_sizer, 0, wxEXPAND | wxALL, 5);
|
||||
main_sizer->Add(bt_settings_static_sizer, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
SetSizer(main_sizer);
|
||||
}
|
||||
@@ -102,6 +153,11 @@ void WiiConfigPane::LoadGUIValues()
|
||||
|
||||
m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard);
|
||||
m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard);
|
||||
|
||||
m_bt_sensor_bar_pos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
|
||||
m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u32>("BT.SENS"));
|
||||
m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.SPKV"));
|
||||
m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<bool>("BT.MOT"));
|
||||
}
|
||||
|
||||
void WiiConfigPane::RefreshGUI()
|
||||
@@ -112,6 +168,11 @@ void WiiConfigPane::RefreshGUI()
|
||||
m_pal60_mode_checkbox->Disable();
|
||||
m_aspect_ratio_choice->Disable();
|
||||
m_system_language_choice->Disable();
|
||||
|
||||
m_bt_sensor_bar_pos->Disable();
|
||||
m_bt_sensor_bar_sens->Disable();
|
||||
m_bt_speaker_volume->Disable();
|
||||
m_bt_wiimote_motor->Disable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +214,26 @@ void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", m_aspect_ratio_choice->GetSelection());
|
||||
}
|
||||
|
||||
void WiiConfigPane::OnSensorBarPosChanged(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", event.GetInt());
|
||||
}
|
||||
|
||||
void WiiConfigPane::OnSensorBarSensChanged(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.SENS", event.GetInt());
|
||||
}
|
||||
|
||||
void WiiConfigPane::OnSpeakerVolumeChanged(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.SPKV", event.GetInt());
|
||||
}
|
||||
|
||||
void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", event.GetInt());
|
||||
}
|
||||
|
||||
// Change from IPL.LNG value to IPL.SADR country code.
|
||||
// http://wiibrew.org/wiki/Country_Codes
|
||||
u8 WiiConfigPane::GetSADRCountryCode(DiscIO::Language language)
|
||||
|
||||
@@ -15,6 +15,7 @@ enum class Language;
|
||||
|
||||
class wxCheckBox;
|
||||
class wxChoice;
|
||||
class wxSlider;
|
||||
|
||||
class WiiConfigPane final : public wxPanel
|
||||
{
|
||||
@@ -33,10 +34,16 @@ private:
|
||||
void OnSystemLanguageChoiceChanged(wxCommandEvent&);
|
||||
void OnAspectRatioChoiceChanged(wxCommandEvent&);
|
||||
|
||||
void OnSensorBarPosChanged(wxCommandEvent&);
|
||||
void OnSensorBarSensChanged(wxCommandEvent&);
|
||||
void OnSpeakerVolumeChanged(wxCommandEvent&);
|
||||
void OnWiimoteMotorChanged(wxCommandEvent&);
|
||||
|
||||
static u8 GetSADRCountryCode(DiscIO::Language language);
|
||||
|
||||
wxArrayString m_system_language_strings;
|
||||
wxArrayString m_aspect_ratio_strings;
|
||||
wxArrayString m_bt_sensor_bar_pos_strings;
|
||||
|
||||
wxCheckBox* m_screensaver_checkbox;
|
||||
wxCheckBox* m_pal60_mode_checkbox;
|
||||
@@ -44,4 +51,9 @@ private:
|
||||
wxCheckBox* m_connect_keyboard_checkbox;
|
||||
wxChoice* m_system_language_choice;
|
||||
wxChoice* m_aspect_ratio_choice;
|
||||
|
||||
wxChoice* m_bt_sensor_bar_pos;
|
||||
wxSlider* m_bt_sensor_bar_sens;
|
||||
wxSlider* m_bt_speaker_volume;
|
||||
wxCheckBox* m_bt_wiimote_motor;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,142 +6,74 @@
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/stattext.h>
|
||||
|
||||
#include "Common/SysConf.h"
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h"
|
||||
#include "InputCommon/GCAdapter.h"
|
||||
|
||||
class InputConfig;
|
||||
class wxCheckBox;
|
||||
class wxChoice;
|
||||
class wxRadioButton;
|
||||
class wxStaticBoxSizer;
|
||||
class wxStaticText;
|
||||
|
||||
class ControllerConfigDiag : public wxDialog
|
||||
class ControllerConfigDiag final : public wxDialog
|
||||
{
|
||||
public:
|
||||
ControllerConfigDiag(wxWindow* const parent);
|
||||
|
||||
private:
|
||||
void OnSensorBarPos(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", event.GetInt());
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnSensorBarSensitivity(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.SENS", event.GetInt());
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnSpeakerVolume(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.SPKV", event.GetInt());
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnMotor(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", event.GetInt());
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnContinuousScanning(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_WiimoteContinuousScanning = event.IsChecked();
|
||||
WiimoteReal::Initialize(Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnPassthroughMode(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_bt_passthrough_enabled = event.IsChecked();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
void OnPassthroughScanButton(wxCommandEvent& event)
|
||||
{
|
||||
auto device = WII_IPC_HLE_Interface::GetDeviceByName("/dev/usb/oh1/57e/305");
|
||||
if (device != nullptr)
|
||||
std::static_pointer_cast<CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
||||
->TriggerSyncButtonPressedEvent();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnPassthroughResetButton(wxCommandEvent& event)
|
||||
{
|
||||
auto device = WII_IPC_HLE_Interface::GetDeviceByName("/dev/usb/oh1/57e/305");
|
||||
if (device != nullptr)
|
||||
std::static_pointer_cast<CWII_IPC_HLE_Device_usb_oh1_57e_305_base>(device)
|
||||
->TriggerSyncButtonHeldEvent();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void OnEnableSpeaker(wxCommandEvent& event)
|
||||
{
|
||||
SConfig::GetInstance().m_WiimoteEnableSpeaker = event.IsChecked();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void UpdateUI()
|
||||
{
|
||||
const bool enable_bt_passthrough_mode = SConfig::GetInstance().m_bt_passthrough_enabled;
|
||||
m_real_wiimotes_sizer->ShowItems(!enable_bt_passthrough_mode);
|
||||
m_bt_passthrough_sizer->ShowItems(enable_bt_passthrough_mode);
|
||||
m_unsupported_bt_text->Show(!enable_bt_passthrough_mode);
|
||||
m_bt_passthrough_text->Show(enable_bt_passthrough_mode);
|
||||
m_balance_board_group->ShowItems(!enable_bt_passthrough_mode);
|
||||
m_enable_speaker_data->Enable(!enable_bt_passthrough_mode);
|
||||
for (int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
{
|
||||
m_wiimote_labels[i]->Enable(!enable_bt_passthrough_mode);
|
||||
m_wiimote_sources[i]->Enable(!enable_bt_passthrough_mode);
|
||||
m_wiimote_configure_button[i]->Enable(!enable_bt_passthrough_mode);
|
||||
}
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
void UpdateUI();
|
||||
|
||||
wxStaticBoxSizer* CreateGamecubeSizer();
|
||||
wxStaticBoxSizer* CreateWiimoteConfigSizer();
|
||||
wxStaticBoxSizer* CreateBalanceBoardSizer();
|
||||
wxStaticBoxSizer* CreateRealWiimoteSizer();
|
||||
wxStaticBoxSizer* CreateGeneralWiimoteSettingsSizer();
|
||||
wxBoxSizer* CreatePassthroughBTConfigSizer();
|
||||
wxBoxSizer* CreateEmulatedBTConfigSizer();
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnCloseButton(wxCommandEvent& event);
|
||||
|
||||
void OnGameCubePortChanged(wxCommandEvent& event);
|
||||
void OnGameCubeConfigButton(wxCommandEvent& event);
|
||||
|
||||
void OnWiimoteSourceChanged(wxCommandEvent& event);
|
||||
void OnWiimoteConfigButton(wxCommandEvent& event);
|
||||
void OnWiimoteRefreshButton(wxCommandEvent& event);
|
||||
void SaveWiimoteSource();
|
||||
|
||||
void OnGameCubePortChanged(wxCommandEvent& event);
|
||||
void OnGameCubeConfigButton(wxCommandEvent& event);
|
||||
|
||||
void OnBluetoothModeChanged(wxCommandEvent& event);
|
||||
|
||||
void OnPassthroughScanButton(wxCommandEvent& event);
|
||||
void OnPassthroughResetButton(wxCommandEvent& event);
|
||||
void OnBalanceBoardChanged(wxCommandEvent& event);
|
||||
void OnContinuousScanning(wxCommandEvent& event);
|
||||
void OnEnableSpeaker(wxCommandEvent& event);
|
||||
|
||||
std::map<wxWindowID, unsigned int> m_gc_port_from_choice_id;
|
||||
std::map<wxWindowID, unsigned int> m_gc_port_from_config_id;
|
||||
std::array<wxButton*, 4> m_gc_port_configure_button;
|
||||
std::array<wxString, 8> m_gc_pad_type_strs;
|
||||
|
||||
wxRadioButton* m_passthrough_bt_radio;
|
||||
wxRadioButton* m_emulated_bt_radio;
|
||||
|
||||
wxStaticText* m_passthrough_sync_text;
|
||||
wxButton* m_passthrough_sync_btn;
|
||||
wxStaticText* m_passthrough_reset_text;
|
||||
wxButton* m_passthrough_reset_btn;
|
||||
|
||||
std::map<wxWindowID, unsigned int> m_wiimote_index_from_choice_id;
|
||||
std::map<wxWindowID, unsigned int> m_wiimote_index_from_config_id;
|
||||
std::array<wxButton*, MAX_WIIMOTES> m_wiimote_configure_button;
|
||||
std::array<wxStaticText*, MAX_WIIMOTES> m_wiimote_labels;
|
||||
std::array<wxChoice*, MAX_WIIMOTES> m_wiimote_sources;
|
||||
wxCheckBox* m_balance_board_checkbox;
|
||||
|
||||
std::array<wxStaticText*, 4> m_wiimote_labels;
|
||||
std::array<wxChoice*, 4> m_wiimote_sources;
|
||||
wxBoxSizer* m_real_wiimotes_sizer;
|
||||
wxBoxSizer* m_bt_passthrough_sizer;
|
||||
wxCheckBox* m_enable_continuous_scanning;
|
||||
wxButton* m_refresh_wm_button;
|
||||
wxStaticText* m_unsupported_bt_text;
|
||||
wxStaticText* m_bt_passthrough_text;
|
||||
wxStaticBoxSizer* m_general_wm_settings;
|
||||
wxStaticBoxSizer* m_balance_board_group;
|
||||
wxCheckBox* m_enable_speaker_data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user