diff --git a/src/base/bittorrent/peerinfo.cpp b/src/base/bittorrent/peerinfo.cpp index 1a1215ee9..637ac7b36 100644 --- a/src/base/bittorrent/peerinfo.cpp +++ b/src/base/bittorrent/peerinfo.cpp @@ -33,7 +33,6 @@ #include "base/bittorrent/torrenthandle.h" #include "base/net/geoipmanager.h" #include "base/unicodestrings.h" -#include "base/utils/string.h" #include "peeraddress.h" using namespace BitTorrent; @@ -261,20 +260,18 @@ qreal PeerInfo::relevance() const void PeerInfo::determineFlags() { - QStringList flagsDescriptionList; - if (isInteresting()) { // d = Your client wants to download, but peer doesn't want to send (interested and choked) if (isRemoteChocked()) { m_flags += "d "; - flagsDescriptionList += "d = " - + tr("Interested(local) and Choked(peer)"); + m_flagsDescription += ("d = " + + tr("Interested(local) and Choked(peer)") + '\n'); } else { // D = Currently downloading (interested and not choked) m_flags += "D "; - flagsDescriptionList += "D = " - + tr("interested(local) and unchoked(peer)"); + m_flagsDescription += ("D = " + + tr("interested(local) and unchoked(peer)") + '\n'); } } @@ -282,95 +279,87 @@ void PeerInfo::determineFlags() // u = Peer wants your client to upload, but your client doesn't want to (interested and choked) if (isChocked()) { m_flags += "u "; - flagsDescriptionList += "u = " - + tr("interested(peer) and choked(local)"); + m_flagsDescription += ("u = " + + tr("interested(peer) and choked(local)") + '\n'); } else { // U = Currently uploading (interested and not choked) m_flags += "U "; - flagsDescriptionList += "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 "; - flagsDescriptionList += "O = " - + tr("optimistic unchoke"); + m_flagsDescription += ("O = " + tr("optimistic unchoke") + '\n'); } // S = Peer is snubbed if (isSnubbed()) { m_flags += "S "; - flagsDescriptionList += "S = " - + tr("peer snubbed"); + m_flagsDescription += ("S = " + tr("peer snubbed") + '\n'); } // I = Peer is an incoming connection if (!isLocalConnection()) { m_flags += "I "; - flagsDescriptionList += "I = " - + tr("incoming connection"); + m_flagsDescription += ("I = " + tr("incoming connection") + '\n'); } // K = Peer is unchoking your client, but your client is not interested if (!isRemoteChocked() && !isInteresting()) { m_flags += "K "; - flagsDescriptionList += "K = " - + tr("not interested(local) and unchoked(peer)"); + m_flagsDescription += ("K = " + + tr("not interested(local) and unchoked(peer)") + '\n'); } // ? = Your client unchoked the peer but the peer is not interested if (!isChocked() && !isRemoteInterested()) { m_flags += "? "; - flagsDescriptionList += "? = " - + tr("not interested(peer) and unchoked(local)"); + m_flagsDescription += ("? = " + + tr("not interested(peer) and unchoked(local)") + '\n'); } // X = Peer was included in peerlists obtained through Peer Exchange (PEX) if (fromPeX()) { m_flags += "X "; - flagsDescriptionList += "X = " - + tr("peer from PEX"); + m_flagsDescription += ("X = " + tr("peer from PEX") + '\n'); } // H = Peer was obtained through DHT if (fromDHT()) { m_flags += "H "; - flagsDescriptionList += "H = " - + tr("peer from DHT"); + m_flagsDescription += ("H = " + tr("peer from DHT") + '\n'); } // E = Peer is using Protocol Encryption (all traffic) if (isRC4Encrypted()) { m_flags += "E "; - flagsDescriptionList += "E = " - + tr("encrypted traffic"); + m_flagsDescription += ("E = " + tr("encrypted traffic") + '\n'); } // e = Peer is using Protocol Encryption (handshake) if (isPlaintextEncrypted()) { m_flags += "e "; - flagsDescriptionList += "e = " - + tr("encrypted handshake"); + m_flagsDescription += ("e = " + tr("encrypted handshake") + '\n'); } // P = Peer is using uTorrent uTP if (useUTPSocket()) { m_flags += "P "; - flagsDescriptionList += "P = " - + QString::fromUtf8(C_UTP); + m_flagsDescription += ("P = " + QString::fromUtf8(C_UTP) + '\n'); } // L = Peer is local if (fromLSD()) { - m_flags += 'L'; - flagsDescriptionList += "L = " - + tr("peer from LSD"); + m_flags += "L "; + m_flagsDescription += ("L = " + tr("peer from LSD") + '\n'); } + m_flags = m_flags.trimmed(); - m_flagsDescription = flagsDescriptionList.join('\n'); + m_flagsDescription = m_flagsDescription.trimmed(); } QString PeerInfo::flags() const diff --git a/src/base/bittorrent/peerinfo.h b/src/base/bittorrent/peerinfo.h index 5ba7b1e3a..328cabf4c 100644 --- a/src/base/bittorrent/peerinfo.h +++ b/src/base/bittorrent/peerinfo.h @@ -32,7 +32,6 @@ #include #include -#include class QBitArray;