Browse Source

Don't use deprecated QUrl::topLevelDomain()

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
15b2811fa5
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 19
      src/gui/transferlistfilterswidget.cpp

19
src/gui/transferlistfilterswidget.cpp

@ -599,18 +599,15 @@ int TrackerFiltersList::rowFromTracker(const QString &tracker) const @@ -599,18 +599,15 @@ int TrackerFiltersList::rowFromTracker(const QString &tracker) const
QString TrackerFiltersList::getHost(const QString &tracker) const
{
QUrl url(tracker);
QString longHost = url.host();
QString tld = url.topLevelDomain();
// We get empty tld when it is invalid or an IPv4/IPv6 address,
// so just return the full host
if (tld.isEmpty())
return longHost;
// We want the domain + tld. Subdomains should be disregarded
int index = longHost.lastIndexOf('.', -(tld.size() + 1));
if (index == -1)
return longHost;
return longHost.mid(index + 1);
const QUrl url {tracker};
const QString host {url.host()};
// host is in IP format
if (!QHostAddress(host).isNull())
return host;
return host.section('.', -2, -1);
}
QStringList TrackerFiltersList::getHashes(const int row) const

Loading…
Cancel
Save