mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Qt: GBA Pad config
This commit is contained in:
45
Source/Core/DolphinQt/Config/Mapping/GBAPadEmu.cpp
Normal file
45
Source/Core/DolphinQt/Config/Mapping/GBAPadEmu.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2021 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/Mapping/GBAPadEmu.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
|
||||
#include "Core/HW/GBAPad.h"
|
||||
#include "Core/HW/GBAPadEmu.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
GBAPadEmu::GBAPadEmu(MappingWindow* window) : MappingWidget(window)
|
||||
{
|
||||
CreateMainLayout();
|
||||
}
|
||||
|
||||
void GBAPadEmu::CreateMainLayout()
|
||||
{
|
||||
auto* layout = new QGridLayout;
|
||||
|
||||
layout->addWidget(
|
||||
CreateControlsBox(tr("D-Pad"), Pad::GetGBAGroup(GetPort(), GBAPadGroup::DPad), 2), 0, 0, -1,
|
||||
1);
|
||||
layout->addWidget(
|
||||
CreateControlsBox(tr("Buttons"), Pad::GetGBAGroup(GetPort(), GBAPadGroup::Buttons), 2), 0, 1,
|
||||
-1, 1);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void GBAPadEmu::LoadSettings()
|
||||
{
|
||||
Pad::LoadGBAConfig();
|
||||
}
|
||||
|
||||
void GBAPadEmu::SaveSettings()
|
||||
{
|
||||
Pad::GetGBAConfig()->SaveConfig();
|
||||
}
|
||||
|
||||
InputConfig* GBAPadEmu::GetConfig()
|
||||
{
|
||||
return Pad::GetGBAConfig();
|
||||
}
|
20
Source/Core/DolphinQt/Config/Mapping/GBAPadEmu.h
Normal file
20
Source/Core/DolphinQt/Config/Mapping/GBAPadEmu.h
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2021 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
||||
|
||||
class GBAPadEmu final : public MappingWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GBAPadEmu(MappingWindow* window);
|
||||
|
||||
InputConfig* GetConfig() override;
|
||||
|
||||
private:
|
||||
void LoadSettings() override;
|
||||
void SaveSettings() override;
|
||||
void CreateMainLayout();
|
||||
};
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "DolphinQt/Config/Mapping/FreeLookGeneral.h"
|
||||
#include "DolphinQt/Config/Mapping/FreeLookRotation.h"
|
||||
#include "DolphinQt/Config/Mapping/GBAPadEmu.h"
|
||||
#include "DolphinQt/Config/Mapping/GCKeyboardEmu.h"
|
||||
#include "DolphinQt/Config/Mapping/GCMicrophone.h"
|
||||
#include "DolphinQt/Config/Mapping/GCPadEmu.h"
|
||||
@ -374,10 +375,15 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case Type::MAPPING_GC_GBA:
|
||||
widget = new GBAPadEmu(this);
|
||||
setWindowTitle(tr("GameBoy Advance at Port %1").arg(GetPort() + 1));
|
||||
AddWidget(tr("GameBoy Advance"), widget);
|
||||
break;
|
||||
case Type::MAPPING_GC_KEYBOARD:
|
||||
widget = new GCKeyboardEmu(this);
|
||||
AddWidget(tr("GameCube Keyboard"), widget);
|
||||
setWindowTitle(tr("GameCube Keyboard at Port %1").arg(GetPort() + 1));
|
||||
AddWidget(tr("GameCube Keyboard"), widget);
|
||||
break;
|
||||
case Type::MAPPING_GC_BONGOS:
|
||||
case Type::MAPPING_GC_STEERINGWHEEL:
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
// GameCube
|
||||
MAPPING_GC_BONGOS,
|
||||
MAPPING_GC_DANCEMAT,
|
||||
MAPPING_GC_GBA,
|
||||
MAPPING_GC_KEYBOARD,
|
||||
MAPPING_GCPAD,
|
||||
MAPPING_GC_STEERINGWHEEL,
|
||||
|
Reference in New Issue
Block a user