From f58994b7bf97dfc2de5fadee8a080b56b20c372f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 10 Oct 2009 20:42:23 +0000 Subject: [PATCH] (trunk gtk,qt) #2490: gtk, qt clients' Details dialog doesn't show ETA anymore --- gtk/details.c | 24 ++++++++++++++++++++++++ qt/details.cc | 23 +++++++++++++++++++++++ qt/details.h | 1 + 3 files changed, 48 insertions(+) diff --git a/gtk/details.c b/gtk/details.c index 02fc2bf87..8f68dcb95 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -70,6 +70,7 @@ struct DetailsImpl GtkWidget * ratio_lb; GtkWidget * error_lb; GtkWidget * date_started_lb; + GtkWidget * eta_lb; GtkWidget * last_activity_lb; GtkWidget * hash_lb; @@ -732,6 +733,25 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n ) gtk_label_set_text( GTK_LABEL( di->date_started_lb ), str ); + /* eta */ + if( n <= 0 ) + str = none; + else { + const int baseline = stats[0]->eta; + for( i=1; ieta ) + break; + if( i!=n ) + str = mixed; + else if( baseline < 0 ) + str = _( "Unknown" ); + else + str = tr_strltime( buf, baseline, sizeof( buf ) ); + } + gtk_label_set_text( GTK_LABEL( di->eta_lb ), str ); + + + /* size_lb */ { char sizebuf[128]; @@ -941,6 +961,10 @@ info_page_new( struct DetailsImpl * di ) l = di->date_started_lb = gtk_label_new( NULL ); hig_workarea_add_row( t, &row, _( "Running time:" ), l, NULL ); + /* eta */ + l = di->eta_lb = gtk_label_new( NULL ); + hig_workarea_add_row( t, &row, _( "Remaining time:" ), l, NULL ); + /* last activity */ l = di->last_activity_lb = gtk_label_new( NULL ); hig_workarea_add_row( t, &row, _( "Last activity:" ), l, NULL ); diff --git a/qt/details.cc b/qt/details.cc index 98e153bd5..4cf7b07c4 100644 --- a/qt/details.cc +++ b/qt/details.cc @@ -329,6 +329,28 @@ Details :: refresh( ) myRunTimeLabel->setText( string ); + // myETALabel + string.clear( ); + if( torrents.empty( ) ) + string = none; + else { + int baseline = torrents[0]->getETA( ); + foreach( const Torrent * t, torrents ) { + if( baseline != t->getETA( ) ) { + string = mixed; + break; + } + } + if( string.isEmpty( ) ) { + if( baseline < 0 ) + string = tr( "Unknown" ); + else + string = Utils::timeToString( baseline ); + } + } + myETALabel->setText( string ); + + // myLastActivityLabel if( torrents.empty( ) ) string = none; @@ -791,6 +813,7 @@ Details :: createInfoTab( ) 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 ); hig->addRow( tr( "Last activity:" ), myLastActivityLabel = new SqueezeLabel ); hig->addRow( tr( "Error:" ), myErrorLabel = new SqueezeLabel ); hig->addSectionDivider( ); diff --git a/qt/details.h b/qt/details.h index d032712c9..d8438e789 100644 --- a/qt/details.h +++ b/qt/details.h @@ -76,6 +76,7 @@ class Details: public QDialog QLabel * myRatioLabel; QLabel * myErrorLabel; QLabel * myRunTimeLabel; + QLabel * myETALabel; QLabel * myLastActivityLabel; QCheckBox * mySessionLimitCheck;