diff options
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 33 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.h | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.ui | 208 |
3 files changed, 141 insertions, 103 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index f6942851a..7f4b794dc 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -421,9 +421,11 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 421 | 421 | ||
| 422 | UpdateControllerIcon(); | 422 | UpdateControllerIcon(); |
| 423 | UpdateControllerAvailableButtons(); | 423 | UpdateControllerAvailableButtons(); |
| 424 | UpdateMotionButtons(); | ||
| 424 | connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) { | 425 | connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) { |
| 425 | UpdateControllerIcon(); | 426 | UpdateControllerIcon(); |
| 426 | UpdateControllerAvailableButtons(); | 427 | UpdateControllerAvailableButtons(); |
| 428 | UpdateMotionButtons(); | ||
| 427 | }); | 429 | }); |
| 428 | 430 | ||
| 429 | connect(ui->comboDevices, qOverload<int>(&QComboBox::currentIndexChanged), this, | 431 | connect(ui->comboDevices, qOverload<int>(&QComboBox::currentIndexChanged), this, |
| @@ -893,6 +895,37 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { | |||
| 893 | } | 895 | } |
| 894 | } | 896 | } |
| 895 | 897 | ||
| 898 | void ConfigureInputPlayer::UpdateMotionButtons() { | ||
| 899 | if (debug) { | ||
| 900 | // Motion isn't used with the debug controller, hide both groupboxes. | ||
| 901 | ui->buttonMotionLeftGroup->hide(); | ||
| 902 | ui->buttonMotionRightGroup->hide(); | ||
| 903 | return; | ||
| 904 | } | ||
| 905 | |||
| 906 | // Show/hide the "Motion 1/2" groupboxes depending on the currently selected controller. | ||
| 907 | switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) { | ||
| 908 | case Settings::ControllerType::ProController: | ||
| 909 | case Settings::ControllerType::LeftJoycon: | ||
| 910 | case Settings::ControllerType::Handheld: | ||
| 911 | // Show "Motion 1" and hide "Motion 2". | ||
| 912 | ui->buttonMotionLeftGroup->show(); | ||
| 913 | ui->buttonMotionRightGroup->hide(); | ||
| 914 | break; | ||
| 915 | case Settings::ControllerType::RightJoycon: | ||
| 916 | // Show "Motion 2" and hide "Motion 1". | ||
| 917 | ui->buttonMotionLeftGroup->hide(); | ||
| 918 | ui->buttonMotionRightGroup->show(); | ||
| 919 | break; | ||
| 920 | case Settings::ControllerType::DualJoyconDetached: | ||
| 921 | default: | ||
| 922 | // Show both "Motion 1/2". | ||
| 923 | ui->buttonMotionLeftGroup->show(); | ||
| 924 | ui->buttonMotionRightGroup->show(); | ||
| 925 | break; | ||
| 926 | } | ||
| 927 | } | ||
| 928 | |||
| 896 | void ConfigureInputPlayer::showEvent(QShowEvent* event) { | 929 | void ConfigureInputPlayer::showEvent(QShowEvent* event) { |
| 897 | if (bottom_row == nullptr) { | 930 | if (bottom_row == nullptr) { |
| 898 | return; | 931 | return; |
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index a12216c55..b343f2c1d 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h | |||
| @@ -107,6 +107,9 @@ private: | |||
| 107 | /// Hides and disables controller settings based on the current controller type. | 107 | /// Hides and disables controller settings based on the current controller type. |
| 108 | void UpdateControllerAvailableButtons(); | 108 | void UpdateControllerAvailableButtons(); |
| 109 | 109 | ||
| 110 | /// Shows or hides motion groupboxes based on the current controller type. | ||
| 111 | void UpdateMotionButtons(); | ||
| 112 | |||
| 110 | /// Gets the default controller mapping for this device and auto configures the input to match. | 113 | /// Gets the default controller mapping for this device and auto configures the input to match. |
| 111 | void UpdateMappingWithDefaults(); | 114 | void UpdateMappingWithDefaults(); |
| 112 | 115 | ||
diff --git a/src/yuzu/configuration/configure_input_player.ui b/src/yuzu/configuration/configure_input_player.ui index b0e572f37..e03461d9d 100644 --- a/src/yuzu/configuration/configure_input_player.ui +++ b/src/yuzu/configuration/configure_input_player.ui | |||
| @@ -1983,6 +1983,9 @@ | |||
| 1983 | <property name="spacing"> | 1983 | <property name="spacing"> |
| 1984 | <number>3</number> | 1984 | <number>3</number> |
| 1985 | </property> | 1985 | </property> |
| 1986 | <property name="topMargin"> | ||
| 1987 | <number>0</number> | ||
| 1988 | </property> | ||
| 1986 | <item> | 1989 | <item> |
| 1987 | <spacer name="horizontalSpacerMiscButtons1"> | 1990 | <spacer name="horizontalSpacerMiscButtons1"> |
| 1988 | <property name="orientation"> | 1991 | <property name="orientation"> |
| @@ -1990,21 +1993,119 @@ | |||
| 1990 | </property> | 1993 | </property> |
| 1991 | <property name="sizeHint" stdset="0"> | 1994 | <property name="sizeHint" stdset="0"> |
| 1992 | <size> | 1995 | <size> |
| 1993 | <width>40</width> | 1996 | <width>20</width> |
| 1994 | <height>0</height> | 1997 | <height>20</height> |
| 1995 | </size> | 1998 | </size> |
| 1996 | </property> | 1999 | </property> |
| 1997 | </spacer> | 2000 | </spacer> |
| 1998 | </item> | 2001 | </item> |
| 1999 | <item> | 2002 | <item> |
| 2003 | <widget class="QGroupBox" name="buttonMotionLeftGroup"> | ||
| 2004 | <property name="title"> | ||
| 2005 | <string>Motion 1</string> | ||
| 2006 | </property> | ||
| 2007 | <property name="alignment"> | ||
| 2008 | <set>Qt::AlignCenter</set> | ||
| 2009 | </property> | ||
| 2010 | <layout class="QVBoxLayout" name="buttonDpadLeftVerticalLayout_2"> | ||
| 2011 | <property name="spacing"> | ||
| 2012 | <number>3</number> | ||
| 2013 | </property> | ||
| 2014 | <property name="leftMargin"> | ||
| 2015 | <number>3</number> | ||
| 2016 | </property> | ||
| 2017 | <property name="topMargin"> | ||
| 2018 | <number>3</number> | ||
| 2019 | </property> | ||
| 2020 | <property name="rightMargin"> | ||
| 2021 | <number>3</number> | ||
| 2022 | </property> | ||
| 2023 | <property name="bottomMargin"> | ||
| 2024 | <number>3</number> | ||
| 2025 | </property> | ||
| 2026 | <item> | ||
| 2027 | <widget class="QPushButton" name="buttonMotionLeft"> | ||
| 2028 | <property name="minimumSize"> | ||
| 2029 | <size> | ||
| 2030 | <width>57</width> | ||
| 2031 | <height>0</height> | ||
| 2032 | </size> | ||
| 2033 | </property> | ||
| 2034 | <property name="maximumSize"> | ||
| 2035 | <size> | ||
| 2036 | <width>55</width> | ||
| 2037 | <height>16777215</height> | ||
| 2038 | </size> | ||
| 2039 | </property> | ||
| 2040 | <property name="styleSheet"> | ||
| 2041 | <string notr="true">min-width: 55px;</string> | ||
| 2042 | </property> | ||
| 2043 | <property name="text"> | ||
| 2044 | <string>Left</string> | ||
| 2045 | </property> | ||
| 2046 | </widget> | ||
| 2047 | </item> | ||
| 2048 | </layout> | ||
| 2049 | </widget> | ||
| 2050 | </item> | ||
| 2051 | <item> | ||
| 2052 | <widget class="QGroupBox" name="buttonMotionRightGroup"> | ||
| 2053 | <property name="title"> | ||
| 2054 | <string>Motion 2</string> | ||
| 2055 | </property> | ||
| 2056 | <property name="alignment"> | ||
| 2057 | <set>Qt::AlignCenter</set> | ||
| 2058 | </property> | ||
| 2059 | <layout class="QVBoxLayout" name="buttonDpadRightVerticalLayout_2"> | ||
| 2060 | <property name="spacing"> | ||
| 2061 | <number>3</number> | ||
| 2062 | </property> | ||
| 2063 | <property name="leftMargin"> | ||
| 2064 | <number>3</number> | ||
| 2065 | </property> | ||
| 2066 | <property name="topMargin"> | ||
| 2067 | <number>3</number> | ||
| 2068 | </property> | ||
| 2069 | <property name="rightMargin"> | ||
| 2070 | <number>3</number> | ||
| 2071 | </property> | ||
| 2072 | <property name="bottomMargin"> | ||
| 2073 | <number>3</number> | ||
| 2074 | </property> | ||
| 2075 | <item> | ||
| 2076 | <widget class="QPushButton" name="buttonMotionRight"> | ||
| 2077 | <property name="minimumSize"> | ||
| 2078 | <size> | ||
| 2079 | <width>57</width> | ||
| 2080 | <height>0</height> | ||
| 2081 | </size> | ||
| 2082 | </property> | ||
| 2083 | <property name="maximumSize"> | ||
| 2084 | <size> | ||
| 2085 | <width>55</width> | ||
| 2086 | <height>16777215</height> | ||
| 2087 | </size> | ||
| 2088 | </property> | ||
| 2089 | <property name="styleSheet"> | ||
| 2090 | <string notr="true">min-width: 55px;</string> | ||
| 2091 | </property> | ||
| 2092 | <property name="text"> | ||
| 2093 | <string>Right</string> | ||
| 2094 | </property> | ||
| 2095 | </widget> | ||
| 2096 | </item> | ||
| 2097 | </layout> | ||
| 2098 | </widget> | ||
| 2099 | </item> | ||
| 2100 | <item> | ||
| 2000 | <spacer name="horizontalSpacerMiscButtons4"> | 2101 | <spacer name="horizontalSpacerMiscButtons4"> |
| 2001 | <property name="orientation"> | 2102 | <property name="orientation"> |
| 2002 | <enum>Qt::Horizontal</enum> | 2103 | <enum>Qt::Horizontal</enum> |
| 2003 | </property> | 2104 | </property> |
| 2004 | <property name="sizeHint" stdset="0"> | 2105 | <property name="sizeHint" stdset="0"> |
| 2005 | <size> | 2106 | <size> |
| 2006 | <width>40</width> | 2107 | <width>20</width> |
| 2007 | <height>0</height> | 2108 | <height>20</height> |
| 2008 | </size> | 2109 | </size> |
| 2009 | </property> | 2110 | </property> |
| 2010 | </spacer> | 2111 | </spacer> |
| @@ -2264,105 +2365,6 @@ | |||
| 2264 | </layout> | 2365 | </layout> |
| 2265 | </widget> | 2366 | </widget> |
| 2266 | </item> | 2367 | </item> |
| 2267 | |||
| 2268 | <item alignment="Qt::AlignHCenter"> | ||
| 2269 | <widget class="QGroupBox" name="buttonMotionLeftGroup"> | ||
| 2270 | <property name="title"> | ||
| 2271 | <string>Motion left</string> | ||
| 2272 | </property> | ||
| 2273 | <property name="alignment"> | ||
| 2274 | <set>Qt::AlignCenter</set> | ||
| 2275 | </property> | ||
| 2276 | <layout class="QVBoxLayout" name="buttonMotionLeftVerticalLayout"> | ||
| 2277 | <property name="spacing"> | ||
| 2278 | <number>3</number> | ||
| 2279 | </property> | ||
| 2280 | <property name="leftMargin"> | ||
| 2281 | <number>3</number> | ||
| 2282 | </property> | ||
| 2283 | <property name="topMargin"> | ||
| 2284 | <number>3</number> | ||
| 2285 | </property> | ||
| 2286 | <property name="rightMargin"> | ||
| 2287 | <number>3</number> | ||
| 2288 | </property> | ||
| 2289 | <property name="bottomMargin"> | ||
| 2290 | <number>3</number> | ||
| 2291 | </property> | ||
| 2292 | <item> | ||
| 2293 | <widget class="QPushButton" name="buttonMotionLeft"> | ||
| 2294 | <property name="minimumSize"> | ||
| 2295 | <size> | ||
| 2296 | <width>57</width> | ||
| 2297 | <height>0</height> | ||
| 2298 | </size> | ||
| 2299 | </property> | ||
| 2300 | <property name="maximumSize"> | ||
| 2301 | <size> | ||
| 2302 | <width>55</width> | ||
| 2303 | <height>16777215</height> | ||
| 2304 | </size> | ||
| 2305 | </property> | ||
| 2306 | <property name="styleSheet"> | ||
| 2307 | <string notr="true">min-width: 55px;</string> | ||
| 2308 | </property> | ||
| 2309 | <property name="text"> | ||
| 2310 | <string>Motion left</string> | ||
| 2311 | </property> | ||
| 2312 | </widget> | ||
| 2313 | </item> | ||
| 2314 | </layout> | ||
| 2315 | </widget> | ||
| 2316 | </item> | ||
| 2317 | <item alignment="Qt::AlignHCenter"> | ||
| 2318 | <widget class="QGroupBox" name="buttonMotionRightGroup"> | ||
| 2319 | <property name="title"> | ||
| 2320 | <string>Motion right</string> | ||
| 2321 | </property> | ||
| 2322 | <property name="alignment"> | ||
| 2323 | <set>Qt::AlignCenter</set> | ||
| 2324 | </property> | ||
| 2325 | <layout class="QVBoxLayout" name="buttonMotionRightVerticalLayout"> | ||
| 2326 | <property name="spacing"> | ||
| 2327 | <number>3</number> | ||
| 2328 | </property> | ||
| 2329 | <property name="leftMargin"> | ||
| 2330 | <number>3</number> | ||
| 2331 | </property> | ||
| 2332 | <property name="topMargin"> | ||
| 2333 | <number>3</number> | ||
| 2334 | </property> | ||
| 2335 | <property name="rightMargin"> | ||
| 2336 | <number>3</number> | ||
| 2337 | </property> | ||
| 2338 | <property name="bottomMargin"> | ||
| 2339 | <number>3</number> | ||
| 2340 | </property> | ||
| 2341 | <item> | ||
| 2342 | <widget class="QPushButton" name="buttonMotionRight"> | ||
| 2343 | <property name="minimumSize"> | ||
| 2344 | <size> | ||
| 2345 | <width>57</width> | ||
| 2346 | <height>0</height> | ||
| 2347 | </size> | ||
| 2348 | </property> | ||
| 2349 | <property name="maximumSize"> | ||
| 2350 | <size> | ||
| 2351 | <width>55</width> | ||
| 2352 | <height>16777215</height> | ||
| 2353 | </size> | ||
| 2354 | </property> | ||
| 2355 | <property name="styleSheet"> | ||
| 2356 | <string notr="true">min-width: 55px;</string> | ||
| 2357 | </property> | ||
| 2358 | <property name="text"> | ||
| 2359 | <string>Motion right</string> | ||
| 2360 | </property> | ||
| 2361 | </widget> | ||
| 2362 | </item> | ||
| 2363 | </layout> | ||
| 2364 | </widget> | ||
| 2365 | </item> | ||
| 2366 | </layout> | 2368 | </layout> |
| 2367 | </item> | 2369 | </item> |
| 2368 | <item> | 2370 | <item> |