diff --git a/ext/libstrawberry-common/core/logging.cpp b/ext/libstrawberry-common/core/logging.cpp
index 49fb17b72..8c05db68a 100644
--- a/ext/libstrawberry-common/core/logging.cpp
+++ b/ext/libstrawberry-common/core/logging.cpp
@@ -212,7 +212,7 @@ void SetLevels(const QString &levels) {
continue;
}
- if (class_name.isEmpty() || class_name == QStringLiteral("*")) {
+ if (class_name.isEmpty() || class_name == QLatin1Char('*')) {
sDefaultLevel = static_cast ") +
+ QLatin1String("
") + tr("Prefix a word with a field name to limit the search to that field, e.g.:") + - QStringLiteral(" ") + - QStringLiteral("") + + QLatin1Char(' ') + + QLatin1String("") + tr("artist") + - QStringLiteral(":Strawbs ") + - tr("searches the collection for all artists that contain the word %1. ").arg(QStringLiteral("Strawbs")) + - QStringLiteral("
") + + QLatin1String(":Strawbs ") + + tr("searches the collection for all artists that contain the word %1. ").arg(QLatin1String("Strawbs")) + + QLatin1String("
") + tr("Search terms for numerical fields can be prefixed with %1 or %2 to refine the search, e.g.: ") - .arg(QStringLiteral(" =, !=, <, >, <="), QStringLiteral(">=")) + - QStringLiteral("") + + .arg(QLatin1String(" =, !=, <, >, <="), QLatin1String(">=")) + + QLatin1String("") + tr("rating") + - QStringLiteral("") + - QStringLiteral(":>=") + - QStringLiteral("4") + + QLatin1String("") + + QLatin1String(":>=") + + QLatin1String("4") + - QStringLiteral("
") + + QLatin1String("
") + tr("Available fields") + - QStringLiteral(": ") + - QStringLiteral("") + - QStringLiteral("") + + QLatin1String(": ") + + QLatin1String("") + + QLatin1String("") + available_fields + - QStringLiteral(".") + - QStringLiteral("
") + QLatin1String(".") + + QLatin1String("") ); QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed); @@ -319,7 +319,7 @@ QActionGroup *CollectionFilterWidget::CreateGroupByActions(const QString &saved_ if (version == 1) { QStringList saved = s.childKeys(); for (int i = 0; i < saved.size(); ++i) { - if (saved.at(i) == QStringLiteral("version")) continue; + if (saved.at(i) == QLatin1String("version")) continue; QByteArray bytes = s.value(saved.at(i)).toByteArray(); QDataStream ds(&bytes, QIODevice::ReadOnly); CollectionModel::Grouping g; @@ -330,7 +330,7 @@ QActionGroup *CollectionFilterWidget::CreateGroupByActions(const QString &saved_ else { QStringList saved = s.childKeys(); for (int i = 0; i < saved.size(); ++i) { - if (saved.at(i) == QStringLiteral("version")) continue; + if (saved.at(i) == QLatin1String("version")) continue; s.remove(saved.at(i)); } } diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index 40f1de599..628e6e4b4 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -728,7 +728,7 @@ void CollectionModel::CreateDividerItem(const QString ÷r_key, const QStrin CollectionItem *divider = new CollectionItem(CollectionItem::Type::Divider, root_); divider->container_key = divider_key; divider->display_text = display_text; - divider->sort_text = divider_key + QStringLiteral(" "); + divider->sort_text = divider_key + QLatin1String(" "); divider_nodes_[divider_key] = divider; endInsertRows(); @@ -772,7 +772,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(CollectionItem *par if (parent != root_ && !parent->container_key.isEmpty()) parent->compilation_artist_node_->container_key.append(parent->container_key); parent->compilation_artist_node_->container_key.append(QLatin1String(kVariousArtists)); parent->compilation_artist_node_->display_text = QLatin1String(kVariousArtists); - parent->compilation_artist_node_->sort_text = QStringLiteral(" various"); + parent->compilation_artist_node_->sort_text = QLatin1String(" various"); parent->compilation_artist_node_->container_level = parent->container_level + 1; endInsertRows(); @@ -1031,14 +1031,14 @@ QString CollectionModel::TextOrUnknown(const QString &text) { QString CollectionModel::PrettyYearAlbum(const int year, const QString &album) { if (year <= 0) return TextOrUnknown(album); - return QString::number(year) + QStringLiteral(" - ") + TextOrUnknown(album); + return QString::number(year) + QLatin1String(" - ") + TextOrUnknown(album); } QString CollectionModel::PrettyAlbumDisc(const QString &album, const int disc) { if (disc <= 0 || Song::AlbumContainsDisc(album)) return TextOrUnknown(album); - return TextOrUnknown(album) + QStringLiteral(" - (Disc ") + QString::number(disc) + QStringLiteral(")"); + return TextOrUnknown(album) + QLatin1String(" - (Disc ") + QString::number(disc) + QLatin1String(")"); } @@ -1047,9 +1047,9 @@ QString CollectionModel::PrettyYearAlbumDisc(const int year, const QString &albu QString str; if (year <= 0) str = TextOrUnknown(album); - else str = QString::number(year) + QStringLiteral(" - ") + TextOrUnknown(album); + else str = QString::number(year) + QLatin1String(" - ") + TextOrUnknown(album); - if (!Song::AlbumContainsDisc(album) && disc > 0) str += QStringLiteral(" - (Disc ") + QString::number(disc) + QStringLiteral(")"); + if (!Song::AlbumContainsDisc(album) && disc > 0) str += QLatin1String(" - (Disc ") + QString::number(disc) + QLatin1String(")"); return str; @@ -1057,7 +1057,7 @@ QString CollectionModel::PrettyYearAlbumDisc(const int year, const QString &albu QString CollectionModel::PrettyDisc(const int disc) { - return QStringLiteral("Disc ") + QString::number(std::max(1, disc)); + return QLatin1String("Disc ") + QString::number(std::max(1, disc)); } @@ -1134,7 +1134,7 @@ QString CollectionModel::SortText(const GroupBy group_by, const int container_le QString CollectionModel::SortText(QString text) { if (text.isEmpty()) { - text = QStringLiteral(" unknown"); + text = QLatin1String(" unknown"); } else { text = text.toLower(); @@ -1153,7 +1153,7 @@ QString CollectionModel::SortTextForArtist(QString artist, const bool skip_artic for (const auto &i : Song::kArticles) { if (artist.startsWith(i)) { qint64 ilen = i.length(); - artist = artist.right(artist.length() - ilen) + QStringLiteral(", ") + i.left(ilen - 1); + artist = artist.right(artist.length() - ilen) + QLatin1String(", ") + i.left(ilen - 1); break; } } diff --git a/src/collection/collectionquery.cpp b/src/collection/collectionquery.cpp index 44d9dfd7a..067439bb3 100644 --- a/src/collection/collectionquery.cpp +++ b/src/collection/collectionquery.cpp @@ -67,7 +67,7 @@ void CollectionQuery::AddWhere(const QString &column, const QVariant &value, con QStringList final_values; final_values.reserve(values.count()); for (const QString &single_value : values) { - final_values.append(QLatin1String("?")); + final_values.append(QStringLiteral("?")); bound_values_ << single_value; } diff --git a/src/collection/savedgroupingmanager.cpp b/src/collection/savedgroupingmanager.cpp index 01dc2030b..16028647d 100644 --- a/src/collection/savedgroupingmanager.cpp +++ b/src/collection/savedgroupingmanager.cpp @@ -165,7 +165,7 @@ void SavedGroupingManager::UpdateModel() { if (version == 1) { QStringList saved = s.childKeys(); for (int i = 0; i < saved.size(); ++i) { - if (saved.at(i) == QStringLiteral("version")) continue; + if (saved.at(i) == QLatin1String("version")) continue; QByteArray bytes = s.value(saved.at(i)).toByteArray(); QDataStream ds(&bytes, QIODevice::ReadOnly); CollectionModel::Grouping g; @@ -183,7 +183,7 @@ void SavedGroupingManager::UpdateModel() { else { QStringList saved = s.childKeys(); for (int i = 0; i < saved.size(); ++i) { - if (saved.at(i) == QStringLiteral("version")) continue; + if (saved.at(i) == QLatin1String("version")) continue; s.remove(saved.at(i)); } } diff --git a/src/context/contextview.cpp b/src/context/contextview.cpp index c34a51868..4e16a95d4 100644 --- a/src/context/contextview.cpp +++ b/src/context/contextview.cpp @@ -633,10 +633,10 @@ void ContextView::UpdateLyrics(const quint64 id, const QString &provider, const if (static_cast"); + text += QLatin1String("
"); text += tr("It is detected that Strawberry is running as a Snap"); - text += QStringLiteral("
"); + text += QLatin1String(""); - text += QStringLiteral(""); + text += QLatin1String("
"); 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 += QStringLiteral("
"); + text += QLatin1String(""); - text += QStringLiteral(""); - 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("
"); + text += QLatin1String(""); + 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("
"); - text += QStringLiteral(""); - text += tr("For Ubuntu there is an official PPA repository available at %1.").arg(QStringLiteral("https://launchpad.net/~jonaski/+archive/ubuntu/strawberry").arg(palette().text().color().name())); - text += QStringLiteral("
"); + text += QLatin1String(""); + text += tr("For Ubuntu there is an official PPA repository available at %1.").arg(QLatin1String("https://launchpad.net/~jonaski/+archive/ubuntu/strawberry").arg(palette().text().color().name())); + text += QLatin1String("
"); - text += QStringLiteral(""); + text += QLatin1String("
"); 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("https://www.strawberrymusicplayer.org/").arg(palette().text().color().name())); - text += QStringLiteral("
"); + text += QLatin1String(""); - text += QStringLiteral(""); + text += QLatin1String("
"); text += tr("For a better experience please consider the other options above."); - text += QStringLiteral("
"); + text += QLatin1String(""); - text += QStringLiteral(""); + text += QLatin1String("
");
text += tr("Copy your strawberry.conf and strawberry.db from your ~/snap directory to avoid losing configuration before you uninstall the snap:");
- text += QStringLiteral("
");
- text += QStringLiteral("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf
");
- text += QStringLiteral("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db
");
- text += QStringLiteral("
");
+ text += QLatin1String("
");
+ text += QLatin1String("cp ~/snap/strawberry/current/.config/strawberry/strawberry.conf ~/.config/strawberry/strawberry.conf
");
+ text += QLatin1String("cp ~/snap/strawberry/current/.local/share/strawberry/strawberry/strawberry.db ~/.local/share/strawberry/strawberry/strawberry.db
");
+ text += QLatin1String("
");
text += tr("Uninstall the snap with:");
- text += QStringLiteral("
");
- text += QStringLiteral("snap remove strawberry");
- text += QStringLiteral("
");
+ text += QLatin1String("
");
+ text += QLatin1String("snap remove strawberry");
+ text += QLatin1String("
");
text += tr("Install strawberry through PPA:");
- text += QStringLiteral("
");
- text += QStringLiteral("sudo add-apt-repository ppa:jonaski/strawberry
");
- text += QStringLiteral("sudo apt-get update
");
- text += QStringLiteral("sudo apt install strawberry");
- text += QStringLiteral("
") + + QLatin1String("
") + tr("Prefix a search term with a field name to limit the search to that field, e.g.:") + - QStringLiteral(" ") + - QStringLiteral("") + + QLatin1Char(' ') + + QLatin1String("") + tr("artist") + - QStringLiteral(":Strawbs ") + - tr("searches the playlist for all artists that contain the word %1. ").arg(QStringLiteral("Strawbs")) + - QStringLiteral("
") + + QLatin1String(":Strawbs ") + + tr("searches the playlist for all artists that contain the word %1. ").arg(QLatin1String("Strawbs")) + + QLatin1String("
") + tr("Search terms for numerical fields can be prefixed with %1 or %2 to refine the search, e.g.: ") - .arg(QLatin1String(" =, !=, <, >, <="), QStringLiteral(">=")) + - QStringLiteral("") + + .arg(QLatin1String(" =, !=, <, >, <="), QLatin1String(">=")) + + QLatin1String("") + tr("rating") + - QStringLiteral("") + - QStringLiteral(":>=") + - QStringLiteral("4") + - QStringLiteral("
") + + QLatin1String("") + + QLatin1String(":>=") + + QLatin1String("4") + + QLatin1String("
") + tr("Multiple search terms can also be combined with \"%1\" (default) and \"%2\", as well as grouped with parentheses. ") .arg(QLatin1String("AND"), QLatin1String("OR")) + - QStringLiteral("
") + + QLatin1String("
") + tr("Available fields") + - QStringLiteral(": ") + QStringLiteral("") + + QLatin1String(": ") + QLatin1String("") + available_fields + - QStringLiteral(".") + - QStringLiteral("
") + QLatin1String(".") + + QLatin1String("") ); diff --git a/src/playlist/playlistfilterparser.cpp b/src/playlist/playlistfilterparser.cpp index 95786eda4..7af170377 100644 --- a/src/playlist/playlistfilterparser.cpp +++ b/src/playlist/playlistfilterparser.cpp @@ -488,7 +488,7 @@ FilterTree *FilterParser::parseSearchTerm() { if (prefix.isEmpty() && (*iter_ == QLatin1Char('>') || *iter_ == QLatin1Char('<') || *iter_ == QLatin1Char('=') || *iter_ == QLatin1Char('!'))) { prefix += *iter_; } - else if (prefix != QLatin1String("=") && *iter_ == QLatin1Char('=')) { + else if (prefix != QLatin1Char('=') && *iter_ == QLatin1Char('=')) { prefix += *iter_; } else { @@ -510,7 +510,7 @@ FilterTree *FilterParser::parseSearchTerm() { FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QString &prefix, const QString &search) const { - if (search.isEmpty() && prefix != QLatin1String("=")) { + if (search.isEmpty() && prefix != QLatin1Char('=')) { return new NopFilter; } // here comes a mess :/ @@ -521,29 +521,29 @@ FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QSt if (columns_[col] == Playlist::Column_Rating) { float parsed_search = Utilities::ParseSearchRating(search); - if (prefix == QStringLiteral("=")) { + if (prefix == QLatin1Char('=')) { cmp = new FloatEqComparator(parsed_search); } - else if (prefix == QStringLiteral("!=") || prefix == QStringLiteral("<>")) { + else if (prefix == QLatin1String("!=") || prefix == QLatin1String("<>")) { cmp = new FloatNeComparator(parsed_search); } - else if (prefix == QStringLiteral(">")) { + else if (prefix == QLatin1Char('>')) { cmp = new FloatGtComparator(parsed_search); } - else if (prefix == QStringLiteral(">=")) { + else if (prefix == QLatin1String(">=")) { cmp = new FloatGeComparator(parsed_search); } - else if (prefix == QStringLiteral("<")) { + else if (prefix == QLatin1Char('<')) { cmp = new FloatLtComparator(parsed_search); } - else if (prefix == QStringLiteral("<=")) { + else if (prefix == QLatin1String("<=")) { cmp = new FloatLeComparator(parsed_search); } else { cmp = new FloatEqComparator(parsed_search); } } - else if (prefix == QStringLiteral("!=") || prefix == QStringLiteral("<>")) { + else if (prefix == QLatin1String("!=") || prefix == QLatin1String("<>")) { cmp = new NeComparator(search); } else if (!col.isEmpty() && columns_.contains(col) && numerical_columns_.contains(columns_[col])) { @@ -556,13 +556,13 @@ FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QSt search_value = search.toInt(); } // alright, back to deciding which comparator we'll use - if (prefix == QLatin1String(">")) { + if (prefix == QLatin1Char('>')) { cmp = new GtComparator(search_value); } else if (prefix == QLatin1String(">=")) { cmp = new GeComparator(search_value); } - else if (prefix == QLatin1String("<")) { + else if (prefix == QLatin1Char('<')) { cmp = new LtComparator(search_value); } else if (prefix == QLatin1String("<=")) { @@ -574,19 +574,19 @@ FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QSt } } else { - if (prefix == QStringLiteral("=")) { + if (prefix == QLatin1Char('=')) { cmp = new EqComparator(search); } - else if (prefix == QStringLiteral(">")) { + else if (prefix == QLatin1Char('>')) { cmp = new LexicalGtComparator(search); } - else if (prefix == QStringLiteral(">=")) { + else if (prefix == QLatin1String(">=")) { cmp = new LexicalGeComparator(search); } - else if (prefix == QStringLiteral("<")) { + else if (prefix == QLatin1Char('<')) { cmp = new LexicalLtComparator(search); } - else if (prefix == QStringLiteral("<=")) { + else if (prefix == QLatin1String("<=")) { cmp = new LexicalLeComparator(search); } else { diff --git a/src/playlist/playlistmanager.cpp b/src/playlist/playlistmanager.cpp index 8d4638e25..98ccb2d12 100644 --- a/src/playlist/playlistmanager.cpp +++ b/src/playlist/playlistmanager.cpp @@ -250,7 +250,7 @@ void PlaylistManager::SaveWithUI(const int id, const QString &playlist_name) { s.endGroup(); QString suggested_filename = playlist_name; - QString filename = last_save_path + QLatin1Char('/') + suggested_filename.remove(QRegularExpression(QLatin1String(kProblematicCharactersRegex), QRegularExpression::CaseInsensitiveOption)) + QStringLiteral(".") + last_save_extension; + QString filename = last_save_path + QLatin1Char('/') + suggested_filename.remove(QRegularExpression(QLatin1String(kProblematicCharactersRegex), QRegularExpression::CaseInsensitiveOption)) + QLatin1Char('.') + last_save_extension; QFileInfo fileinfo; forever { @@ -451,7 +451,7 @@ void PlaylistManager::UpdateSummaryText() { summary += tr("%n track(s)", "", tracks); if (nanoseconds > 0) { - summary += QStringLiteral(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QStringLiteral(" ]"); + summary += QLatin1String(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QLatin1String(" ]"); } emit SummaryTextChanged(summary); @@ -566,7 +566,7 @@ QString PlaylistManager::GetNameForNewPlaylist(const SongList &songs) { if (!various_artists && albums.size() == 1) { QStringList album_names = albums.values(); - result += QStringLiteral(" - ") + album_names.first(); + result += QLatin1String(" - ") + album_names.first(); } return result; diff --git a/src/playlistparsers/asxparser.cpp b/src/playlistparsers/asxparser.cpp index e690197a4..4247dd707 100644 --- a/src/playlistparsers/asxparser.cpp +++ b/src/playlistparsers/asxparser.cpp @@ -93,20 +93,20 @@ Song ASXParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const bool switch (type) { case QXmlStreamReader::StartElement:{ const QString name = reader->name().toString().toLower(); - if (name == QStringLiteral("ref")) { - ref = reader->attributes().value(QStringLiteral("href")).toString(); + if (name == QLatin1String("ref")) { + ref = reader->attributes().value(QLatin1String("href")).toString(); } - else if (name == QStringLiteral("title")) { + else if (name == QLatin1String("title")) { title = reader->readElementText(); } - else if (name == QStringLiteral("author")) { + else if (name == QLatin1String("author")) { artist = reader->readElementText(); } break; } case QXmlStreamReader::EndElement:{ const QString name = reader->name().toString().toLower(); - if (name == QStringLiteral("entry")) { + if (name == QLatin1String("entry")) { goto return_song; } break; @@ -138,16 +138,16 @@ void ASXParser::Save(const SongList &songs, QIODevice *device, const QDir&, cons writer.writeStartDocument(); { StreamElement asx(QStringLiteral("asx"), &writer); - writer.writeAttribute(QStringLiteral("version"), QStringLiteral("3.0")); + writer.writeAttribute(QLatin1String("version"), QLatin1String("3.0")); for (const Song &song : songs) { StreamElement entry(QStringLiteral("entry"), &writer); - writer.writeTextElement(QStringLiteral("title"), song.title()); + writer.writeTextElement(QLatin1String("title"), song.title()); { StreamElement ref(QStringLiteral("ref"), &writer); - writer.writeAttribute(QStringLiteral("href"), song.url().toString()); + writer.writeAttribute(QLatin1String("href"), song.url().toString()); } if (!song.artist().isEmpty()) { - writer.writeTextElement(QStringLiteral("author"), song.artist()); + writer.writeTextElement(QLatin1String("author"), song.artist()); } } } diff --git a/src/playlistparsers/wplparser.cpp b/src/playlistparsers/wplparser.cpp index 2246769ef..3078840dd 100644 --- a/src/playlistparsers/wplparser.cpp +++ b/src/playlistparsers/wplparser.cpp @@ -69,8 +69,8 @@ void WplParser::ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *so QString name = reader->name().toString(); switch (type) { case QXmlStreamReader::StartElement:{ - if (name == QStringLiteral("media")) { - QString src = reader->attributes().value(QStringLiteral("src")).toString(); + if (name == QLatin1String("media")) { + QString src = reader->attributes().value(QLatin1String("src")).toString(); if (!src.isEmpty()) { Song song = LoadSong(src, 0, 0, dir, collection_search); if (song.is_valid()) { @@ -84,7 +84,7 @@ void WplParser::ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *so break; } case QXmlStreamReader::EndElement:{ - if (name == QStringLiteral("seq")) { + if (name == QLatin1String("seq")) { return; } break; @@ -101,14 +101,14 @@ void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, QXmlStreamWriter writer(device); writer.setAutoFormatting(true); writer.setAutoFormattingIndent(2); - writer.writeProcessingInstruction(QStringLiteral("wpl"), QStringLiteral("version=\"1.0\"")); + writer.writeProcessingInstruction(QLatin1String("wpl"), QLatin1String("version=\"1.0\"")); StreamElement smil(QStringLiteral("smil"), &writer); { StreamElement head(QStringLiteral("head"), &writer); - WriteMeta(QStringLiteral("Generator"), QStringLiteral("Strawberry -- ") + QLatin1String(STRAWBERRY_VERSION_DISPLAY), &writer); - WriteMeta(QStringLiteral("ItemCount"), QString::number(songs.count()), &writer); + WriteMeta(QLatin1String("Generator"), QLatin1String("Strawberry -- ") + QLatin1String(STRAWBERRY_VERSION_DISPLAY), &writer); + WriteMeta(QLatin1String("ItemCount"), QString::number(songs.count()), &writer); } { @@ -116,8 +116,8 @@ void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, { StreamElement seq(QStringLiteral("seq"), &writer); for (const Song &song : songs) { - writer.writeStartElement(QStringLiteral("media")); - writer.writeAttribute(QStringLiteral("src"), URLOrFilename(song.url(), dir, path_type)); + writer.writeStartElement(QLatin1String("media")); + writer.writeAttribute(QLatin1String("src"), URLOrFilename(song.url(), dir, path_type)); writer.writeEndElement(); } } @@ -126,9 +126,9 @@ void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, void WplParser::WriteMeta(const QString &name, const QString &content, QXmlStreamWriter *writer) { - writer->writeStartElement(QStringLiteral("meta")); - writer->writeAttribute(QStringLiteral("name"), name); - writer->writeAttribute(QStringLiteral("content"), content); + writer->writeStartElement(QLatin1String("meta")); + writer->writeAttribute(QLatin1String("name"), name); + writer->writeAttribute(QLatin1String("content"), content); writer->writeEndElement(); } diff --git a/src/playlistparsers/xspfparser.cpp b/src/playlistparsers/xspfparser.cpp index 2f37c36f9..4afa864cb 100644 --- a/src/playlistparsers/xspfparser.cpp +++ b/src/playlistparsers/xspfparser.cpp @@ -74,22 +74,22 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo QString name = reader->name().toString(); switch (type) { case QXmlStreamReader::StartElement:{ - if (name == QStringLiteral("location")) { + if (name == QLatin1String("location")) { location = QUrl::fromPercentEncoding(reader->readElementText().toUtf8()); } - else if (name == QStringLiteral("title")) { + else if (name == QLatin1String("title")) { title = reader->readElementText(); } - else if (name == QStringLiteral("creator")) { + else if (name == QLatin1String("creator")) { artist = reader->readElementText(); } - else if (name == QStringLiteral("album")) { + else if (name == QLatin1String("album")) { album = reader->readElementText(); } - else if (name == QStringLiteral("image")) { + else if (name == QLatin1String("image")) { art = QUrl::fromPercentEncoding(reader->readElementText().toUtf8()); } - else if (name == QStringLiteral("duration")) { // in milliseconds. + else if (name == QLatin1String("duration")) { // in milliseconds. const QString duration = reader->readElementText(); bool ok = false; nanosec = duration.toInt(&ok) * kNsecPerMsec; @@ -97,7 +97,7 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo nanosec = -1; } } - else if (name == QStringLiteral("trackNum")) { + else if (name == QLatin1String("trackNum")) { const QString track_num_str = reader->readElementText(); bool ok = false; track_num = track_num_str.toInt(&ok); @@ -105,13 +105,13 @@ Song XSPFParser::ParseTrack(QXmlStreamReader *reader, const QDir &dir, const boo track_num = -1; } } - else if (name == QStringLiteral("info")) { + else if (name == QLatin1String("info")) { // TODO: Do something with extra info? } break; } case QXmlStreamReader::EndElement:{ - if (name == QStringLiteral("track")) { + if (name == QLatin1String("track")) { goto return_song; } } @@ -144,8 +144,8 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, writer.setAutoFormattingIndent(2); writer.writeStartDocument(); StreamElement playlist(QStringLiteral("playlist"), &writer); - writer.writeAttribute(QStringLiteral("version"), QStringLiteral("1")); - writer.writeDefaultNamespace(QStringLiteral("http://xspf.org/ns/0/")); + writer.writeAttribute(QLatin1String("version"), QLatin1String("1")); + writer.writeDefaultNamespace(QLatin1String("http://xspf.org/ns/0/")); Settings s; s.beginGroup(PlaylistSettingsPage::kSettingsGroup); @@ -157,23 +157,23 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, QString filename_or_url = QString::fromLatin1(QUrl::toPercentEncoding(URLOrFilename(song.url(), dir, path_type), "/ ")); StreamElement track(QStringLiteral("track"), &writer); - writer.writeTextElement(QStringLiteral("location"), filename_or_url); + writer.writeTextElement(QLatin1String("location"), filename_or_url); if (write_metadata || (song.is_stream() && !song.is_radio())) { - writer.writeTextElement(QStringLiteral("title"), song.title()); + writer.writeTextElement(QLatin1String("title"), song.title()); if (!song.artist().isEmpty()) { - writer.writeTextElement(QStringLiteral("creator"), song.artist()); + writer.writeTextElement(QLatin1String("creator"), song.artist()); } if (!song.album().isEmpty()) { - writer.writeTextElement(QStringLiteral("album"), song.album()); + writer.writeTextElement(QLatin1String("album"), song.album()); } if (song.length_nanosec() != -1) { - writer.writeTextElement(QStringLiteral("duration"), QString::number(song.length_nanosec() / kNsecPerMsec)); + writer.writeTextElement(QLatin1String("duration"), QString::number(song.length_nanosec() / kNsecPerMsec)); } } if ((write_metadata || song.has_cue() || (song.is_stream() && !song.is_radio())) && song.track() > 0) { - writer.writeTextElement(QStringLiteral("trackNum"), QString::number(song.track())); + writer.writeTextElement(QLatin1String("trackNum"), QString::number(song.track())); } if (write_metadata || (song.is_stream() && !song.is_radio())) { @@ -181,7 +181,7 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, // Ignore images that are in our resource bundle. if (!cover_url.isEmpty() && cover_url.isValid()) { const QString cover_filename = QString::fromLatin1(QUrl::toPercentEncoding(URLOrFilename(cover_url, dir, path_type), "/ ")); - writer.writeTextElement(QStringLiteral("image"), cover_filename); + writer.writeTextElement(QLatin1String("image"), cover_filename); } } } diff --git a/src/qobuz/qobuzstreamurlrequest.cpp b/src/qobuz/qobuzstreamurlrequest.cpp index 539553eda..7965a76a1 100644 --- a/src/qobuz/qobuzstreamurlrequest.cpp +++ b/src/qobuz/qobuzstreamurlrequest.cpp @@ -121,7 +121,7 @@ void QobuzStreamURLRequest::GetStreamURL() { std::sort(params_to_sign.begin(), params_to_sign.end()); QString data_to_sign; - data_to_sign += QStringLiteral("trackgetFileUrl"); + data_to_sign += QLatin1String("trackgetFileUrl"); for (const Param ¶m : params_to_sign) { data_to_sign += param.first + param.second; } diff --git a/src/queue/queue.cpp b/src/queue/queue.cpp index f202ef3b0..f44c9b80c 100644 --- a/src/queue/queue.cpp +++ b/src/queue/queue.cpp @@ -255,7 +255,7 @@ void Queue::UpdateSummaryText() { summary += tr("%n track(s)", "", tracks); if (nanoseconds > 0) { - summary += QStringLiteral(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QStringLiteral(" ]"); + summary += QLatin1String(" - [ ") + Utilities::WordyTimeNanosec(nanoseconds) + QLatin1String(" ]"); } emit SummaryTextChanged(summary); diff --git a/src/radios/radiomodel.cpp b/src/radios/radiomodel.cpp index e36b2a03f..c22d9441f 100644 --- a/src/radios/radiomodel.cpp +++ b/src/radios/radiomodel.cpp @@ -177,7 +177,7 @@ void RadioModel::AddChannels(const RadioChannelList &channels) { RadioItem *item = new RadioItem(RadioItem::Type::Channel, container); item->source = channel.source; item->display_text = channel.name; - item->sort_text = SortText(Song::TextForSource(channel.source) + QStringLiteral(" - ") + channel.name); + item->sort_text = SortText(Song::TextForSource(channel.source) + QLatin1String(" - ") + channel.name); item->channel = channel; items_ << item; endInsertRows(); @@ -325,7 +325,7 @@ void RadioModel::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult QString RadioModel::SortText(QString text) { if (text.isEmpty()) { - text = QStringLiteral(" unknown"); + text = QLatin1String(" unknown"); } else { text = text.toLower(); diff --git a/src/radios/radioparadiseservice.cpp b/src/radios/radioparadiseservice.cpp index 0c099a318..49a239f87 100644 --- a/src/radios/radioparadiseservice.cpp +++ b/src/radios/radioparadiseservice.cpp @@ -110,11 +110,11 @@ void RadioParadiseService::GetChannelsReply(QNetworkReply *reply, const int task QString label = obj_stream[QLatin1String("label")].toString(); QString url = obj_stream[QLatin1String("url")].toString(); if (!url.contains(QRegularExpression(QStringLiteral("^[0-9a-zA-Z]*:\\/\\/"), QRegularExpression::CaseInsensitiveOption))) { - url.prepend(QStringLiteral("https://")); + url.prepend(QLatin1String("https://")); } RadioChannel channel; channel.source = source_; - channel.name = name + QStringLiteral(" - ") + label; + channel.name = name + QLatin1String(" - ") + label; channel.url.setUrl(url); channels << channel; } diff --git a/src/radios/somafmservice.cpp b/src/radios/somafmservice.cpp index 4d8088999..b62439a24 100644 --- a/src/radios/somafmservice.cpp +++ b/src/radios/somafmservice.cpp @@ -112,7 +112,7 @@ void SomaFMService::GetChannelsReply(QNetworkReply *reply, const int task_id) { } RadioChannel channel; QString quality = obj_playlist[QLatin1String("quality")].toString(); - if (quality != QStringLiteral("highest")) continue; + if (quality != QLatin1String("highest")) continue; channel.source = source_; channel.name = name; channel.url.setUrl(obj_playlist[QLatin1String("url")].toString()); diff --git a/src/settings/globalshortcutssettingspage.cpp b/src/settings/globalshortcutssettingspage.cpp index 4e00843fb..2eff76396 100644 --- a/src/settings/globalshortcutssettingspage.cpp +++ b/src/settings/globalshortcutssettingspage.cpp @@ -260,7 +260,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(QStringLiteral("gnome-keybinding-properties"))); + QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QLatin1String("gnome-keybinding-properties"))); } } @@ -270,7 +270,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(QStringLiteral("mate-keybinding-properties"))); + QMessageBox::warning(this, QStringLiteral("Error"), tr("The \"%1\" command could not be started.").arg(QLatin1String("mate-keybinding-properties"))); } } @@ -345,18 +345,18 @@ void GlobalShortcutsSettingsPage::ChangeClicked() { void GlobalShortcutsSettingsPage::X11Warning() { QString de = de_.toLower(); - if (de == QStringLiteral("kde") || de == QStringLiteral("gnome") || de == QStringLiteral("x-cinnamon") || de == QStringLiteral("mate")) { + if (de == QLatin1String("kde") || de == QLatin1String("gnome") || de == QLatin1String("x-cinnamon") || de == QLatin1String("mate")) { QString text(tr("Using X11 shortcuts on %1 is not recommended and can cause keyboard to become unresponsive!").arg(de_)); - if (de == QStringLiteral("kde")) { + if (de == QLatin1String("kde")) { text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_); } - else if (de == QStringLiteral("gnome")) { + else if (de == QLatin1String("gnome")) { 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 == QStringLiteral("x-cinnamon")) { + else if (de == QLatin1String("x-cinnamon")) { 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 == QStringLiteral("mate")) { + else if (de == QLatin1String("mate")) { 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); diff --git a/src/smartplaylists/smartplaylistsearch.cpp b/src/smartplaylists/smartplaylistsearch.cpp index 45460a962..963428c4d 100644 --- a/src/smartplaylists/smartplaylistsearch.cpp +++ b/src/smartplaylists/smartplaylistsearch.cpp @@ -62,7 +62,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const { } if (!terms_.isEmpty() && search_type_ != SearchType::All) { - QString boolean_op = search_type_ == SearchType::And ? QStringLiteral(" AND ") : QStringLiteral(" OR "); + QString boolean_op = search_type_ == SearchType::And ? QLatin1String(" AND ") : QLatin1String(" OR "); where_clauses << QStringLiteral("(") + term_where_clauses.join(boolean_op) + QStringLiteral(")"); } @@ -80,7 +80,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const { where_clauses << QStringLiteral("unavailable = 0"); if (!where_clauses.isEmpty()) { - sql += QStringLiteral(" WHERE ") + where_clauses.join(QLatin1String(" AND ")); + sql += QLatin1String(" WHERE ") + where_clauses.join(QLatin1String(" AND ")); } // Add sort by @@ -88,7 +88,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const { sql += QLatin1String(" ORDER BY random()"); } else { - sql += QStringLiteral(" ORDER BY ") + SmartPlaylistSearchTerm::FieldColumnName(sort_field_) + (sort_type_ == SortType::FieldAsc ? QStringLiteral(" ASC") : QStringLiteral(" DESC")); + sql += QLatin1String(" ORDER BY ") + SmartPlaylistSearchTerm::FieldColumnName(sort_field_) + (sort_type_ == SortType::FieldAsc ? QLatin1String(" ASC") : QLatin1String(" DESC")); } // Add limit @@ -96,7 +96,7 @@ QString SmartPlaylistSearch::ToSql(const QString &songs_table) const { sql += QStringLiteral(" LIMIT %1 OFFSET %2").arg(limit_).arg(first_item_); } else if (limit_ != -1) { - sql += QStringLiteral(" LIMIT ") + QString::number(limit_); + sql += QLatin1String(" LIMIT ") + QString::number(limit_); } //qLog(Debug) << sql; diff --git a/src/smartplaylists/smartplaylistsearchterm.cpp b/src/smartplaylists/smartplaylistsearchterm.cpp index afb7b50ae..749e1a270 100644 --- a/src/smartplaylists/smartplaylistsearchterm.cpp +++ b/src/smartplaylists/smartplaylistsearchterm.cpp @@ -62,12 +62,12 @@ QString SmartPlaylistSearchTerm::ToSql() const { if (TypeOf(field_) == Type::Date) { if (special_date_query) { // We have a numeric date, consider also the time for more precision - col = QStringLiteral("DATETIME(") + col + QStringLiteral(", 'unixepoch', 'localtime')"); + col = QLatin1String("DATETIME(") + col + QLatin1String(", 'unixepoch', 'localtime')"); second_value = second_value_.toString(); second_value.replace(QLatin1Char('\''), QLatin1String("''")); - if (date == QStringLiteral("weeks")) { + if (date == QLatin1String("weeks")) { // Sqlite doesn't know weeks, transform them to days - date = QStringLiteral("days"); + date = QLatin1String("days"); value = QString::number(value_.toInt() * 7); second_value = QString::number(second_value_.toInt() * 7); } @@ -76,13 +76,13 @@ QString SmartPlaylistSearchTerm::ToSql() const { // We have the exact date // The calendar widget specifies no time so ditch the possible time part // from integers representing the dates. - col = QStringLiteral("DATE(") + col + QStringLiteral(", 'unixepoch', 'localtime')"); - value = QStringLiteral("DATE(") + value + QStringLiteral(", 'unixepoch', 'localtime')"); + col = QLatin1String("DATE(") + col + QLatin1String(", 'unixepoch', 'localtime')"); + value = QLatin1String("DATE(") + value + QLatin1String(", 'unixepoch', 'localtime')"); } } else if (TypeOf(field_) == Type::Time) { // Convert seconds to nanoseconds - value = QStringLiteral("CAST (") + value + QStringLiteral(" *1000000000 AS INTEGER)"); + value = QLatin1String("CAST (") + value + QLatin1String(" *1000000000 AS INTEGER)"); } // File paths need some extra processing since they are stored as encoded urls in the database. @@ -95,61 +95,61 @@ QString SmartPlaylistSearchTerm::ToSql() const { } } else if (TypeOf(field_) == Type::Rating) { - col = QStringLiteral("CAST ((replace(") + col + QStringLiteral(", -1, 0) + 0.05) * 10 AS INTEGER)"); - value = QStringLiteral("CAST ((") + value + QStringLiteral(" + 0.05) * 10 AS INTEGER)"); + col = QLatin1String("CAST ((replace(") + col + QLatin1String(", -1, 0) + 0.05) * 10 AS INTEGER)"); + value = QLatin1String("CAST ((") + value + QLatin1String(" + 0.05) * 10 AS INTEGER)"); } switch (operator_) { case Operator::Contains: - return col + QStringLiteral(" LIKE '%") + value + QStringLiteral("%'"); + return col + QLatin1String(" LIKE '%") + value + QLatin1String("%'"); case Operator::NotContains: - return col + QStringLiteral(" NOT LIKE '%") + value + QStringLiteral("%'"); + return col + QLatin1String(" NOT LIKE '%") + value + QLatin1String("%'"); case Operator::StartsWith: - return col + QStringLiteral(" LIKE '") + value + QStringLiteral("%'"); + return col + QLatin1String(" LIKE '") + value + QLatin1String("%'"); case Operator::EndsWith: - return col + QStringLiteral(" LIKE '%") + value + QLatin1Char('\''); + return col + QLatin1String(" LIKE '%") + value + QLatin1Char('\''); case Operator::Equals: if (TypeOf(field_) == Type::Text) { - return col + QStringLiteral(" LIKE '") + value + QLatin1Char('\''); + return col + QLatin1String(" LIKE '") + value + QLatin1Char('\''); } else if (TypeOf(field_) == Type::Date || TypeOf(field_) == Type::Time || TypeOf(field_) == Type::Rating) { - return col + QStringLiteral(" = ") + value; + return col + QLatin1String(" = ") + value; } else { - return col + QStringLiteral(" = '") + value + QLatin1Char('\''); + return col + QLatin1String(" = '") + value + QLatin1Char('\''); } case Operator::GreaterThan: if (TypeOf(field_) == Type::Date || TypeOf(field_) == Type::Time || TypeOf(field_) == Type::Rating) { - return col + QStringLiteral(" > ") + value; + return col + QLatin1String(" > ") + value; } else { - return col + QStringLiteral(" > '") + value + QLatin1Char('\''); + return col + QLatin1String(" > '") + value + QLatin1Char('\''); } case Operator::LessThan: if (TypeOf(field_) == Type::Date || TypeOf(field_) == Type::Time || TypeOf(field_) == Type::Rating) { - return col + QStringLiteral(" < ") + value; + return col + QLatin1String(" < ") + value; } else { - return col + QStringLiteral(" < '") + value + QLatin1Char('\''); + return col + QLatin1String(" < '") + value + QLatin1Char('\''); } case Operator::NumericDate: - return col + QStringLiteral(" > ") + QStringLiteral("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime')"); + return col + QLatin1String(" > ") + QLatin1String("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QLatin1String("', 'localtime')"); case Operator::NumericDateNot: - return col + QStringLiteral(" < ") + QStringLiteral("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime')"); + return col + QLatin1String(" < ") + QLatin1String("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QLatin1String("', 'localtime')"); case Operator::RelativeDate: // Consider the time range before the first date but after the second one - return QStringLiteral("(") + col + QStringLiteral(" < ") + QStringLiteral("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime') AND ") + col + QStringLiteral(" > ") + QStringLiteral("DATETIME('now', '-") + second_value + QLatin1Char(' ') + date + QStringLiteral("', 'localtime'))"); + return QLatin1String("(") + col + QLatin1String(" < ") + QLatin1String("DATETIME('now', '-") + value + QLatin1Char(' ') + date + QLatin1String("', 'localtime') AND ") + col + QLatin1String(" > ") + QLatin1String("DATETIME('now', '-") + second_value + QLatin1Char(' ') + date + QLatin1String("', 'localtime'))"); case Operator::NotEquals: if (TypeOf(field_) == Type::Text) { - return col + QStringLiteral(" <> '") + value + QLatin1Char('\''); + return col + QLatin1String(" <> '") + value + QLatin1Char('\''); } else { - return col + QStringLiteral(" <> ") + value; + return col + QLatin1String(" <> ") + value; } case Operator::Empty: - return col + QStringLiteral(" = ''"); + return col + QLatin1String(" = ''"); case Operator::NotEmpty: - return col + QStringLiteral(" <> ''"); + return col + QLatin1String(" <> ''"); } return QString(); diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index d9e0ae44e..b3cc56759 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -95,8 +95,8 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co if (mime_type.isEmpty()) return nullptr; // HACK: Force mp4mux because it doesn't set any useful src caps - if (mime_type == QStringLiteral("audio/mp4")) { - emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(QStringLiteral("mp4mux")).arg(-1)); + if (mime_type == QLatin1String("audio/mp4")) { + emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(QLatin1String("mp4mux")).arg(-1)); return CreateElement(QStringLiteral("mp4mux"), bin); } @@ -153,7 +153,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_)); - if (best.name_ == QStringLiteral("lamemp3enc")) { + if (best.name_ == QLatin1String("lamemp3enc")) { // Special case: we need to add xingmux and id3v2mux to the pipeline when using lamemp3enc because it doesn't write the VBR or ID3v2 headers itself. emit LogLine(QStringLiteral("Adding xingmux and id3v2mux to the pipeline")); @@ -214,7 +214,7 @@ Transcoder::Transcoder(QObject *parent, const QString &settings_postfix) // Initialize some settings for the lamemp3enc element. Settings s; - s.beginGroup(QStringLiteral("Transcoder/lamemp3enc") + settings_postfix_); + s.beginGroup(QLatin1String("Transcoder/lamemp3enc") + settings_postfix_); if (s.value("target").isNull()) { s.setValue("target", 1); // 1 == bitrate @@ -298,7 +298,7 @@ QString Transcoder::GetFile(const QString &input, const TranscoderPreset &preset if (!fileinfo_output.isFile() || fileinfo_output.filePath().isEmpty() || fileinfo_output.path().isEmpty() || fileinfo_output.fileName().isEmpty() || fileinfo_output.suffix().isEmpty()) { QFileInfo fileinfo_input(input); - QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/transcoder"); + QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1String("/transcoder"); if (!QDir(temp_dir).exists()) QDir().mkpath(temp_dir); QString filename = fileinfo_input.completeBaseName() + QLatin1Char('.') + preset.extension_; fileinfo_output.setFile(temp_dir + QLatin1Char('/') + filename); @@ -569,7 +569,7 @@ QMap