From 6963f3dc93ba22edc4f1582a2e8860c9767aeb54 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Mon, 31 May 2010 15:30:44 +0000 Subject: [PATCH] (qt) fix partial seeds showing 100% downloaded --- qt/torrent-delegate.cc | 4 ++-- qt/torrent.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qt/torrent-delegate.cc b/qt/torrent-delegate.cc index 9352c5938..9a2b3425a 100644 --- a/qt/torrent-delegate.cc +++ b/qt/torrent-delegate.cc @@ -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( ) ) ); } diff --git a/qt/torrent.h b/qt/torrent.h index b96dcf442..e51f754d9 100644 --- a/qt/torrent.h +++ b/qt/torrent.h @@ -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 ); }