(qt) fix partial seeds showing 100% downloaded

This commit is contained in:
Daniel Lee 2010-05-31 15:30:44 +00:00
parent ee558fda5a
commit 6963f3dc93
2 changed files with 3 additions and 2 deletions

View File

@ -91,7 +91,7 @@ TorrentDelegate :: progressString( const Torrent& tor ) const
str = tr( "%1 of %2 (%3%), uploaded %4 (Ratio: %5 Goal: %6)" )
.arg( Utils::sizeToString( haveTotal ) )
.arg( Utils::sizeToString( tor.totalSize( ) ) )
.arg( tor.percentDone( ) * 100.0, 0, 'f', 2 )
.arg( tor.percentComplete( ) * 100.0, 0, 'f', 2 )
.arg( Utils::sizeToString( tor.uploadedEver( ) ) )
.arg( Utils::ratioToString( tor.ratio( ) ) )
.arg( Utils::ratioToString( seedRatio ) );
@ -106,7 +106,7 @@ TorrentDelegate :: progressString( const Torrent& tor ) const
str = tr( "%1 of %2 (%3%), uploaded %4 (Ratio: %5)" )
.arg( Utils::sizeToString( haveTotal ) )
.arg( Utils::sizeToString( tor.totalSize( ) ) )
.arg( tor.percentDone( ) * 100.0, 0, 'f', 2 )
.arg( tor.percentComplete( ) * 100.0, 0, 'f', 2 )
.arg( Utils::sizeToString( tor.uploadedEver( ) ) )
.arg( Utils::ratioToString( tor.ratio( ) ) );
}

View File

@ -253,6 +253,7 @@ class Torrent: public QObject
bool hasMetadata( ) const { return getDouble( METADATA_PERCENT_DONE ) >= 1.0; }
int pieceCount( ) const { return getInt( PIECE_COUNT ); }
double ratio( ) const { return getDouble( RATIO ); }
double percentComplete( ) const { return haveTotal() / (double)totalSize(); }
double percentDone( ) const { return getDouble( PERCENT_DONE ); }
double metadataPercentDone( ) const { return getDouble( METADATA_PERCENT_DONE ); }
uint64_t downloadedEver( ) const { return getSize( DOWNLOADED_EVER ); }