Lioncash fef1b84f0a DolphinQt: Replace QStringLiteral with alternatives where applicable
QStringLiterals generate a buffer so that during runtime there's very
little cost to constructing a QString. However, this also means that
duplicated strings cannot be optimized out into a single entry that gets
referenced everywhere, taking up space in the binary.

Rather than use QStringLiteral(""), we can just use QString{} (the
default constructor) to signify the empty string. This gets rid of an
unnecessary string buffer from being created, saving a tiny bit of
space.

While we're at it, we can just use the character overloads of particular
functions when they're available instead of using a QString overload.
The characters in this case are Latin-1 to begin with, so we can just
specify the characters as QLatin1Char instances to use those overloads.
These will automatically convert to QChar if needed, so this is safe.
2019-07-30 09:06:03 -04:00

60 lines
1.5 KiB
C++

// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "DolphinQt/Config/Mapping/GCKeyboardEmu.h"
#include "InputCommon/InputConfig.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCKeyboardEmu.h"
GCKeyboardEmu::GCKeyboardEmu(MappingWindow* window) : MappingWidget(window)
{
CreateMainLayout();
}
void GCKeyboardEmu::CreateMainLayout()
{
m_main_layout = new QHBoxLayout();
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)));
auto* vbox_layout = new QVBoxLayout();
vbox_layout->addWidget(
CreateGroupBox(QString{}, Keyboard::GetGroup(GetPort(), KeyboardGroup::Kb5x)));
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();
}