diff --git a/gtk/details.c b/gtk/details.c index c56aad9fa..105cf78e9 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -64,7 +64,6 @@ struct DetailsImpl GtkWidget * have_lb; GtkWidget * dl_lb; GtkWidget * ul_lb; - GtkWidget * ratio_lb; GtkWidget * error_lb; GtkWidget * date_started_lb; GtkWidget * eta_lb; @@ -857,29 +856,23 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n ) /* ul_lb */ - if( n <= 0 ) - str = no_torrent; - else { - uint64_t sum = 0; - for( i=0; iuploadedEver; - str = tr_strlsize( buf, sum, sizeof( buf ) ); - } - gtr_label_set_text( GTK_LABEL( di->ul_lb ), str ); - - - /* ratio */ if( n <= 0 ) str = no_torrent; else { uint64_t up = 0; uint64_t down = 0; + char upstr[64]; + char ratiostr[64]; for( i=0; iuploadedEver; down += stats[i]->downloadedEver; } - str = tr_strlratio( buf, tr_getRatio( up, down ), sizeof( buf ) ); + tr_strlsize( upstr, up, sizeof( upstr ) ); + tr_strlratio( ratiostr, tr_getRatio( up, down ), sizeof( ratiostr ) ); + g_snprintf( buf, sizeof( buf ), _( "%s (Ratio: %s)" ), upstr, ratiostr ); + str = buf; } - gtr_label_set_text( GTK_LABEL( di->ratio_lb ), str ); + gtr_label_set_text( GTK_LABEL( di->ul_lb ), str ); /* hash_lb */ if( n <= 0 ) @@ -962,10 +955,6 @@ info_page_new( struct DetailsImpl * di ) l = di->ul_lb = gtk_label_new( NULL ); hig_workarea_add_row( t, &row, _( "Uploaded:" ), l, NULL ); - /* ratio */ - l = di->ratio_lb = gtk_label_new( NULL ); - hig_workarea_add_row( t, &row, _( "Ratio:" ), l, NULL ); - /* state */ l = di->state_lb = gtk_label_new( NULL ); hig_workarea_add_row( t, &row, _( "State:" ), l, NULL ); diff --git a/qt/details.cc b/qt/details.cc index 7bd8785b0..97d046f6a 100644 --- a/qt/details.cc +++ b/qt/details.cc @@ -45,6 +45,7 @@ #include #include +#include // tr_getRatio() #include "details.h" #include "file-tree.h" @@ -426,40 +427,21 @@ Details :: refresh( ) } myDownloadedLabel->setText( string ); - uint64_t u = 0; if( torrents.empty( ) ) string = none; else { - foreach( const Torrent * t, torrents ) u += t->uploadedEver( ); - string = QString( Formatter::sizeToString( u ) ); + uint64_t u = 0; + uint64_t d = 0; + foreach( const Torrent * t, torrents ) { + u += t->uploadedEver( ); + d += t->downloadedEver( ); + } + string = tr( "%1 (Ratio: %2)" ) + .arg( Formatter::sizeToString( u ) ) + .arg( Formatter::ratioToString( tr_getRatio( u, d ) ) ); } myUploadedLabel->setText( string ); - if( torrents.empty( ) ) - string = none; - else if( torrents.count() == 1 ) - string = Formatter::ratioToString( torrents.first()->ratio() ); - else { - bool isMixed = false; - int ratioType = (int) torrents.first()->ratio(); - if( ratioType > 0 ) ratioType = 0; - foreach( const Torrent *t, torrents ) - { - if( ratioType != ( t->ratio() >= 0 ? 0 : t->ratio() ) ) - { - isMixed = true; - break; - } - } - if( isMixed ) - string = mixed; - else if( ratioType < 0 ) - string = Formatter::ratioToString( ratioType ); - else - string = Formatter::ratioToString( (double)u / d ); - } - myRatioLabel->setText( string ); - const QDateTime qdt_now = QDateTime::currentDateTime( ); // myRunTimeLabel @@ -860,7 +842,6 @@ Details :: createInfoTab( ) hig->addRow( tr( "Availability:" ), myAvailabilityLabel = new SqueezeLabel ); hig->addRow( tr( "Downloaded:" ), myDownloadedLabel = new SqueezeLabel ); hig->addRow( tr( "Uploaded:" ), myUploadedLabel = new SqueezeLabel ); - hig->addRow( tr( "Ratio:" ), myRatioLabel = new SqueezeLabel ); hig->addRow( tr( "State:" ), myStateLabel = new SqueezeLabel ); hig->addRow( tr( "Running time:" ), myRunTimeLabel = new SqueezeLabel ); hig->addRow( tr( "Remaining time:" ), myETALabel = new SqueezeLabel ); diff --git a/qt/details.h b/qt/details.h index 25d2f39bc..8e8685550 100644 --- a/qt/details.h +++ b/qt/details.h @@ -83,7 +83,6 @@ class Details: public QDialog QLabel * myAvailabilityLabel; QLabel * myDownloadedLabel; QLabel * myUploadedLabel; - QLabel * myRatioLabel; QLabel * myErrorLabel; QLabel * myRunTimeLabel; QLabel * myETALabel;