(qt) #3286:Use flagStr in the status field of the peer list

This commit is contained in:
Daniel Lee 2010-06-26 17:48:27 +00:00
parent b0e108838c
commit f22eac4709
4 changed files with 6 additions and 9 deletions

View File

@ -216,6 +216,7 @@
| clientName | string | tr_peer_stat
| clientIsChoked | boolean | tr_peer_stat
| clientIsInterested | boolean | tr_peer_stat
| flagStr | string | tr_peer_stat
| isDownloadingFrom | boolean | tr_peer_stat
| isEncrypted | boolean | tr_peer_stat
| isIncoming | boolean | tr_peer_stat

View File

@ -825,15 +825,7 @@ Details :: refresh( )
newItems << item;
}
QString code;
if( peer.isDownloadingFrom ) { code += 'D'; }
else if( peer.clientIsInterested ) { code += 'd'; }
if( peer.isUploadingTo ) { code += 'U'; }
else if( peer.peerIsInterested ) { code += 'u'; }
if( !peer.clientIsChoked && !peer.clientIsInterested ) { code += 'K'; }
if( !peer.peerIsChoked && !peer.peerIsInterested ) { code += '?'; }
if( peer.isEncrypted ) { code += 'E'; }
if( peer.isIncoming ) { code += 'I'; }
const QString code = peer.flagStr;
item->setStatus( code );
item->refresh( peer );
@ -849,6 +841,7 @@ Details :: refresh( )
case 'K': txt = tr( "Peer has unchoked us, but we're not interested" ); break;
case '?': txt = tr( "We unchoked this peer, but they're not interested" ); break;
case 'E': txt = tr( "Encrypted connection" ); break;
case 'H': txt = tr( "Peer was discovered through DHT" ); break;
case 'X': txt = tr( "Peer was discovered through Peer Exchange (PEX)" ); break;
case 'I': txt = tr( "Peer is an incoming connection" ); break;
}

View File

@ -635,6 +635,8 @@ Torrent :: update( tr_benc * d )
peer.clientIsChoked = b;
if( tr_bencDictFindBool( child, "clientIsInterested", &b ) )
peer.clientIsInterested = b;
if( tr_bencDictFindStr( child, "flagStr", &str ) )
peer.flagStr = QString::fromUtf8( str );
if( tr_bencDictFindBool( child, "isDownloadingFrom", &b ) )
peer.isDownloadingFrom = b;
if( tr_bencDictFindBool( child, "isEncrypted", &b ) )

View File

@ -42,6 +42,7 @@ struct Peer
QString clientName;
bool clientIsChoked;
bool clientIsInterested;
QString flagStr;
bool isDownloadingFrom;
bool isEncrypted;
bool isIncoming;