-
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.
Qt: Implement button mapping dialogs
- Loading branch information
Showing
22 changed files
with
1,388 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,66 @@ | ||
// 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/GCKeyboardEmu.h" | ||
#include "InputCommon/InputConfig.h" | ||
|
||
#include "Core/HW/GCKeyboard.h" | ||
#include "Core/HW/GCKeyboardEmu.h" | ||
|
||
GCKeyboardEmu::GCKeyboardEmu(MappingWindow* window) : MappingWidget(window) | ||
{ | ||
Keyboard::Initialize(); | ||
|
||
CreateMainLayout(); | ||
} | ||
|
||
void GCKeyboardEmu::CreateMainLayout() | ||
{ | ||
m_main_layout = new QHBoxLayout(); | ||
|
||
m_main_layout->addWidget( | ||
CreateGroupBox(QStringLiteral(""), Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb0x))); | ||
m_main_layout->addWidget( | ||
CreateGroupBox(QStringLiteral(""), Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb1x))); | ||
m_main_layout->addWidget( | ||
CreateGroupBox(QStringLiteral(""), Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb2x))); | ||
m_main_layout->addWidget( | ||
CreateGroupBox(QStringLiteral(""), Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb3x))); | ||
m_main_layout->addWidget( | ||
CreateGroupBox(QStringLiteral(""), Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb4x))); | ||
|
||
auto* vbox_layout = new QVBoxLayout(); | ||
auto* options_box = | ||
CreateGroupBox(tr("Options"), Keyboard::GetGroup(GetPort(), KeyboardGroup::Options)); | ||
|
||
options_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); | ||
|
||
vbox_layout->addWidget( | ||
CreateGroupBox(QStringLiteral(""), Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb5x))); | ||
vbox_layout->addWidget(options_box); | ||
|
||
m_main_layout->addLayout(vbox_layout); | ||
|
||
setLayout(m_main_layout); | ||
} | ||
|
||
void GCKeyboardEmu::LoadSettings() | ||
{ | ||
Keyboard::LoadConfig(); | ||
} | ||
|
||
void GCKeyboardEmu::SaveSettings() | ||
{ | ||
Keyboard::GetConfig()->SaveConfig(); | ||
} | ||
|
||
InputConfig* GCKeyboardEmu::GetConfig() | ||
{ | ||
return Keyboard::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,34 @@ | ||
// 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 GCKeyboardEmu final : public MappingWidget | ||
{ | ||
public: | ||
explicit GCKeyboardEmu(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; | ||
}; |
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; | ||
}; |
Oops, something went wrong.