mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Merge pull request #8042 from jordan-woyak/mapping-ui-clear-fix
DolphinQt: Fix "Default" and "Clear" buttons not updating the displayed extension.
This commit is contained in:
commit
360f2b4a2f
@ -117,7 +117,7 @@ void IOWindow::CreateMainLayout()
|
|||||||
|
|
||||||
void IOWindow::ConfigChanged()
|
void IOWindow::ConfigChanged()
|
||||||
{
|
{
|
||||||
const auto old_state = blockSignals(true);
|
const QSignalBlocker blocker(this);
|
||||||
|
|
||||||
m_expression_text->setPlainText(QString::fromStdString(m_reference->GetExpression()));
|
m_expression_text->setPlainText(QString::fromStdString(m_reference->GetExpression()));
|
||||||
m_expression_text->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
m_expression_text->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
||||||
@ -128,8 +128,6 @@ void IOWindow::ConfigChanged()
|
|||||||
|
|
||||||
UpdateDeviceList();
|
UpdateDeviceList();
|
||||||
UpdateOptionList();
|
UpdateOptionList();
|
||||||
|
|
||||||
blockSignals(old_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOWindow::ConnectWidgets()
|
void IOWindow::ConnectWidgets()
|
||||||
|
@ -38,9 +38,8 @@ void MappingDouble::fixup(QString& input) const
|
|||||||
|
|
||||||
void MappingDouble::ConfigChanged()
|
void MappingDouble::ConfigChanged()
|
||||||
{
|
{
|
||||||
const bool old_state = blockSignals(true);
|
const QSignalBlocker blocker(this);
|
||||||
setValue(m_setting.GetValue());
|
setValue(m_setting.GetValue());
|
||||||
blockSignals(old_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MappingBool::MappingBool(MappingWidget* parent, ControllerEmu::NumericSetting<bool>* setting)
|
MappingBool::MappingBool(MappingWidget* parent, ControllerEmu::NumericSetting<bool>* setting)
|
||||||
@ -56,7 +55,6 @@ MappingBool::MappingBool(MappingWidget* parent, ControllerEmu::NumericSetting<bo
|
|||||||
|
|
||||||
void MappingBool::ConfigChanged()
|
void MappingBool::ConfigChanged()
|
||||||
{
|
{
|
||||||
const bool old_state = blockSignals(true);
|
const QSignalBlocker blocker(this);
|
||||||
setChecked(m_setting.GetValue());
|
setChecked(m_setting.GetValue());
|
||||||
blockSignals(old_state);
|
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ void MappingWindow::RefreshDevices()
|
|||||||
|
|
||||||
void MappingWindow::OnGlobalDevicesChanged()
|
void MappingWindow::OnGlobalDevicesChanged()
|
||||||
{
|
{
|
||||||
const auto old_state = m_devices_combo->blockSignals(true);
|
const QSignalBlocker blocker(m_devices_combo);
|
||||||
|
|
||||||
m_devices_combo->clear();
|
m_devices_combo->clear();
|
||||||
|
|
||||||
@ -292,8 +292,6 @@ void MappingWindow::OnGlobalDevicesChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_devices_combo->addItem(tr("All devices"));
|
m_devices_combo->addItem(tr("All devices"));
|
||||||
|
|
||||||
m_devices_combo->blockSignals(old_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingWindow::SetMappingType(MappingWindow::Type type)
|
void MappingWindow::SetMappingType(MappingWindow::Type type)
|
||||||
|
@ -29,7 +29,7 @@ WiimoteEmuExtension::WiimoteEmuExtension(MappingWindow* window) : MappingWidget(
|
|||||||
CreateTurntableLayout();
|
CreateTurntableLayout();
|
||||||
CreateMainLayout();
|
CreateMainLayout();
|
||||||
|
|
||||||
ChangeExtensionType(Type::NONE);
|
ChangeExtensionType(WiimoteEmu::ExtensionNumber::NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiimoteEmuExtension::CreateClassicLayout()
|
void WiimoteEmuExtension::CreateClassicLayout()
|
||||||
@ -210,12 +210,14 @@ InputConfig* WiimoteEmuExtension::GetConfig()
|
|||||||
return Wiimote::GetConfig();
|
return Wiimote::GetConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiimoteEmuExtension::ChangeExtensionType(WiimoteEmuExtension::Type type)
|
void WiimoteEmuExtension::ChangeExtensionType(u32 type)
|
||||||
{
|
{
|
||||||
m_classic_box->setHidden(type != Type::CLASSIC_CONTROLLER);
|
using WiimoteEmu::ExtensionNumber;
|
||||||
m_drums_box->setHidden(type != Type::DRUMS);
|
|
||||||
m_guitar_box->setHidden(type != Type::GUITAR);
|
m_none_box->setHidden(type != ExtensionNumber::NONE);
|
||||||
m_none_box->setHidden(type != Type::NONE);
|
m_nunchuk_box->setHidden(type != ExtensionNumber::NUNCHUK);
|
||||||
m_nunchuk_box->setHidden(type != Type::NUNCHUK);
|
m_classic_box->setHidden(type != ExtensionNumber::CLASSIC);
|
||||||
m_turntable_box->setHidden(type != Type::TURNTABLE);
|
m_guitar_box->setHidden(type != ExtensionNumber::GUITAR);
|
||||||
|
m_drums_box->setHidden(type != ExtensionNumber::DRUMS);
|
||||||
|
m_turntable_box->setHidden(type != ExtensionNumber::TURNTABLE);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
||||||
|
|
||||||
|
#include "Core/HW/WiimoteEmu/ExtensionPort.h"
|
||||||
|
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
|
|
||||||
@ -13,21 +15,11 @@ class WiimoteEmuExtension final : public MappingWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum class Type
|
|
||||||
{
|
|
||||||
NONE,
|
|
||||||
CLASSIC_CONTROLLER,
|
|
||||||
DRUMS,
|
|
||||||
GUITAR,
|
|
||||||
NUNCHUK,
|
|
||||||
TURNTABLE
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit WiimoteEmuExtension(MappingWindow* window);
|
explicit WiimoteEmuExtension(MappingWindow* window);
|
||||||
|
|
||||||
InputConfig* GetConfig() override;
|
InputConfig* GetConfig() override;
|
||||||
|
|
||||||
void ChangeExtensionType(Type type);
|
void ChangeExtensionType(u32 type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadSettings() override;
|
void LoadSettings() override;
|
||||||
|
@ -48,10 +48,7 @@ void WiimoteEmuGeneral::CreateMainLayout()
|
|||||||
m_extension_combo = new QComboBox();
|
m_extension_combo = new QComboBox();
|
||||||
|
|
||||||
for (const auto& attachment : ce_extension->GetAttachmentList())
|
for (const auto& attachment : ce_extension->GetAttachmentList())
|
||||||
{
|
m_extension_combo->addItem(tr(attachment->GetName().c_str()));
|
||||||
// TODO: Figure out how to localize this
|
|
||||||
m_extension_combo->addItem(QString::fromStdString(attachment->GetName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
extension->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
extension->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
|
||||||
@ -74,30 +71,21 @@ void WiimoteEmuGeneral::Connect(MappingWindow* window)
|
|||||||
{
|
{
|
||||||
connect(m_extension_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(m_extension_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &WiimoteEmuGeneral::OnAttachmentChanged);
|
this, &WiimoteEmuGeneral::OnAttachmentChanged);
|
||||||
connect(window, &MappingWindow::Update, this, &WiimoteEmuGeneral::Update);
|
connect(window, &MappingWindow::ConfigChanged, this, &WiimoteEmuGeneral::ConfigChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiimoteEmuGeneral::OnAttachmentChanged(int extension)
|
void WiimoteEmuGeneral::OnAttachmentChanged(int extension)
|
||||||
{
|
{
|
||||||
const QString value = m_extension_combo->currentText();
|
m_extension_widget->ChangeExtensionType(extension);
|
||||||
|
|
||||||
static const QMap<QString, WiimoteEmuExtension::Type> value_map = {
|
|
||||||
{QStringLiteral("None"), WiimoteEmuExtension::Type::NONE},
|
|
||||||
{QStringLiteral("Classic"), WiimoteEmuExtension::Type::CLASSIC_CONTROLLER},
|
|
||||||
{QStringLiteral("Drums"), WiimoteEmuExtension::Type::DRUMS},
|
|
||||||
{QStringLiteral("Guitar"), WiimoteEmuExtension::Type::GUITAR},
|
|
||||||
{QStringLiteral("Nunchuk"), WiimoteEmuExtension::Type::NUNCHUK},
|
|
||||||
{QStringLiteral("Turntable"), WiimoteEmuExtension::Type::TURNTABLE}};
|
|
||||||
|
|
||||||
m_extension_widget->ChangeExtensionType(value_map[value]);
|
|
||||||
|
|
||||||
auto* ce_extension = static_cast<ControllerEmu::Attachments*>(
|
auto* ce_extension = static_cast<ControllerEmu::Attachments*>(
|
||||||
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::Attachments));
|
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::Attachments));
|
||||||
ce_extension->SetSelectedAttachment(extension);
|
ce_extension->SetSelectedAttachment(extension);
|
||||||
|
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WiimoteEmuGeneral::Update()
|
void WiimoteEmuGeneral::ConfigChanged()
|
||||||
{
|
{
|
||||||
auto* ce_extension = static_cast<ControllerEmu::Attachments*>(
|
auto* ce_extension = static_cast<ControllerEmu::Attachments*>(
|
||||||
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::Attachments));
|
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::Attachments));
|
||||||
@ -107,7 +95,6 @@ void WiimoteEmuGeneral::Update()
|
|||||||
|
|
||||||
void WiimoteEmuGeneral::LoadSettings()
|
void WiimoteEmuGeneral::LoadSettings()
|
||||||
{
|
{
|
||||||
Update();
|
|
||||||
Wiimote::LoadConfig();
|
Wiimote::LoadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ private:
|
|||||||
void CreateMainLayout();
|
void CreateMainLayout();
|
||||||
void Connect(MappingWindow* window);
|
void Connect(MappingWindow* window);
|
||||||
void OnAttachmentChanged(int index);
|
void OnAttachmentChanged(int index);
|
||||||
void Update();
|
void ConfigChanged();
|
||||||
|
|
||||||
// Extensions
|
// Extensions
|
||||||
QComboBox* m_extension_combo;
|
QComboBox* m_extension_combo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user