Qt/Core: Implement GBA Hotkeys

This commit is contained in:
Bonta
2021-07-04 13:26:47 +02:00
parent d6f86e1754
commit b73d16a71a
9 changed files with 193 additions and 8 deletions

View File

@ -0,0 +1,43 @@
// Copyright 2021 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "DolphinQt/Config/Mapping/HotkeyGBA.h"
#include <QGroupBox>
#include <QHBoxLayout>
#include "Core/HotkeyManager.h"
HotkeyGBA::HotkeyGBA(MappingWindow* window) : MappingWidget(window)
{
CreateMainLayout();
}
void HotkeyGBA::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
m_main_layout->addWidget(
CreateGroupBox(tr("Core"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_GBA_CORE)));
m_main_layout->addWidget(
CreateGroupBox(tr("Volume"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_GBA_VOLUME)));
m_main_layout->addWidget(
CreateGroupBox(tr("Window Size"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_GBA_SIZE)));
setLayout(m_main_layout);
}
InputConfig* HotkeyGBA::GetConfig()
{
return HotkeyManagerEmu::GetConfig();
}
void HotkeyGBA::LoadSettings()
{
HotkeyManagerEmu::LoadConfig();
}
void HotkeyGBA::SaveSettings()
{
HotkeyManagerEmu::GetConfig()->SaveConfig();
}

View File

@ -0,0 +1,25 @@
// Copyright 2021 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "DolphinQt/Config/Mapping/MappingWidget.h"
class QHBoxLayout;
class HotkeyGBA final : public MappingWidget
{
Q_OBJECT
public:
explicit HotkeyGBA(MappingWindow* window);
InputConfig* GetConfig() override;
private:
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();
// Main
QHBoxLayout* m_main_layout;
};

View File

@ -30,6 +30,7 @@
#include "DolphinQt/Config/Mapping/Hotkey3D.h"
#include "DolphinQt/Config/Mapping/HotkeyControllerProfile.h"
#include "DolphinQt/Config/Mapping/HotkeyDebugging.h"
#include "DolphinQt/Config/Mapping/HotkeyGBA.h"
#include "DolphinQt/Config/Mapping/HotkeyGeneral.h"
#include "DolphinQt/Config/Mapping/HotkeyGraphics.h"
#include "DolphinQt/Config/Mapping/HotkeyStates.h"
@ -435,6 +436,7 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
AddWidget(tr("3D"), new Hotkey3D(this));
AddWidget(tr("Save and Load State"), new HotkeyStates(this));
AddWidget(tr("Other State Management"), new HotkeyStatesOther(this));
AddWidget(tr("GameBoy Advance"), new HotkeyGBA(this));
setWindowTitle(tr("Hotkey Settings"));
break;
}