mirror of
https://github.com/transmission/transmission
synced 2025-03-10 06:02:57 +00:00
Make the right end blue if the whole bar is blue.
This commit is contained in:
parent
a3e1af9717
commit
4c9421cfa4
1 changed files with 24 additions and 18 deletions
|
@ -137,31 +137,37 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
||||||
float completedWidth = [fTorrent progress] * width,
|
float completedWidth = [fTorrent progress] * width,
|
||||||
remainingWidth = width - completedWidth;
|
remainingWidth = width - completedWidth;
|
||||||
|
|
||||||
NSImage * barActiveEnd, * barActive;
|
NSImage * barLeftEnd, * barRightEnd;
|
||||||
if ([fTorrent isActive])
|
BOOL isActive = [fTorrent isActive];
|
||||||
{
|
|
||||||
barActiveEnd = fProgressEndBlue;
|
//left end
|
||||||
barActive = fProgressBlue;
|
if (remainingWidth == width)
|
||||||
}
|
barLeftEnd = fProgressEndWhite;
|
||||||
|
else if (isActive)
|
||||||
|
barLeftEnd = fProgressEndBlue;
|
||||||
else
|
else
|
||||||
{
|
barLeftEnd = fProgressEndGray;
|
||||||
barActiveEnd = fProgressEndGray;
|
|
||||||
barActive = fProgressGray;
|
|
||||||
}
|
|
||||||
if (completedWidth < 1.0)
|
|
||||||
barActiveEnd = fProgressEndWhite;
|
|
||||||
|
|
||||||
[barActiveEnd compositeToPoint: point operation: NSCompositeSourceOver];
|
[barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver];
|
||||||
|
|
||||||
|
//active bar
|
||||||
point.x += 1.0;
|
point.x += 1.0;
|
||||||
[self placeBar: barActive width: completedWidth point: point];
|
[self placeBar: isActive ? fProgressBlue : fProgressGray width: completedWidth point: point];
|
||||||
|
|
||||||
|
//remaining bar
|
||||||
point.x += completedWidth;
|
point.x += completedWidth;
|
||||||
[self placeBar: fProgressWhite width: remainingWidth point: point];
|
[self placeBar: fProgressWhite width: remainingWidth point: point];
|
||||||
|
|
||||||
|
//right end
|
||||||
|
if (completedWidth < width)
|
||||||
|
barRightEnd = fProgressEndWhite;
|
||||||
|
else if (isActive)
|
||||||
|
barRightEnd = fProgressEndBlue;
|
||||||
|
else
|
||||||
|
barRightEnd = fProgressEndGray;
|
||||||
|
|
||||||
point.x += remainingWidth;
|
point.x += remainingWidth;
|
||||||
[[fTorrent progress] < 1.0 ? fProgressEndWhite : fProgressEndGray
|
[barRightEnd compositeToPoint: point operation: NSCompositeSourceOver];
|
||||||
compositeToPoint: point operation: NSCompositeSourceOver];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue