diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index 3ed0ffb1c8..e85ddda9d0 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -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 diff --git a/Source/Core/DolphinQt2/Config/Mapping/GCMicrophone.cpp b/Source/Core/DolphinQt2/Config/Mapping/GCMicrophone.cpp new file mode 100644 index 0000000000..bd5037073d --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/GCMicrophone.cpp @@ -0,0 +1,45 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include +#include +#include +#include + +#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(); +} diff --git a/Source/Core/DolphinQt2/Config/Mapping/GCMicrophone.h b/Source/Core/DolphinQt2/Config/Mapping/GCMicrophone.h new file mode 100644 index 0000000000..577a5320f7 --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/GCMicrophone.h @@ -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; +}; diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp index 18d22b706d..7c0c72d40f 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp @@ -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: { diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h index d97b39d576..e16d120c1a 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h @@ -38,6 +38,7 @@ public: MAPPING_GC_KEYBOARD, MAPPING_GCPAD, MAPPING_GC_STEERINGWHEEL, + MAPPING_GC_MICROPHONE, // Wii MAPPING_WIIMOTE_EMU, MAPPING_WIIMOTE_HYBRID,