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:
parent
aec2701009
commit
06bea89970
1 changed files with 15 additions and 5 deletions
20
qt/utils.cc
20
qt/utils.cc
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue