1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

(qt) Don't round ratio

This commit is contained in:
Daniel Lee 2010-05-24 04:17:49 +00:00
parent aec2701009
commit 06bea89970

View file

@ -77,12 +77,22 @@ Utils :: ratioToString( double ratio )
buf = tr( "None" );
else if( (int)ratio == TR_RATIO_INF )
buf = QString::fromUtf8( "\xE2\x88\x9E" );
else if( ratio < 10.0 )
buf.sprintf( "%'.2f", ratio );
else if( ratio < 100.0 )
buf.sprintf( "%'.1f", ratio );
else
buf.sprintf( "%'.0f", ratio );
{
QStringList temp;
temp = QString().sprintf( "%f", ratio ).split( "." );
if( ratio < 100.0 )
{
if( ratio < 10.0 )
temp[1].truncate( 2 );
else
temp[1].truncate( 1 );
buf = temp.join( "." );
}
else
buf = QString( temp[0] );
}
return buf;