(trunk gtk,qt) #2490: gtk, qt clients' Details dialog doesn't show ETA anymore

This commit is contained in:
Charles Kerr 2009-10-10 20:42:23 +00:00
parent 2730f9ac9c
commit f58994b7bf
3 changed files with 48 additions and 0 deletions

View File

@ -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; i<n; ++i )
if( baseline != stats[i]->eta )
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 );

View File

@ -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( );

View File

@ -76,6 +76,7 @@ class Details: public QDialog
QLabel * myRatioLabel;
QLabel * myErrorLabel;
QLabel * myRunTimeLabel;
QLabel * myETALabel;
QLabel * myLastActivityLabel;
QCheckBox * mySessionLimitCheck;