Port to QStringLiteral operator

This commit is contained in:
Jonas Kvinge
2024-10-20 06:38:55 +02:00
parent 722035913e
commit ef9ef63f02
202 changed files with 2036 additions and 1889 deletions

View File

@@ -39,7 +39,7 @@ constexpr char kLyricsStart[] = "<div id='inlyr'>";
} // namespace
ElyricsNetLyricsProvider::ElyricsNetLyricsProvider(SharedPtr<NetworkAccessManager> network, QObject *parent)
: HtmlLyricsProvider(QStringLiteral("elyrics.net"), true, QLatin1String(kStartTag), QLatin1String(kEndTag), QLatin1String(kLyricsStart), false, network, parent) {}
: HtmlLyricsProvider(u"elyrics.net"_s, true, QLatin1String(kStartTag), QLatin1String(kEndTag), QLatin1String(kLyricsStart), false, network, parent) {}
QUrl ElyricsNetLyricsProvider::Url(const LyricsSearchRequest &request) {
@@ -51,12 +51,12 @@ QString ElyricsNetLyricsProvider::StringFixup(const QString &text) {
Q_ASSERT(QThread::currentThread() != qApp->thread());
static const QRegularExpression regex_illegal_characters(QStringLiteral("[^\\w0-9_,&\\-\\(\\) ]"));
static const QRegularExpression regex_duplicate_whitespaces(QStringLiteral(" {2,}"));
static const QRegularExpression regex_illegal_characters(u"[^\\w0-9_,&\\-\\(\\) ]"_s);
static const QRegularExpression regex_duplicate_whitespaces(u" {2,}"_s);
return Utilities::Transliterate(text)
.replace(regex_illegal_characters, QStringLiteral("_"))
.replace(regex_duplicate_whitespaces, QStringLiteral(" "))
.replace(regex_illegal_characters, u"_"_s)
.replace(regex_duplicate_whitespaces, u" "_s)
.simplified()
.replace(u' ', u'-')
.toLower();