Remove "Device" keyword from platform device name

QC uses the display name set in IDeviceFactory to refer to the
platform name. However, the display name usually have the "Device"
keyword at the end because it's coming form the IDeviceFactory.
That would work fine for example in new device creation dialog.
But QC is using that in other places like new file/project wizard
to show the supported platform for a project, and that's where
having "Device" seems unnecessary or wrong.

This fixes that behavior, but removing that keyword when calling
KitFeatureProvider::displayNameForPlatform().

Change-Id: I5fd4bbcb1ec2579f8b7e86226a7d50b6d7807382
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Assam Boudjelthia
2022-03-06 03:55:54 +02:00
parent 0f6e9f7146
commit 4ba957f9d8

View File

@@ -813,7 +813,10 @@ QSet<Id> KitFeatureProvider::availablePlatforms() const
QString KitFeatureProvider::displayNameForPlatform(Id id) const QString KitFeatureProvider::displayNameForPlatform(Id id) const
{ {
if (IDeviceFactory *f = IDeviceFactory::find(id)) { if (IDeviceFactory *f = IDeviceFactory::find(id)) {
const QString dn = f->displayName(); QString dn = f->displayName();
const QString deviceStr = QStringLiteral("device");
if (dn.endsWith(deviceStr, Qt::CaseInsensitive))
dn = dn.remove(deviceStr, Qt::CaseInsensitive).trimmed();
QTC_CHECK(!dn.isEmpty()); QTC_CHECK(!dn.isEmpty());
return dn; return dn;
} }