refactor: Settings make the name checking regex static in the method

This commit is contained in:
sithlord48
2025-11-13 17:09:34 -05:00
committed by Chris Rizzitello
parent 4df7c54afb
commit 204a6cca8a

View File

@ -155,7 +155,8 @@ QVariant Settings::defaultValue(const QString &key)
// The localhost name can contain spaces and non word characters
QString name = QSysInfo::machineHostName().simplified();
name.replace(QLatin1String(" "), QStringLiteral("_"));
name.replace(QRegularExpression(QLatin1String("\\W")), QLatin1String(""));
static const auto nameRegex = QRegularExpression(QLatin1String("\\W"));
name.replace(nameRegex, QLatin1String(""));
return name;
}