Permalink
Browse files

Merge pull request #7449 from amaiorano/fix-extensions-combo-update-o…

…n-reset-defaults

Fix extensions combo update on reset defaults
  • Loading branch information...
Tilka committed Oct 14, 2018
2 parents 9a1f259 + f257630 commit e18fbb9bd35fc1df74670f5a37ca6b120d974513
@@ -13,6 +13,7 @@
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "DolphinQt/Config/Mapping/MappingWindow.h"
#include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h"
#include "InputCommon/ControllerEmu/ControlGroup/Extension.h"
@@ -23,7 +24,7 @@ WiimoteEmuGeneral::WiimoteEmuGeneral(MappingWindow* window, WiimoteEmuExtension*
: MappingWidget(window), m_extension_widget(extension)
{
CreateMainLayout();
Connect();
Connect(window);
}
void WiimoteEmuGeneral::CreateMainLayout()
@@ -66,10 +67,11 @@ void WiimoteEmuGeneral::CreateMainLayout()
setLayout(m_main_layout);
}
void WiimoteEmuGeneral::Connect()
void WiimoteEmuGeneral::Connect(MappingWindow* window)
{
connect(m_extension_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &WiimoteEmuGeneral::OnAttachmentChanged);
connect(window, &MappingWindow::Update, this, &WiimoteEmuGeneral::Update);
}
void WiimoteEmuGeneral::OnAttachmentChanged(int extension)
@@ -92,14 +94,17 @@ void WiimoteEmuGeneral::OnAttachmentChanged(int extension)
SaveSettings();
}
void WiimoteEmuGeneral::LoadSettings()
void WiimoteEmuGeneral::Update()
{
auto* ce_extension = static_cast<ControllerEmu::Extension*>(
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::Extension));
m_extension_combo->setCurrentIndex(ce_extension->switch_extension);
OnAttachmentChanged(ce_extension->switch_extension);
}
void WiimoteEmuGeneral::LoadSettings()
{
Update();
Wiimote::LoadConfig();
}
@@ -22,8 +22,9 @@ class WiimoteEmuGeneral final : public MappingWidget
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();
void Connect();
void Connect(MappingWindow* window);
void OnAttachmentChanged(int index);
void Update();
// Main
QHBoxLayout* m_main_layout;

0 comments on commit e18fbb9

Please sign in to comment.