2017-05-20 15:53:17 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
2017-11-03 21:47:36 +00:00
|
|
|
#include <QDialogButtonBox>
|
2017-05-20 15:53:17 +00:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
#include "DolphinQt2/Config/Mapping/GCPadWiiU.h"
|
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
#include "Core/ConfigManager.h"
|
2017-05-20 15:53:17 +00:00
|
|
|
#include "InputCommon/GCAdapter.h"
|
|
|
|
|
2017-11-03 21:47:36 +00:00
|
|
|
GCPadWiiU::GCPadWiiU(int port, QWidget* parent) : QDialog(parent), m_port{port}
|
2017-05-20 15:53:17 +00:00
|
|
|
{
|
|
|
|
CreateLayout();
|
|
|
|
ConnectWidgets();
|
|
|
|
|
|
|
|
LoadSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GCPadWiiU::CreateLayout()
|
|
|
|
{
|
2017-11-03 21:47:36 +00:00
|
|
|
setWindowTitle(tr("GameCube Adapter for Wii U at Port %1").arg(m_port + 1));
|
|
|
|
|
2017-05-20 15:53:17 +00:00
|
|
|
const bool detected = GCAdapter::IsDetected();
|
|
|
|
m_layout = new QVBoxLayout();
|
|
|
|
m_status_label = new QLabel(detected ? tr("Adapter Detected") : tr("No Adapter Detected"));
|
|
|
|
m_rumble = new QCheckBox(tr("Enable Rumble"));
|
|
|
|
m_simulate_bongos = new QCheckBox(tr("Simulate DK Bongos"));
|
2017-11-03 21:47:36 +00:00
|
|
|
m_button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
m_layout->addWidget(m_status_label);
|
|
|
|
m_layout->addWidget(m_rumble);
|
|
|
|
m_layout->addWidget(m_simulate_bongos);
|
2017-11-03 21:47:36 +00:00
|
|
|
m_layout->addWidget(m_button_box);
|
2017-05-20 15:53:17 +00:00
|
|
|
|
|
|
|
if (!detected)
|
|
|
|
{
|
|
|
|
m_rumble->setEnabled(false);
|
|
|
|
m_simulate_bongos->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
setLayout(m_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GCPadWiiU::ConnectWidgets()
|
|
|
|
{
|
|
|
|
connect(m_rumble, &QCheckBox::toggled, this, &GCPadWiiU::SaveSettings);
|
|
|
|
connect(m_simulate_bongos, &QCheckBox::toggled, this, &GCPadWiiU::SaveSettings);
|
2017-11-03 21:47:36 +00:00
|
|
|
connect(m_button_box, &QDialogButtonBox::accepted, this, &GCPadWiiU::accept);
|
2017-05-20 15:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GCPadWiiU::LoadSettings()
|
|
|
|
{
|
2017-11-03 21:47:36 +00:00
|
|
|
m_rumble->setChecked(SConfig::GetInstance().m_AdapterRumble[m_port]);
|
|
|
|
m_simulate_bongos->setChecked(SConfig::GetInstance().m_AdapterKonga[m_port]);
|
2017-05-20 15:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GCPadWiiU::SaveSettings()
|
|
|
|
{
|
2017-11-03 21:47:36 +00:00
|
|
|
SConfig::GetInstance().m_AdapterRumble[m_port] = m_rumble->isChecked();
|
|
|
|
SConfig::GetInstance().m_AdapterKonga[m_port] = m_simulate_bongos->isChecked();
|
2017-05-20 15:53:17 +00:00
|
|
|
}
|