Wiimote Mapping UI: Motion Input tab: Rework mapping warning, add explanation of and button to open Alternate Input Sources window.

This commit is contained in:
rlnilsen 2019-10-24 18:14:19 +02:00
parent 5ff79499a5
commit 332cad21a4
2 changed files with 30 additions and 28 deletions

View File

@ -8,12 +8,15 @@
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QString>
#include <QVBoxLayout>
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
#include "InputCommon/InputConfig.h"
WiimoteEmuMotionControlIMU::WiimoteEmuMotionControlIMU(MappingWindow* window)
@ -22,36 +25,36 @@ WiimoteEmuMotionControlIMU::WiimoteEmuMotionControlIMU(MappingWindow* window)
CreateMainLayout();
}
QGroupBox* WiimoteEmuMotionControlIMU::AddWarning(QGroupBox* groupbox)
{
QFormLayout* layout = static_cast<QFormLayout*>(groupbox->layout());
QLabel* label;
label = new QLabel(QLatin1String(""));
layout->addRow(label);
label = new QLabel(tr("WARNING"));
label->setStyleSheet(QLatin1String("QLabel { color : red; }"));
layout->addRow(label);
label = new QLabel(
tr("These controls are not intended for mapping regular buttons, triggers or axes."));
label->setWordWrap(true);
layout->addRow(label);
return groupbox;
}
void WiimoteEmuMotionControlIMU::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
auto* warning_layout = new QHBoxLayout();
auto* warning_label =
new QLabel(tr("WARNING: The controls under Accelerometer and Gyroscope are designed to "
"interface directly with motion sensor hardware. They are not intended for "
"mapping traditional buttons, triggers or axes. You might need to configure "
"alternate input sources before using these controls."));
warning_label->setWordWrap(true);
auto* warning_input_sources_button = new QPushButton(tr("Alternate Input Sources"));
warning_layout->addWidget(warning_label, 1);
warning_layout->addWidget(warning_input_sources_button, 0, Qt::AlignRight);
connect(warning_input_sources_button, &QPushButton::clicked, this, [this] {
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
window->setAttribute(Qt::WA_DeleteOnClose, true);
window->setWindowModality(Qt::WindowModality::WindowModal);
window->show();
});
m_main_layout->addWidget(
auto* groups_layout = new QHBoxLayout();
groups_layout->addWidget(
CreateGroupBox(Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUPoint)));
m_main_layout->addWidget(AddWarning(CreateGroupBox(
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUAccelerometer))));
m_main_layout->addWidget(AddWarning(
CreateGroupBox(Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUGyroscope))));
groups_layout->addWidget(CreateGroupBox(
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUAccelerometer)));
groups_layout->addWidget(
CreateGroupBox(Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUGyroscope)));
m_main_layout = new QVBoxLayout();
m_main_layout->addLayout(warning_layout);
m_main_layout->addLayout(groups_layout);
setLayout(m_main_layout);
}

View File

@ -25,8 +25,7 @@ private:
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();
static QGroupBox* AddWarning(QGroupBox* groupbox);
// Main
QHBoxLayout* m_main_layout;
QVBoxLayout* m_main_layout;
};