make progress bar yellow when checking cache (color is temporary until someone can make a real yellow one)

This commit is contained in:
Mitchell Livingston 2007-07-03 02:26:31 +00:00
parent 1067a001d9
commit b94ddd9bc4
5 changed files with 17 additions and 9 deletions

View File

@ -36,6 +36,7 @@
+ (CTGradient *)progressBlueGradient;
+ (CTGradient *)progressGreenGradient;
+ (CTGradient *)progressLightGreenGradient;
+ (CTGradient *)progressYellowGradient;
+ (CTGradient *)progressTransparentGradient;
@end

View File

@ -310,6 +310,12 @@
return [newInstance autorelease];
}
+ (CTGradient *)progressYellowGradient
{
#warning someone make a real one!
return [CTGradient gradientWithBeginningColor: [NSColor orangeColor] endingColor: [NSColor yellowColor]];
}
+ (CTGradient *)progressTransparentGradient
{
CTGradient *newInstance = [[[self class] alloc] init];

View File

@ -524,6 +524,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[NSNumber numberWithFloat: [self progress]], @"Progress",
[NSNumber numberWithFloat: (float)fStat->left/[self size]], @"Left",
[NSNumber numberWithBool: [self isActive]], @"Active",
[NSNumber numberWithBool: [self isChecking]], @"Checking",
[NSNumber numberWithBool: [self isError]], @"Error", nil];
if ([self isSeeding])
@ -1658,7 +1659,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{
NSEnumerator * enumerator = [siblings objectEnumerator];
while ((dict = [enumerator nextObject]))
if ([[dict objectForKey: @"Name"] isEqualToString: name] && [[dict objectForKey: @"IsFolder"] boolValue])
if ([[dict objectForKey: @"IsFolder"] boolValue] && [[dict objectForKey: @"Name"] isEqualToString: name])
break;
}

View File

@ -32,7 +32,7 @@
{
NSImage * fErrorImage;
CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fLightGreenGradient,
* fGreenGradient, * fBlueGradient, * fTransparentGradient;
* fGreenGradient, * fYellowGradient, * fBlueGradient, * fTransparentGradient;
NSUserDefaults * fDefaults;
}

View File

@ -52,6 +52,7 @@
fBlueGradient = [[CTGradient progressBlueGradient] retain];
fGreenGradient = [[CTGradient progressGreenGradient] retain];
fLightGreenGradient = [[CTGradient progressLightGreenGradient] retain];
fYellowGradient = [[CTGradient progressYellowGradient] retain];
fTransparentGradient = [[CTGradient progressTransparentGradient] retain];
fErrorImage = [[NSImage imageNamed: @"Error"] copy];
@ -100,7 +101,9 @@
}
}
if ([[info objectForKey: @"Seeding"] boolValue])
if ([[info objectForKey: @"Checking"] boolValue])
[fYellowGradient fillRect: completeBounds angle: -90];
else if ([[info objectForKey: @"Seeding"] boolValue])
{
NSRect ratioBounds = completeBounds;
ratioBounds.size.width *= [[info objectForKey: @"ProgressStopRatio"] floatValue];
@ -109,13 +112,10 @@
[fLightGreenGradient fillRect: completeBounds angle: -90];
[fGreenGradient fillRect: ratioBounds angle: -90];
}
else if ([[info objectForKey: @"Active"] boolValue])
[fBlueGradient fillRect: completeBounds angle: -90];
else
{
if ([[info objectForKey: @"Active"] boolValue])
[fBlueGradient fillRect: completeBounds angle: -90];
else
[fGrayGradient fillRect: completeBounds angle: -90];
}
[fGrayGradient fillRect: completeBounds angle: -90];
[[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] set];
[NSBezierPath strokeRect: NSInsetRect(barBounds, 0.5, 0.5)];