-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,060 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2017 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/GCPadEmu.h" | ||
#include "InputCommon/InputConfig.h" | ||
|
||
#include "Core/HW/GCPad.h" | ||
#include "Core/HW/GCPadEmu.h" | ||
|
||
GCPadEmu::GCPadEmu(MappingWindow* window) : MappingWidget(window) | ||
{ | ||
Pad::Initialize(); | ||
|
||
CreateMainLayout(); | ||
} | ||
|
||
void GCPadEmu::CreateMainLayout() | ||
{ | ||
m_main_layout = new QHBoxLayout(); | ||
|
||
auto* hbox_layout = new QVBoxLayout(); | ||
|
||
hbox_layout->addWidget( | ||
CreateGroupBox(tr("Triggers"), Pad::GetGroup(GetPort(), PadGroup::Triggers))); | ||
hbox_layout->addWidget(CreateGroupBox(tr("Rumble"), Pad::GetGroup(GetPort(), PadGroup::Rumble))); | ||
|
||
m_main_layout->addWidget( | ||
CreateGroupBox(tr("Buttons"), Pad::GetGroup(GetPort(), PadGroup::Buttons))); | ||
m_main_layout->addWidget( | ||
CreateGroupBox(tr("Control Stick"), Pad::GetGroup(GetPort(), PadGroup::MainStick))); | ||
m_main_layout->addWidget( | ||
CreateGroupBox(tr("C-Stick"), Pad::GetGroup(GetPort(), PadGroup::CStick))); | ||
m_main_layout->addWidget(CreateGroupBox(tr("D-Pad"), Pad::GetGroup(GetPort(), PadGroup::DPad))); | ||
m_main_layout->addItem(hbox_layout); | ||
|
||
setLayout(m_main_layout); | ||
} | ||
|
||
void GCPadEmu::LoadSettings() | ||
{ | ||
Pad::LoadConfig(); | ||
} | ||
|
||
void GCPadEmu::SaveSettings() | ||
{ | ||
Pad::GetConfig()->SaveConfig(); | ||
} | ||
|
||
InputConfig* GCPadEmu::GetConfig() | ||
{ | ||
return Pad::GetConfig(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2017 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "DolphinQt2/Config/Mapping/MappingWidget.h" | ||
|
||
class QCheckBox; | ||
class QFormLayout; | ||
class QGroupBox; | ||
class QHBoxLayout; | ||
class QLabel; | ||
class QVBoxLayout; | ||
|
||
class GCPadEmu final : public MappingWidget | ||
{ | ||
public: | ||
explicit GCPadEmu(MappingWindow* window); | ||
|
||
InputConfig* GetConfig() override; | ||
|
||
private: | ||
void LoadSettings() override; | ||
void SaveSettings() override; | ||
void CreateButtonsLayout(); | ||
void CreateControlstickLayout(); | ||
void CreateCStickLayout(); | ||
void CreateTriggersLayout(); | ||
void CreateDPadLayout(); | ||
void CreateMainLayout(); | ||
void ConnectWidgets(); | ||
|
||
// Main | ||
QHBoxLayout* m_main_layout; | ||
|
||
// Buttons | ||
QGroupBox* m_buttons_box; | ||
QFormLayout* m_buttons_layout; | ||
|
||
// Control Stick | ||
QGroupBox* m_controlstick_box; | ||
QFormLayout* m_controlstick_layout; | ||
// TODO Add missing settings | ||
|
||
// C Stick | ||
QGroupBox* m_cstick_box; | ||
QFormLayout* m_cstick_layout; | ||
// TODO Add missing settings | ||
|
||
// Triggers | ||
QGroupBox* m_triggers_box; | ||
QFormLayout* m_triggers_layout; | ||
// TODO Add missing settings | ||
|
||
// D-Pad | ||
QGroupBox* m_dpad_box; | ||
QFormLayout* m_dpad_layout; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2017 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include <QCheckBox> | ||
#include <QLabel> | ||
#include <QVBoxLayout> | ||
|
||
#include "DolphinQt2/Config/Mapping/GCPadWiiU.h" | ||
|
||
#include "DolphinQt2/Settings.h" | ||
#include "InputCommon/GCAdapter.h" | ||
|
||
GCPadWiiU::GCPadWiiU(MappingWindow* window) : MappingWidget(window) | ||
{ | ||
CreateLayout(); | ||
ConnectWidgets(); | ||
|
||
LoadSettings(); | ||
} | ||
|
||
void GCPadWiiU::CreateLayout() | ||
{ | ||
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")); | ||
|
||
m_layout->addWidget(m_status_label); | ||
m_layout->addWidget(m_rumble); | ||
m_layout->addWidget(m_simulate_bongos); | ||
|
||
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); | ||
} | ||
|
||
void GCPadWiiU::LoadSettings() | ||
{ | ||
m_rumble->setChecked(Settings().IsGCAdapterRumbleEnabled(GetPort())); | ||
m_simulate_bongos->setChecked(Settings().IsGCAdapterSimulatingDKBongos(GetPort())); | ||
} | ||
|
||
void GCPadWiiU::SaveSettings() | ||
{ | ||
Settings().SetGCAdapterRumbleEnabled(GetPort(), m_rumble->isChecked()); | ||
Settings().SetGCAdapterSimulatingDKBongos(GetPort(), m_simulate_bongos->isChecked()); | ||
} | ||
|
||
InputConfig* GCPadWiiU::GetConfig() | ||
{ | ||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2017 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "DolphinQt2/Config/Mapping/MappingWidget.h" | ||
|
||
class QCheckBox; | ||
class QLabel; | ||
class QVBoxLayout; | ||
|
||
class GCPadWiiU final : public MappingWidget | ||
{ | ||
public: | ||
explicit GCPadWiiU(MappingWindow* window); | ||
|
||
InputConfig* GetConfig() override; | ||
|
||
private: | ||
void LoadSettings() override; | ||
void SaveSettings() override; | ||
|
||
void CreateLayout(); | ||
void ConnectWidgets(); | ||
|
||
QVBoxLayout* m_layout; | ||
QLabel* m_status_label; | ||
|
||
// Checkboxes | ||
QCheckBox* m_rumble; | ||
QCheckBox* m_simulate_bongos; | ||
}; |
Oops, something went wrong.