Merge pull request #6287 from spycrab/qt_gamecube

Qt/Settings: Implement "GameCube pane"
This commit is contained in:
Anthony
2018-01-23 12:25:05 -08:00
committed by GitHub
9 changed files with 462 additions and 0 deletions

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,

View File

@ -12,6 +12,7 @@
#include "DolphinQt2/Settings.h"
#include "DolphinQt2/Settings/AdvancedPane.h"
#include "DolphinQt2/Settings/AudioPane.h"
#include "DolphinQt2/Settings/GameCubePane.h"
#include "DolphinQt2/Settings/GeneralPane.h"
#include "DolphinQt2/Settings/InterfacePane.h"
#include "DolphinQt2/Settings/PathPane.h"
@ -42,6 +43,7 @@ SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent)
m_general_pane_index = AddTab(m_tabs, tr("General"), new GeneralPane(), "config");
AddTab(m_tabs, tr("Interface"), new InterfacePane(), "browse");
m_audio_pane_index = AddTab(m_tabs, tr("Audio"), new AudioPane(), "play");
AddTab(m_tabs, tr("GameCube"), new GameCubePane(), "gcpad");
AddTab(m_tabs, tr("Paths"), new PathPane(), "browse");
AddTab(m_tabs, tr("Advanced"), new AdvancedPane(), "config");