Use static QRegularExpression
This commit is contained in:
@@ -94,7 +94,10 @@ QString CoverUtils::CoverFilePath(const CoverOptions &options, const Song::Sourc
|
||||
filename = CoverFilenameFromVariable(options, artist, album);
|
||||
filename.remove(QRegularExpression(QLatin1String(kInvalidFatCharactersRegex), QRegularExpression::CaseInsensitiveOption)).remove(QLatin1Char('/')).remove(QLatin1Char('\\'));
|
||||
if (options.cover_lowercase) filename = filename.toLower();
|
||||
if (options.cover_replace_spaces) filename.replace(QRegularExpression(QStringLiteral("\\s")), QStringLiteral("-"));
|
||||
if (options.cover_replace_spaces) {
|
||||
static const QRegularExpression regex_whitespaces(QStringLiteral("\\s"));
|
||||
filename.replace(regex_whitespaces, QStringLiteral("-"));
|
||||
}
|
||||
if (!extension.isEmpty()) {
|
||||
filename.append(QLatin1Char('.'));
|
||||
filename.append(extension);
|
||||
|
||||
@@ -66,7 +66,8 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
|
||||
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));
|
||||
static const QRegularExpression regex(QStringLiteral("[%][a-zA-Z]*( |$)"), QRegularExpression::CaseInsensitiveOption);
|
||||
cmd = cmd.remove(regex);
|
||||
# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
command_params = cmd.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
# else
|
||||
|
||||
@@ -112,7 +112,7 @@ QString DecodeHtmlEntities(const QString &text) {
|
||||
|
||||
QString ReplaceMessage(const QString &message, const Song &song, const QString &newline, const bool html_escaped) {
|
||||
|
||||
QRegularExpression variable_replacer(QStringLiteral("[%][a-z]+[%]"));
|
||||
static const QRegularExpression variable_replacer(QStringLiteral("[%][a-z]+[%]"));
|
||||
QString copy(message);
|
||||
|
||||
// Replace the first line
|
||||
@@ -125,7 +125,8 @@ QString ReplaceMessage(const QString &message, const Song &song, const QString &
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
|
||||
qint64 index_of = copy.indexOf(QRegularExpression(QStringLiteral(" - (>|$)")));
|
||||
static const QRegularExpression regexp(QStringLiteral(" - (>|$)"));
|
||||
qint64 index_of = copy.indexOf(regexp);
|
||||
if (index_of >= 0) copy = copy.remove(index_of, 3);
|
||||
|
||||
return copy;
|
||||
|
||||
@@ -107,7 +107,7 @@ QString PrettyFutureDate(const QDate date) {
|
||||
|
||||
QDateTime ParseRFC822DateTime(const QString &text) {
|
||||
|
||||
QRegularExpression regexp(QStringLiteral("(\\d{1,2}) (\\w{3,12}) (\\d+) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})"));
|
||||
static const QRegularExpression regexp(QStringLiteral("(\\d{1,2}) (\\w{3,12}) (\\d+) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})"));
|
||||
QRegularExpressionMatch re_match = regexp.match(text);
|
||||
if (!re_match.hasMatch()) {
|
||||
return QDateTime();
|
||||
|
||||
Reference in New Issue
Block a user