Replace QStringLiteral with QLatin1String
This commit is contained in:
@@ -1103,7 +1103,7 @@ SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QS
|
||||
QMutexLocker l(db_->Mutex());
|
||||
QSqlDatabase db(db_->Connect());
|
||||
|
||||
QString in = ids.join(QStringLiteral(","));
|
||||
QString in = ids.join(QLatin1Char(','));
|
||||
|
||||
SqlQuery q(db);
|
||||
q.prepare(QStringLiteral("SELECT %3.ROWID, %2, %3.%4 FROM %3, %1 WHERE %3.%4 IN (in) AND %1.ROWID = %3.ROWID AND unavailable = 0").arg(songs_table_, Song::kColumnSpec, table, column, in));
|
||||
@@ -1134,7 +1134,7 @@ Song CollectionBackend::GetSongById(const int id, QSqlDatabase &db) {
|
||||
|
||||
SongList CollectionBackend::GetSongsById(const QStringList &ids, QSqlDatabase &db) {
|
||||
|
||||
QString in = ids.join(QStringLiteral(","));
|
||||
QString in = ids.join(QLatin1Char(','));
|
||||
|
||||
SqlQuery q(db);
|
||||
q.prepare(QStringLiteral("SELECT %1 FROM %2 WHERE ROWID IN (%3)").arg(Song::kRowIdColumnSpec, songs_table_, in));
|
||||
@@ -1885,7 +1885,7 @@ bool CollectionBackend::ResetPlayStatistics(const QStringList &id_str_list) {
|
||||
|
||||
SqlQuery q(db);
|
||||
q.prepare(QStringLiteral("UPDATE %1 SET playcount = 0, skipcount = 0, lastplayed = -1 WHERE ROWID IN (:ids)").arg(songs_table_));
|
||||
q.BindValue(QStringLiteral(":ids"), id_str_list.join(QStringLiteral(",")));
|
||||
q.BindValue(QStringLiteral(":ids"), id_str_list.join(QLatin1Char(',')));
|
||||
if (!q.Exec()) {
|
||||
db_->ReportErrors(q);
|
||||
return false;
|
||||
@@ -2063,7 +2063,7 @@ void CollectionBackend::UpdateSongsRating(const QList<int> &id_list, const float
|
||||
for (int i : id_list) {
|
||||
id_str_list << QString::number(i);
|
||||
}
|
||||
QString ids = id_str_list.join(QStringLiteral(","));
|
||||
QString ids = id_str_list.join(QLatin1Char(','));
|
||||
SqlQuery q(db);
|
||||
q.prepare(QStringLiteral("UPDATE %1 SET rating = :rating WHERE ROWID IN (%2)").arg(songs_table_, ids));
|
||||
q.BindValue(QStringLiteral(":rating"), rating);
|
||||
|
||||
@@ -140,11 +140,11 @@ bool CollectionFilter::filterAcceptsRow(const int source_row, const QModelIndex
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (field.compare(QStringLiteral("length"), Qt::CaseInsensitive) == 0) {
|
||||
else if (field.compare(QLatin1String("length"), Qt::CaseInsensitive) == 0) {
|
||||
filters.insert(field, Filter(field, static_cast<qint64>(Utilities::ParseSearchTime(value)) * kNsecPerSec, foperator));
|
||||
continue;
|
||||
}
|
||||
else if (field.compare(QStringLiteral("rating"), Qt::CaseInsensitive) == 0) {
|
||||
else if (field.compare(QLatin1String("rating"), Qt::CaseInsensitive) == 0) {
|
||||
filters.insert(field, Filter(field, Utilities::ParseSearchRating(value), foperator));
|
||||
}
|
||||
}
|
||||
@@ -218,24 +218,24 @@ bool CollectionFilter::ItemMetadataMatchesFilterText(const Song &metadata, const
|
||||
|
||||
QVariant CollectionFilter::DataFromField(const QString &field, const Song &metadata) {
|
||||
|
||||
if (field == QStringLiteral("albumartist")) return metadata.effective_albumartist();
|
||||
if (field == QStringLiteral("artist")) return metadata.artist();
|
||||
if (field == QStringLiteral("album")) return metadata.album();
|
||||
if (field == QStringLiteral("title")) return metadata.title();
|
||||
if (field == QStringLiteral("composer")) return metadata.composer();
|
||||
if (field == QStringLiteral("performer")) return metadata.performer();
|
||||
if (field == QStringLiteral("grouping")) return metadata.grouping();
|
||||
if (field == QStringLiteral("genre")) return metadata.genre();
|
||||
if (field == QStringLiteral("comment")) return metadata.comment();
|
||||
if (field == QStringLiteral("track")) return metadata.track();
|
||||
if (field == QStringLiteral("year")) return metadata.year();
|
||||
if (field == QStringLiteral("length")) return metadata.length_nanosec();
|
||||
if (field == QStringLiteral("samplerate")) return metadata.samplerate();
|
||||
if (field == QStringLiteral("bitdepth")) return metadata.bitdepth();
|
||||
if (field == QStringLiteral("bitrate")) return metadata.bitrate();
|
||||
if (field == QStringLiteral("rating")) return metadata.rating();
|
||||
if (field == QStringLiteral("playcount")) return metadata.playcount();
|
||||
if (field == QStringLiteral("skipcount")) return metadata.skipcount();
|
||||
if (field == QLatin1String("albumartist")) return metadata.effective_albumartist();
|
||||
if (field == QLatin1String("artist")) return metadata.artist();
|
||||
if (field == QLatin1String("album")) return metadata.album();
|
||||
if (field == QLatin1String("title")) return metadata.title();
|
||||
if (field == QLatin1String("composer")) return metadata.composer();
|
||||
if (field == QLatin1String("performer")) return metadata.performer();
|
||||
if (field == QLatin1String("grouping")) return metadata.grouping();
|
||||
if (field == QLatin1String("genre")) return metadata.genre();
|
||||
if (field == QLatin1String("comment")) return metadata.comment();
|
||||
if (field == QLatin1String("track")) return metadata.track();
|
||||
if (field == QLatin1String("year")) return metadata.year();
|
||||
if (field == QLatin1String("length")) return metadata.length_nanosec();
|
||||
if (field == QLatin1String("samplerate")) return metadata.samplerate();
|
||||
if (field == QLatin1String("bitdepth")) return metadata.bitdepth();
|
||||
if (field == QLatin1String("bitrate")) return metadata.bitrate();
|
||||
if (field == QLatin1String("rating")) return metadata.rating();
|
||||
if (field == QLatin1String("playcount")) return metadata.playcount();
|
||||
if (field == QLatin1String("skipcount")) return metadata.skipcount();
|
||||
|
||||
return QVariant();
|
||||
|
||||
@@ -277,22 +277,22 @@ bool CollectionFilter::FieldValueMatchesData(const QVariant &value, const QVaria
|
||||
template<typename T>
|
||||
bool CollectionFilter::FieldNumericalValueMatchesData(const T value, const QString &foperator, const T data) {
|
||||
|
||||
if (foperator == QStringLiteral("=") || foperator == QStringLiteral("==")) {
|
||||
if (foperator == QLatin1Char('=') || foperator == QLatin1String("==")) {
|
||||
return data == value;
|
||||
}
|
||||
else if (foperator == QStringLiteral("!=") || foperator == QStringLiteral("<>")) {
|
||||
else if (foperator == QLatin1String("!=") || foperator == QLatin1String("<>")) {
|
||||
return data != value;
|
||||
}
|
||||
else if (foperator == QStringLiteral("<")) {
|
||||
else if (foperator == QLatin1Char('<')) {
|
||||
return data < value;
|
||||
}
|
||||
else if (foperator == QStringLiteral(">")) {
|
||||
else if (foperator == QLatin1Char('>')) {
|
||||
return data > value;
|
||||
}
|
||||
else if (foperator == QStringLiteral(">=")) {
|
||||
else if (foperator == QLatin1String(">=")) {
|
||||
return data >= value;
|
||||
}
|
||||
else if (foperator == QStringLiteral("<=")) {
|
||||
else if (foperator == QLatin1String("<=")) {
|
||||
return data <= value;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
|
||||
|
||||
ui_->setupUi(this);
|
||||
|
||||
QString available_fields = Song::kTextSearchColumns.join(QStringLiteral(", "));
|
||||
available_fields += QStringLiteral(", ") + Song::kNumericalSearchColumns.join(QStringLiteral(", "));
|
||||
QString available_fields = Song::kTextSearchColumns.join(QLatin1String(", "));
|
||||
available_fields += QLatin1String(", ") + Song::kNumericalSearchColumns.join(QLatin1String(", "));
|
||||
|
||||
ui_->search_field->setToolTip(
|
||||
QStringLiteral("<html><head/><body><p>") +
|
||||
|
||||
@@ -62,12 +62,12 @@ CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_ta
|
||||
void CollectionQuery::AddWhere(const QString &column, const QVariant &value, const QString &op) {
|
||||
|
||||
// Ignore 'literal' for IN
|
||||
if (op.compare(QStringLiteral("IN"), Qt::CaseInsensitive) == 0) {
|
||||
if (op.compare(QLatin1String("IN"), Qt::CaseInsensitive) == 0) {
|
||||
QStringList values = value.toStringList();
|
||||
QStringList final_values;
|
||||
final_values.reserve(values.count());
|
||||
for (const QString &single_value : values) {
|
||||
final_values.append(QStringLiteral("?"));
|
||||
final_values.append(QLatin1String("?"));
|
||||
bound_values_ << single_value;
|
||||
}
|
||||
|
||||
@@ -124,13 +124,13 @@ bool CollectionQuery::Exec() {
|
||||
where_clauses << QStringLiteral("unavailable = 0");
|
||||
}
|
||||
|
||||
if (!where_clauses.isEmpty()) sql += QStringLiteral(" WHERE ") + where_clauses.join(QStringLiteral(" AND "));
|
||||
if (!where_clauses.isEmpty()) sql += QLatin1String(" WHERE ") + where_clauses.join(QLatin1String(" AND "));
|
||||
|
||||
if (!order_by_.isEmpty()) sql += QStringLiteral(" ORDER BY ") + order_by_;
|
||||
if (!order_by_.isEmpty()) sql += QLatin1String(" ORDER BY ") + order_by_;
|
||||
|
||||
if (limit_ != -1) sql += QStringLiteral(" LIMIT ") + QString::number(limit_);
|
||||
if (limit_ != -1) sql += QLatin1String(" LIMIT ") + QString::number(limit_);
|
||||
|
||||
sql.replace(QStringLiteral("%songs_table"), songs_table_);
|
||||
sql.replace(QLatin1String("%songs_table"), songs_table_);
|
||||
|
||||
if (!QSqlQuery::prepare(sql)) return false;
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
|
||||
else {
|
||||
QString ext_part(ExtensionPart(child));
|
||||
QString dir_part(DirectoryPart(child));
|
||||
if (kIgnoredExtensions.contains(child_info.suffix(), Qt::CaseInsensitive) || child_info.baseName() == QStringLiteral("qt_temp")) {
|
||||
if (kIgnoredExtensions.contains(child_info.suffix(), Qt::CaseInsensitive) || child_info.baseName() == QLatin1String("qt_temp")) {
|
||||
t->AddToProgress(1);
|
||||
}
|
||||
else if (sValidImages.contains(ext_part)) {
|
||||
@@ -613,7 +613,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
|
||||
Chromaprinter chromaprinter(file);
|
||||
fingerprint = chromaprinter.CreateFingerprint();
|
||||
if (fingerprint.isEmpty()) {
|
||||
fingerprint = QStringLiteral("NONE");
|
||||
fingerprint = QLatin1String("NONE");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -640,11 +640,11 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
|
||||
Chromaprinter chromaprinter(file);
|
||||
fingerprint = chromaprinter.CreateFingerprint();
|
||||
if (fingerprint.isEmpty()) {
|
||||
fingerprint = QStringLiteral("NONE");
|
||||
fingerprint = QLatin1String("NONE");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (song_tracking_ && !fingerprint.isEmpty() && fingerprint != QStringLiteral("NONE") && FindSongsByFingerprint(file, fingerprint, &matching_songs)) {
|
||||
if (song_tracking_ && !fingerprint.isEmpty() && fingerprint != QLatin1String("NONE") && FindSongsByFingerprint(file, fingerprint, &matching_songs)) {
|
||||
|
||||
// The song is in the database and still on disk.
|
||||
// Check the mtime to see if it's been changed since it was added.
|
||||
@@ -936,7 +936,7 @@ void CollectionWatcher::AddChangedSong(const QString &file, const Song &matching
|
||||
qLog(Debug) << "Song" << file << "unchanged.";
|
||||
}
|
||||
else {
|
||||
qLog(Debug) << "Song" << file << changes.join(QStringLiteral(", ")) << "changed.";
|
||||
qLog(Debug) << "Song" << file << changes.join(QLatin1String(", ")) << "changed.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user