Replace QStringLiteral with QLatin1String

This commit is contained in:
Jonas Kvinge
2024-06-12 20:30:36 +02:00
parent 20595a11bc
commit 5451c110b1
64 changed files with 367 additions and 366 deletions

View File

@@ -126,33 +126,33 @@ PlaylistContainer::PlaylistContainer(QWidget *parent)
QString available_fields = PlaylistFilter().column_names().keys().join(QLatin1String(", "));
ui_->search_field->setToolTip(
QStringLiteral("<html><head/><body><p>") +
QLatin1String("<html><head/><body><p>") +
tr("Prefix a search term with a field name to limit the search to that field, e.g.:") +
QStringLiteral(" ") +
QStringLiteral("<span style=\"font-weight:600;\">") +
QLatin1Char(' ') +
QLatin1String("<span style=\"font-weight:600;\">") +
tr("artist") +
QStringLiteral(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the playlist for all artists that contain the word %1. ").arg(QStringLiteral("Strawbs")) +
QStringLiteral("</p><p>") +
QLatin1String(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the playlist for all artists that contain the word %1. ").arg(QLatin1String("Strawbs")) +
QLatin1String("</p><p>") +
tr("Search terms for numerical fields can be prefixed with %1 or %2 to refine the search, e.g.: ")
.arg(QLatin1String(" =, !=, &lt;, &gt;, &lt;="), QStringLiteral("&gt;=")) +
QStringLiteral("<span style=\"font-weight:600;\">") +
.arg(QLatin1String(" =, !=, &lt;, &gt;, &lt;="), QLatin1String("&gt;=")) +
QLatin1String("<span style=\"font-weight:600;\">") +
tr("rating") +
QStringLiteral("</span>") +
QStringLiteral(":>=") +
QStringLiteral("<span style=\"font-weight:italic;\">4</span>") +
QStringLiteral("</p><p>") +
QLatin1String("</span>") +
QLatin1String(":>=") +
QLatin1String("<span style=\"font-weight:italic;\">4</span>") +
QLatin1String("</p><p>") +
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("</p><p><span style=\"font-weight:600;\">") +
QLatin1String("</p><p><span style=\"font-weight:600;\">") +
tr("Available fields") +
QStringLiteral(": ") + QStringLiteral("</span><span style=\"font-style:italic;\">") +
QLatin1String(": ") + QLatin1String("</span><span style=\"font-style:italic;\">") +
available_fields +
QStringLiteral("</span>.") +
QStringLiteral("</p></body></html>")
QLatin1String("</span>.") +
QLatin1String("</p></body></html>")
);

View File

@@ -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 {

View File

@@ -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;