configure_input_player: Show/hide motion buttons based on the controller
This commit is contained in:
parent
df3cbd4758
commit
8e18b61972
@ -421,9 +421,11 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||
|
||||
UpdateControllerIcon();
|
||||
UpdateControllerAvailableButtons();
|
||||
UpdateMotionButtons();
|
||||
connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) {
|
||||
UpdateControllerIcon();
|
||||
UpdateControllerAvailableButtons();
|
||||
UpdateMotionButtons();
|
||||
});
|
||||
|
||||
connect(ui->comboDevices, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
@ -893,6 +895,37 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureInputPlayer::UpdateMotionButtons() {
|
||||
if (debug) {
|
||||
// Motion isn't used with the debug controller, hide both groupboxes.
|
||||
ui->buttonMotionLeftGroup->hide();
|
||||
ui->buttonMotionRightGroup->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
// Show/hide the "Motion 1/2" groupboxes depending on the currently selected controller.
|
||||
switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) {
|
||||
case Settings::ControllerType::ProController:
|
||||
case Settings::ControllerType::LeftJoycon:
|
||||
case Settings::ControllerType::Handheld:
|
||||
// Show "Motion 1" and hide "Motion 2".
|
||||
ui->buttonMotionLeftGroup->show();
|
||||
ui->buttonMotionRightGroup->hide();
|
||||
break;
|
||||
case Settings::ControllerType::RightJoycon:
|
||||
// Show "Motion 2" and hide "Motion 1".
|
||||
ui->buttonMotionLeftGroup->hide();
|
||||
ui->buttonMotionRightGroup->show();
|
||||
break;
|
||||
case Settings::ControllerType::DualJoyconDetached:
|
||||
default:
|
||||
// Show both "Motion 1/2".
|
||||
ui->buttonMotionLeftGroup->show();
|
||||
ui->buttonMotionRightGroup->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureInputPlayer::showEvent(QShowEvent* event) {
|
||||
if (bottom_row == nullptr) {
|
||||
return;
|
||||
|
@ -107,6 +107,9 @@ private:
|
||||
/// Hides and disables controller settings based on the current controller type.
|
||||
void UpdateControllerAvailableButtons();
|
||||
|
||||
/// Shows or hides motion groupboxes based on the current controller type.
|
||||
void UpdateMotionButtons();
|
||||
|
||||
/// Gets the default controller mapping for this device and auto configures the input to match.
|
||||
void UpdateMappingWithDefaults();
|
||||
|
||||
|
@ -1983,6 +1983,9 @@
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerMiscButtons1">
|
||||
<property name="orientation">
|
||||
@ -1990,12 +1993,110 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="buttonMotionLeftGroup">
|
||||
<property name="title">
|
||||
<string>Motion 1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="buttonDpadLeftVerticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonMotionLeft">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">min-width: 55px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="buttonMotionRightGroup">
|
||||
<property name="title">
|
||||
<string>Motion 2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="buttonDpadRightVerticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonMotionRight">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">min-width: 55px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerMiscButtons4">
|
||||
<property name="orientation">
|
||||
@ -2003,8 +2104,8 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -2264,105 +2365,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QGroupBox" name="buttonMotionLeftGroup">
|
||||
<property name="title">
|
||||
<string>Motion left</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="buttonMotionLeftVerticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonMotionLeft">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">min-width: 55px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Motion left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QGroupBox" name="buttonMotionRightGroup">
|
||||
<property name="title">
|
||||
<string>Motion right</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="buttonMotionRightVerticalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonMotionRight">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>57</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">min-width: 55px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Motion right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user