mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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.
This commit is contained in:
@ -192,7 +192,7 @@ void MenuBar::AddFileMenu()
|
||||
{
|
||||
QMenu* file_menu = addMenu(tr("&File"));
|
||||
m_open_action = file_menu->addAction(tr("&Open..."), this, &MenuBar::Open,
|
||||
QKeySequence(QStringLiteral("Ctrl+O")));
|
||||
QKeySequence(Qt::CTRL + Qt::Key_O));
|
||||
|
||||
file_menu->addSeparator();
|
||||
|
||||
@ -203,8 +203,8 @@ void MenuBar::AddFileMenu()
|
||||
|
||||
file_menu->addSeparator();
|
||||
|
||||
m_exit_action = file_menu->addAction(tr("E&xit"), this, &MenuBar::Exit,
|
||||
QKeySequence(QStringLiteral("Alt+F4")));
|
||||
m_exit_action =
|
||||
file_menu->addAction(tr("E&xit"), this, &MenuBar::Exit, QKeySequence(Qt::ALT + Qt::Key_F4));
|
||||
}
|
||||
|
||||
void MenuBar::AddToolsMenu()
|
||||
@ -244,8 +244,7 @@ void MenuBar::AddToolsMenu()
|
||||
tools_menu->addSeparator();
|
||||
|
||||
// Label will be set by a NANDRefresh later
|
||||
m_boot_sysmenu =
|
||||
tools_menu->addAction(QStringLiteral(""), this, [this] { emit BootWiiSystemMenu(); });
|
||||
m_boot_sysmenu = tools_menu->addAction(QString{}, this, [this] { emit BootWiiSystemMenu(); });
|
||||
m_wad_install_action = tools_menu->addAction(tr("Install WAD..."), this, &MenuBar::InstallWAD);
|
||||
m_manage_nand_menu = tools_menu->addMenu(tr("Manage NAND"));
|
||||
m_import_backup = m_manage_nand_menu->addAction(tr("Import BootMii NAND Backup..."), this,
|
||||
@ -325,7 +324,7 @@ void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
|
||||
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
QAction* action = m_state_load_slots_menu->addAction(QStringLiteral(""));
|
||||
QAction* action = m_state_load_slots_menu->addAction(QString{});
|
||||
|
||||
connect(action, &QAction::triggered, this, [=]() { emit StateLoadSlotAt(i); });
|
||||
}
|
||||
@ -342,7 +341,7 @@ void MenuBar::AddStateSaveMenu(QMenu* emu_menu)
|
||||
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
QAction* action = m_state_save_slots_menu->addAction(QStringLiteral(""));
|
||||
QAction* action = m_state_save_slots_menu->addAction(QString{});
|
||||
|
||||
connect(action, &QAction::triggered, this, [=]() { emit StateSaveSlotAt(i); });
|
||||
}
|
||||
@ -355,7 +354,7 @@ void MenuBar::AddStateSlotMenu(QMenu* emu_menu)
|
||||
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
QAction* action = m_state_slot_menu->addAction(QStringLiteral(""));
|
||||
QAction* action = m_state_slot_menu->addAction(QString{});
|
||||
action->setCheckable(true);
|
||||
action->setActionGroup(m_state_slots);
|
||||
if (Settings::Instance().GetStateSlot() == i)
|
||||
@ -479,7 +478,7 @@ void MenuBar::AddViewMenu()
|
||||
view_menu->addAction(tr("Purge Game List Cache"), this, &MenuBar::PurgeGameListCache);
|
||||
view_menu->addSeparator();
|
||||
view_menu->addAction(tr("Search"), this, &MenuBar::ShowSearch,
|
||||
QKeySequence(QStringLiteral("Ctrl+F")));
|
||||
QKeySequence(Qt::CTRL + Qt::Key_F));
|
||||
}
|
||||
|
||||
void MenuBar::AddOptionsMenu()
|
||||
@ -939,7 +938,7 @@ void MenuBar::UpdateToolsMenu(bool emulation_started)
|
||||
const QString sysmenu_version =
|
||||
tmd.IsValid() ?
|
||||
QString::fromStdString(DiscIO::GetSysMenuVersionString(tmd.GetTitleVersion())) :
|
||||
QStringLiteral("");
|
||||
QString{};
|
||||
m_boot_sysmenu->setText(tr("Load Wii System Menu %1").arg(sysmenu_version));
|
||||
|
||||
m_boot_sysmenu->setEnabled(tmd.IsValid());
|
||||
@ -1438,8 +1437,8 @@ void MenuBar::LogInstructions()
|
||||
void MenuBar::SearchInstruction()
|
||||
{
|
||||
bool good;
|
||||
QString op = QInputDialog::getText(this, tr("Search instruction"), tr("Instruction:"),
|
||||
QLineEdit::Normal, QStringLiteral(""), &good);
|
||||
const QString op = QInputDialog::getText(this, tr("Search instruction"), tr("Instruction:"),
|
||||
QLineEdit::Normal, QString{}, &good);
|
||||
|
||||
if (!good)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user