mirror of
https://github.com/transmission/transmission
synced 2025-02-01 03:43:43 +00:00
don't draw for ratio < 0
This commit is contained in:
parent
96e9685c6a
commit
dcd012a12c
1 changed files with 7 additions and 4 deletions
|
@ -97,19 +97,20 @@
|
|||
NSDictionary * info = [self objectValue];
|
||||
|
||||
width -= 2.0;
|
||||
|
||||
BOOL seeding = [[info objectForKey: @"Seeding"] boolValue],
|
||||
isActive = [[info objectForKey: @"Active"] boolValue];
|
||||
float completedWidth, remainingWidth;
|
||||
|
||||
//bar images and widths
|
||||
NSImage * barLeftEnd, * barRightEnd, * barComplete, * barRemaining;
|
||||
if (seeding)
|
||||
if ([[info objectForKey: @"Seeding"] boolValue])
|
||||
{
|
||||
float stopRatio, ratio;
|
||||
if ((stopRatio = [[info objectForKey: @"StopRatio"] floatValue]) != INVALID
|
||||
&& (ratio = [[info objectForKey: @"Ratio"] floatValue]) < stopRatio)
|
||||
{
|
||||
if (ratio < 0)
|
||||
ratio = 0;
|
||||
completedWidth = width * ratio / stopRatio;
|
||||
}
|
||||
else
|
||||
completedWidth = width;
|
||||
remainingWidth = width - completedWidth;
|
||||
|
@ -124,6 +125,8 @@
|
|||
completedWidth = [[info objectForKey: @"Progress"] floatValue] * width;
|
||||
remainingWidth = width - completedWidth;
|
||||
|
||||
BOOL isActive = [[info objectForKey: @"Active"] boolValue];
|
||||
|
||||
if (remainingWidth == width)
|
||||
barLeftEnd = fProgressEndWhite;
|
||||
else if (isActive)
|
||||
|
|
Loading…
Reference in a new issue