mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 13:28:50 +03:00
Merge pull request #14810 from Chocobo1/info
Capitalize "peer flags" descriptions
This commit is contained in:
commit
a4ce5d1687
1 changed files with 44 additions and 81 deletions
|
@ -257,123 +257,86 @@ qreal PeerInfo::relevance() const
|
||||||
|
|
||||||
void PeerInfo::determineFlags()
|
void PeerInfo::determineFlags()
|
||||||
{
|
{
|
||||||
|
const auto updateFlags = [this](const QChar specifier, const QString &explanation)
|
||||||
|
{
|
||||||
|
m_flags += (specifier + QLatin1Char(' '));
|
||||||
|
m_flagsDescription += QString::fromLatin1("%1 = %2\n").arg(specifier, explanation);
|
||||||
|
};
|
||||||
|
|
||||||
if (isInteresting())
|
if (isInteresting())
|
||||||
{
|
{
|
||||||
// d = Your client wants to download, but peer doesn't want to send (interested and choked)
|
|
||||||
if (isRemoteChocked())
|
if (isRemoteChocked())
|
||||||
{
|
{
|
||||||
m_flags += "d ";
|
// d = Your client wants to download, but peer doesn't want to send (interested and choked)
|
||||||
m_flagsDescription += ("d = "
|
updateFlags(QLatin1Char('d'), tr("Interested (local) and choked (peer)"));
|
||||||
+ tr("Interested(local) and Choked(peer)") + '\n');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// D = Currently downloading (interested and not choked)
|
// D = Currently downloading (interested and not choked)
|
||||||
m_flags += "D ";
|
updateFlags(QLatin1Char('D'), tr("Interested (local) and unchoked (peer)"));
|
||||||
m_flagsDescription += ("D = "
|
|
||||||
+ tr("interested(local) and unchoked(peer)") + '\n');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRemoteInterested())
|
if (isRemoteInterested())
|
||||||
{
|
{
|
||||||
// u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
|
|
||||||
if (isChocked())
|
if (isChocked())
|
||||||
{
|
{
|
||||||
m_flags += "u ";
|
// u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
|
||||||
m_flagsDescription += ("u = "
|
updateFlags(QLatin1Char('u'), tr("Interested (peer) and choked (local)"));
|
||||||
+ tr("interested(peer) and choked(local)") + '\n');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// U = Currently uploading (interested and not choked)
|
// U = Currently uploading (interested and not choked)
|
||||||
m_flags += "U ";
|
updateFlags(QLatin1Char('U'), tr("Interested (peer) and unchoked (local)"));
|
||||||
m_flagsDescription += ("U = "
|
|
||||||
+ tr("interested(peer) and unchoked(local)") + '\n');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// O = Optimistic unchoke
|
|
||||||
if (optimisticUnchoke())
|
|
||||||
{
|
|
||||||
m_flags += "O ";
|
|
||||||
m_flagsDescription += ("O = " + tr("optimistic unchoke") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// S = Peer is snubbed
|
|
||||||
if (isSnubbed())
|
|
||||||
{
|
|
||||||
m_flags += "S ";
|
|
||||||
m_flagsDescription += ("S = " + tr("peer snubbed") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// I = Peer is an incoming connection
|
|
||||||
if (!isLocalConnection())
|
|
||||||
{
|
|
||||||
m_flags += "I ";
|
|
||||||
m_flagsDescription += ("I = " + tr("incoming connection") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// K = Peer is unchoking your client, but your client is not interested
|
// K = Peer is unchoking your client, but your client is not interested
|
||||||
if (!isRemoteChocked() && !isInteresting())
|
if (!isRemoteChocked() && !isInteresting())
|
||||||
{
|
updateFlags(QLatin1Char('K'), tr("Not interested (local) and unchoked (peer)"));
|
||||||
m_flags += "K ";
|
|
||||||
m_flagsDescription += ("K = "
|
|
||||||
+ tr("not interested(local) and unchoked(peer)") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// ? = Your client unchoked the peer but the peer is not interested
|
// ? = Your client unchoked the peer but the peer is not interested
|
||||||
if (!isChocked() && !isRemoteInterested())
|
if (!isChocked() && !isRemoteInterested())
|
||||||
{
|
updateFlags(QLatin1Char('?'), tr("Not interested (peer) and unchoked (local)"));
|
||||||
m_flags += "? ";
|
|
||||||
m_flagsDescription += ("? = "
|
|
||||||
+ tr("not interested(peer) and unchoked(local)") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// X = Peer was included in peerlists obtained through Peer Exchange (PEX)
|
// O = Optimistic unchoke
|
||||||
if (fromPeX())
|
if (optimisticUnchoke())
|
||||||
{
|
updateFlags(QLatin1Char('O'), tr("Optimistic unchoke"));
|
||||||
m_flags += "X ";
|
|
||||||
m_flagsDescription += ("X = " + tr("peer from PEX") + '\n');
|
// S = Peer is snubbed
|
||||||
}
|
if (isSnubbed())
|
||||||
|
updateFlags(QLatin1Char('S'), tr("Peer snubbed"));
|
||||||
|
|
||||||
|
// I = Peer is an incoming connection
|
||||||
|
if (!isLocalConnection())
|
||||||
|
updateFlags(QLatin1Char('I'), tr("Incoming connection"));
|
||||||
|
|
||||||
// H = Peer was obtained through DHT
|
// H = Peer was obtained through DHT
|
||||||
if (fromDHT())
|
if (fromDHT())
|
||||||
{
|
updateFlags(QLatin1Char('H'), tr("Peer from DHT"));
|
||||||
m_flags += "H ";
|
|
||||||
m_flagsDescription += ("H = " + tr("peer from DHT") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// E = Peer is using Protocol Encryption (all traffic)
|
// X = Peer was included in peerlists obtained through Peer Exchange (PEX)
|
||||||
if (isRC4Encrypted())
|
if (fromPeX())
|
||||||
{
|
updateFlags(QLatin1Char('X'), tr("Peer from PEX"));
|
||||||
m_flags += "E ";
|
|
||||||
m_flagsDescription += ("E = " + tr("encrypted traffic") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// e = Peer is using Protocol Encryption (handshake)
|
|
||||||
if (isPlaintextEncrypted())
|
|
||||||
{
|
|
||||||
m_flags += "e ";
|
|
||||||
m_flagsDescription += ("e = " + tr("encrypted handshake") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// P = Peer is using uTorrent uTP
|
|
||||||
if (useUTPSocket())
|
|
||||||
{
|
|
||||||
m_flags += "P ";
|
|
||||||
m_flagsDescription += ("P = " + QString::fromUtf8(C_UTP) + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
// L = Peer is local
|
// L = Peer is local
|
||||||
if (fromLSD())
|
if (fromLSD())
|
||||||
{
|
updateFlags(QLatin1Char('L'), tr("Peer from LSD"));
|
||||||
m_flags += "L ";
|
|
||||||
m_flagsDescription += ("L = " + tr("peer from LSD") + '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
m_flags = m_flags.trimmed();
|
// E = Peer is using Protocol Encryption (all traffic)
|
||||||
m_flagsDescription = m_flagsDescription.trimmed();
|
if (isRC4Encrypted())
|
||||||
|
updateFlags(QLatin1Char('E'), tr("Encrypted traffic"));
|
||||||
|
|
||||||
|
// e = Peer is using Protocol Encryption (handshake)
|
||||||
|
if (isPlaintextEncrypted())
|
||||||
|
updateFlags(QLatin1Char('e'), tr("Encrypted handshake"));
|
||||||
|
|
||||||
|
// P = Peer is using uTorrent uTP
|
||||||
|
if (useUTPSocket())
|
||||||
|
updateFlags(QLatin1Char('P'), QString::fromUtf8(C_UTP));
|
||||||
|
|
||||||
|
m_flags.chop(1);
|
||||||
|
m_flagsDescription.chop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PeerInfo::flags() const
|
QString PeerInfo::flags() const
|
||||||
|
|
Loading…
Reference in a new issue