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

@@ -311,7 +311,7 @@ bool CommandlineOptions::Parse() {
log_levels_ = OptArgToString(optarg);
break;
case LongOptions::Version:{
QString version_text = QString::fromUtf8(kVersionText).arg(QStringLiteral(STRAWBERRY_VERSION_DISPLAY));
QString version_text = QString::fromUtf8(kVersionText).arg(QLatin1String(STRAWBERRY_VERSION_DISPLAY));
std::cout << version_text.toLocal8Bit().constData() << std::endl;
std::exit(0);
}

View File

@@ -414,7 +414,7 @@ void Database::ExecSongTablesCommands(QSqlDatabase &db, const QStringList &song_
if (command.contains(QLatin1String(kMagicAllSongsTables))) {
for (const QString &table : song_tables) {
// Another horrible hack: device songs tables don't have matching _fts tables, so if this command tries to touch one, ignore it.
if (table.startsWith(QLatin1String("device_")) && command.contains(QLatin1String(kMagicAllSongsTables) + QStringLiteral("_fts"))) {
if (table.startsWith(QLatin1String("device_")) && command.contains(QLatin1String(kMagicAllSongsTables) + QLatin1String("_fts"))) {
continue;
}
@@ -450,7 +450,7 @@ QStringList Database::SongsTables(QSqlDatabase &db, const int schema_version) {
// look for the tables in the main db
const QStringList &tables = db.tables();
for (const QString &table : tables) {
if (table == QStringLiteral("songs") || table.endsWith(QLatin1String("_songs"))) ret << table;
if (table == QLatin1String("songs") || table.endsWith(QLatin1String("_songs"))) ret << table;
}
// look for the tables in attached dbs
@@ -460,7 +460,7 @@ QStringList Database::SongsTables(QSqlDatabase &db, const int schema_version) {
q.prepare(QStringLiteral("SELECT NAME FROM %1.sqlite_master WHERE type='table' AND name='songs' OR name LIKE '%songs'").arg(key));
if (q.Exec()) {
while (q.next()) {
QString tab_name = key + QStringLiteral(".") + q.value(0).toString();
QString tab_name = key + QLatin1Char('.') + q.value(0).toString();
ret << tab_name;
}
}

View File

@@ -1049,7 +1049,7 @@ MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OS
rosetta_message->set_settings_group(QLatin1String(kSettingsGroup));
rosetta_message->set_do_not_show_message_again(QStringLiteral("ignore_rosetta"));
rosetta_message->setAttribute(Qt::WA_DeleteOnClose);
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("You are running Strawberry under Rosetta. Running Strawberry under Rosetta is unsupported and known to have issues. You should download Strawberry for the correct CPU architecture from %1").arg(QStringLiteral("<a href=\"https://downloads.strawberrymusicplayer.org/\">downloads.strawberrymusicplayer.org</a>")), IconLoader::Load(QStringLiteral("dialog-warning")));
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("You are running Strawberry under Rosetta. Running Strawberry under Rosetta is unsupported and known to have issues. You should download Strawberry for the correct CPU architecture from %1").arg(QLatin1String("<a href=\"https://downloads.strawberrymusicplayer.org/\">downloads.strawberrymusicplayer.org</a>")), IconLoader::Load(QStringLiteral("dialog-warning")));
}
}
#endif
@@ -2366,7 +2366,7 @@ void MainWindow::ShowInCollection() {
}
QString search;
if (!songs.isEmpty()) {
search = QStringLiteral("artist:") + songs.first().artist() + QStringLiteral(" album:") + songs.first().album();
search = QLatin1String("artist:") + songs.first().artist() + QLatin1String(" album:") + songs.first().album();
}
collection_view_->filter_widget()->ShowInCollection(search);
@@ -2500,7 +2500,7 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
#ifdef HAVE_TIDAL
for (const QUrl &url : options.urls()) {
if (url.scheme() == QStringLiteral("tidal") && url.host() == QStringLiteral("login")) {
if (url.scheme() == QLatin1String("tidal") && url.host() == QLatin1String("login")) {
emit AuthorizationUrlReceived(url);
return;
}
@@ -2943,9 +2943,9 @@ void MainWindow::CheckFullRescanRevisions() {
if (!reasons.isEmpty()) {
QString message = tr("The version of Strawberry you've just updated to requires a full collection rescan because of the new features listed below:") + QStringLiteral("<ul>");
for (const QString &reason : reasons) {
message += QStringLiteral("<li>") + reason + QStringLiteral("</li>");
message += QLatin1String("<li>") + reason + QLatin1String("</li>");
}
message += QStringLiteral("</ul>") + tr("Would you like to run a full rescan right now?");
message += QLatin1String("</ul>") + tr("Would you like to run a full rescan right now?");
if (QMessageBox::question(this, tr("Collection rescan notice"), message, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
app_->collection()->FullScan();
}

View File

@@ -325,13 +325,13 @@ void Mpris2::SetLoopStatus(const QString &value) {
PlaylistSequence::RepeatMode mode = PlaylistSequence::RepeatMode::Off;
if (value == QStringLiteral("None")) {
if (value == QLatin1String("None")) {
mode = PlaylistSequence::RepeatMode::Off;
}
else if (value == QStringLiteral("Track")) {
else if (value == QLatin1String("Track")) {
mode = PlaylistSequence::RepeatMode::Track;
}
else if (value == QStringLiteral("Playlist")) {
else if (value == QLatin1String("Playlist")) {
mode = PlaylistSequence::RepeatMode::Playlist;
}

View File

@@ -1913,7 +1913,7 @@ void Song::MergeUserSetData(const Song &other, const bool merge_playcount, const
}
QString Song::AlbumKey() const {
return QStringLiteral("%1|%2|%3").arg(is_compilation() ? QStringLiteral("_compilation") : effective_albumartist(), has_cue() ? cue_path() : QLatin1String(""), effective_album());
return QStringLiteral("%1|%2|%3").arg(is_compilation() ? QLatin1String("_compilation") : effective_albumartist(), has_cue() ? cue_path() : QLatin1String(""), effective_album());
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)