Qt/Mapping: Implement Microphone widget

This commit is contained in:
spycrab 2018-01-04 18:38:09 +00:00
parent c749125be5
commit 2167a45c24
5 changed files with 83 additions and 0 deletions

View File

@ -50,6 +50,7 @@ set(SRCS
Config/LogConfigWidget.cpp
Config/LogWidget.cpp
Config/Mapping/GCKeyboardEmu.cpp
Config/Mapping/GCMicrophone.cpp
Config/Mapping/GCPadEmu.cpp
Config/Mapping/GCPadWiiUConfigDialog.cpp
Config/Mapping/Hotkey3D.cpp

View File

@ -0,0 +1,45 @@
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "DolphinQt2/Config/Mapping/GCMicrophone.h"
#include "InputCommon/InputConfig.h"
#include "Core/HW/GCPad.h"
#include "Core/HW/GCPadEmu.h"
GCMicrophone::GCMicrophone(MappingWindow* window) : MappingWidget(window)
{
CreateMainLayout();
}
void GCMicrophone::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
m_main_layout->addWidget(
CreateGroupBox(tr("Microphone"), Pad::GetGroup(GetPort(), PadGroup::Mic)));
setLayout(m_main_layout);
}
void GCMicrophone::LoadSettings()
{
Pad::LoadConfig();
}
void GCMicrophone::SaveSettings()
{
Pad::GetConfig()->SaveConfig();
}
InputConfig* GCMicrophone::GetConfig()
{
return Pad::GetConfig();
}

View File

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

View File

@ -19,6 +19,7 @@
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "DolphinQt2/Config/Mapping/GCKeyboardEmu.h"
#include "DolphinQt2/Config/Mapping/GCMicrophone.h"
#include "DolphinQt2/Config/Mapping/GCPadEmu.h"
#include "DolphinQt2/Config/Mapping/Hotkey3D.h"
#include "DolphinQt2/Config/Mapping/HotkeyGeneral.h"
@ -254,6 +255,12 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
setWindowTitle(tr("GameCube Controller at Port %1").arg(GetPort() + 1));
AddWidget(tr("GameCube Controller"), widget);
break;
case Type::MAPPING_GC_MICROPHONE:
widget = new GCMicrophone(this);
setWindowTitle(tr("GameCube Microphone Slot %1")
.arg(GetPort() == 0 ? QStringLiteral("A") : QStringLiteral("B")));
AddWidget(tr("Microphone"), widget);
break;
case Type::MAPPING_WIIMOTE_EMU:
case Type::MAPPING_WIIMOTE_HYBRID:
{

View File

@ -38,6 +38,7 @@ public:
MAPPING_GC_KEYBOARD,
MAPPING_GCPAD,
MAPPING_GC_STEERINGWHEEL,
MAPPING_GC_MICROPHONE,
// Wii
MAPPING_WIIMOTE_EMU,
MAPPING_WIIMOTE_HYBRID,