mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
Merge pull request #7788 from jordan-woyak/mapping-ui-clear-button
DolphinQt: Make the mapping window clear button use ControllerEmu's clear functionality.
This commit is contained in:
commit
226affe00b
@ -26,13 +26,6 @@ void MappingBool::Connect()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingBool::Clear()
|
|
||||||
{
|
|
||||||
m_setting->SetValue(false);
|
|
||||||
m_parent->SaveSettings();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MappingBool::Update()
|
void MappingBool::Update()
|
||||||
{
|
{
|
||||||
setChecked(m_setting->GetValue());
|
setChecked(m_setting->GetValue());
|
||||||
|
@ -18,7 +18,6 @@ class MappingBool : public QCheckBox
|
|||||||
public:
|
public:
|
||||||
MappingBool(MappingWidget* widget, ControllerEmu::BooleanSetting* setting);
|
MappingBool(MappingWidget* widget, ControllerEmu::BooleanSetting* setting);
|
||||||
|
|
||||||
void Clear();
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -28,13 +28,6 @@ void MappingNumeric::Connect()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingNumeric::Clear()
|
|
||||||
{
|
|
||||||
m_setting->SetValue(m_setting->m_default_value);
|
|
||||||
m_parent->SaveSettings();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MappingNumeric::Update()
|
void MappingNumeric::Update()
|
||||||
{
|
{
|
||||||
setValue(m_setting->GetValue() * 100);
|
setValue(m_setting->GetValue() * 100);
|
||||||
|
@ -19,7 +19,6 @@ class MappingNumeric : public QSpinBox
|
|||||||
public:
|
public:
|
||||||
MappingNumeric(MappingWidget* widget, ControllerEmu::NumericSetting* ref);
|
MappingNumeric(MappingWidget* widget, ControllerEmu::NumericSetting* ref);
|
||||||
|
|
||||||
void Clear();
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -26,13 +26,6 @@ void MappingRadio::Connect()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingRadio::Clear()
|
|
||||||
{
|
|
||||||
m_setting->SetValue(false);
|
|
||||||
m_parent->SaveSettings();
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MappingRadio::Update()
|
void MappingRadio::Update()
|
||||||
{
|
{
|
||||||
setChecked(m_setting->GetValue());
|
setChecked(m_setting->GetValue());
|
||||||
|
@ -18,7 +18,6 @@ class MappingRadio : public QRadioButton
|
|||||||
public:
|
public:
|
||||||
MappingRadio(MappingWidget* widget, ControllerEmu::BooleanSetting* setting);
|
MappingRadio(MappingWidget* widget, ControllerEmu::BooleanSetting* setting);
|
||||||
|
|
||||||
void Clear();
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
MappingWidget::MappingWidget(MappingWindow* window) : m_parent(window)
|
MappingWidget::MappingWidget(MappingWindow* window) : m_parent(window)
|
||||||
{
|
{
|
||||||
connect(window, &MappingWindow::ClearFields, this, &MappingWidget::OnClearFields);
|
|
||||||
connect(window, &MappingWindow::Update, this, &MappingWidget::Update);
|
connect(window, &MappingWindow::Update, this, &MappingWidget::Update);
|
||||||
connect(window, &MappingWindow::Save, this, &MappingWidget::SaveSettings);
|
connect(window, &MappingWindow::Save, this, &MappingWidget::SaveSettings);
|
||||||
}
|
}
|
||||||
@ -141,21 +140,6 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
|
|||||||
return group_box;
|
return group_box;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MappingWidget::OnClearFields()
|
|
||||||
{
|
|
||||||
for (auto* button : m_buttons)
|
|
||||||
button->Clear();
|
|
||||||
|
|
||||||
for (auto* spinbox : m_numerics)
|
|
||||||
spinbox->Clear();
|
|
||||||
|
|
||||||
for (auto* checkbox : m_bools)
|
|
||||||
checkbox->Clear();
|
|
||||||
|
|
||||||
for (auto* radio : m_radio)
|
|
||||||
radio->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MappingWidget::Update()
|
void MappingWidget::Update()
|
||||||
{
|
{
|
||||||
for (auto* button : m_buttons)
|
for (auto* button : m_buttons)
|
||||||
|
@ -60,8 +60,6 @@ protected:
|
|||||||
QGroupBox* CreateGroupBox(const QString& name, ControllerEmu::ControlGroup* group);
|
QGroupBox* CreateGroupBox(const QString& name, ControllerEmu::ControlGroup* group);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnClearFields();
|
|
||||||
|
|
||||||
MappingWindow* m_parent;
|
MappingWindow* m_parent;
|
||||||
bool m_first = true;
|
bool m_first = true;
|
||||||
std::vector<MappingBool*> m_bools;
|
std::vector<MappingBool*> m_bools;
|
||||||
|
@ -143,7 +143,7 @@ void MappingWindow::ConnectWidgets()
|
|||||||
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
|
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
|
||||||
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &MappingWindow::OnDeviceChanged);
|
this, &MappingWindow::OnDeviceChanged);
|
||||||
connect(m_reset_clear, &QPushButton::clicked, this, [this] { emit ClearFields(); });
|
connect(m_reset_clear, &QPushButton::clicked, this, &MappingWindow::OnClearFieldsPressed);
|
||||||
connect(m_reset_default, &QPushButton::clicked, this, &MappingWindow::OnDefaultFieldsPressed);
|
connect(m_reset_default, &QPushButton::clicked, this, &MappingWindow::OnDefaultFieldsPressed);
|
||||||
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed);
|
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed);
|
||||||
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed);
|
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed);
|
||||||
@ -380,6 +380,16 @@ void MappingWindow::OnDefaultFieldsPressed()
|
|||||||
emit Save();
|
emit Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MappingWindow::OnClearFieldsPressed()
|
||||||
|
{
|
||||||
|
// Loading an empty inifile section clears everything.
|
||||||
|
IniFile::Section sec;
|
||||||
|
m_controller->LoadConfig(&sec);
|
||||||
|
m_controller->UpdateReferences(g_controller_interface);
|
||||||
|
emit Update();
|
||||||
|
emit Save();
|
||||||
|
}
|
||||||
|
|
||||||
bool MappingWindow::IsIterativeInput() const
|
bool MappingWindow::IsIterativeInput() const
|
||||||
{
|
{
|
||||||
return m_iterative_input->isChecked();
|
return m_iterative_input->isChecked();
|
||||||
|
@ -56,7 +56,6 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Update();
|
void Update();
|
||||||
void ClearFields();
|
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -75,6 +74,7 @@ private:
|
|||||||
void OnLoadProfilePressed();
|
void OnLoadProfilePressed();
|
||||||
void OnSaveProfilePressed();
|
void OnSaveProfilePressed();
|
||||||
void OnDefaultFieldsPressed();
|
void OnDefaultFieldsPressed();
|
||||||
|
void OnClearFieldsPressed();
|
||||||
void OnDeviceChanged(int index);
|
void OnDeviceChanged(int index);
|
||||||
void OnGlobalDevicesChanged();
|
void OnGlobalDevicesChanged();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user