Merge pull request #8065 from jordan-woyak/wm-ext-names

WiimoteEmu/DolphinQt: Better extension display names.
This commit is contained in:
Léo Lam 2019-05-02 13:14:17 +02:00 committed by GitHub
commit 3b16d2261a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 31 additions and 15 deletions

View File

@ -72,7 +72,7 @@ constexpr std::array<u16, 4> classic_dpad_bitmasks{{
Classic::PAD_RIGHT, Classic::PAD_RIGHT,
}}; }};
Classic::Classic() : Extension1stParty(_trans("Classic")) Classic::Classic() : Extension1stParty("Classic", _trans("Classic Controller"))
{ {
// buttons // buttons
groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons")));

View File

@ -52,7 +52,7 @@ constexpr std::array<u8, 2> drum_button_bitmasks{{
Drums::BUTTON_PLUS, Drums::BUTTON_PLUS,
}}; }};
Drums::Drums() : Extension1stParty(_trans("Drums")) Drums::Drums() : Extension1stParty("Drums", _trans("Drum Kit"))
{ {
// Pads. // Pads.
groups.emplace_back(m_pads = new ControllerEmu::Buttons(_trans("Pads"))); groups.emplace_back(m_pads = new ControllerEmu::Buttons(_trans("Pads")));

View File

@ -16,13 +16,23 @@
namespace WiimoteEmu namespace WiimoteEmu
{ {
Extension::Extension(const char* name) : m_name(name) Extension::Extension(const char* name) : Extension(name, name)
{
}
Extension::Extension(const char* config_name, const char* display_name)
: m_config_name(config_name), m_display_name(display_name)
{ {
} }
std::string Extension::GetName() const std::string Extension::GetName() const
{ {
return m_name; return m_config_name;
}
std::string Extension::GetDisplayName() const
{
return m_display_name;
} }
None::None() : Extension("None") None::None() : Extension("None")
@ -64,10 +74,6 @@ int None::BusWrite(u8 slave_addr, u8 addr, int count, const u8* data_in)
return 0; return 0;
} }
EncryptedExtension::EncryptedExtension(const char* name) : Extension(name)
{
}
bool EncryptedExtension::ReadDeviceDetectPin() const bool EncryptedExtension::ReadDeviceDetectPin() const
{ {
return true; return true;

View File

@ -21,8 +21,10 @@ class Extension : public ControllerEmu::EmulatedController, public I2CSlave
{ {
public: public:
explicit Extension(const char* name); explicit Extension(const char* name);
Extension(const char* config_name, const char* display_name);
std::string GetName() const override; std::string GetName() const override;
std::string GetDisplayName() const override;
// Used by the wiimote to detect extension changes. // Used by the wiimote to detect extension changes.
// The normal extensions short this pin so it's always connected, // The normal extensions short this pin so it's always connected,
@ -35,7 +37,8 @@ public:
virtual void Update() = 0; virtual void Update() = 0;
private: private:
const char* const m_name; const char* const m_config_name;
const char* const m_display_name;
}; };
class None : public Extension class None : public Extension
@ -60,7 +63,7 @@ class EncryptedExtension : public Extension
public: public:
static constexpr u8 I2C_ADDR = 0x52; static constexpr u8 I2C_ADDR = 0x52;
EncryptedExtension(const char* name); using Extension::Extension;
// TODO: This is public for TAS reasons. // TODO: This is public for TAS reasons.
// TODO: TAS handles encryption poorly. // TODO: TAS handles encryption poorly.

View File

@ -45,7 +45,7 @@ constexpr std::array<const char*, 6> turntable_button_names{{
_trans("Blue Right"), _trans("Blue Right"),
}}; }};
Turntable::Turntable() : Extension1stParty(_trans("Turntable")) Turntable::Turntable() : Extension1stParty("Turntable", _trans("DJ Turntable"))
{ {
// buttons // buttons
groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons")));

View File

@ -31,7 +31,7 @@ constexpr std::array<const char*, 2> udraw_tablet_button_names{{
_trans("Rocker Down"), _trans("Rocker Down"),
}}; }};
UDrawTablet::UDrawTablet() : Extension3rdParty(_trans("uDraw")) UDrawTablet::UDrawTablet() : Extension3rdParty("uDraw", _trans("uDraw GameTablet"))
{ {
// Buttons // Buttons
groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons"))); groups.emplace_back(m_buttons = new ControllerEmu::Buttons(_trans("Buttons")));

View File

@ -65,7 +65,7 @@ void WiimoteEmuExtension::CreateClassicLayout()
void WiimoteEmuExtension::CreateDrumsLayout() void WiimoteEmuExtension::CreateDrumsLayout()
{ {
auto* layout = new QGridLayout(); auto* layout = new QGridLayout();
m_drums_box = new QGroupBox(tr("Drums"), this); m_drums_box = new QGroupBox(tr("Drum Kit"), this);
layout->addWidget( layout->addWidget(
CreateGroupBox(tr("Stick"), Wiimote::GetDrumsGroup(GetPort(), WiimoteEmu::DrumsGroup::Stick)), CreateGroupBox(tr("Stick"), Wiimote::GetDrumsGroup(GetPort(), WiimoteEmu::DrumsGroup::Stick)),
@ -150,7 +150,7 @@ void WiimoteEmuExtension::CreateGuitarLayout()
void WiimoteEmuExtension::CreateTurntableLayout() void WiimoteEmuExtension::CreateTurntableLayout()
{ {
auto* layout = new QGridLayout(); auto* layout = new QGridLayout();
m_turntable_box = new QGroupBox(tr("Turntable"), this); m_turntable_box = new QGroupBox(tr("DJ Turntable"), this);
layout->addWidget(CreateGroupBox(tr("Stick"), Wiimote::GetTurntableGroup( layout->addWidget(CreateGroupBox(tr("Stick"), Wiimote::GetTurntableGroup(
GetPort(), WiimoteEmu::TurntableGroup::Stick)), GetPort(), WiimoteEmu::TurntableGroup::Stick)),

View File

@ -48,7 +48,7 @@ void WiimoteEmuGeneral::CreateMainLayout()
m_extension_combo = new QComboBox(); m_extension_combo = new QComboBox();
for (const auto& attachment : ce_extension->GetAttachmentList()) for (const auto& attachment : ce_extension->GetAttachmentList())
m_extension_combo->addItem(tr(attachment->GetName().c_str())); m_extension_combo->addItem(tr(attachment->GetDisplayName().c_str()));
extension->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); extension->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

View File

@ -20,6 +20,11 @@ namespace ControllerEmu
{ {
static std::recursive_mutex s_get_state_mutex; static std::recursive_mutex s_get_state_mutex;
std::string EmulatedController::GetDisplayName() const
{
return GetName();
}
EmulatedController::~EmulatedController() = default; EmulatedController::~EmulatedController() = default;
// This should be called before calling GetState() or State() on a control reference // This should be called before calling GetState() or State() on a control reference

View File

@ -28,7 +28,9 @@ class EmulatedController
{ {
public: public:
virtual ~EmulatedController(); virtual ~EmulatedController();
virtual std::string GetName() const = 0; virtual std::string GetName() const = 0;
virtual std::string GetDisplayName() const;
virtual void LoadDefaults(const ControllerInterface& ciface); virtual void LoadDefaults(const ControllerInterface& ciface);