Commit 2581892e authored by Frederik Gladhorn's avatar Frederik Gladhorn

Return Model name from EDID even when Vendor is empty

I have two screens where for some reason the vendor is empty in the EDID
information. At least return the model name.
parent d5a08db0
......@@ -36,18 +36,22 @@ QString Utils::outputName(const KScreen::Output *output)
if (output->type() == KScreen::Output::Panel) {
return i18n("Laptop Screen");
}
if (output->edid() && !output->edid()->vendor().isEmpty()) {
if (output->edid()->name().isEmpty()) {
return QStringLiteral("%1 (%2)").arg(output->edid()->vendor(),
output->name());
} else {
return QStringLiteral("%1 %2 (%3)").arg(output->edid()->vendor(),
output->edid()->name(),
output->name());
if (output->edid()) {
// The name will be "VendorName ModelName (ConnectorName)",
// but some components may be empty.
QString name;
if (!(output->edid()->vendor().isEmpty())) {
name = output->edid()->vendor() + QLatin1Char(' ');
}
if (!output->edid()->name().isEmpty()) {
name += output->edid()->name() + QLatin1Char(' ');
}
if (!name.trimmed().isEmpty()) {
return name + QStringLiteral("(%1)").arg(output->name());
}
} else {
return output->name();
}
return output->name();
}
QString Utils::sizeToString(const QSize &size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment