From e92ada09af1d57c913383d2d02c9e68d56120e62 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 5 Feb 2023 13:30:26 +0100 Subject: [PATCH] Replace QRegExp by QRegularExpression --- components/config/launchersettings.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/config/launchersettings.cpp b/components/config/launchersettings.cpp index 0239f2d334..9d12535619 100644 --- a/components/config/launchersettings.cpp +++ b/components/config/launchersettings.cpp @@ -303,8 +303,8 @@ bool Config::LauncherSettings::setValue(const QString& sectionPrefix, const QStr void Config::LauncherSettings::readFile(QTextStream& stream) { - const QRegExp sectionRe("^\\[([^]]+)\\]"); - const QRegExp keyRe("^([^=]+)\\s*=\\s*(.+)$"); + const QRegularExpression sectionRe("^\\[([^]]+)\\]$"); + const QRegularExpression keyRe("^([^=]+)\\s*=\\s*(.+)$"); QString section; @@ -315,20 +315,22 @@ void Config::LauncherSettings::readFile(QTextStream& stream) if (line.isEmpty() || line.startsWith("#")) continue; - if (sectionRe.exactMatch(line)) + const QRegularExpressionMatch sectionMatch = sectionRe.match(line); + if (sectionMatch.hasMatch()) { - section = sectionRe.cap(1); + section = sectionMatch.captured(1); continue; } if (section.isEmpty()) continue; - if (keyRe.indexIn(line) == -1) + const QRegularExpressionMatch keyMatch = keyRe.match(line); + if (!keyMatch.hasMatch()) continue; - const QString key = keyRe.cap(1).trimmed(); - const QString value = keyRe.cap(2).trimmed(); + const QString key = keyMatch.captured(1).trimmed(); + const QString value = keyMatch.captured(2).trimmed(); if (!setValue(section, key, value)) Log(Debug::Warning) << "Unsupported setting in the launcher config file: section: "