mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-11 12:51:03 +00:00
Merge pull request #17830 from Chocobo1/trackers
Fix wrong 'tracker error' count
This commit is contained in:
commit
30c2f9d9f3
@ -66,18 +66,18 @@ namespace
|
|||||||
|
|
||||||
QString getScheme(const QString &tracker)
|
QString getScheme(const QString &tracker)
|
||||||
{
|
{
|
||||||
const QUrl url {tracker};
|
const QString scheme = QUrl(tracker).scheme();
|
||||||
QString scheme = url.scheme();
|
return !scheme.isEmpty() ? scheme : u"http"_qs;
|
||||||
if (scheme.isEmpty())
|
|
||||||
scheme = u"http"_qs;
|
|
||||||
return scheme;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getHost(const QString &tracker)
|
QString getHost(const QString &url)
|
||||||
{
|
{
|
||||||
// We want the domain + tld. Subdomains should be disregarded
|
// We want the domain + tld. Subdomains should be disregarded
|
||||||
const QUrl url {tracker};
|
// If failed to parse the domain or IP address, original input should be returned
|
||||||
const QString host {url.host()};
|
|
||||||
|
const QString host = QUrl(url).host();
|
||||||
|
if (host.isEmpty())
|
||||||
|
return url;
|
||||||
|
|
||||||
// host is in IP format
|
// host is in IP format
|
||||||
if (!QHostAddress(host).isNull())
|
if (!QHostAddress(host).isNull())
|
||||||
@ -360,7 +360,6 @@ void StatusFilterWidget::torrentAboutToBeDeleted(BitTorrent::Torrent *const torr
|
|||||||
|
|
||||||
TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon)
|
TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *transferList, const bool downloadFavicon)
|
||||||
: BaseFilterWidget(parent, transferList)
|
: BaseFilterWidget(parent, transferList)
|
||||||
, m_totalTorrents(0)
|
|
||||||
, m_downloadTrackerFavicon(downloadFavicon)
|
, m_downloadTrackerFavicon(downloadFavicon)
|
||||||
{
|
{
|
||||||
auto *allTrackers = new QListWidgetItem(this);
|
auto *allTrackers = new QListWidgetItem(this);
|
||||||
@ -509,10 +508,8 @@ void TrackerFiltersList::addItems(const QString &trackerURL, const QVector<BitTo
|
|||||||
void TrackerFiltersList::removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id)
|
void TrackerFiltersList::removeItem(const QString &trackerURL, const BitTorrent::TorrentID &id)
|
||||||
{
|
{
|
||||||
const QString host = getHost(trackerURL);
|
const QString host = getHost(trackerURL);
|
||||||
QSet<BitTorrent::TorrentID> torrentIDs = m_trackers.value(host).torrents;
|
|
||||||
if (torrentIDs.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
QSet<BitTorrent::TorrentID> torrentIDs = m_trackers.value(host).torrents;
|
||||||
torrentIDs.remove(id);
|
torrentIDs.remove(id);
|
||||||
|
|
||||||
QListWidgetItem *trackerItem = nullptr;
|
QListWidgetItem *trackerItem = nullptr;
|
||||||
|
@ -157,12 +157,12 @@ private:
|
|||||||
QListWidgetItem *item = nullptr;
|
QListWidgetItem *item = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
QHash<QString, TrackerData> m_trackers;
|
QHash<QString, TrackerData> m_trackers; // <tracker host, tracker data>
|
||||||
QHash<BitTorrent::TorrentID, QSet<QString>> m_errors; // <torrent ID, tracker hosts>
|
QHash<BitTorrent::TorrentID, QSet<QString>> m_errors; // <torrent ID, tracker hosts>
|
||||||
QHash<BitTorrent::TorrentID, QSet<QString>> m_warnings; // <torrent ID, tracker hosts>
|
QHash<BitTorrent::TorrentID, QSet<QString>> m_warnings; // <torrent ID, tracker hosts>
|
||||||
PathList m_iconPaths;
|
PathList m_iconPaths;
|
||||||
int m_totalTorrents;
|
int m_totalTorrents = 0;
|
||||||
bool m_downloadTrackerFavicon;
|
bool m_downloadTrackerFavicon = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TransferListFiltersWidget final : public QFrame
|
class TransferListFiltersWidget final : public QFrame
|
||||||
|
Loading…
x
Reference in New Issue
Block a user