]> granicus.if.org Git - transmission/commitdiff
(trunk gtk,qt) add a little symmetry to the info tab's fields
authorCharles Kerr <charles@transmissionbt.com>
Sun, 28 Jun 2009 16:21:47 +0000 (16:21 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 28 Jun 2009 16:21:47 +0000 (16:21 +0000)
gtk/details.c
qt/details.cc

index 8d5d1f29243b59d0c68d19702be8d986fa76aae5..67cf3905a0315b7adc1d53e89ddd4426371f6da1 100644 (file)
@@ -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;
         }
     }
index 37110cdf0eb2581772aced4b497fbc5070774e49..8ca320bd207b6d00d0cac4ca72ba9eb13cd08cfd 100644 (file)
@@ -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 );