mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-30 03:28:41 -07:00
Improve tracker entries handling
This commit is contained in:
parent
6b3c6c12ff
commit
7a8c05dc7c
17 changed files with 194 additions and 215 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2015, 2021 Vladimir Golovnev <glassez@yandex.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -28,17 +28,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <libtorrent/announce_entry.hpp>
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
class QString;
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TrackerEntry
|
||||
struct TrackerEntry
|
||||
{
|
||||
public:
|
||||
enum Status
|
||||
{
|
||||
NotContacted = 1,
|
||||
|
@ -47,26 +44,26 @@ namespace BitTorrent
|
|||
NotWorking = 4
|
||||
};
|
||||
|
||||
TrackerEntry() = default;
|
||||
TrackerEntry(const QString &url);
|
||||
TrackerEntry(const lt::announce_entry &nativeEntry);
|
||||
TrackerEntry(const TrackerEntry &other) = default;
|
||||
TrackerEntry &operator=(const TrackerEntry &other) = default;
|
||||
struct EndpointStats
|
||||
{
|
||||
int protocolVersion = 1;
|
||||
|
||||
QString url() const;
|
||||
Status status() const;
|
||||
Status status = NotContacted;
|
||||
int numSeeds = -1;
|
||||
int numLeeches = -1;
|
||||
int numDownloaded = -1;
|
||||
};
|
||||
|
||||
int tier() const;
|
||||
void setTier(int value);
|
||||
QString url;
|
||||
int tier = 0;
|
||||
|
||||
int numSeeds() const;
|
||||
int numLeeches() const;
|
||||
int numDownloaded() const;
|
||||
QVector<EndpointStats> endpoints {};
|
||||
|
||||
const lt::announce_entry &nativeEntry() const;
|
||||
|
||||
private:
|
||||
lt::announce_entry m_nativeEntry;
|
||||
// Deprecated fields
|
||||
Status status = NotContacted;
|
||||
int numSeeds = -1;
|
||||
int numLeeches = -1;
|
||||
int numDownloaded = -1;
|
||||
};
|
||||
|
||||
bool operator==(const TrackerEntry &left, const TrackerEntry &right);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue