add availability bar to dim percent not available (yellow for now)

This commit is contained in:
Mitchell Livingston 2007-11-11 16:59:32 +00:00
parent 8516860fec
commit f20a6b15b7
6 changed files with 26 additions and 15 deletions

View File

@ -200,6 +200,7 @@
- (void) toggleSmallView: (id) sender;
- (void) togglePiecesBar: (id) sender;
- (void) toggleAvailabilityBar: (id) sender;
- (void) toggleStatusBar: (id) sender;
- (void) showStatusBar: (BOOL) show animate: (BOOL) animate;

View File

@ -1533,7 +1533,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
if (![fWindow isKeyWindow])
if (![fWindow isMainWindow])
[fBadger incrementCompleted];
if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] <= 0)
@ -2405,6 +2405,12 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fTableView display];
}
- (void) toggleAvailabilityBar: (id) sender
{
[fDefaults setBool: ![fDefaults boolForKey: @"DisplayProgressBarAvailable"] forKey: @"DisplayProgressBarAvailable"];
[fTableView display];
}
- (void) toggleStatusBar: (id) sender
{
[self showStatusBar: [fStatusBar isHidden] animate: YES];
@ -2800,6 +2806,12 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[menuItem setState: [fDefaults boolForKey: @"PiecesBar"] ? NSOnState : NSOffState];
return [fWindow isVisible];
}
if (action == @selector(toggleAvailabilityBar:))
{
[menuItem setState: [fDefaults boolForKey: @"DisplayProgressBarAvailable"] ? NSOnState : NSOffState];
return [fWindow isVisible];
}
//enable show info
if (action == @selector(showInfo:))

View File

@ -126,6 +126,8 @@
<string>id</string>
<key>switchFilter</key>
<string>id</string>
<key>toggleAvailabilityBar</key>
<string>id</string>
<key>toggleFilterBar</key>
<string>id</string>
<key>togglePiecesBar</key>

Binary file not shown.

View File

@ -241,7 +241,6 @@
- (void) updatePortStatus
{
tr_handle_status * stat = tr_handleStatus(fHandle);
if (fNatStatus != stat->natTraversalStatus || fPublicPort != stat->publicPort)
{
fNatStatus = stat->natTraversalStatus;

View File

@ -333,30 +333,27 @@
if (rightWidth > 0)
{
int availableWidth = 0;
/*if (![fDefaults boolForKey: @"DisplayProgressBarAvailable"])
if ([fDefaults boolForKey: @"DisplayProgressBarAvailable"])
{
//NSLog(@"notAvailableWidth %d rightWidth %d", notAvailableWidth, rightWidth);
availableWidth = MAX(0, (float)rightWidth - barRect.size.width * [torrent notAvailableDesired]);
int notAvailableWidth = MIN(barRect.size.width * [torrent notAvailableDesired], rightWidth);
rightWidth -= notAvailableWidth;
if (availableWidth > 0)
if (notAvailableWidth > 0)
{
rightWidth -= availableWidth;
NSRect availableRect = barRect;
availableRect.origin.x += leftWidth;
availableRect.size.width = availableWidth;
NSRect notAvailableRect = barRect;
notAvailableRect.origin.x += leftWidth + rightWidth;
notAvailableRect.size.width = notAvailableWidth;
if (!fYellowGradient)
fYellowGradient = [[CTGradient progressYellowGradient] retain];
[fYellowGradient fillRect: availableRect angle: -90];
[fYellowGradient fillRect: notAvailableRect angle: -90];
}
}*/
}
if (rightWidth > 0)
{
NSRect includeRect = barRect;
includeRect.origin.x += leftWidth + availableWidth;
includeRect.origin.x += leftWidth;
includeRect.size.width = rightWidth;
if (!fWhiteGradient)