Use QStringLiteral

This commit is contained in:
Jonas Kvinge
2024-04-09 23:20:26 +02:00
parent 3cfffa5fbb
commit 58944993b8
233 changed files with 3885 additions and 3885 deletions

View File

@@ -43,47 +43,47 @@ About::About(QWidget *parent) : QDialog(parent), ui_{} {
setWindowTitle(tr("About Strawberry"));
strawberry_authors_ \
<< Person("Jonas Kvinge");
<< Person(QStringLiteral("Jonas Kvinge"));
strawberry_contributors_ \
<< Person("Gavin D. Howard")
<< Person("Martin Delille");
<< Person(QStringLiteral("Gavin D. Howard"))
<< Person(QStringLiteral("Martin Delille"));
clementine_authors_
<< Person("David Sansome")
<< Person("John Maguire")
<< Person(QString::fromUtf8("Paweł Bara"))
<< Person("Arnaud Bienner");
<< Person(QStringLiteral("David Sansome"))
<< Person(QStringLiteral("John Maguire"))
<< Person(QStringLiteral("Paweł Bara"))
<< Person(QStringLiteral("Arnaud Bienner"));
clementine_contributors_ \
<< Person("Jakub Stachowski")
<< Person("Paul Cifarelli")
<< Person("Felipe Rivera")
<< Person("Alexander Peitz")
<< Person("Andreas Muttscheller")
<< Person("Mark Furneaux")
<< Person("Florian Bigard")
<< Person("Alex Bikadorov")
<< Person("Mattias Andersson")
<< Person("Alan Briolat")
<< Person("Arun Narayanankutty")
<< Person(QString::fromUtf8("Bartłomiej Burdukiewicz"))
<< Person("Andre Siviero")
<< Person("Santiago Gil")
<< Person("Tyler Rhodes")
<< Person("Vikram Ambrose")
<< Person("David Guillen")
<< Person("Krzysztof Sobiecki")
<< Person("Valeriy Malov")
<< Person("Nick Lanham");
<< Person(QStringLiteral("Jakub Stachowski"))
<< Person(QStringLiteral("Paul Cifarelli"))
<< Person(QStringLiteral("Felipe Rivera"))
<< Person(QStringLiteral("Alexander Peitz"))
<< Person(QStringLiteral("Andreas Muttscheller"))
<< Person(QStringLiteral("Mark Furneaux"))
<< Person(QStringLiteral("Florian Bigard"))
<< Person(QStringLiteral("Alex Bikadorov"))
<< Person(QStringLiteral("Mattias Andersson"))
<< Person(QStringLiteral("Alan Briolat"))
<< Person(QStringLiteral("Arun Narayanankutty"))
<< Person(QStringLiteral("Bartłomiej Burdukiewicz"))
<< Person(QStringLiteral("Andre Siviero"))
<< Person(QStringLiteral("Santiago Gil"))
<< Person(QStringLiteral("Tyler Rhodes"))
<< Person(QStringLiteral("Vikram Ambrose"))
<< Person(QStringLiteral("David Guillen"))
<< Person(QStringLiteral("Krzysztof Sobiecki"))
<< Person(QStringLiteral("Valeriy Malov"))
<< Person(QStringLiteral("Nick Lanham"));
strawberry_thanks_ \
<< Person("Mark Kretschmann")
<< Person("Max Howell")
<< Person("Artur Rona")
<< Person("Robert-André Mauchin")
<< Person("Thomas Pierson")
<< Person("Fabio Loli");
<< Person(QStringLiteral("Mark Kretschmann"))
<< Person(QStringLiteral("Max Howell"))
<< Person(QStringLiteral("Artur Rona"))
<< Person(QStringLiteral("Robert-André Mauchin"))
<< Person(QStringLiteral("Thomas Pierson"))
<< Person(QStringLiteral("Fabio Loli"));
QFont title_font;
title_font.setBold(true);
@@ -92,7 +92,7 @@ About::About(QWidget *parent) : QDialog(parent), ui_{} {
ui_.label_title->setFont(title_font);
ui_.label_title->setText(windowTitle());
ui_.label_text->setText(MainHtml());
ui_.text_contributors->document()->setDefaultStyleSheet(QString("a {color: %1; }").arg(palette().text().color().name()));
ui_.text_contributors->document()->setDefaultStyleSheet(QStringLiteral("a {color: %1; }").arg(palette().text().color().name()));
ui_.text_contributors->setText(ContributorsHtml());
ui_.buttonBox->button(QDialogButtonBox::Close)->setShortcut(QKeySequence::Close);
@@ -103,31 +103,31 @@ QString About::MainHtml() const {
QString ret;
ret += QString("<p>");
ret += QStringLiteral("<p>");
ret += tr("Version %1").arg(QCoreApplication::applicationVersion());
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += QStringLiteral("<p>");
ret += tr("Strawberry is a music player and music collection organizer.");
ret += QString("<br />");
ret += QStringLiteral("<br />");
ret += tr("It is a fork of Clementine released in 2018 aimed at music collectors and audiophiles.");
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += tr("Strawberry is free software released under GPL. The source code is available on %1").arg(QString("<a style=\"color:%1;\" href=\"https://github.com/strawberrymusicplayer/strawberry\">GitHub</a>.").arg(palette().text().color().name()));
ret += QString("<br />");
ret += tr("You should have received a copy of the GNU General Public License along with this program. If not, see %1").arg(QString("<a style=\"color:%1;\" href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>").arg(palette().text().color().name()));
ret += QString("</p>");
ret += QStringLiteral("<p>");
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 += QStringLiteral("<br />");
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 += QStringLiteral("</p>");
ret += QString("<p>");
ret += QStringLiteral("<p>");
ret += tr("If you like Strawberry and can make use of it, consider sponsoring or donating.");
ret += QString("<br />");
ret += QStringLiteral("<br />");
ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg(
QString("<a style=\"color:%1;\" href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>").arg(palette().text().color().name()),
QString("<a style=\"color:%1;\" href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>").arg(palette().text().color().name())
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 += QString("</p>");
ret += QStringLiteral("</p>");
return ret;
@@ -137,54 +137,54 @@ QString About::ContributorsHtml() const {
QString ret;
ret += QString("<p>");
ret += "<b>";
ret += QStringLiteral("<p>");
ret += QLatin1String("<b>");
ret += tr("Author and maintainer");
ret += "</b>";
ret += QLatin1String("</b>");
for (const Person &person : strawberry_authors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += "<b>";
ret += QStringLiteral("<p>");
ret += QLatin1String("<b>");
ret += tr("Contributors");
ret += "</b>";
ret += QLatin1String("</b>");
for (const Person &person : strawberry_contributors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += "<b>";
ret += QStringLiteral("<p>");
ret += QLatin1String("<b>");
ret += tr("Clementine authors");
ret += "</b>";
ret += QLatin1String("</b>");
for (const Person &person : clementine_authors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += "<b>";
ret += QStringLiteral("<p>");
ret += QLatin1String("<b>");
ret += tr("Clementine contributors");
ret += "</b>";
ret += QLatin1String("</b>");
for (const Person &person : clementine_contributors_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += "<b>";
ret += QStringLiteral("<p>");
ret += QLatin1String("<b>");
ret += tr("Thanks to");
ret += "</b>";
ret += QLatin1String("</b>");
for (const Person &person : strawberry_thanks_) {
ret += "<br />" + PersonToHtml(person);
}
ret += QString("</p>");
ret += QStringLiteral("</p>");
ret += QString("<p>");
ret += QStringLiteral("<p>");
ret += tr("Thanks to all the other Amarok and Clementine contributors.");
ret += QString("</p>");
ret += QStringLiteral("</p>");
return ret;
}
@@ -195,6 +195,6 @@ QString About::PersonToHtml(const Person &person) {
return person.name;
}
else {
return QString("%1 &lt;<a href=\"mailto:%2\">%3</a>&gt;").arg(person.name, person.email, person.email);
return QStringLiteral("%1 &lt;<a href=\"mailto:%2\">%3</a>&gt;").arg(person.name, person.email, person.email);
}
}

View File

@@ -48,7 +48,7 @@ Console::Console(Application *app, QWidget *parent) : QDialog(parent), ui_{}, ap
QObject::connect(ui_.run, &QPushButton::clicked, this, &Console::RunQuery);
QFont font("Monospace");
QFont font(QStringLiteral("Monospace"));
font.setStyleHint(QFont::TypeWriter);
ui_.output->setFont(font);
@@ -79,7 +79,7 @@ void Console::RunQuery() {
values.append(record.value(i).toString());
}
ui_.output->append(values.join("|"));
ui_.output->append(values.join(QStringLiteral("|")));
}

View File

@@ -225,8 +225,8 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
ui_->summary_art->installEventFilter(this);
// Add the next/previous buttons
previous_button_ = new QPushButton(IconLoader::Load("go-previous"), tr("Previous"), this);
next_button_ = new QPushButton(IconLoader::Load("go-next"), tr("Next"), this);
previous_button_ = new QPushButton(IconLoader::Load(QStringLiteral("go-previous")), tr("Previous"), this);
next_button_ = new QPushButton(IconLoader::Load(QStringLiteral("go-next")), tr("Next"), this);
ui_->button_box->addButton(previous_button_, QDialogButtonBox::ResetRole);
ui_->button_box->addButton(next_button_, QDialogButtonBox::ResetRole);
@@ -240,11 +240,11 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
new QShortcut(QKeySequence::MoveToNextPage, next_button_, SLOT(click()));
// Show the shortcuts as tooltips
previous_button_->setToolTip(QString("%1 (%2 / %3)").arg(
previous_button_->setToolTip(QStringLiteral("%1 (%2 / %3)").arg(
previous_button_->text(),
QKeySequence(QKeySequence::Back).toString(QKeySequence::NativeText),
QKeySequence(QKeySequence::MoveToPreviousPage).toString(QKeySequence::NativeText)));
next_button_->setToolTip(QString("%1 (%2 / %3)").arg(
next_button_->setToolTip(QStringLiteral("%1 (%2 / %3)").arg(
next_button_->text(),
QKeySequence(QKeySequence::Forward).toString(QKeySequence::NativeText),
QKeySequence(QKeySequence::MoveToNextPage).toString(QKeySequence::NativeText)));
@@ -690,9 +690,9 @@ void EditTagDialog::SelectionChanged() {
summary += "<p><b>" + first_song.PrettyTitleWithArtist().toHtmlEscaped() + "</b></p>";
}
else {
summary += "<p><b>";
summary += QLatin1String("<p><b>");
summary += tr("%1 songs selected.").arg(indexes.count());
summary += "</b></p>";
summary += QLatin1String("</b></p>");
}
ui_->tags_summary->setText(summary);
@@ -787,8 +787,8 @@ void EditTagDialog::UpdateSummaryTab(const Song &song) {
ui_->length->setText(Utilities::PrettyTimeNanosec(song.length_nanosec()));
SetText(ui_->samplerate, song.samplerate(), "Hz");
SetText(ui_->bitdepth, song.bitdepth(), "Bit");
SetText(ui_->samplerate, song.samplerate(), QStringLiteral("Hz"));
SetText(ui_->bitdepth, song.bitdepth(), QStringLiteral("Bit"));
SetText(ui_->bitrate, song.bitrate(), tr("kbps"));
ui_->ebur128_integrated_loudness->setText(song.Ebur128LoudnessLUFSToText());
ui_->ebur128_loudness_range->setText(song.Ebur128LoudnessRangeLUToText());
@@ -859,7 +859,7 @@ QString EditTagDialog::GetArtSummary(const Song &song, const AlbumCoverLoaderRes
}
if (!song.is_collection_song()) {
if (!summary.isEmpty()) summary += "<br />";
if (!summary.isEmpty()) summary += QLatin1String("<br />");
summary = tr("Album cover editing is only available for collection songs.");
}
@@ -906,8 +906,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 += "<br />";
summary += "<br />";
summary += QLatin1String("<br />");
summary += QLatin1String("<br />");
summary += GetArtSummary(data_[idx.row()].current_, result.type);
ui_->summary->setText(summary);
}
@@ -932,8 +932,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 += "<br />";
summary += "<br />";
summary += QLatin1String("<br />");
summary += QLatin1String("<br />");
if (cover_action == UpdateCoverAction::None) {
summary += GetArtSummary(first_song, result.type);
}

View File

@@ -81,7 +81,7 @@ void ErrorDialog::UpdateContent() {
QString html;
for (const QString &message : current_messages_) {
if (!html.isEmpty()) {
html += "<hr/>";
html += QLatin1String("<hr/>");
}
html += message.toHtmlEscaped();
}

View File

@@ -41,7 +41,7 @@ LastFMImportDialog::LastFMImportDialog(SharedPtr<LastFMImport> lastfm_import, QW
ui_->setupUi(this);
setWindowIcon(IconLoader::Load("scrobble"));
setWindowIcon(IconLoader::Load(QStringLiteral("scrobble")));
ui_->stackedWidget->setCurrentWidget(ui_->page_start);

View File

@@ -29,7 +29,7 @@ SnapDialog::SnapDialog(QWidget *parent) : MessageDialog(parent) {
setWindowTitle(tr("Strawberry is running as a Snap"));
const QIcon icon = IconLoader::Load("dialog-warning");
const QIcon icon = IconLoader::Load(QStringLiteral("dialog-warning"));
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
const QPixmap pixmap = icon.pixmap(QSize(64, 64), devicePixelRatioF());
#else
@@ -38,56 +38,56 @@ SnapDialog::SnapDialog(QWidget *parent) : MessageDialog(parent) {
ui_->label_logo->setPixmap(pixmap);
QString text;
text += QString("<p>");
text += QStringLiteral("<p>");
text += tr("It is detected that Strawberry is running as a Snap");
text += QString("</p>");
text += QStringLiteral("</p>");
text += QString("<p>");
text += QStringLiteral("<p>");
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 += QString("</p>");
text += QStringLiteral("</p>");
text += QString("<p>");
text += QString("Strawberry is available natively in the official package repositories for Fedora, openSUSE, Mageia, Arch, Manjaro, MX Linux and most other popular Linux distributions.");
text += QString("</p>");
text += QStringLiteral("<p>");
text += QStringLiteral("Strawberry is available natively in the official package repositories for Fedora, openSUSE, Mageia, Arch, Manjaro, MX Linux and most other popular Linux distributions.");
text += QStringLiteral("</p>");
text += QString("<p>");
text += tr("For Ubuntu there is an official PPA repository available at %1.").arg(QString("<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 += QString("</p>");
text += QStringLiteral("<p>");
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 += QStringLiteral("</p>");
text += QString("<p>");
text += tr("Official releases are available for Debian and Ubuntu which also work on most of their derivatives. See %1 for more information.").arg(QString("<a style=\"color:%1;\" href=\"https://www.strawberrymusicplayer.org/\">https://www.strawberrymusicplayer.org/</a>").arg(palette().text().color().name()));
text += QString("</p>");
text += QStringLiteral("<p>");
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 += QStringLiteral("</p>");
text += QString("<p>");
text += QStringLiteral("<p>");
text += tr("For a better experience please consider the other options above.");
text += QString("</p>");
text += QStringLiteral("</p>");
text += QString("<p>");
text += QStringLiteral("<p>");
text += tr("Copy your strawberry.conf and strawberry.db from your ~/snap directory to avoid losing configuration before you uninstall the snap:");
text += QString("<br />");
text += QString("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf<br />");
text += QString("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db<br />");
text += QString("</p>");
text += QString("<p>");
text += QStringLiteral("<br />");
text += QStringLiteral("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf<br />");
text += QStringLiteral("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db<br />");
text += QStringLiteral("</p>");
text += QStringLiteral("<p>");
text += tr("Uninstall the snap with:");
text += QString("<br />");
text += QString("snap remove strawberry");
text += QString("</p>");
text += QString("<p>");
text += QStringLiteral("<br />");
text += QStringLiteral("snap remove strawberry");
text += QStringLiteral("</p>");
text += QStringLiteral("<p>");
text += tr("Install strawberry through PPA:");
text += QString("<br />");
text += QString("sudo add-apt-repository ppa:jonaski/strawberry<br />");
text += QString("sudo apt-get update<br />");
text += QString("sudo apt install strawberry");
text += QString("</p>");
text += QString("<p></p>");
text += QStringLiteral("<br />");
text += QStringLiteral("sudo add-apt-repository ppa:jonaski/strawberry<br />");
text += QStringLiteral("sudo apt-get update<br />");
text += QStringLiteral("sudo apt install strawberry");
text += QStringLiteral("</p>");
text += QStringLiteral("<p></p>");
ui_->label_text->setText(text);
ui_->label_text->adjustSize();
adjustSize();
settings_group_ = MainWindow::kSettingsGroup;
do_not_show_message_again_ = "ignore_snap";
do_not_show_message_again_ = QStringLiteral("ignore_snap");
if (parent) {
Utilities::CenterWidgetOnScreen(Utilities::GetScreen(parent), this);

View File

@@ -66,8 +66,8 @@ TrackSelectionDialog::TrackSelectionDialog(QWidget *parent)
SetLoading(QString());
// Add the next/previous buttons
previous_button_ = new QPushButton(IconLoader::Load("go-previous"), tr("Previous"), this);
next_button_ = new QPushButton(IconLoader::Load("go-next"), tr("Next"), this);
previous_button_ = new QPushButton(IconLoader::Load(QStringLiteral("go-previous")), tr("Previous"), this);
next_button_ = new QPushButton(IconLoader::Load(QStringLiteral("go-next")), tr("Next"), this);
ui_->button_box->addButton(previous_button_, QDialogButtonBox::ResetRole);
ui_->button_box->addButton(next_button_, QDialogButtonBox::ResetRole);