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

@@ -36,6 +36,8 @@
#include "about.h"
#include "ui_about.h"
using namespace Qt::StringLiterals;
About::About(QWidget *parent) : QDialog(parent), ui_{} {
ui_.setupUi(this);
@@ -106,31 +108,31 @@ QString About::MainHtml() const {
QString ret;
ret += QLatin1String("<p>");
ret += "<p>"_L1;
ret += tr("Version %1").arg(QCoreApplication::applicationVersion());
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += "<p>"_L1;
ret += tr("Strawberry is a music player and music collection organizer.");
ret += QLatin1String("<br />");
ret += "<br />"_L1;
ret += tr("It is a fork of Clementine released in 2018 aimed at music collectors and audiophiles.");
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += "<p>"_L1;
ret += tr("Strawberry is free software released under GPL. The source code is available on %1").arg(QStringLiteral("<a style=\"color:%1;\" href=\"https://github.com/strawberrymusicplayer/strawberry\">GitHub</a>.").arg(palette().text().color().name()));
ret += QLatin1String("<br />");
ret += "<br />"_L1;
ret += tr("You should have received a copy of the GNU General Public License along with this program. If not, see %1").arg(QStringLiteral("<a style=\"color:%1;\" href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>").arg(palette().text().color().name()));
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += "<p>"_L1;
ret += tr("If you like Strawberry and can make use of it, consider sponsoring or donating.");
ret += QLatin1String("<br />");
ret += "<br />"_L1;
ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg(
QStringLiteral("<a style=\"color:%1;\" href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>").arg(palette().text().color().name()),
QStringLiteral("<a style=\"color:%1;\" href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>").arg(palette().text().color().name())
);
ret += QLatin1String("</p>");
ret += "</p>"_L1;
return ret;
@@ -140,54 +142,54 @@ QString About::ContributorsHtml() const {
QString ret;
ret += QLatin1String("<p>");
ret += QLatin1String("<b>");
ret += "<p>"_L1;
ret += "<b>"_L1;
ret += tr("Author and maintainer");
ret += QLatin1String("</b>");
ret += "</b>"_L1;
for (const Person &person : strawberry_authors_) {
ret += QLatin1String("<br />") + PersonToHtml(person);
ret += "<br />"_L1 + PersonToHtml(person);
}
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += QLatin1String("<b>");
ret += "<p>"_L1;
ret += "<b>"_L1;
ret += tr("Contributors");
ret += QLatin1String("</b>");
ret += "</b>"_L1;
for (const Person &person : strawberry_contributors_) {
ret += QLatin1String("<br />") + PersonToHtml(person);
ret += "<br />"_L1 + PersonToHtml(person);
}
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += QLatin1String("<b>");
ret += "<p>"_L1;
ret += "<b>"_L1;
ret += tr("Clementine authors");
ret += QLatin1String("</b>");
ret += "</b>"_L1;
for (const Person &person : clementine_authors_) {
ret += QLatin1String("<br />") + PersonToHtml(person);
ret += "<br />"_L1 + PersonToHtml(person);
}
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += QLatin1String("<b>");
ret += "<p>"_L1;
ret += "<b>"_L1;
ret += tr("Clementine contributors");
ret += QLatin1String("</b>");
ret += "</b>"_L1;
for (const Person &person : clementine_contributors_) {
ret += QLatin1String("<br />") + PersonToHtml(person);
ret += "<br />"_L1 + PersonToHtml(person);
}
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += QLatin1String("<b>");
ret += "<p>"_L1;
ret += "<b>"_L1;
ret += tr("Thanks to");
ret += QLatin1String("</b>");
ret += "</b>"_L1;
for (const Person &person : strawberry_thanks_) {
ret += QLatin1String("<br />") + PersonToHtml(person);
ret += "<br />"_L1 + PersonToHtml(person);
}
ret += QLatin1String("</p>");
ret += "</p>"_L1;
ret += QLatin1String("<p>");
ret += "<p>"_L1;
ret += tr("Thanks to all the other Amarok and Clementine contributors.");
ret += QLatin1String("</p>");
ret += "</p>"_L1;
return ret;
}

View File

@@ -79,7 +79,7 @@ void Console::RunQuery() {
values.append(record.value(i).toString());
}
ui_.output->append(values.join(QLatin1Char('|')));
ui_.output->append(values.join(u'|'));
}

View File

@@ -101,6 +101,8 @@
#include "ui_edittagdialog.h"
#include "tagreadermessages.pb.h"
using namespace Qt::StringLiterals;
namespace {
constexpr char kTagsDifferentHintText[] = QT_TR_NOOP("(different across multiple songs)");
constexpr char kArtDifferentHintText[] = QT_TR_NOOP("Different art across multiple songs.");
@@ -476,21 +478,21 @@ void EditTagDialog::SetSongListVisibility(bool visible) {
QVariant EditTagDialog::Data::value(const Song &song, const QString &id) {
if (id == QLatin1String("title")) return song.title();
if (id == QLatin1String("artist")) return song.artist();
if (id == QLatin1String("album")) return song.album();
if (id == QLatin1String("albumartist")) return song.albumartist();
if (id == QLatin1String("composer")) return song.composer();
if (id == QLatin1String("performer")) return song.performer();
if (id == QLatin1String("grouping")) return song.grouping();
if (id == QLatin1String("genre")) return song.genre();
if (id == QLatin1String("comment")) return song.comment();
if (id == QLatin1String("lyrics")) return song.lyrics();
if (id == QLatin1String("track")) return song.track();
if (id == QLatin1String("disc")) return song.disc();
if (id == QLatin1String("year")) return song.year();
if (id == QLatin1String("compilation")) return song.compilation();
if (id == QLatin1String("rating")) { return song.rating(); }
if (id == "title"_L1) return song.title();
if (id == "artist"_L1) return song.artist();
if (id == "album"_L1) return song.album();
if (id == "albumartist"_L1) return song.albumartist();
if (id == "composer"_L1) return song.composer();
if (id == "performer"_L1) return song.performer();
if (id == "grouping"_L1) return song.grouping();
if (id == "genre"_L1) return song.genre();
if (id == "comment"_L1) return song.comment();
if (id == "lyrics"_L1) return song.lyrics();
if (id == "track"_L1) return song.track();
if (id == "disc"_L1) return song.disc();
if (id == "year"_L1) return song.year();
if (id == "compilation"_L1) return song.compilation();
if (id == "rating"_L1) { return song.rating(); }
qLog(Warning) << "Unknown ID" << id;
return QVariant();
@@ -498,21 +500,21 @@ QVariant EditTagDialog::Data::value(const Song &song, const QString &id) {
void EditTagDialog::Data::set_value(const QString &id, const QVariant &value) {
if (id == QLatin1String("title")) current_.set_title(value.toString());
else if (id == QLatin1String("artist")) current_.set_artist(value.toString());
else if (id == QLatin1String("album")) current_.set_album(value.toString());
else if (id == QLatin1String("albumartist")) current_.set_albumartist(value.toString());
else if (id == QLatin1String("composer")) current_.set_composer(value.toString());
else if (id == QLatin1String("performer")) current_.set_performer(value.toString());
else if (id == QLatin1String("grouping")) current_.set_grouping(value.toString());
else if (id == QLatin1String("genre")) current_.set_genre(value.toString());
else if (id == QLatin1String("comment")) current_.set_comment(value.toString());
else if (id == QLatin1String("lyrics")) current_.set_lyrics(value.toString());
else if (id == QLatin1String("track")) current_.set_track(value.toInt());
else if (id == QLatin1String("disc")) current_.set_disc(value.toInt());
else if (id == QLatin1String("year")) current_.set_year(value.toInt());
else if (id == QLatin1String("compilation")) current_.set_compilation(value.toBool());
else if (id == QLatin1String("rating")) { current_.set_rating(value.toFloat()); }
if (id == "title"_L1) current_.set_title(value.toString());
else if (id == "artist"_L1) current_.set_artist(value.toString());
else if (id == "album"_L1) current_.set_album(value.toString());
else if (id == "albumartist"_L1) current_.set_albumartist(value.toString());
else if (id == "composer"_L1) current_.set_composer(value.toString());
else if (id == "performer"_L1) current_.set_performer(value.toString());
else if (id == "grouping"_L1) current_.set_grouping(value.toString());
else if (id == "genre"_L1) current_.set_genre(value.toString());
else if (id == "comment"_L1) current_.set_comment(value.toString());
else if (id == "lyrics"_L1) current_.set_lyrics(value.toString());
else if (id == "track"_L1) current_.set_track(value.toInt());
else if (id == "disc"_L1) current_.set_disc(value.toInt());
else if (id == "year"_L1) current_.set_year(value.toInt());
else if (id == "compilation"_L1) current_.set_compilation(value.toBool());
else if (id == "rating"_L1) { current_.set_rating(value.toFloat()); }
else qLog(Warning) << "Unknown ID" << id;
}
@@ -692,12 +694,12 @@ void EditTagDialog::SelectionChanged() {
QString summary;
if (indexes.count() == 1) {
summary += QLatin1String("<p><b>") + first_song.PrettyTitleWithArtist().toHtmlEscaped() + QLatin1String("</b></p>");
summary += "<p><b>"_L1 + first_song.PrettyTitleWithArtist().toHtmlEscaped() + "</b></p>"_L1;
}
else {
summary += QLatin1String("<p><b>");
summary += "<p><b>"_L1;
summary += tr("%1 songs selected.").arg(indexes.count());
summary += QLatin1String("</b></p>");
summary += "</b></p>"_L1;
}
ui_->tags_summary->setText(summary);
@@ -864,7 +866,7 @@ QString EditTagDialog::GetArtSummary(const Song &song, const AlbumCoverLoaderRes
}
if (!song.is_collection_song()) {
if (!summary.isEmpty()) summary += QLatin1String("<br />");
if (!summary.isEmpty()) summary += "<br />"_L1;
summary = tr("Album cover editing is only available for collection songs.");
}
@@ -911,8 +913,8 @@ void EditTagDialog::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderRes
if (ui_->song_list->selectionModel()->selectedIndexes().count() > 0) {
const QModelIndex idx = ui_->song_list->selectionModel()->selectedIndexes().first();
QString summary = ui_->summary->toPlainText();
summary += QLatin1String("<br />");
summary += QLatin1String("<br />");
summary += "<br />"_L1;
summary += "<br />"_L1;
summary += GetArtSummary(data_[idx.row()].current_, result.type);
ui_->summary->setText(summary);
}
@@ -938,8 +940,8 @@ void EditTagDialog::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderRes
bool enable_change_art = false;
if (first_song.is_valid()) {
QString summary = ui_->tags_summary->toPlainText();
summary += QLatin1String("<br />");
summary += QLatin1String("<br />");
summary += "<br />"_L1;
summary += "<br />"_L1;
if (cover_action == UpdateCoverAction::None) {
summary += GetArtSummary(first_song, result.type);
}

View File

@@ -35,6 +35,8 @@
#include "errordialog.h"
#include "ui_errordialog.h"
using namespace Qt::StringLiterals;
ErrorDialog::ErrorDialog(QWidget *parent)
: QDialog(parent),
ui_(new Ui_ErrorDialog) {
@@ -83,7 +85,7 @@ void ErrorDialog::UpdateContent() {
QString html;
for (const QString &message : std::as_const(current_messages_)) {
if (!html.isEmpty()) {
html += QLatin1String("<hr/>");
html += "<hr/>"_L1;
}
html += message.toHtmlEscaped();
}

View File

@@ -25,6 +25,8 @@
#include "snapdialog.h"
#include "ui_messagedialog.h"
using namespace Qt::StringLiterals;
SnapDialog::SnapDialog(QWidget *parent) : MessageDialog(parent) {
setWindowTitle(tr("Strawberry is running as a Snap"));
@@ -34,56 +36,56 @@ SnapDialog::SnapDialog(QWidget *parent) : MessageDialog(parent) {
ui_->label_logo->setPixmap(pixmap);
QString text;
text += QLatin1String("<p>");
text += "<p>"_L1;
text += tr("It is detected that Strawberry is running as a Snap");
text += QLatin1String("</p>");
text += "</p>"_L1;
text += QLatin1String("<p>");
text += "<p>"_L1;
text += tr("Strawberry is slower, and has restrictions when running as a Snap. Accessing the root filesystem (/) will not work. There also might be other restrictions such as accessing certain devices or network shares.");
text += QLatin1String("</p>");
text += "</p>"_L1;
text += QLatin1String("<p>");
text += QLatin1String("Strawberry is available natively in the official package repositories for Fedora, openSUSE, Mageia, Arch, Manjaro, MX Linux and most other popular Linux distributions.");
text += QLatin1String("</p>");
text += "<p>"_L1;
text += "Strawberry is available natively in the official package repositories for Fedora, openSUSE, Mageia, Arch, Manjaro, MX Linux and most other popular Linux distributions."_L1;
text += "</p>"_L1;
text += QLatin1String("<p>");
text += "<p>"_L1;
text += tr("For Ubuntu there is an official PPA repository available at %1.").arg(QStringLiteral("<a style=\"color:%1;\" href=\"https://launchpad.net/~jonaski/+archive/ubuntu/strawberry\">https://launchpad.net/~jonaski/+archive/ubuntu/strawberry</a>").arg(palette().text().color().name()));
text += QLatin1String("</p>");
text += "</p>"_L1;
text += QLatin1String("<p>");
text += "<p>"_L1;
text += tr("Official releases are available for Debian and Ubuntu which also work on most of their derivatives. See %1 for more information.").arg(QStringLiteral("<a style=\"color:%1;\" href=\"https://www.strawberrymusicplayer.org/\">https://www.strawberrymusicplayer.org/</a>").arg(palette().text().color().name()));
text += QLatin1String("</p>");
text += "</p>"_L1;
text += QLatin1String("<p>");
text += "<p>"_L1;
text += tr("For a better experience please consider the other options above.");
text += QLatin1String("</p>");
text += "</p>"_L1;
text += QLatin1String("<p>");
text += "<p>"_L1;
text += tr("Copy your strawberry.conf and strawberry.db from your ~/snap directory to avoid losing configuration before you uninstall the snap:");
text += QLatin1String("<br />");
text += QLatin1String("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf<br />");
text += QLatin1String("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db<br />");
text += QLatin1String("</p>");
text += QLatin1String("<p>");
text += "<br />"_L1;
text += "cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf<br />"_L1;
text += "cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db<br />"_L1;
text += "</p>"_L1;
text += "<p>"_L1;
text += tr("Uninstall the snap with:");
text += QLatin1String("<br />");
text += QLatin1String("snap remove strawberry");
text += QLatin1String("</p>");
text += QLatin1String("<p>");
text += "<br />"_L1;
text += "snap remove strawberry"_L1;
text += "</p>"_L1;
text += "<p>"_L1;
text += tr("Install strawberry through PPA:");
text += QLatin1String("<br />");
text += QLatin1String("sudo add-apt-repository ppa:jonaski/strawberry<br />");
text += QLatin1String("sudo apt-get update<br />");
text += QLatin1String("sudo apt install strawberry");
text += QLatin1String("</p>");
text += QLatin1String("<p></p>");
text += "<br />"_L1;
text += "sudo add-apt-repository ppa:jonaski/strawberry<br />"_L1;
text += "sudo apt-get update<br />"_L1;
text += "sudo apt install strawberry"_L1;
text += "</p>"_L1;
text += "<p></p>"_L1;
ui_->label_text->setText(text);
ui_->label_text->adjustSize();
adjustSize();
settings_group_ = QLatin1String(MainWindow::kSettingsGroup);
do_not_show_message_again_ = QLatin1String("ignore_snap");
do_not_show_message_again_ = "ignore_snap"_L1;
if (parent) {
Utilities::CenterWidgetOnScreen(Utilities::GetScreen(parent), this);