display the infinity symbol in stats for ratio when there is upload but no download

This commit is contained in:
Mitchell Livingston 2007-12-13 04:31:38 +00:00
parent e1d10bba7e
commit 1b6a8a9504
5 changed files with 9 additions and 3 deletions

2
NEWS
View File

@ -11,9 +11,9 @@ NEWS file for Transmission <http://transmission.m0k.org/>
+ Statistics window
+ Pieces Bar (return of Advanced Bar)
+ Availability Bar (overlay on regular bar)
+ Leopard: Time Machine will ignore incomplete downloads
+ Display remaining time for seeding transfers
+ Sort by total activity
+ Leopard: Time Machine will ignore incomplete downloads
+ Leopard: Fix bug where text fields would reject localized decimal values
- GTK+:
+ Statistics window

View File

@ -138,7 +138,10 @@ tr_getSessionStats( const tr_handle * handle,
{
const struct tr_stats_handle * stats = handle->sessionStats;
*setme = stats->single;
setme->ratio = setme->downloadedBytes ? (double)setme->uploadedBytes / (double)setme->downloadedBytes : TR_RATIO_NA;
setme->ratio = setme->downloadedBytes ? (double)setme->uploadedBytes / (double)setme->downloadedBytes
: ( setme->uploadedBytes ? TR_RATIO_INF : TR_RATIO_NA );
setme->secondsActive += ( time(NULL) - stats->startTime );
}

View File

@ -699,6 +699,7 @@ struct tr_stat
float swarmspeed;
#define TR_RATIO_NA -1
#define TR_RATIO_INF -2
float ratio;
uint64_t startDate;

View File

@ -97,6 +97,8 @@
{
if (ratio == TR_RATIO_NA)
return NSLocalizedString(@"N/A", "No Ratio");
else if (ratio == TR_RATIO_INF)
return [NSString stringWithUTF8String: "\xE2\x88\x9E"];
else if (ratio < 0)
return NSLocalizedString(@"error", "Ratio invalid");
else;

View File

@ -49,7 +49,7 @@
- (void) setShowOnTiger: (BOOL) show
{
fShow = [NSApp isOnLeopardOrBetter] || show;
fShow = show || [NSApp isOnLeopardOrBetter];
}
- (BOOL) isOpaque