Also show first IP address of interface in HTTP server settings page.

This commit is contained in:
craig.p.drummond
2014-06-16 19:11:43 +00:00
committed by craig.p.drummond
parent ed6173d3af
commit 5989ffd6fc
2 changed files with 14 additions and 4 deletions

View File

@@ -33,18 +33,27 @@ static int isIfaceType(const QNetworkInterface &iface, const QString &prefix)
return iface.name().length()>prefix.length() && iface.name().startsWith(prefix) && iface.name()[prefix.length()].isDigit();
}
static QString details(const QNetworkInterface &iface)
{
QString d=iface.humanReadableName();
if (!iface.addressEntries().isEmpty()) {
d+=QLatin1String(" - ")+iface.addressEntries().first().ip().toString();
}
return d;
}
static QString displayName(const QNetworkInterface &iface)
{
if (iface.name()=="lo") {
return i18n("Local loopback (%1)", iface.name());
return i18n("Local loopback (%1)", details(iface));
}
if (isIfaceType(iface, "eth")) {
return i18n("Wired (%1)", iface.name());
return i18n("Wired (%1)", details(iface));
}
if (isIfaceType(iface, "wlan")) {
return i18n("Wireless (%1)", iface.name());
return i18n("Wireless (%1)", details(iface));
}
return iface.name();
return details(iface);
}
static void initInterfaces(QComboBox *combo)