Motion Input: Add nunchuk support.

This commit is contained in:
rlnilsen
2019-11-04 04:19:33 +01:00
parent 15fc71cfcf
commit 965781ea9d
12 changed files with 268 additions and 16 deletions

View File

@ -33,6 +33,8 @@
#include "DolphinQt/Config/Mapping/HotkeyTAS.h"
#include "DolphinQt/Config/Mapping/HotkeyWii.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuExtensionMotionInput.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuExtensionMotionSimulation.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuGeneral.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
@ -346,12 +348,18 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
case Type::MAPPING_WIIMOTE_EMU:
{
auto* extension = new WiimoteEmuExtension(this);
auto* extension_motion_input = new WiimoteEmuExtensionMotionInput(this);
auto* extension_motion_simulation = new WiimoteEmuExtensionMotionSimulation(this);
widget = new WiimoteEmuGeneral(this, extension);
setWindowTitle(tr("Wii Remote %1").arg(GetPort() + 1));
AddWidget(tr("General and Options"), widget);
AddWidget(tr("Motion Simulation"), new WiimoteEmuMotionControl(this));
AddWidget(tr("Motion Input"), new WiimoteEmuMotionControlIMU(this));
AddWidget(tr("Extension"), extension);
m_extension_motion_simulation_tab =
AddWidget(EXTENSION_MOTION_SIMULATION_TAB_NAME, extension_motion_simulation);
m_extension_motion_input_tab =
AddWidget(EXTENSION_MOTION_INPUT_TAB_NAME, extension_motion_input);
break;
}
case Type::MAPPING_HOTKEYS:
@ -395,9 +403,11 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
m_profiles_combo->setCurrentIndex(-1);
}
void MappingWindow::AddWidget(const QString& name, QWidget* widget)
QWidget* MappingWindow::AddWidget(const QString& name, QWidget* widget)
{
m_tab_widget->addTab(GetWrappedWidget(widget, this, 150, 210), name);
QWidget* wrapper = GetWrappedWidget(widget, this, 150, 210);
m_tab_widget->addTab(wrapper, name);
return wrapper;
}
int MappingWindow::GetPort() const
@ -432,3 +442,17 @@ void MappingWindow::OnClearFieldsPressed()
emit ConfigChanged();
emit Save();
}
void MappingWindow::ShowExtensionMotionTabs(bool show)
{
if (show)
{
m_tab_widget->addTab(m_extension_motion_simulation_tab, EXTENSION_MOTION_SIMULATION_TAB_NAME);
m_tab_widget->addTab(m_extension_motion_input_tab, EXTENSION_MOTION_INPUT_TAB_NAME);
}
else
{
m_tab_widget->removeTab(5);
m_tab_widget->removeTab(4);
}
}