From: Charles Kerr Date: Sun, 28 Jun 2009 16:21:47 +0000 (+0000) Subject: (trunk gtk,qt) add a little symmetry to the info tab's fields X-Git-Tag: 1.73~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c825ce54de6177aa50b71c6b0e00674da7de7417;p=transmission (trunk gtk,qt) add a little symmetry to the info tab's fields --- diff --git a/gtk/details.c b/gtk/details.c index 8d5d1f292..67cf3905a 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -790,17 +790,14 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n ) if( !haveValid && !haveUnchecked ) str = none; else { - char pct[16], ver[64]; - double n = 100.0 * ( sizeWhenDone - leftUntilDone ); - g_snprintf( pct, sizeof( pct ), _( "%.1f%%" ), n/sizeWhenDone ); - tr_strlsize( ver, haveValid, sizeof( ver ) ); - if( !haveUnchecked ) - g_snprintf( buf, sizeof(buf), _( "%1$s (%2$s verified)" ), pct, ver ); - else { - char u[64]; - tr_strlsize( u, haveUnchecked, sizeof( u ) ); - g_snprintf( buf, sizeof(buf), _( "%1$s (%2$s verified, %3$s unverified)" ), pct, ver, u ); - } + char unver[64], total[64]; + const double ratio = ( 100.0 * ( haveValid + haveUnchecked ) ) / leftUntilDone; + tr_strlsize( total, haveUnchecked + haveValid, sizeof( total ) ); + tr_strlsize( unver, haveUnchecked, sizeof( unver ) ); + if( haveUnchecked ) + g_snprintf( buf, sizeof( buf ), _( "%1$s (%2$.1f%%); %3$s Unverified" ), total, ratio, unver ); + else + g_snprintf( buf, sizeof( buf ), _( "%1$s (%2$.1f%%)" ), total, ratio ); str = buf; } } diff --git a/qt/details.cc b/qt/details.cc index 37110cdf0..8ca320bd2 100644 --- a/qt/details.cc +++ b/qt/details.cc @@ -269,14 +269,14 @@ Details :: refresh( ) else { QString pct = locale.toString( 100.0*((sizeWhenDone-leftUntilDone)/sizeWhenDone), 'f', 2 ); if( !haveUnverified ) - string = tr( "%1 (%2 verified)" ) - .arg( pct ) - .arg( Utils :: sizeToString( haveVerified ) ); + string = tr( "%1 (%2%)" ) + .arg( Utils :: sizeToString( haveVerified + haveUnverified ) ) + .arg( pct ); else - string = tr( "%1 (%2 verified, %3 unverified)" ) - .arg( pct ) - .arg( Utils :: sizeToString( haveVerified ) ) - .arg( Utils :: sizeToString( haveUnverified ) ); + string = tr( "%1 (%2%); %3 Unverified" ) + .arg( Utils :: sizeToString( haveVerified + haveUnverified ) ) + .arg( pct ) + .arg( Utils :: sizeToString( haveUnverified ) ); } myHaveLabel->setText( string );