From 296959ec58a54a08195bf5e91d8f7ab618db58ed Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 10 Nov 2022 21:09:34 -0600 Subject: [PATCH 1/2] GCKeyboardEmu: Eliminate unused Options group. --- Source/Core/Core/HW/GCKeyboardEmu.cpp | 5 ----- Source/Core/Core/HW/GCKeyboardEmu.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/Source/Core/Core/HW/GCKeyboardEmu.cpp b/Source/Core/Core/HW/GCKeyboardEmu.cpp index 2322977fff..aace009503 100644 --- a/Source/Core/Core/HW/GCKeyboardEmu.cpp +++ b/Source/Core/Core/HW/GCKeyboardEmu.cpp @@ -75,9 +75,6 @@ GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index) groups.emplace_back(m_keys5x = new ControllerEmu::Buttons(_trans("Keys"))); for (const char* key : named_keys5) m_keys5x->AddInput(ControllerEmu::DoNotTranslate, key); - - // options - groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); } std::string GCKeyboard::GetName() const @@ -101,8 +98,6 @@ ControllerEmu::ControlGroup* GCKeyboard::GetGroup(KeyboardGroup group) return m_keys4x; case KeyboardGroup::Kb5x: return m_keys5x; - case KeyboardGroup::Options: - return m_options; default: return nullptr; } diff --git a/Source/Core/Core/HW/GCKeyboardEmu.h b/Source/Core/Core/HW/GCKeyboardEmu.h index 492e8e77c4..17ffe82baa 100644 --- a/Source/Core/Core/HW/GCKeyboardEmu.h +++ b/Source/Core/Core/HW/GCKeyboardEmu.h @@ -23,8 +23,6 @@ enum class KeyboardGroup Kb3x, Kb4x, Kb5x, - - Options }; class GCKeyboard : public ControllerEmu::EmulatedController @@ -43,7 +41,6 @@ private: ControllerEmu::Buttons* m_keys3x; ControllerEmu::Buttons* m_keys4x; ControllerEmu::Buttons* m_keys5x; - ControllerEmu::ControlGroup* m_options; const unsigned int m_index; }; From e9af3d945a167773b836cd041091cecb9e309fd3 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 11 Nov 2022 01:55:24 -0600 Subject: [PATCH 2/2] DolphinQt: Rename "Keyboard" to "Keyboard Controller" and add warning text. --- .../Config/GamecubeControllersWidget.cpp | 2 +- .../Config/Mapping/GCKeyboardEmu.cpp | 40 +++++++++++-------- .../DolphinQt/Config/Mapping/GCKeyboardEmu.h | 10 ----- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp b/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp index df7d66262f..5425ed8af0 100644 --- a/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp +++ b/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp @@ -40,7 +40,7 @@ static constexpr std::array s_gc_types = { SIDeviceName{SerialInterface::SIDEVICE_GC_GBA_EMULATED, _trans("GBA (Integrated)")}, #endif SIDeviceName{SerialInterface::SIDEVICE_GC_GBA, _trans("GBA (TCP)")}, - SIDeviceName{SerialInterface::SIDEVICE_GC_KEYBOARD, _trans("Keyboard")}, + SIDeviceName{SerialInterface::SIDEVICE_GC_KEYBOARD, _trans("Keyboard Controller")}, }; static std::optional ToGCMenuIndex(const SerialInterface::SIDevices sidevice) diff --git a/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.cpp b/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.cpp index 583025b4e5..9078cd0172 100644 --- a/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.cpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include "InputCommon/InputConfig.h" @@ -20,26 +22,32 @@ GCKeyboardEmu::GCKeyboardEmu(MappingWindow* window) : MappingWidget(window) void GCKeyboardEmu::CreateMainLayout() { - m_main_layout = new QHBoxLayout(); + const auto vbox_layout = new QVBoxLayout; - m_main_layout->addWidget( - CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb0x))); - m_main_layout->addWidget( - CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb1x))); - m_main_layout->addWidget( - CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb2x))); - m_main_layout->addWidget( - CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb3x))); - m_main_layout->addWidget( - CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb4x))); + const auto warning_layout = new QHBoxLayout; + vbox_layout->addLayout(warning_layout); - auto* vbox_layout = new QVBoxLayout(); - vbox_layout->addWidget( - CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb5x))); + const auto warning_icon = new QLabel; + const auto size = QFontMetrics(font()).height() * 3 / 2; + warning_icon->setPixmap(style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(size, size)); + warning_layout->addWidget(warning_icon); - m_main_layout->addLayout(vbox_layout); + const auto warning_text = + new QLabel(tr("You are configuring a \"Keyboard Controller\". " + "This device is exclusively for \"Phantasy Star Online Episode I & II\". " + "If you are unsure, turn back now and configure a \"Standard Controller\".")); + warning_text->setWordWrap(true); + warning_layout->addWidget(warning_text, 1); - setLayout(m_main_layout); + const auto layout = new QHBoxLayout; + + using KG = KeyboardGroup; + for (auto kbg : {KG::Kb0x, KG::Kb1x, KG::Kb2x, KG::Kb3x, KG::Kb4x, KG::Kb5x}) + layout->addWidget(CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), kbg))); + + vbox_layout->addLayout(layout); + + setLayout(vbox_layout); } void GCKeyboardEmu::LoadSettings() diff --git a/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.h b/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.h index 5a80fae169..015566848d 100644 --- a/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.h +++ b/Source/Core/DolphinQt/Config/Mapping/GCKeyboardEmu.h @@ -5,13 +5,6 @@ #include "DolphinQt/Config/Mapping/MappingWidget.h" -class QCheckBox; -class QFormLayout; -class QGroupBox; -class QHBoxLayout; -class QLabel; -class QVBoxLayout; - class GCKeyboardEmu final : public MappingWidget { Q_OBJECT @@ -24,7 +17,4 @@ private: void LoadSettings() override; void SaveSettings() override; void CreateMainLayout(); - - // Main - QHBoxLayout* m_main_layout; };