Changeset 9666


Ignore:
Timestamp:
Dec 4, 2009, 5:05:19 AM (12 years ago)
Author:
charles
Message:

(trunk, qt) #2096: show magnet links the same way the gtk+ client does

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/torrent-delegate.cc

    r9247 r9666  
    132132TorrentDelegate :: shortTransferString( const Torrent& tor ) const
    133133{
    134     const bool haveDown( tor.peersWeAreDownloadingFrom( ) > 0 );
    135     const bool haveUp( tor.peersWeAreUploadingTo( ) > 0 );
     134    const bool haveMeta( tor.hasMetadata( ) );
     135    const bool haveDown( haveMeta && tor.peersWeAreDownloadingFrom( ) > 0 );
     136    const bool haveUp( haveMeta && tor.peersWeAreUploadingTo( ) > 0 );
    136137    QString downStr, upStr, str;
    137138
     
    147148    else if( haveUp )
    148149        str = tr( "Up: %1" ).arg( upStr );
    149     else
     150    else if( tor.hasMetadata( ) )
    150151        str = tr( "Idle" );
    151152
     
    204205
    205206        case TR_STATUS_DOWNLOAD:
    206             str = tr( "Downloading from %1 of %n connected peer(s)", 0, tor.connectedPeersAndWebseeds( ) )
    207                   .arg( tor.peersWeAreDownloadingFrom( ) );
     207            if( tor.hasMetadata( ) )
     208                str = tr( "Downloading from %1 of %n connected peer(s)", 0, tor.connectedPeersAndWebseeds( ) )
     209                        .arg( tor.peersWeAreDownloadingFrom( ) );
     210            else
     211                str = tr( "Downloading metadata from %n peer(s) (%1% done)", 0, tor.peersWeAreDownloadingFrom( ) )
     212                        .arg( int(100.0 * tor.metadataPercentDone( ) ) );
    208213            break;
    209214
     
    218223    }
    219224
    220     if( tor.isReadyToTransfer( ) )
    221         str += tr( " - " ) + shortTransferString( tor );
     225    if( tor.isReadyToTransfer( ) ) {
     226        QString s = shortTransferString( tor );
     227        if( !s.isEmpty( ) )
     228            str += tr( " - " ) + s;
     229    }
    222230
    223231    return str;
Note: See TracChangeset for help on using the changeset viewer.