mirror of
https://github.com/transmission/transmission
synced 2025-03-09 13:50:00 +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
|
@ -136,32 +136,38 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80
|
|||
{
|
||||
float completedWidth = [fTorrent progress] * width,
|
||||
remainingWidth = width - completedWidth;
|
||||
|
||||
NSImage * barActiveEnd, * barActive;
|
||||
if ([fTorrent isActive])
|
||||
{
|
||||
barActiveEnd = fProgressEndBlue;
|
||||
barActive = fProgressBlue;
|
||||
}
|
||||
|
||||
NSImage * barLeftEnd, * barRightEnd;
|
||||
BOOL isActive = [fTorrent isActive];
|
||||
|
||||
//left end
|
||||
if (remainingWidth == width)
|
||||
barLeftEnd = fProgressEndWhite;
|
||||
else if (isActive)
|
||||
barLeftEnd = fProgressEndBlue;
|
||||
else
|
||||
{
|
||||
barActiveEnd = fProgressEndGray;
|
||||
barActive = fProgressGray;
|
||||
}
|
||||
if (completedWidth < 1.0)
|
||||
barActiveEnd = fProgressEndWhite;
|
||||
|
||||
[barActiveEnd compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
barLeftEnd = fProgressEndGray;
|
||||
|
||||
[barLeftEnd compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
|
||||
//active bar
|
||||
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;
|
||||
[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;
|
||||
[[fTorrent progress] < 1.0 ? fProgressEndWhite : fProgressEndGray
|
||||
compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
[barRightEnd compositeToPoint: point operation: NSCompositeSourceOver];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue