Input: Add hotkey to cycle the wiimote profile forward or backward

Co-authored-by:  Barath Kannan <barathsotd@gmail.com>
This commit is contained in:
iwubcode
2018-04-13 23:51:32 -05:00
parent 29b71fb9ce
commit 3969bf6d1c
16 changed files with 237 additions and 0 deletions

View File

@ -50,6 +50,7 @@ add_executable(dolphin-emu
Config/Mapping/GCPadEmu.cpp
Config/Mapping/GCPadWiiUConfigDialog.cpp
Config/Mapping/Hotkey3D.cpp
Config/Mapping/HotkeyControllerProfile.cpp
Config/Mapping/HotkeyDebugging.cpp
Config/Mapping/HotkeyGeneral.cpp
Config/Mapping/HotkeyGraphics.cpp

View File

@ -0,0 +1,39 @@
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinQt/Config/Mapping/HotkeyControllerProfile.h"
#include <QGroupBox>
#include <QHBoxLayout>
#include "Core/HotkeyManager.h"
HotkeyControllerProfile::HotkeyControllerProfile(MappingWindow* window) : MappingWidget(window)
{
CreateMainLayout();
}
void HotkeyControllerProfile::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
m_main_layout->addWidget(CreateGroupBox(tr("Controller Profile"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_CONTROLLER_PROFILE)));
setLayout(m_main_layout);
}
InputConfig* HotkeyControllerProfile::GetConfig()
{
return HotkeyManagerEmu::GetConfig();
}
void HotkeyControllerProfile::LoadSettings()
{
HotkeyManagerEmu::LoadConfig();
}
void HotkeyControllerProfile::SaveSettings()
{
HotkeyManagerEmu::GetConfig()->SaveConfig();
}

View File

@ -0,0 +1,26 @@
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinQt/Config/Mapping/MappingWidget.h"
class QHBoxLayout;
class HotkeyControllerProfile final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyControllerProfile(MappingWindow* window);
InputConfig* GetConfig() override;
private:
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();
// Main
QHBoxLayout* m_main_layout;
};

View File

@ -25,6 +25,7 @@
#include "DolphinQt/Config/Mapping/GCMicrophone.h"
#include "DolphinQt/Config/Mapping/GCPadEmu.h"
#include "DolphinQt/Config/Mapping/Hotkey3D.h"
#include "DolphinQt/Config/Mapping/HotkeyControllerProfile.h"
#include "DolphinQt/Config/Mapping/HotkeyDebugging.h"
#include "DolphinQt/Config/Mapping/HotkeyGeneral.h"
#include "DolphinQt/Config/Mapping/HotkeyGraphics.h"
@ -310,6 +311,7 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
AddWidget(tr("Debugging"), new HotkeyDebugging(this));
AddWidget(tr("Wii and Wii Remote"), new HotkeyWii(this));
AddWidget(tr("Controller Profile"), new HotkeyControllerProfile(this));
AddWidget(tr("Graphics"), new HotkeyGraphics(this));
AddWidget(tr("3D"), new Hotkey3D(this));
AddWidget(tr("Save and Load State"), new HotkeyStates(this));

View File

@ -70,6 +70,7 @@
<QtMoc Include="Config\Mapping\GCPadEmu.h" />
<QtMoc Include="Config\Mapping\GCPadWiiUConfigDialog.h" />
<QtMoc Include="Config\Mapping\Hotkey3D.h" />
<QtMoc Include="Config\Mapping\HotkeyControllerProfile.h" />
<QtMoc Include="Config\Mapping\HotkeyDebugging.h" />
<QtMoc Include="Config\Mapping\HotkeyGeneral.h" />
<QtMoc Include="Config\Mapping\HotkeyGraphics.h" />
@ -203,6 +204,7 @@
<ClCompile Include="$(QtMocOutPrefix)HacksWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Host.cpp" />
<ClCompile Include="$(QtMocOutPrefix)Hotkey3D.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyControllerProfile.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyDebugging.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyGeneral.cpp" />
<ClCompile Include="$(QtMocOutPrefix)HotkeyGraphics.cpp" />
@ -283,6 +285,7 @@
<ClCompile Include="Config\Mapping\GCPadEmu.cpp" />
<ClCompile Include="Config\Mapping\GCPadWiiUConfigDialog.cpp" />
<ClCompile Include="Config\Mapping\Hotkey3D.cpp" />
<ClCompile Include="Config\Mapping\HotkeyControllerProfile.cpp" />
<ClCompile Include="Config\Mapping\HotkeyDebugging.cpp" />
<ClCompile Include="Config\Mapping\HotkeyGeneral.cpp" />
<ClCompile Include="Config\Mapping\HotkeyGraphics.cpp" />

View File

@ -240,6 +240,11 @@ void HotkeyScheduler::Run()
emit ConnectWiiRemote(wiimote_id);
}
if (IsHotkey(HK_PREV_WIIMOTE_PROFILE))
m_profile_cycler.PreviousWiimoteProfile();
else if (IsHotkey(HK_NEXT_WIIMOTE_PROFILE))
m_profile_cycler.NextWiimoteProfile();
const auto show_msg = [](OSDMessage message) {
if (g_renderer)
g_renderer->ShowOSDMessage(message);

View File

@ -9,6 +9,7 @@
#include <QObject>
#include "Common/Flag.h"
#include "InputCommon/InputProfile.h"
class HotkeyScheduler : public QObject
{
@ -64,4 +65,6 @@ private:
Common::Flag m_stop_requested;
std::thread m_thread;
InputProfile::ProfileCycler m_profile_cycler;
};