Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #8654 from 3t13nn3/HotkeyControllerProfile
Qt: Fix Hotkey Controller Profile display with boxes for each Wiimote
  • Loading branch information
leoetlino committed Apr 28, 2020
2 parents 93abbc6 + 8288bdc commit 58de3c5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 28 deletions.
37 changes: 20 additions & 17 deletions Source/Core/Core/HotkeyManager.cpp
Expand Up @@ -85,22 +85,22 @@ constexpr std::array<const char*, 134> s_hotkey_labels{{
_trans("Toggle SD Card"),
_trans("Toggle USB Keyboard"),

_trans("Next Profile for Wii Remote 1"),
_trans("Previous Profile for Wii Remote 1"),
_trans("Next Game Profile for Wii Remote 1"),
_trans("Previous Game Profile for Wii Remote 1"),
_trans("Next Profile for Wii Remote 2"),
_trans("Previous Profile for Wii Remote 2"),
_trans("Next Game Profile for Wii Remote 2"),
_trans("Previous Game Profile for Wii Remote 2"),
_trans("Next Profile for Wii Remote 3"),
_trans("Previous Profile for Wii Remote 3"),
_trans("Next Game Profile for Wii Remote 3"),
_trans("Previous Game Profile for Wii Remote 3"),
_trans("Next Profile for Wii Remote 4"),
_trans("Previous Profile for Wii Remote 4"),
_trans("Next Game Profile for Wii Remote 4"),
_trans("Previous Game Profile for Wii Remote 4"),
_trans("Next Profile"),
_trans("Previous Profile"),
_trans("Next Game Profile"),
_trans("Previous Game Profile"),
_trans("Next Profile"),
_trans("Previous Profile"),
_trans("Next Game Profile"),
_trans("Previous Game Profile"),
_trans("Next Profile"),
_trans("Previous Profile"),
_trans("Next Game Profile"),
_trans("Previous Game Profile"),
_trans("Next Profile"),
_trans("Previous Profile"),
_trans("Next Game Profile"),
_trans("Previous Game Profile"),

_trans("Toggle Crop"),
_trans("Toggle Aspect Ratio"),
Expand Down Expand Up @@ -328,7 +328,10 @@ constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> s_groups_info = {
{_trans("Program Counter"), HK_SHOW_PC, HK_SET_PC},
{_trans("Breakpoint"), HK_BP_TOGGLE, HK_MBP_ADD},
{_trans("Wii"), HK_TRIGGER_SYNC_BUTTON, HK_TOGGLE_USB_KEYBOARD},
{_trans("Controller Profile"), HK_NEXT_WIIMOTE_PROFILE_1, HK_PREV_GAME_WIIMOTE_PROFILE_4},
{_trans("Controller Profile 1"), HK_NEXT_WIIMOTE_PROFILE_1, HK_PREV_GAME_WIIMOTE_PROFILE_1},
{_trans("Controller Profile 2"), HK_NEXT_WIIMOTE_PROFILE_2, HK_PREV_GAME_WIIMOTE_PROFILE_2},
{_trans("Controller Profile 3"), HK_NEXT_WIIMOTE_PROFILE_3, HK_PREV_GAME_WIIMOTE_PROFILE_3},
{_trans("Controller Profile 4"), HK_NEXT_WIIMOTE_PROFILE_4, HK_PREV_GAME_WIIMOTE_PROFILE_4},
{_trans("Graphics Toggles"), HK_TOGGLE_CROP, HK_TOGGLE_TEXTURES},
{_trans("Internal Resolution"), HK_INCREASE_IR, HK_DECREASE_IR},
{_trans("Freelook"), HK_FREELOOK_DECREASE_SPEED, HK_FREELOOK_TOGGLE},
Expand Down
5 changes: 4 additions & 1 deletion Source/Core/Core/HotkeyManager.h
Expand Up @@ -187,7 +187,10 @@ enum HotkeyGroup : int
HKGP_PC,
HKGP_BREAKPOINT,
HKGP_WII,
HKGP_CONTROLLER_PROFILE,
HKGP_CONTROLLER_PROFILE_1,
HKGP_CONTROLLER_PROFILE_2,
HKGP_CONTROLLER_PROFILE_3,
HKGP_CONTROLLER_PROFILE_4,
HKGP_GRAPHICS_TOGGLES,
HKGP_IR,
HKGP_FREELOOK,
Expand Down
27 changes: 22 additions & 5 deletions Source/Core/DolphinQt/Config/Mapping/HotkeyControllerProfile.cpp
Expand Up @@ -4,8 +4,8 @@

#include "DolphinQt/Config/Mapping/HotkeyControllerProfile.h"

#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>

#include "Core/HotkeyManager.h"

Expand All @@ -16,12 +16,29 @@ HotkeyControllerProfile::HotkeyControllerProfile(MappingWindow* window) : Mappin

void HotkeyControllerProfile::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
const auto main_layout = new QGridLayout;

m_main_layout->addWidget(CreateGroupBox(
tr("Controller Profile"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_CONTROLLER_PROFILE)));
main_layout->addWidget(
CreateGroupBox(tr("Wii Remote %1").arg(1),
HotkeyManagerEmu::GetHotkeyGroup(HKGP_CONTROLLER_PROFILE_1)),
0, 0);

setLayout(m_main_layout);
main_layout->addWidget(
CreateGroupBox(tr("Wii Remote %1").arg(2),
HotkeyManagerEmu::GetHotkeyGroup(HKGP_CONTROLLER_PROFILE_2)),
0, 1);

main_layout->addWidget(
CreateGroupBox(tr("Wii Remote %1").arg(3),
HotkeyManagerEmu::GetHotkeyGroup(HKGP_CONTROLLER_PROFILE_3)),
1, 0);

main_layout->addWidget(
CreateGroupBox(tr("Wii Remote %1").arg(4),
HotkeyManagerEmu::GetHotkeyGroup(HKGP_CONTROLLER_PROFILE_4)),
1, 1);

setLayout(main_layout);
}

InputConfig* HotkeyControllerProfile::GetConfig()
Expand Down
Expand Up @@ -6,8 +6,6 @@

#include "DolphinQt/Config/Mapping/MappingWidget.h"

class QHBoxLayout;

class HotkeyControllerProfile final : public MappingWidget
{
Q_OBJECT
Expand All @@ -20,7 +18,4 @@ class HotkeyControllerProfile final : public MappingWidget
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();

// Main
QHBoxLayout* m_main_layout;
};

0 comments on commit 58de3c5

Please sign in to comment.