[users] Clean up DMI model more for hostname
Remove anything in parentheses, and also drop the "Apple" prefix for Apple machines. This converts: "Apple MacBook Air (13-inch, M2, 2022)" into: "MacBookAir" which is a lot more reasonable. Other vendors could be added as needed (it's inconsistent whether DT platforms prefix the model with the vendor or not). Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
17e1027ea2
commit
a899f76da2
@ -321,7 +321,7 @@ Config::hostnameStatus() const
|
|||||||
static QString
|
static QString
|
||||||
cleanupForHostname( const QString& s )
|
cleanupForHostname( const QString& s )
|
||||||
{
|
{
|
||||||
QRegExp dmirx( "[^a-zA-Z0-9]", Qt::CaseInsensitive );
|
QRegExp dmirx( "(^Apple|\\(.*\\)|[^a-zA-Z0-9])", Qt::CaseInsensitive );
|
||||||
return s.toLower().replace( dmirx, " " ).remove( ' ' );
|
return s.toLower().replace( dmirx, " " ).remove( ' ' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user