Qt: Replace most _L1 usage with _s

Avoids runtime heap allocation.

NOTE: appending, comparing, etc with latin1 views are still
allocation-free.
This commit is contained in:
Stenzek
2026-06-02 20:57:04 +10:00
parent 8dd88aad2c
commit e21bf74f29
31 changed files with 162 additions and 162 deletions
@@ -147,7 +147,7 @@ void AdvancedSettingsWidget::onClearWebCacheClicked()
Error error;
if (!HTTPCache::Clear(&error))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Failed to clear web cache"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Failed to clear web cache"_s,
QString::fromStdString(error.GetDescription()));
}
+1 -1
View File
@@ -1011,7 +1011,7 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
// Execute new appimage.
QProcess* new_process = new QProcess();
new_process->setProgram(QString::fromUtf8(appimage_path));
new_process->setArguments(QStringList{"-updatecleanup"_L1});
new_process->setArguments(QStringList{u"-updatecleanup"_s});
if (!new_process->startDetached())
{
reportError("Failed to execute new AppImage.");
+3 -3
View File
@@ -136,9 +136,9 @@ void BIOSSettingsWidget::populateDropDownForRegion(ConsoleRegion region, QComboB
cb->clear();
if (per_game)
cb->addItem(QIcon(":/icons/system-search.png"_L1), tr("Use Global Setting"));
cb->addItem(QIcon(u":/icons/system-search.png"_s), tr("Use Global Setting"));
cb->addItem(QIcon(":/icons/system-search.png"_L1), tr("Auto-Detect"));
cb->addItem(QIcon(u":/icons/system-search.png"_s), tr("Auto-Detect"));
std::sort(images.begin(), images.end(), [region](const auto& left, const auto& right) {
const bool left_region_match = (left.second && left.second->region == region);
@@ -182,7 +182,7 @@ void BIOSSettingsWidget::setDropDownValue(QComboBox* cb, const std::optional<std
}
}
cb->addItem(QIcon(":/icons/monochrome/svg/close-line.png"_L1), tr("%1 (Missing)").arg(qname), QVariant(qname));
cb->addItem(QIcon(u":/icons/monochrome/svg/close-line.png"_s), tr("%1 (Missing)").arg(qname), QVariant(qname));
cb->setCurrentIndex(cb->count() - 1);
}
+13 -13
View File
@@ -119,7 +119,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_AnalogController ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/controller-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/controller-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -129,7 +129,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_AnalogJoystick ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/joystick-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/joystick-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -139,7 +139,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_DigitalController ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/controller-digital-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/controller-digital-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -149,7 +149,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_GunCon ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/guncon-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/guncon-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -159,7 +159,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_NeGcon ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/negcon-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/negcon-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -169,7 +169,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_NeGconRumble ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/negcon-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/negcon-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -179,7 +179,7 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_Mouse ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/mouse-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/mouse-line.svg"_s);
image_widget = ui.image;
}
break;
@@ -189,21 +189,21 @@ void ControllerBindingWidget::populateWidgets()
Ui::ControllerBindingWidget_Justifier ui;
ui.setupUi(m_bindings_widget);
bindBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/guncon-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/guncon-line.svg"_s);
image_widget = ui.image;
}
break;
case ControllerType::None:
{
m_icon = QIcon(":/icons/monochrome/svg/controller-strike-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/controller-strike-line.svg"_s);
}
break;
default:
{
createBindingWidgets(m_bindings_widget);
m_icon = QIcon(":/icons/monochrome/svg/controller-line.svg"_L1);
m_icon = QIcon(u":/icons/monochrome/svg/controller-line.svg"_s);
}
break;
}
@@ -562,7 +562,7 @@ void ControllerMacroWidget::createWidgets(ControllerBindingWidget* bwidget)
m_container->addWidget(m_macros[i]);
QListWidgetItem* item = new QListWidgetItem();
item->setIcon(QIcon(":/icons/monochrome/svg/flashlight-line.svg"_L1));
item->setIcon(QIcon(u":/icons/monochrome/svg/flashlight-line.svg"_s));
m_macroList->addItem(item);
updateListItem(i);
}
@@ -821,7 +821,7 @@ static void createSettingWidgets(SettingsInterface* const sif, QWidget* parent_w
if (std::abs(si.multiplier - 100.0f) < 0.01f)
{
sb->setDecimals(0);
sb->setSuffix("%"_L1);
sb->setSuffix(u"%"_s);
}
ControllerSettingWidgetBinder::BindWidgetToInputProfileNormalized(sif, sb, section, std::move(key_name),
@@ -973,7 +973,7 @@ ControllerCustomSettingsWidget::ControllerCustomSettingsWidget(ControllerBinding
QHBoxLayout* bottom_hlayout = new QHBoxLayout();
QPushButton* restore_defaults = new QPushButton(tr("Restore Default Settings"), swidget);
restore_defaults->setIcon(QIcon(":/icons/monochrome/svg/restart-line.svg"_L1));
restore_defaults->setIcon(QIcon(u":/icons/monochrome/svg/restart-line.svg"_s));
bottom_hlayout->addStretch(1);
bottom_hlayout->addWidget(restore_defaults);
swidget_layout->addLayout(bottom_hlayout, current_row++, 0, 1, 4);
@@ -223,7 +223,7 @@ void ControllerGlobalSettingsWidget::ledSettingsClicked()
QHBoxLayout* const heading_layout = new QHBoxLayout;
QLabel* const icon = new QLabel;
icon->setPixmap(QIcon(":/icons/monochrome/svg/lightbulb-line.svg"_L1).pixmap(32));
icon->setPixmap(QIcon(u":/icons/monochrome/svg/lightbulb-line.svg"_s).pixmap(32));
QLabel* const heading = new QLabel(
tr("<strong>Controller LED Settings</strong><br>\nThe \"alternate\" color is used when analog mode is active."));
heading->setWordWrap(true);
@@ -231,7 +231,7 @@ void ControllerSettingsWindow::onNewProfileClicked()
Error error;
if (!temp_si.Save(&error, Settings::GetSectionSaveOrder()))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to save the new preset to '%1':\n%2")
.arg(QString::fromStdString(temp_si.GetPath()))
.arg(QString::fromStdString(error.GetDescription())));
@@ -282,7 +282,7 @@ void ControllerSettingsWindow::onDeleteProfileClicked()
std::string profile_path(System::GetInputProfilePath(m_profile_name.toStdString()));
if (!FileSystem::DeleteFile(profile_path.c_str()))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to delete '%1'.").arg(QString::fromStdString(profile_path)));
return;
}
@@ -442,7 +442,7 @@ void ControllerSettingsWindow::createWidgets()
// global settings
QListWidgetItem* item = new QListWidgetItem();
item->setText(tr("Global Settings"));
item->setIcon(QIcon(":/icons/monochrome/svg/settings-3-line.svg"_L1));
item->setIcon(QIcon(u":/icons/monochrome/svg/settings-3-line.svg"_s));
m_ui.settingsCategory->addItem(item);
m_ui.settingsCategory->setCurrentRow(0);
m_global_settings = new ControllerGlobalSettingsWidget(m_ui.settingsContainer, this);
@@ -481,7 +481,7 @@ void ControllerSettingsWindow::createWidgets()
{
QListWidgetItem* item = new QListWidgetItem();
item->setText(tr("Hotkeys"));
item->setIcon(QIcon(":/icons/monochrome/svg/keyboard-line.svg"_L1));
item->setIcon(QIcon(u":/icons/monochrome/svg/keyboard-line.svg"_s));
m_ui.settingsCategory->addItem(item);
m_hotkey_settings = new HotkeySettingsWidget(m_ui.settingsContainer, this);
m_ui.settingsContainer->addWidget(m_hotkey_settings);
+1 -1
View File
@@ -20,7 +20,7 @@ using namespace Qt::StringLiterals;
CoverDownloadWindow::CoverDownloadWindow() : QWidget()
{
m_ui.setupUi(this);
m_ui.coverIcon->setPixmap(QIcon(":/icons/monochrome/svg/artboard-2-line.svg"_L1).pixmap(32));
m_ui.coverIcon->setPixmap(QIcon(u":/icons/monochrome/svg/artboard-2-line.svg"_s).pixmap(32));
updateEnabled();
connect(m_ui.start, &QPushButton::clicked, this, &CoverDownloadWindow::onStartClicked);
+2 -2
View File
@@ -39,8 +39,8 @@ DebuggerCodeView::DebuggerCodeView(QWidget* parent) : QAbstractScrollArea(parent
updateRowHeight();
// Load icons
m_pc_pixmap = QIcon(":/icons/debug-pc.png"_L1).pixmap(12);
m_breakpoint_pixmap = QIcon(":/icons/media-record.png"_L1).pixmap(12);
m_pc_pixmap = QIcon(u":/icons/debug-pc.png"_s).pixmap(12);
m_breakpoint_pixmap = QIcon(u":/icons/media-record.png"_s).pixmap(12);
// Connect scroll bar
connect(verticalScrollBar(), &QScrollBar::valueChanged, this, [this](int value) {
+4 -4
View File
@@ -300,10 +300,10 @@ void DebuggerWindow::onCodeViewContextMenuRequested(const QPoint& pt)
menu->addAction(QStringLiteral("0x%1").arg(static_cast<uint>(address), 8, 16, QChar('0')))->setEnabled(false);
menu->addSeparator();
menu->addAction(QIcon(":/icons/monochrome/svg/debug-toggle-breakpoint.svg"_L1), tr("Toggle &Breakpoint"),
menu->addAction(QIcon(u":/icons/monochrome/svg/debug-toggle-breakpoint.svg"_s), tr("Toggle &Breakpoint"),
[this, address]() { toggleBreakpoint(address); });
menu->addAction(QIcon(":/icons/monochrome/svg/debugger-go-to-cursor.svg"_L1), tr("&Run To Cursor"), [address]() {
menu->addAction(QIcon(u":/icons/monochrome/svg/debugger-go-to-cursor.svg"_s), tr("&Run To Cursor"), [address]() {
Host::RunOnCoreThread([address]() {
CPU::AddBreakpoint(CPU::BreakpointType::Execute, address, true, true);
g_core_thread->setSystemPaused(false);
@@ -311,10 +311,10 @@ void DebuggerWindow::onCodeViewContextMenuRequested(const QPoint& pt)
});
menu->addSeparator();
menu->addAction(QIcon(":/icons/monochrome/svg/debugger-go-to-address.svg"_L1), tr("View in &Dump"),
menu->addAction(QIcon(u":/icons/monochrome/svg/debugger-go-to-address.svg"_s), tr("View in &Dump"),
[this, address]() { scrollToMemoryAddress(address); });
menu->addAction(QIcon(":/icons/monochrome/svg/debug-trace-line.svg"_L1), tr("&Follow Load/Store"),
menu->addAction(QIcon(u":/icons/monochrome/svg/debug-trace-line.svg"_s), tr("&Follow Load/Store"),
[this, address]() { tryFollowLoadStore(address); });
menu->popup(m_ui.codeView->mapToGlobal(pt));
@@ -131,13 +131,13 @@ static void addDirectoryOption(SettingsWindow* dialog, QTableWidget* table, cons
layout->setContentsMargins(0, 0, 0, 0);
QLineEdit* value = new QLineEdit(container);
value->setObjectName("value"_L1);
value->setObjectName(u"value"_s);
SettingWidgetBinder::BindWidgetToStringSetting(dialog->getSettingsInterface(), value, std::move(section),
std::move(key));
layout->addWidget(value, 1);
QPushButton* browse = new QPushButton(container);
browse->setText("..."_L1);
browse->setText(u"..."_s);
browse->setMaximumWidth(32);
QObject::connect(browse, &QPushButton::clicked, browse, [browse, value, name]() {
const QString path(QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
@@ -154,7 +154,7 @@ static void setDirectoryOption(QTableWidget* table, int row, const char* value)
{
QWidget* widget = table->cellWidget(row, 1);
Assert(widget);
QLineEdit* valuew = widget->findChild<QLineEdit*>("value"_L1);
QLineEdit* valuew = widget->findChild<QLineEdit*>(u"value"_s);
Assert(valuew);
valuew->setText(QString::fromUtf8(value));
}
@@ -163,7 +163,7 @@ DebuggingSettingsWidget::DebuggingSettingsWidget(SettingsWindow* dialog, QWidget
: QWidget(parent), m_dialog(dialog)
{
m_ui.setupUi(this);
m_ui.icon->setSource(":/icons/monochrome/svg/error-warning-line.svg"_L1);
m_ui.icon->setSource(u":/icons/monochrome/svg/error-warning-line.svg"_s);
connect(m_ui.resetToDefaultButton, &QPushButton::clicked, this, &DebuggingSettingsWidget::onResetToDefaultClicked);
@@ -349,22 +349,22 @@ void GameCheatSettingsWidget::onCheatListContextMenuRequested(const QPoint& pos)
QMenu* const context_menu = QtUtils::NewPopupMenu(m_ui.cheatList);
context_menu->addAction(QIcon(":/icons/monochrome/svg/add-line.svg"_L1), tr("Add Cheat..."), this,
context_menu->addAction(QIcon(u":/icons/monochrome/svg/add-line.svg"_s), tr("Add Cheat..."), this,
&GameCheatSettingsWidget::newCode);
context_menu
->addAction(QIcon(":/icons/monochrome/svg/edit-box-line.svg"_L1), tr("Edit Cheat..."),
->addAction(QIcon(u":/icons/monochrome/svg/edit-box-line.svg"_s), tr("Edit Cheat..."),
[this, selected_code]() { editCode(selected_code); })
->setEnabled(selected != nullptr);
context_menu
->addAction(QIcon(":/icons/monochrome/svg/minus-line.svg"_L1), tr("Remove Cheat"),
->addAction(QIcon(u":/icons/monochrome/svg/minus-line.svg"_s), tr("Remove Cheat"),
[this, selected_code]() { removeCode(selected_code, true); })
->setEnabled(selected != nullptr);
context_menu->addSeparator();
context_menu->addAction(QIcon(":/icons/monochrome/svg/chat-off-line.svg"_L1), tr("Disable All Cheats"), this,
context_menu->addAction(QIcon(u":/icons/monochrome/svg/chat-off-line.svg"_s), tr("Disable All Cheats"), this,
&GameCheatSettingsWidget::disableAllCheats);
context_menu->addAction(QIcon(":/icons/monochrome/svg/refresh-line.svg"_L1), tr("Reload Cheats"), this,
context_menu->addAction(QIcon(u":/icons/monochrome/svg/refresh-line.svg"_s), tr("Reload Cheats"), this,
&GameCheatSettingsWidget::onReloadClicked);
context_menu->popup(m_ui.cheatList->mapToGlobal(pos));
@@ -602,7 +602,7 @@ void GameCheatSettingsWidget::importCodes(const std::string& file_contents)
if (!Cheats::ImportCodesFromString(&new_codes, file_contents, Cheats::FileFormat::Unknown, true, &error))
{
QtUtils::AsyncMessageBox(
this, QMessageBox::Critical, "Error"_L1,
this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to parse file:\n%1").arg(QString::fromStdString(error.GetDescription())));
return;
}
@@ -610,7 +610,7 @@ void GameCheatSettingsWidget::importCodes(const std::string& file_contents)
if (!Cheats::SaveCodesToFile(getPathForSavingCheats().c_str(), new_codes, &error))
{
QtUtils::AsyncMessageBox(
this, QMessageBox::Critical, "Error"_L1,
this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to save file:\n%1").arg(QString::fromStdString(error.GetDescription())));
}
@@ -78,7 +78,7 @@ void GameListSettingsWidget::refreshExclusionList()
for (const std::string& path : paths)
{
QListWidgetItem* const it = new QListWidgetItem(QString::fromStdString(path));
it->setIcon(QIcon(":/icons/monochrome/svg/file-forbid-line.svg"_L1));
it->setIcon(QIcon(u":/icons/monochrome/svg/file-forbid-line.svg"_s));
m_ui.excludedPaths->addItem(it);
}
@@ -89,7 +89,7 @@ void GameListSettingsWidget::addPathToTable(const std::string& path, bool recurs
{
QTreeWidgetItem* const item = new QTreeWidgetItem();
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setIcon(0, QIcon(recursive ? ":/icons/monochrome/svg/folder-open-line.svg"_L1 : ":/icons/monochrome/svg/folder-line.svg"_L1));
item->setIcon(0, QIcon(recursive ? u":/icons/monochrome/svg/folder-open-line.svg"_s : u":/icons/monochrome/svg/folder-line.svg"_s));
item->setText(0, QString::fromStdString(path));
item->setCheckState(1, recursive ? Qt::Checked : Qt::Unchecked);
m_ui.searchDirectoryList->addTopLevelItem(item);
@@ -149,7 +149,7 @@ void GameListSettingsWidget::onDirectoryListItemChanged(QTreeWidgetItem* item, i
const std::string path = item->text(0).toStdString();
const bool recursive = (item->checkState(1) == Qt::Checked);
item->setIcon(0, QIcon(recursive ? ":/icons/monochrome/svg/folder-open-line.svg"_L1 : ":/icons/monochrome/svg/folder-line.svg"_L1));
item->setIcon(0, QIcon(recursive ? u":/icons/monochrome/svg/folder-open-line.svg"_s : u":/icons/monochrome/svg/folder-line.svg"_s));
if (recursive)
{
@@ -174,10 +174,10 @@ void GameListSettingsWidget::onDirectoryListContextMenuRequested(const QPoint& p
const int row = selection[0].row();
QMenu* const menu = QtUtils::NewPopupMenu(this);
menu->addAction(QIcon(":/icons/monochrome/svg/folder-reduce-line.svg"_L1), tr("Remove"), this,
menu->addAction(QIcon(u":/icons/monochrome/svg/folder-reduce-line.svg"_s), tr("Remove"), this,
&GameListSettingsWidget::onRemoveSearchDirectoryButtonClicked);
menu->addSeparator();
menu->addAction(QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1), tr("Open Directory..."), [this, row]() {
menu->addAction(QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s), tr("Open Directory..."), [this, row]() {
const QTreeWidgetItem* const item = m_ui.searchDirectoryList->topLevelItem(row);
if (item)
QtUtils::OpenURL(this, QUrl::fromLocalFile(item->text(0)));
+1 -1
View File
@@ -1860,7 +1860,7 @@ GameListWidget::GameListWidget(QWidget* parent, QAction* action_view_list, QActi
Ui::EmptyGameListWidget empty_ui;
empty_ui.setupUi(m_empty_widget);
empty_ui.supportedFormats->setText(qApp->translate("GameListWidget", SUPPORTED_FORMATS_STRING));
empty_ui.icon->setSource(":/icons/monochrome/svg/information-line.svg"_L1);
empty_ui.icon->setSource(u":/icons/monochrome/svg/information-line.svg"_s);
m_ui.stack->insertWidget(2, m_empty_widget);
m_ui.viewGameList->setDefaultAction(action_view_list);
@@ -91,7 +91,7 @@ void GamePatchSettingsWidget::reloadList()
m_dialog->getSettingsInterface()->GetStringList(Cheats::PATCHES_CONFIG_SECTION, Cheats::PATCH_ENABLE_CONFIG_KEY);
QWidget* container = new QWidget(m_ui.scrollArea);
container->setObjectName("patches_container"_L1);
container->setObjectName(u"patches_container"_s);
QVBoxLayout* layout = new QVBoxLayout(container);
m_ui.scrollArea->setWidget(container);
+5 -5
View File
@@ -296,8 +296,8 @@ void GameSummaryWidget::populateUi(const GameList::Entry* entry)
m_ui.compatibilityComments->setEnabled(!m_compatibility_comments.isEmpty());
m_ui.inputProfile->addItem(QIcon(":/icons/monochrome/svg/global-line.svg"_L1), tr("Use Global Settings"));
m_ui.inputProfile->addItem(QIcon(":/icons/monochrome/svg/controller-digital-line.svg"_L1),
m_ui.inputProfile->addItem(QIcon(u":/icons/monochrome/svg/global-line.svg"_s), tr("Use Global Settings"));
m_ui.inputProfile->addItem(QIcon(u":/icons/monochrome/svg/controller-digital-line.svg"_s),
tr("Game Specific Configuration"));
for (const std::string& name : InputManager::GetInputProfileNames())
m_ui.inputProfile->addItem(QString::fromStdString(name));
@@ -327,7 +327,7 @@ void GameSummaryWidget::onChangeSerialClicked()
QDialog* const dialog = new QDialog(this);
Ui::EditGameSerialDialog dialog_ui;
dialog_ui.setupUi(dialog);
dialog_ui.icon->setPixmap(QIcon(":/icons/monochrome/svg/disc-line.svg"_L1).pixmap(32));
dialog_ui.icon->setPixmap(QIcon(u":/icons/monochrome/svg/disc-line.svg"_s).pixmap(32));
dialog_ui.path->setText(QString::fromStdString(m_path));
dialog_ui.serial->setText(QString::fromStdString(entry->serial));
dialog_ui.serial->setFocus();
@@ -480,8 +480,8 @@ void GameSummaryWidget::populateTracksInfo()
const CDImage::TrackMode mode = image->GetTrackMode(static_cast<u8>(track));
QTreeWidgetItem* row = new QTreeWidgetItem(m_ui.tracks);
row->setIcon(0, QIcon((mode == CDImage::TrackMode::Audio) ? ":/icons/monochrome/svg/file-music-line.svg"_L1 :
":/icons/monochrome/svg/disc-line.svg"_L1));
row->setIcon(0, QIcon((mode == CDImage::TrackMode::Audio) ? u":/icons/monochrome/svg/file-music-line.svg"_s :
u":/icons/monochrome/svg/disc-line.svg"_s));
row->setText(0, tr("Track %1").arg(track));
row->setText(1, QString::fromUtf8(track_mode_strings[static_cast<u32>(mode)]));
row->setText(2, MSFToString(position));
@@ -1151,7 +1151,7 @@ TextureReplacementSettingsDialog::TextureReplacementSettingsDialog(SettingsWindo
: QDialog(parent)
{
m_ui.setupUi(this);
m_ui.icon->setPixmap(QIcon(":/icons/monochrome/svg/image-fill.svg"_L1).pixmap(32));
m_ui.icon->setPixmap(QIcon(u":/icons/monochrome/svg/image-fill.svg"_s).pixmap(32));
constexpr Settings::TextureReplacementSettings::Configuration default_replacement_config;
SettingsInterface* const sif = settings_window->getSettingsInterface();
+1 -1
View File
@@ -520,7 +520,7 @@ void InputBindingWidget::showEffectBindingDialog()
QHBoxLayout* const heading_layout = new QHBoxLayout();
QLabel* const icon = new QLabel(&dlg);
icon->setPixmap(QIcon(":/icons/monochrome/svg/pushpin-line.svg"_L1).pixmap(32, 32));
icon->setPixmap(QIcon(u":/icons/monochrome/svg/pushpin-line.svg"_s).pixmap(32, 32));
QLabel* const heading =
new QLabel(tr("<strong>%1</strong><br>Select the device and effect to map this bind to.").arg(full_key), &dlg);
heading->setWordWrap(true);
+12 -12
View File
@@ -57,7 +57,7 @@ ISOBrowserWindow* ISOBrowserWindow::createAndOpenFile(QWidget* parent, const QSt
if (!ib->tryOpenFile(path, &error))
{
QtUtils::AsyncMessageBox(
parent, QMessageBox::Critical, "Error"_L1,
parent, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to open %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
delete ib;
return nullptr;
@@ -99,7 +99,7 @@ void ISOBrowserWindow::onOpenFileClicked()
if (!tryOpenFile(path, &error))
{
QtUtils::AsyncMessageBox(
this, QMessageBox::Critical, "Error"_L1,
this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to open %1:\n%2").arg(path).arg(QString::fromStdString(error.GetDescription())));
return;
}
@@ -165,16 +165,16 @@ void ISOBrowserWindow::onFileContextMenuRequested(const QPoint& pos)
const QString path = items.front()->data(0, Qt::UserRole).toString();
if (is_directory)
{
menu->addAction(QIcon(":/icons/monochrome/svg/file-line.svg"_L1), tr("&Open"),
menu->addAction(QIcon(u":/icons/monochrome/svg/file-line.svg"_s), tr("&Open"),
[this, path]() { populateFiles(path); });
}
else
{
menu->addAction(QIcon(":/icons/monochrome/svg/save-3-line.svg"_L1), tr("&Extract"),
menu->addAction(QIcon(u":/icons/monochrome/svg/save-3-line.svg"_s), tr("&Extract"),
[this, path]() { extractFile(path, IsoReader::ReadMode::Data); });
menu->addAction(QIcon(":/icons/monochrome/svg/save-3-line.svg"_L1), tr("Extract (&XA)"),
menu->addAction(QIcon(u":/icons/monochrome/svg/save-3-line.svg"_s), tr("Extract (&XA)"),
[this, path]() { extractFile(path, IsoReader::ReadMode::Mode2); });
menu->addAction(QIcon(":/icons/monochrome/svg/save-3-line.svg"_L1), tr("Extract (&Raw)"),
menu->addAction(QIcon(u":/icons/monochrome/svg/save-3-line.svg"_s), tr("Extract (&Raw)"),
[this, path]() { extractFile(path, IsoReader::ReadMode::Raw); });
}
@@ -219,7 +219,7 @@ void ISOBrowserWindow::extractFile(const QString& path, IsoReader::ReadMode mode
return [this, spath = std::move(spath), error = std::move(error), result]() mutable {
if (!result)
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to save %1:\n%2")
.arg(QtUtils::StringViewToQString(Path::GetFileName(spath)))
.arg(QString::fromStdString(error.GetDescription())));
@@ -274,7 +274,7 @@ void ISOBrowserWindow::populateDirectories()
enableExtractButtons(false);
QTreeWidgetItem* root = new QTreeWidgetItem;
root->setIcon(0, QIcon(":/icons/monochrome/svg/disc-line.svg"_L1));
root->setIcon(0, QIcon(u":/icons/monochrome/svg/disc-line.svg"_s));
root->setText(0, QtUtils::StringViewToQString(Path::GetFileTitle(m_image->GetPath())));
root->setData(0, Qt::UserRole, QString());
m_ui.directoryView->addTopLevelItem(root);
@@ -303,7 +303,7 @@ void ISOBrowserWindow::populateSubdirectories(std::string_view dir, QTreeWidgetI
continue;
QTreeWidgetItem* item = new QTreeWidgetItem(parent);
item->setIcon(0, QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1));
item->setIcon(0, QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s));
item->setText(0, QtUtils::StringViewToQString(Path::GetFileName(full_path)));
item->setData(0, Qt::UserRole, QString::fromStdString(full_path));
populateSubdirectories(full_path, item);
@@ -327,8 +327,8 @@ void ISOBrowserWindow::populateFiles(const QString& path)
const auto add_entry = [this](const std::string& full_path, const IsoReader::ISODirectoryEntry& entry) {
QTreeWidgetItem* item = new QTreeWidgetItem;
item->setIcon(0, QIcon(entry.IsDirectory() ? ":/icons/monochrome/svg/folder-open-line.svg"_L1 :
":/icons/monochrome/svg/file-line.svg"_L1));
item->setIcon(0, QIcon(entry.IsDirectory() ? u":/icons/monochrome/svg/folder-open-line.svg"_s :
u":/icons/monochrome/svg/file-line.svg"_s));
item->setText(0, QtUtils::StringViewToQString(Path::GetFileName(full_path)));
item->setData(0, Qt::UserRole, QString::fromStdString(full_path));
item->setData(0, Qt::UserRole + 1, entry.IsDirectory());
@@ -341,7 +341,7 @@ void ISOBrowserWindow::populateFiles(const QString& path)
if (!path.isEmpty())
{
QTreeWidgetItem* item = new QTreeWidgetItem;
item->setIcon(0, QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1));
item->setIcon(0, QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s));
item->setText(0, tr("<Parent Directory>"));
item->setData(0, Qt::UserRole, QtUtils::StringViewToQString(Path::GetDirectory(spath)));
item->setData(0, Qt::UserRole + 1, true);
+2 -2
View File
@@ -310,7 +310,7 @@ void LogWindow::updateWindowTitle()
void LogWindow::createUi()
{
setWindowIcon(QIcon(":/icons/monochrome/svg/file-list-line.svg"_L1));
setWindowIcon(QIcon(u":/icons/monochrome/svg/file-list-line.svg"_s));
setWindowFlag(Qt::CustomizeWindowHint, true);
setWindowFlag(Qt::WindowCloseButtonHint, false);
updateWindowTitle();
@@ -417,7 +417,7 @@ void LogWindow::onSaveTriggered()
QFile file(path);
if (!file.open(QFile::WriteOnly | QFile::Text))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1, "Failed to open file for writing."_L1);
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s, u"Failed to open file for writing."_s);
return;
}
+6 -6
View File
@@ -1935,18 +1935,18 @@ void MainWindow::setupAdditionalUi()
QActionGroup* const order_group = new QActionGroup(m_ui.menuSortBy);
QAction* const ascending_action = new QAction(tr("&Ascending"), order_group);
ascending_action->setIcon(QIcon(":/icons/monochrome/svg/sort-asc.svg"_L1));
ascending_action->setIcon(QIcon(u":/icons/monochrome/svg/sort-asc.svg"_s));
ascending_action->setCheckable(true);
ascending_action->setChecked(current_sort_order == Qt::AscendingOrder);
ascending_action->setObjectName("SortAscending"_L1);
ascending_action->setObjectName(u"SortAscending"_s);
m_ui.menuSortBy->addAction(ascending_action);
connect(ascending_action, &QAction::triggered, this, &MainWindow::onViewSortOrderActionTriggered);
QAction* const descending_action = new QAction(tr("&Descending"), order_group);
descending_action->setIcon(QIcon(":/icons/monochrome/svg/sort-desc.svg"_L1));
descending_action->setIcon(QIcon(u":/icons/monochrome/svg/sort-desc.svg"_s));
descending_action->setCheckable(true);
descending_action->setChecked(current_sort_order == Qt::DescendingOrder);
descending_action->setObjectName("SortDescending"_L1);
descending_action->setObjectName(u"SortDescending"_s);
m_ui.menuSortBy->addAction(descending_action);
connect(descending_action, &QAction::triggered, this, &MainWindow::onViewSortOrderActionTriggered);
}
@@ -1993,9 +1993,9 @@ void MainWindow::onGameListSortIndicatorOrderChanged(int column, Qt::SortOrder o
{
bool activate = false;
if (action->objectName() == "SortAscending"_L1)
if (action->objectName() == u"SortAscending"_s)
activate = (order == Qt::AscendingOrder);
else if (action->objectName() == "SortDescending"_L1)
else if (action->objectName() == u"SortDescending"_s)
activate = (order == Qt::DescendingOrder);
else
activate = (action->data() == column);
@@ -376,7 +376,7 @@ bool MemoryCardEditorWindow::loadCard(const QString& filename, Card* card)
if (!MemoryCardImage::LoadFromFile(&card->data, filename_str.c_str(), &error))
{
QtUtils::AsyncMessageBox(
this, QMessageBox::Critical, "Error"_L1,
this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to load memory card:\n%1").arg(QString::fromStdString(error.GetDescription())));
return false;
}
@@ -570,7 +570,7 @@ void MemoryCardEditorWindow::saveCard(Card* card)
if (!MemoryCardImage::SaveToFile(card->data, card->filename.c_str(), &error))
{
QtUtils::AsyncMessageBox(
this, QMessageBox::Critical, "Error"_L1,
this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to save memory card: %1").arg(QString::fromStdString(error.GetDescription())));
return;
}
@@ -629,7 +629,7 @@ void MemoryCardEditorWindow::doCopyFile()
std::vector<u8> buffer;
if (!MemoryCardImage::ReadFile(src->data, *fi, &buffer, &error))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to read file %1:\n%2")
.arg(QString::fromStdString(fi->filename))
.arg(QString::fromStdString(error.GetDescription())));
@@ -638,7 +638,7 @@ void MemoryCardEditorWindow::doCopyFile()
if (!MemoryCardImage::WriteFile(&dst->data, fi->filename, buffer, &error))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to write file %1:\n%2")
.arg(QString::fromStdString(fi->filename))
.arg(QString::fromStdString(error.GetDescription())));
@@ -660,7 +660,7 @@ void MemoryCardEditorWindow::doDeleteFile()
if (!MemoryCardImage::DeleteFile(&card->data, *fi, fi->deleted))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to delete file %1").arg(QString::fromStdString(fi->filename)));
return;
}
@@ -709,7 +709,7 @@ void MemoryCardEditorWindow::doExportSaveFile()
Error error;
if (!MemoryCardImage::ExportSave(&card->data, *fi, filename.toStdString().c_str(), &error))
{
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, "Error"_L1,
QtUtils::AsyncMessageBox(this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to export save file %1:\n%2")
.arg(QString::fromStdString(fi->filename))
.arg(QString::fromStdString(error.GetDescription())));
@@ -917,7 +917,7 @@ std::string MemoryCardRenameFileDialog::getNewName() const
void MemoryCardRenameFileDialog::setupAdditionalUi()
{
m_ui.icon->setPixmap(QIcon(":/icons/monochrome/svg/memcard-line.svg"_L1).pixmap(32));
m_ui.icon->setPixmap(QIcon(u":/icons/monochrome/svg/memcard-line.svg"_s).pixmap(32));
for (const auto& [region, prefix] : MEMORY_CARD_FILE_REGION_PREFIXES)
{
@@ -67,13 +67,13 @@ void MemoryCardSettingsWidget::createUi(SettingsWindow* dialog)
QLineEdit* const directory = new QLineEdit(box);
QPushButton* const browse = new QPushButton(box);
browse->setToolTip(tr("Browse..."));
browse->setIcon(QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1));
browse->setIcon(QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s));
QPushButton* const open = new QPushButton(box);
open->setToolTip(tr("Open..."));
open->setIcon(QIcon(":/icons/monochrome/svg/open-folder-line.svg"_L1));
open->setIcon(QIcon(u":/icons/monochrome/svg/open-folder-line.svg"_s));
QPushButton* const reset = new QPushButton(box);
reset->setToolTip(qApp->translate("QPlatformTheme", "Reset"));
reset->setIcon(QIcon(":/icons/monochrome/svg/delete-back-2-line.svg"_L1));
reset->setIcon(QIcon(u":/icons/monochrome/svg/delete-back-2-line.svg"_s));
hbox->addWidget(directory);
hbox->addWidget(browse);
hbox->addWidget(open);
@@ -95,13 +95,13 @@ void MemoryCardSettingsWidget::createUi(SettingsWindow* dialog)
QLineEdit* const directory = new QLineEdit(box);
QPushButton* const browse = new QPushButton(box);
browse->setToolTip(tr("Browse..."));
browse->setIcon(QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1));
browse->setIcon(QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s));
QPushButton* const open = new QPushButton(box);
open->setToolTip(tr("Open..."));
open->setIcon(QIcon(":/icons/monochrome/svg/open-folder-line.svg"_L1));
open->setIcon(QIcon(u":/icons/monochrome/svg/open-folder-line.svg"_s));
QPushButton* const reset = new QPushButton(box);
reset->setToolTip(qApp->translate("QPlatformTheme", "Reset"));
reset->setIcon(QIcon(":/icons/monochrome/svg/delete-back-2-line.svg"_L1));
reset->setIcon(QIcon(u":/icons/monochrome/svg/delete-back-2-line.svg"_s));
hbox->addWidget(directory);
hbox->addWidget(browse);
hbox->addWidget(open);
@@ -186,14 +186,14 @@ void MemoryCardSettingsWidget::createPortSettingsUi(SettingsWindow* dialog, int
memory_card_layout->addWidget(ui->memory_card_path);
ui->memory_card_path_browse = new QPushButton(ui->container);
ui->memory_card_path_browse->setIcon(QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1));
ui->memory_card_path_browse->setIcon(QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s));
ui->memory_card_path_browse->setToolTip(tr("Browse..."));
connect(ui->memory_card_path_browse, &QPushButton::clicked, this,
[this, index]() { onBrowseMemoryCardPathClicked(index); });
memory_card_layout->addWidget(ui->memory_card_path_browse);
ui->memory_card_path_reset = new QPushButton(ui->container);
ui->memory_card_path_reset->setIcon(QIcon(":/icons/monochrome/svg/delete-back-2-line.svg"_L1));
ui->memory_card_path_reset->setIcon(QIcon(u":/icons/monochrome/svg/delete-back-2-line.svg"_s));
ui->memory_card_path_reset->setToolTip(qApp->translate("QPlatformTheme", "Reset"));
connect(ui->memory_card_path_reset, &QPushButton::clicked, this,
[this, index]() { onResetMemoryCardPathClicked(index); });
@@ -203,7 +203,7 @@ void PostProcessingChainConfigWidget::onAddButtonClicked()
if (!PostProcessing::Config::AddStage(si, m_section, selected_shader, &error))
{
QtUtils::AsyncMessageBox(
this, QMessageBox::Critical, "Error"_L1,
this, QMessageBox::Critical, u"Error"_s,
QStringLiteral("Failed to add shader: %1").arg(QString::fromStdString(error.GetDescription())));
return;
}
@@ -669,7 +669,7 @@ PostProcessingSelectShaderDialog::PostProcessingSelectShaderDialog(QWidget* pare
{
m_ui.setupUi(this);
m_ui.searchIcon->setPixmap(QIcon(":/icons/monochrome/svg/mag-line.svg"_L1).pixmap(16));
m_ui.searchIcon->setPixmap(QIcon(u":/icons/monochrome/svg/mag-line.svg"_s).pixmap(16));
m_ui.filterGroup->setId(m_ui.filterGLSL, static_cast<int>(PostProcessing::ShaderType::GLSL));
m_ui.filterGroup->setId(m_ui.filterReshade, static_cast<int>(PostProcessing::ShaderType::Reshade));
@@ -725,7 +725,7 @@ QTreeWidgetItem* PostProcessingSelectShaderDialog::createTreeItem(const QString&
item->setText(0, display_name.mid(pos + 1));
if (is_directory)
{
item->setIcon(0, QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1));
item->setIcon(0, QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s));
item->setExpanded(true);
}
@@ -771,11 +771,11 @@ QIcon PostProcessingSelectShaderDialog::shaderIconFromType(const PostProcessing:
switch (type)
{
case PostProcessing::ShaderType::GLSL:
return QIcon(":/icons/monochrome/svg/shader-glsl.svg"_L1);
return QIcon(u":/icons/monochrome/svg/shader-glsl.svg"_s);
case PostProcessing::ShaderType::Reshade:
return QIcon(":/icons/monochrome/svg/shader-reshade.svg"_L1);
return QIcon(u":/icons/monochrome/svg/shader-reshade.svg"_s);
case PostProcessing::ShaderType::Slang:
return QIcon(":/icons/monochrome/svg/shader-slang.svg"_L1);
return QIcon(u":/icons/monochrome/svg/shader-slang.svg"_s);
default:
return QIcon();
}
+21 -21
View File
@@ -257,11 +257,11 @@ bool QtHost::EarlyProcessStartup()
// Set application details.
// This is critical for Linux to show the correct application name in the task switcher, since it appears
// to uses the application name to search for desktop files with the corresponding StartupWMClass.
QApplication::setApplicationName("duckstation-qt"_L1);
QApplication::setApplicationName(u"duckstation-qt"_s);
QApplication::setApplicationVersion(QString::fromUtf8(g_scm_version_str));
QApplication::setOrganizationName("Stenzek"_L1);
QApplication::setOrganizationDomain("duckstation.org"_L1);
QApplication::setDesktopFileName("org.duckstation.DuckStation"_L1);
QApplication::setOrganizationName(u"Stenzek"_s);
QApplication::setOrganizationDomain(u"duckstation.org"_s);
QApplication::setDesktopFileName(u"org.duckstation.DuckStation"_s);
Error error;
if (!Core::ProcessStartup(&error)) [[unlikely]]
@@ -273,9 +273,9 @@ bool QtHost::EarlyProcessStartup()
// allow us to override standard qt icons as well
QStringList icon_theme_search_paths = QIcon::themeSearchPaths();
if (!icon_theme_search_paths.contains(":/icons"_L1))
icon_theme_search_paths.emplace_back(":/icons"_L1);
icon_theme_search_paths.emplace_back(":/standard-icons"_L1);
if (!icon_theme_search_paths.contains(u":/icons"_s))
icon_theme_search_paths.emplace_back(u":/icons"_s);
icon_theme_search_paths.emplace_back(u":/standard-icons"_s);
QIcon::setThemeSearchPaths(icon_theme_search_paths);
QIcon::setThemeName("monochrome");
return true;
@@ -537,7 +537,7 @@ void QtHost::CheckDesktopFile()
desktop_file_path = fmt::format("{}/.local/share/{}", home, DESKTOP_FILE_NAME);
}
const auto msgbox_title = "DuckStation"_L1;
const auto msgbox_title = u"DuckStation"_s;
if (!FileSystem::FileExists(desktop_file_path.c_str()))
{
@@ -608,7 +608,7 @@ void QtHost::CheckDesktopFile()
INFO_LOG("Desktop file path mismatch: current='{}', existing='{}'", application_path, normalized_existing);
const QMessageBox::StandardButton result = QMessageBox::question(
g_main_window, "DuckStation"_L1,
g_main_window, u"DuckStation"_s,
qApp
->translate("QtHost", "The existing launcher shortcut points to a different location:\n\n"
"Current: %1\n"
@@ -802,9 +802,9 @@ bool QtHost::InitializeFoldersAndConfig(Error* error)
if (!Core::InitializeBaseSettingsLayer(Core::GetBaseSettingsPath(), &config_error))
{
if (QMessageBox::question(
nullptr, "DuckStation"_L1,
"Failed to load configuration. The error was:\n\n%1\n\nThe settings file may be corrupted. Do you want to "
"delete the settings file and try again? Note that any currently-configured settings will be lost."_L1.arg(
nullptr, u"DuckStation"_s,
u"Failed to load configuration. The error was:\n\n%1\n\nThe settings file may be corrupted. Do you want to "
"delete the settings file and try again? Note that any currently-configured settings will be lost."_s.arg(
QString::fromStdString(config_error.GetDescription()))) == QMessageBox::Yes)
{
if (!FileSystem::DeleteFile(Core::GetBaseSettingsPath().c_str(), &config_error))
@@ -915,12 +915,12 @@ void QtHost::ApplyMigrations()
if (!FileSystem::IsDirectoryEmpty(achievement_icons_directory.c_str()))
{
QMessageBox mb(
QMessageBox::Question, "DuckStation"_L1,
"DuckStation has migrated to using an archive for caching achievement icons, which is significantly more "
QMessageBox::Question, u"DuckStation"_s,
u"DuckStation has migrated to using an archive for caching achievement icons, which is significantly more "
"efficient and does not create thousands of files.\n\n"
"The old directory of achievement icons is no longer needed and can be deleted.\n\n"
"Do you want to delete the old achievement icons cache now?"
"\n\nNo save data or achievement progress will be lost."_L1,
"\n\nNo save data or achievement progress will be lost."_s,
QMessageBox::Yes | QMessageBox::No);
mb.setWindowIcon(GetAppIcon());
if (mb.exec() == QMessageBox::Yes)
@@ -928,7 +928,7 @@ void QtHost::ApplyMigrations()
Error error;
if (!FileSystem::RecursiveDeleteDirectory(achievement_icons_directory.c_str(), &error))
{
QMessageBox::critical(nullptr, "Error"_L1,
QMessageBox::critical(nullptr, u"Error"_s,
QString::fromStdString(fmt::format(
"Failed to delete old achievement icons directory: {}", error.GetDescription())));
}
@@ -2793,11 +2793,11 @@ InputDeviceListModel::~InputDeviceListModel() = default;
QIcon InputDeviceListModel::getIconForKey(const InputBindingKey& key)
{
if (key.source_type == InputSourceType::Keyboard)
return QIcon(":/icons/monochrome/svg/keyboard-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/keyboard-line.svg"_s);
else if (key.source_type == InputSourceType::Pointer)
return QIcon(":/icons/monochrome/svg/mouse-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/mouse-line.svg"_s);
else
return QIcon(":/icons/monochrome/svg/controller-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/controller-line.svg"_s);
}
QString InputDeviceListModel::getDeviceName(const InputBindingKey& key)
@@ -3532,7 +3532,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
}
else if (args[i][0] == QChar('-'))
{
QMessageBox::critical(nullptr, "DuckStation"_L1, QString("Unknown parameter: %1"_L1).arg(args[i]));
QMessageBox::critical(nullptr, u"DuckStation"_s, u"Unknown parameter: %1"_s.arg(args[i]));
return false;
}
@@ -3550,7 +3550,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
if (!InitializeFoldersAndConfig(&error) || !LoadResources(&error))
{
// NOTE: No point translating this, because no config means the language won't be loaded anyway.
QMessageBox::critical(nullptr, "DuckStation"_L1, QString::fromStdString(error.GetDescription()));
QMessageBox::critical(nullptr, u"DuckStation"_s, QString::fromStdString(error.GetDescription()));
return false;
}
+4 -4
View File
@@ -242,7 +242,7 @@ bool QtHost::LoadStyledFusionTheme(std::string_view name)
}
SetThemeAttributes(true, false, is_dark); // is_dark parsed from PALETTE block
qApp->setStyle(QStyleFactory::create("Fusion"_L1));
qApp->setStyle(QStyleFactory::create(u"Fusion"_s));
qApp->setPalette(palette);
if (ShouldDisableStyleSheet())
SetStyleSheet(QString());
@@ -275,21 +275,21 @@ void QtHost::SetStyleFromSettings()
qApp->setStyle(s_themes_locals.unthemed_style_name);
qApp->setPalette(s_themes_locals.unthemed_palette);
QFile f(":qdarkstyle/style.qss"_L1);
QFile f(u":qdarkstyle/style.qss"_s);
if (f.open(QFile::ReadOnly | QFile::Text))
SetStyleSheet(f.readAll());
}
else if (theme == "fusion")
{
SetThemeAttributes(false, true, false);
qApp->setStyle(QStyleFactory::create("Fusion"_L1));
qApp->setStyle(QStyleFactory::create(u"Fusion"_s));
qApp->setPalette(s_themes_locals.unthemed_palette);
}
#ifdef _WIN32
else if (theme == "windowsvista")
{
SetThemeAttributes(false, false, false);
qApp->setStyle(QStyleFactory::create("windowsvista"_L1));
qApp->setStyle(QStyleFactory::create(u"windowsvista"_s));
qApp->setPalette(s_themes_locals.unthemed_palette);
}
#endif
+10 -10
View File
@@ -186,7 +186,7 @@ void QtUtils::OpenURL(QWidget* parent, const QUrl& qurl)
{
if (!QDesktopServices::openUrl(qurl))
{
QtUtils::AsyncMessageBox(parent, QMessageBox::Critical, "Failed to open URL"_L1,
QtUtils::AsyncMessageBox(parent, QMessageBox::Critical, u"Failed to open URL"_s,
QStringLiteral("Failed to open URL.\n\nThe URL was: %1").arg(qurl.toString()));
}
}
@@ -489,10 +489,10 @@ QIcon QtUtils::GetIconForRegion(ConsoleRegion region)
return QIcon(QtHost::GetResourceQPath("images/flags/PAL.svg", true));
case ConsoleRegion::Auto:
return QIcon(":/icons/system-search.png"_L1);
return QIcon(u":/icons/system-search.png"_s);
default:
return QIcon(":/icons/monochrome/svg/file-unknow-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/file-unknow-line.svg"_s);
}
}
@@ -512,7 +512,7 @@ QIcon QtUtils::GetIconForRegion(DiscRegion region)
case DiscRegion::Other:
case DiscRegion::NonPS1:
default:
return QIcon(":/icons/monochrome/svg/file-unknow-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/file-unknow-line.svg"_s);
}
}
@@ -521,16 +521,16 @@ QIcon QtUtils::GetIconForEntryType(GameList::EntryType type)
switch (type)
{
case GameList::EntryType::Disc:
return QIcon(":/icons/monochrome/svg/disc-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/disc-line.svg"_s);
case GameList::EntryType::Playlist:
return QIcon(":/icons/monochrome/svg/play-list-2-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/play-list-2-line.svg"_s);
case GameList::EntryType::DiscSet:
return QIcon(":/icons/monochrome/svg/multi-discs.svg"_L1);
return QIcon(u":/icons/monochrome/svg/multi-discs.svg"_s);
case GameList::EntryType::PSF:
return QIcon(":/icons/monochrome/svg/file-music-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/file-music-line.svg"_s);
case GameList::EntryType::PSExe:
default:
return QIcon(":/icons/monochrome/svg/settings-3-line.svg"_L1);
return QIcon(u":/icons/monochrome/svg/settings-3-line.svg"_s);
}
}
@@ -736,7 +736,7 @@ void QtUtils::SetIsMaskForMonochromeMenuBarActionIcons(QMenu* const menu)
// Skip icons that aren't monochrome.
const QString icon_name = icon.name();
if (!icon_name.startsWith(":/icons/monochrome/"_L1))
if (!icon_name.startsWith(u":/icons/monochrome/"_s))
continue;
// Annoyingly this creates a new icon, we can't modify the existing icon.
+1 -1
View File
@@ -288,7 +288,7 @@ bool Host::SetScreensaverInhibit(bool inhibit, Error* error)
if (inhibit)
{
const QDBusReply<quint32> msg = s_window_info_locals.screensaver_inhibit_interface->call(
"Inhibit", "DuckStation"_L1, "DuckStation VM is running."_L1);
"Inhibit", u"DuckStation"_s, u"DuckStation VM is running."_s);
if (!msg.isValid())
{
FormatQDBusReplyError(error, "Inhibit message call failed: ", msg.error());
+18 -18
View File
@@ -66,7 +66,7 @@ SettingsWindow::SettingsWindow(const GameList::Entry* entry, std::unique_ptr<INI
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
addWidget(m_game_summary = new GameSummaryWidget(entry, this, m_ui.settingsContainer), tr("Summary"),
":/icons/monochrome/svg/file-list-line.svg"_L1,
u":/icons/monochrome/svg/file-list-line.svg"_s,
tr("<strong>Summary</strong><hr>This page shows information about the selected game, and allows you to "
"validate your disc was dumped correctly."));
addPages();
@@ -93,7 +93,7 @@ void SettingsWindow::addPages()
{
addWidget(
new InterfaceSettingsWidget(this, m_ui.settingsContainer), tr("Interface"),
":/icons/monochrome/svg/settings-3-line.svg"_L1,
u":/icons/monochrome/svg/settings-3-line.svg"_s,
tr("<strong>Interface Settings</strong><hr>These options control how the emulator looks and "
"behaves.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
@@ -101,36 +101,36 @@ void SettingsWindow::addPages()
{
addWidget(
m_game_list_settings = new GameListSettingsWidget(this, m_ui.settingsContainer), tr("Game List"),
":/icons/monochrome/svg/folder-open-line.svg"_L1,
u":/icons/monochrome/svg/folder-open-line.svg"_s,
tr("<strong>Game List Settings</strong><hr>The list above shows the directories which will be searched by "
"DuckStation to populate the game list. Search directories can be added, removed, and switched to "
"recursive/non-recursive."));
}
addWidget(new BIOSSettingsWidget(this, m_ui.settingsContainer), tr("BIOS"), ":/icons/monochrome/svg/chip-line.svg"_L1,
addWidget(new BIOSSettingsWidget(this, m_ui.settingsContainer), tr("BIOS"), u":/icons/monochrome/svg/chip-line.svg"_s,
tr("<strong>BIOS Settings</strong><hr>These options control which BIOS and expansion port is "
"used.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
addWidget(
new ConsoleSettingsWidget(this, m_ui.settingsContainer), tr("Console"),
":/icons/monochrome/svg/emulation-line.svg"_L1,
u":/icons/monochrome/svg/emulation-line.svg"_s,
tr("<strong>Console Settings</strong><hr>These options determine the configuration of the simulated "
"console.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
addWidget(
new EmulationSettingsWidget(this, m_ui.settingsContainer), tr("Emulation"),
":/icons/monochrome/svg/chip-2-line.svg"_L1,
u":/icons/monochrome/svg/chip-2-line.svg"_s,
tr("<strong>Emulation Settings</strong><hr>These options determine the speed and runahead behavior of the "
"system.<br><br>Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
if (isPerGameSettings())
{
addWidget(new GamePatchSettingsWidget(this, m_ui.settingsContainer), tr("Patches"),
":/icons/monochrome/svg/sparkling-line.svg"_L1,
u":/icons/monochrome/svg/sparkling-line.svg"_s,
tr("<strong>Patches</strong><hr>This section allows you to select optional patches to apply to the game, "
"which may provide performance, visual, or gameplay improvements. Activating game patches can cause "
"unpredictable behavior, crashing, soft-locks, or broken saved games. Use patches at your own risk, "
"no support will be provided to users who have enabled game patches."));
addWidget(new GameCheatSettingsWidget(this, m_ui.settingsContainer), tr("Cheats"),
":/icons/monochrome/svg/cheats-line.svg"_L1,
u":/icons/monochrome/svg/cheats-line.svg"_s,
tr("<strong>Cheats</strong><hr>This section allows you to select which cheats you wish to enable. "
"<strong>Using cheats can have unpredictable effects on games, causing crashes, graphical glitches, "
"and corrupted saves.</strong> Cheats also persist through save states even after being disabled, "
@@ -139,34 +139,34 @@ void SettingsWindow::addPages()
addWidget(
new MemoryCardSettingsWidget(this, m_ui.settingsContainer), tr("Memory Cards"),
":/icons/monochrome/svg/memcard-line.svg"_L1,
u":/icons/monochrome/svg/memcard-line.svg"_s,
tr("<strong>Memory Card Settings</strong><hr>This page lets you control what mode the memory card emulation will "
"function in, and where the images for these cards will be stored on disk."));
GraphicsSettingsWidget* graphics_settings;
addWidget(graphics_settings = new GraphicsSettingsWidget(this, m_ui.settingsContainer), tr("Graphics"),
":/icons/monochrome/svg/image-fill.svg"_L1,
u":/icons/monochrome/svg/image-fill.svg"_s,
tr("<strong>Graphics Settings</strong><hr>These options control how the graphics of the emulated console "
"are rendered. Not all options are available for the software renderer. Mouse over each option for "
"additional information, and Shift+Wheel to scroll this panel."));
//: Translators may want to shorten On-Screen Display to "OSD".
addWidget(new OSDSettingsWidget(this, m_ui.settingsContainer), tr("On-Screen Display"),
":/icons/monochrome/svg/numbers-fill.svg"_L1,
u":/icons/monochrome/svg/numbers-fill.svg"_s,
tr("<strong>On-Screen Display Settings</strong><hr>These options determine the behavior of the messages "
"that are displayed while content is running."));
addWidget(
new PostProcessingSettingsWidget(this, m_ui.settingsContainer), tr("Post-Processing"),
":/icons/monochrome/svg/sun-fill.svg"_L1,
u":/icons/monochrome/svg/sun-fill.svg"_s,
tr("<strong>Post-Processing Settings</strong><hr>Post processing allows you to alter the appearance of the image "
"displayed on the screen with various filters. Shaders will be executed in sequence. Additional shaders can be "
"downloaded from <a href=\"%1\">%1</a>.")
.arg("https://github.com/stenzek/emu-shaders"));
addWidget(
new AudioSettingsWidget(this, m_ui.settingsContainer), tr("Audio"), ":/icons/monochrome/svg/volume-up-line.svg"_L1,
new AudioSettingsWidget(this, m_ui.settingsContainer), tr("Audio"), u":/icons/monochrome/svg/volume-up-line.svg"_s,
tr("<strong>Audio Settings</strong><hr>These options control the audio output of the console. Mouse over an option "
"for additional information."));
addWidget(
new AchievementSettingsWidget(this, m_ui.settingsContainer), tr("Achievements"),
":/icons/monochrome/svg/trophy-line.svg"_L1,
u":/icons/monochrome/svg/trophy-line.svg"_s,
tr("<strong>Achievement Settings</strong><hr>DuckStation uses RetroAchievements as an achievement database and "
"for tracking progress. To use achievements, please sign up for an account at <a href=\"%1\">%1</a>. To view "
"the achievement list in-game, press the hotkey for <strong>Open Pause Menu</strong> and select "
@@ -174,14 +174,14 @@ void SettingsWindow::addPages()
"Shift+Wheel to scroll this panel.")
.arg("https://retroachievements.org/"));
addWidget(new CaptureSettingsWidget(this, m_ui.settingsContainer), tr("Capture"),
":/icons/monochrome/svg/vidicon-line.svg"_L1,
u":/icons/monochrome/svg/vidicon-line.svg"_s,
tr("<strong>Capture Settings</strong><hr>These options determine how screenshots and videos are captured "
"by the application."));
if (!isPerGameSettings())
{
addWidget(new AdvancedSettingsWidget(this, m_ui.settingsContainer), tr("Advanced"),
":/icons/monochrome/svg/alert-line.svg"_L1,
u":/icons/monochrome/svg/alert-line.svg"_s,
tr("<strong>Advanced Settings</strong><hr>These options control logging and internal behavior of the "
"emulator. Mouse over an option for additional information, and Shift+Wheel to scroll this panel."));
}
@@ -190,7 +190,7 @@ void SettingsWindow::addPages()
{
addWidget(
new DebuggingSettingsWidget(this, m_ui.settingsContainer), tr("Debugging"),
":/icons/monochrome/svg/code-line.svg"_L1,
u":/icons/monochrome/svg/code-line.svg"_s,
tr("<strong>Debugging Settings</strong><hr>These options control internal behavior of the emulator. You should "
"not modify anything on this page without a good reason to do so."));
}
@@ -275,7 +275,7 @@ void SettingsWindow::connectUi()
}
}
void SettingsWindow::addWidget(QWidget* widget, QString title, QLatin1StringView icon, QString help_text)
void SettingsWindow::addWidget(QWidget* widget, QString title, QString icon, QString help_text)
{
const int index = m_ui.settingsCategory->count();
+1 -1
View File
@@ -108,7 +108,7 @@ private:
void addPages();
void reloadPages();
void addWidget(QWidget* widget, QString title, QLatin1StringView icon, QString help_text);
void addWidget(QWidget* widget, QString title, QString icon, QString help_text);
bool handleWheelEvent(QWheelEvent* event);
void onCategoryCurrentRowChanged(int row);
+5 -5
View File
@@ -82,7 +82,7 @@ template<>
struct SettingAccessor<QLineEdit>
{
static bool getBoolValue(const QLineEdit* widget) { return widget->text().toInt() != 0; }
static void setBoolValue(QLineEdit* widget, bool value) { widget->setText(value ? "1"_L1 : "0"_L1); }
static void setBoolValue(QLineEdit* widget, bool value) { widget->setText(value ? u"1"_s : u"0"_s); }
static void makeNullableBool(QLineEdit* widget, bool globalValue) { widget->setEnabled(false); }
static std::optional<bool> getNullableBoolValue(const QLineEdit* widget) { return getBoolValue(widget); }
static void setNullableBoolValue(QLineEdit* widget, std::optional<bool> value)
@@ -268,14 +268,14 @@ struct SettingAccessor<QCheckBox>
Qt::PartiallyChecked);
}
static QString getStringValue(const QCheckBox* widget) { return widget->isChecked() ? "1"_L1 : "0"_L1; }
static QString getStringValue(const QCheckBox* widget) { return widget->isChecked() ? u"1"_s : u"0"_s; }
static void setStringValue(QCheckBox* widget, const QString& value) { widget->setChecked(value.toInt() != 0); }
static void makeNullableString(QCheckBox* widget, const QString& globalValue) { widget->setTristate(true); }
static std::optional<QString> getNullableStringValue(const QCheckBox* widget)
{
return (widget->checkState() == Qt::PartiallyChecked) ?
std::nullopt :
std::optional<QString>(widget->isChecked() ? "1"_L1 : "0"_L1);
std::optional<QString>(widget->isChecked() ? u"1"_s : u"0"_s);
}
static void setNullableStringValue(QCheckBox* widget, std::optional<QString> value)
{
@@ -416,7 +416,7 @@ struct SettingAccessor<QSpinBox>
static void updateFont(QSpinBox* widget, bool isNull)
{
// We should be able to use QFont here.. but it doesn't update on change.
widget->setStyleSheet(isNull ? QString("font-style: italic;"_L1) : QString());
widget->setStyleSheet(isNull ? u"font-style: italic;"_s : QString());
widget->setPrefix(isNull ? qApp->translate("SettingWidgetBinder", "Default: ") : QString());
}
@@ -708,7 +708,7 @@ struct SettingAccessor<QAction>
setFloatValue(widget, value.value_or(0.0f));
}
static QString getStringValue(const QAction* widget) { return widget->isChecked() ? "1"_L1 : "0"_L1; }
static QString getStringValue(const QAction* widget) { return widget->isChecked() ? u"1"_s : u"0"_s; }
static void setStringValue(QAction* widget, const QString& value) { widget->setChecked(value.toInt() != 0); }
static void makeNullableString(QAction* widget, const QString& globalValue) { widget->setEnabled(false); }
static std::optional<QString> getNullableStringValue(const QAction* widget) { return getStringValue(widget); }
+6 -6
View File
@@ -259,10 +259,10 @@ void SetupWizardDialog::onDirectoryListContextMenuRequested(const QPoint& point)
const int row = selection[0].row();
QMenu* const menu = QtUtils::NewPopupMenu(this);
menu->addAction(QIcon(":/icons/monochrome/svg/folder-reduce-line.svg"_L1), tr("Remove"), this,
menu->addAction(QIcon(u":/icons/monochrome/svg/folder-reduce-line.svg"_s), tr("Remove"), this,
&SetupWizardDialog::onRemoveSearchDirectoryButtonClicked);
menu->addSeparator();
menu->addAction(QIcon(":/icons/monochrome/svg/folder-open-line.svg"_L1), tr("Open Directory..."), [this, row]() {
menu->addAction(QIcon(u":/icons/monochrome/svg/folder-open-line.svg"_s), tr("Open Directory..."), [this, row]() {
const QTreeWidgetItem* const item = m_ui.searchDirectoryList->topLevelItem(row);
if (item)
QtUtils::OpenURL(this, QUrl::fromLocalFile(item->text(0)));
@@ -327,8 +327,8 @@ void SetupWizardDialog::onSearchDirectoryListItemChanged(QTreeWidgetItem* item,
const std::string path = item->text(0).toStdString();
const bool recursive = (item->checkState(1) == Qt::Checked);
item->setIcon(0, QIcon(recursive ? ":/icons/monochrome/svg/folder-open-line.svg"_L1 :
":/icons/monochrome/svg/folder-line.svg"_L1));
item->setIcon(0, QIcon(recursive ? u":/icons/monochrome/svg/folder-open-line.svg"_s :
u":/icons/monochrome/svg/folder-line.svg"_s));
if (recursive)
{
@@ -348,8 +348,8 @@ void SetupWizardDialog::addPathToTable(const std::string& path, bool recursive)
{
QTreeWidgetItem* const item = new QTreeWidgetItem();
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setIcon(0, QIcon(recursive ? ":/icons/monochrome/svg/folder-open-line.svg"_L1 :
":/icons/monochrome/svg/folder-line.svg"_L1));
item->setIcon(0, QIcon(recursive ? u":/icons/monochrome/svg/folder-open-line.svg"_s :
u":/icons/monochrome/svg/folder-line.svg"_s));
item->setText(0, QString::fromStdString(path));
item->setCheckState(1, recursive ? Qt::Checked : Qt::Unchecked);
m_ui.searchDirectoryList->addTopLevelItem(item);