Qt: Implement advanced mapping I/O windows

This commit is contained in:
spycrab
2017-06-13 17:16:41 +02:00
parent 03c1a1e392
commit 50c13c1902
12 changed files with 523 additions and 74 deletions

View File

@ -8,6 +8,7 @@
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
#include "DolphinQt2/Config/Mapping/IOWindow.h"
#include "DolphinQt2/Config/Mapping/MappingBool.h"
#include "DolphinQt2/Config/Mapping/MappingButton.h"
#include "DolphinQt2/Config/Mapping/MappingNumeric.h"
@ -49,9 +50,23 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
for (auto& control : group->controls)
{
auto* button = new MappingButton(this, control->control_ref.get());
button->setMinimumWidth(125);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
form_layout->addRow(QString::fromStdString(control->name), button);
auto* control_ref = control->control_ref.get();
connect(button, &MappingButton::AdvancedPressed, [this, control_ref] {
if (m_parent->GetDevice() == nullptr)
return;
IOWindow io(this, m_parent->GetController(), control_ref,
control_ref->IsInput() ? IOWindow::Type::Input : IOWindow::Type::Output);
io.exec();
Update();
});
m_buttons.push_back(button);
}
@ -108,3 +123,8 @@ bool MappingWidget::GetFirstButtonPress()
}
return false;
}
ControllerEmu::EmulatedController* MappingWidget::GetController() const
{
return m_parent->GetController();
}