Replace QStringLiteral with QLatin1String

This commit is contained in:
Jonas Kvinge
2024-06-12 02:13:27 +02:00
parent 597a8cd6c8
commit b89c200076
73 changed files with 1215 additions and 1215 deletions

View File

@@ -46,7 +46,7 @@ QString CoverUtils::AlbumCoverFilename(QString artist, QString album, const QStr
artist.remove(QLatin1Char('/')).remove(QLatin1Char('\\'));
album.remove(QLatin1Char('/')).remove(QLatin1Char('\\'));
QString filename = artist + QStringLiteral("-") + album;
QString filename = artist + QLatin1Char('-') + album;
filename = Utilities::Transliterate(filename.toLower());
filename = filename.replace(QLatin1Char(' '), QLatin1Char('-'))
.replace(QLatin1String("--"), QLatin1String("-"))
@@ -76,7 +76,7 @@ QString CoverUtils::CoverFilePath(const CoverOptions &options, const Song::Sourc
path = Song::ImageCacheDir(source);
}
if (path.right(1) == QDir::separator() || path.right(1) == QLatin1String("/")) {
if (path.right(1) == QDir::separator() || path.right(1) == QLatin1Char('/')) {
path.chop(1);
}
@@ -105,7 +105,7 @@ QString CoverUtils::CoverFilePath(const CoverOptions &options, const Song::Sourc
filename = CoverFilenameFromSource(source, cover_url, artist, album, album_id, extension);
}
QString filepath(path + QStringLiteral("/") + filename);
QString filepath(path + QLatin1Char('/') + filename);
return filepath;
@@ -118,7 +118,7 @@ QString CoverUtils::CoverFilenameFromSource(const Song::Source source, const QUr
switch (source) {
case Song::Source::Tidal:
if (!album_id.isEmpty()) {
filename = album_id + QStringLiteral("-") + cover_url.fileName();
filename = album_id + QLatin1Char('-') + cover_url.fileName();
break;
}
[[fallthrough]];

View File

@@ -52,9 +52,9 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
QString desktop_file = QString::fromUtf8(proc.readLine()).simplified();
QString xdg_data_dirs = QString::fromUtf8(qgetenv("XDG_DATA_DIRS"));
if (xdg_data_dirs.isEmpty()) {
xdg_data_dirs = QStringLiteral("/usr/local/share/:/usr/share/");
xdg_data_dirs = QLatin1String("/usr/local/share/:/usr/share/");
}
const QStringList data_dirs = xdg_data_dirs.split(QStringLiteral(":"));
const QStringList data_dirs = xdg_data_dirs.split(QLatin1Char(':'));
QString command;
QStringList command_params;
@@ -63,7 +63,7 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
if (!QFile::exists(desktop_file_path)) continue;
QSettings setting(desktop_file_path, QSettings::IniFormat);
setting.beginGroup(QStringLiteral("Desktop Entry"));
if (setting.contains(QStringLiteral("Exec"))) {
if (setting.contains(QLatin1String("Exec"))) {
QString cmd = setting.value(QStringLiteral("Exec")).toString();
if (cmd.isEmpty()) break;
cmd = cmd.remove(QRegularExpression(QStringLiteral("[%][a-zA-Z]*( |$)"), QRegularExpression::CaseInsensitiveOption));
@@ -80,10 +80,10 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
}
if (command.startsWith(QLatin1String("/usr/bin/"))) {
command = command.split(QStringLiteral("/")).last();
command = command.split(QLatin1Char('/')).last();
}
if (command.isEmpty() || command == QStringLiteral("exo-open")) {
if (command.isEmpty() || command == QLatin1String("exo-open")) {
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
else if (command.startsWith(QLatin1String("nautilus"))) {