Replace QLatin1String with operator _L1

This commit is contained in:
Jonas Kvinge
2024-09-07 04:24:14 +02:00
parent e3e6a22172
commit 4270b12cd1
185 changed files with 2429 additions and 2139 deletions

View File

@@ -46,6 +46,8 @@
#include "behavioursettingspage.h"
#include "ui_behavioursettingspage.h"
using namespace Qt::StringLiterals;
class SettingsDialog;
const char *BehaviourSettingsPage::kSettingsGroup = "Behaviour";
@@ -95,9 +97,9 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog, QWidget *pa
QString code = re_match.captured(1);
QString lookup_code = QString(code)
.replace(QLatin1String("@latin"), QLatin1String("_Latn"))
.replace(QLatin1String("_CN"), QLatin1String("_Hans_CN"))
.replace(QLatin1String("_TW"), QLatin1String("_Hant_TW"));
.replace("@latin"_L1, "_Latn"_L1)
.replace("_CN"_L1, "_Hans_CN"_L1)
.replace("_TW"_L1, "_Hant_TW"_L1);
QString language_name = QLocale::languageToString(QLocale(lookup_code).language());
QString native_name = QLocale(lookup_code).nativeLanguageName();

View File

@@ -158,7 +158,7 @@ void CollectionSettingsPage::Load() {
ui_->expire_unavailable_songs_days->setValue(s.value("expire_unavailable_songs", 60).toInt());
QStringList filters = s.value("cover_art_patterns", QStringList() << QStringLiteral("front") << QStringLiteral("cover")).toStringList();
ui_->cover_art_patterns->setText(filters.join(QLatin1Char(',')));
ui_->cover_art_patterns->setText(filters.join(u','));
ui_->spinbox_cache_size->setValue(s.value(kSettingsCacheSize, kSettingsCacheSizeDefault).toInt());
ui_->combobox_cache_size->setCurrentIndex(ui_->combobox_cache_size->findData(s.value(kSettingsCacheSizeUnit, static_cast<int>(CacheSizeUnit::MB)).toInt()));
@@ -203,7 +203,7 @@ void CollectionSettingsPage::Save() {
QString filter_text = ui_->cover_art_patterns->text();
const QStringList filters = filter_text.split(QLatin1Char(','), Qt::SkipEmptyParts);
const QStringList filters = filter_text.split(u',', Qt::SkipEmptyParts);
s.setValue("cover_art_patterns", filters);

View File

@@ -46,6 +46,8 @@
#include "covermanager/coverprovider.h"
#include "widgets/loginstatewidget.h"
using namespace Qt::StringLiterals;
const char *CoversSettingsPage::kSettingsGroup = "Covers";
const char *CoversSettingsPage::kProviders = "providers";
const char *CoversSettingsPage::kTypes = "types";
@@ -222,15 +224,15 @@ void CoversSettingsPage::ProvidersCurrentItemChanged(QListWidgetItem *item_curre
CoverProvider *provider = dialog()->app()->cover_providers()->ProviderByName(item_current->text());
if (provider) {
if (provider->AuthenticationRequired()) {
if (provider->name() == QLatin1String("Tidal") && !provider->IsAuthenticated()) {
if (provider->name() == "Tidal"_L1 && !provider->IsAuthenticated()) {
DisableAuthentication();
ui_->label_auth_info->setText(tr("Use Tidal settings to authenticate."));
}
else if (provider->name() == QLatin1String("Spotify") && !provider->IsAuthenticated()) {
else if (provider->name() == "Spotify"_L1 && !provider->IsAuthenticated()) {
DisableAuthentication();
ui_->label_auth_info->setText(tr("Use Spotify settings to authenticate."));
}
else if (provider->name() == QLatin1String("Qobuz") && !provider->IsAuthenticated()) {
else if (provider->name() == "Qobuz"_L1 && !provider->IsAuthenticated()) {
DisableAuthentication();
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
}
@@ -339,15 +341,15 @@ void CoversSettingsPage::LogoutClicked() {
if (!provider) return;
provider->Deauthenticate();
if (provider->name() == QLatin1String("Tidal")) {
if (provider->name() == "Tidal"_L1) {
DisableAuthentication();
ui_->label_auth_info->setText(tr("Use Tidal settings to authenticate."));
}
else if (provider->name() == QLatin1String("Spotify")) {
else if (provider->name() == "Spotify"_L1) {
DisableAuthentication();
ui_->label_auth_info->setText(tr("Use Spotify settings to authenticate."));
}
else if (provider->name() == QLatin1String("Qobuz")) {
else if (provider->name() == "Qobuz"_L1) {
DisableAuthentication();
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
}
@@ -379,7 +381,7 @@ void CoversSettingsPage::AuthenticationFailure(const QStringList &errors) {
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
QMessageBox::warning(this, tr("Authentication failed"), errors.join(QLatin1Char('\n')));
QMessageBox::warning(this, tr("Authentication failed"), errors.join(u'\n'));
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
ui_->button_authenticate->setEnabled(true);
@@ -429,16 +431,16 @@ void CoversSettingsPage::AddAlbumCoverArtType(const QString &name, const QString
QString CoversSettingsPage::AlbumCoverArtTypeDescription(const QString &type) const {
if (type == QLatin1String("art_unset")) {
if (type == "art_unset"_L1) {
return tr("Manually unset (%1)").arg(type);
}
if (type == QLatin1String("art_manual")) {
if (type == "art_manual"_L1) {
return tr("Set through album cover search (%1)").arg(type);
}
if (type == QLatin1String("art_automatic")) {
if (type == "art_automatic"_L1) {
return tr("Automatically picked up from album directory (%1)").arg(type);
}
if (type == QLatin1String("art_embedded")) {
if (type == "art_embedded"_L1) {
return tr("Embedded album cover art (%1)").arg(type);
}

View File

@@ -49,6 +49,8 @@
#include "globalshortcutssettingspage.h"
#include "ui_globalshortcutssettingspage.h"
using namespace Qt::StringLiterals;
const char *GlobalShortcutsSettingsPage::kSettingsGroup = "GlobalShortcuts";
GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog, QWidget *parent)
@@ -260,7 +262,7 @@ void GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties() {
if (!QProcess::startDetached(QStringLiteral("gnome-keybinding-properties"), QStringList())) {
if (!QProcess::startDetached(QStringLiteral("gnome-control-center"), QStringList() << QStringLiteral("keyboard"))) {
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QLatin1String("gnome-keybinding-properties")));
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg("gnome-keybinding-properties"_L1));
}
}
@@ -270,7 +272,7 @@ void GlobalShortcutsSettingsPage::OpenMateKeybindingProperties() {
if (!QProcess::startDetached(QStringLiteral("mate-keybinding-properties"), QStringList())) {
if (!QProcess::startDetached(QStringLiteral("mate-control-center"), QStringList() << QStringLiteral("keyboard"))) {
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QLatin1String("mate-keybinding-properties")));
QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg("mate-keybinding-properties"_L1));
}
}
@@ -347,18 +349,18 @@ void GlobalShortcutsSettingsPage::ChangeClicked() {
void GlobalShortcutsSettingsPage::X11Warning() {
QString de = de_.toLower();
if (de == QLatin1String("kde") || de == QLatin1String("gnome") || de == QLatin1String("x-cinnamon") || de == QLatin1String("mate")) {
if (de == "kde"_L1 || de == "gnome"_L1 || de == "x-cinnamon"_L1 || de == "mate"_L1) {
QString text(tr("Using X11 shortcuts on %1 is not recommended and can cause keyboard to become unresponsive!").arg(de_));
if (de == QLatin1String("kde")) {
if (de == "kde"_L1) {
text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_);
}
else if (de == QLatin1String("gnome")) {
else if (de == "gnome"_L1) {
text += tr(" Shortcuts on %1 are usually used through Gnome Settings Daemon and should be configured in gnome-settings-daemon instead.").arg(de_);
}
else if (de == QLatin1String("x-cinnamon")) {
else if (de == "x-cinnamon"_L1) {
text += tr(" Shortcuts on %1 are usually used through Gnome Settings Daemon and should be configured in cinnamon-settings-daemon instead.").arg(de_);
}
else if (de == QLatin1String("mate")) {
else if (de == "mate"_L1) {
text += tr(" Shortcuts on %1 are usually used through MATE Settings Daemon and should be configured there instead.").arg(de_);
}
ui_->label_warn_text->setText(text);

View File

@@ -253,7 +253,7 @@ void LyricsSettingsPage::AuthenticationFailure(const QStringList &errors) {
if (!isVisible() || !ui_->providers->currentItem() || ui_->providers->currentItem()->text() != provider->name()) return;
QMessageBox::warning(this, tr("Authentication failed"), errors.join(QLatin1Char('\n')));
QMessageBox::warning(this, tr("Authentication failed"), errors.join(u'\n'));
ui_->login_state->SetLoggedIn(LoginStateWidget::State::LoggedOut);
ui_->button_authenticate->setEnabled(true);