small efficiency change and some improvements for the invisible file checkboxes

This commit is contained in:
Mitchell Livingston
2007-02-23 19:17:31 +00:00
parent 74d2eefac4
commit 16cd689de2
3 changed files with 63 additions and 10 deletions

View File

@@ -107,13 +107,19 @@
//set file table
[fFileOutline setDoubleAction: @selector(revealFile:)];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(fileFinished:) name: @"FileFinished" object: nil];
//set blank inspector
[self updateInfoForTorrents: [NSArray array]];
}
- (void) dealloc
{
[fTorrents release];
[[NSNotificationCenter defaultCenter] removeObserver: self];
if (fTorrents)
[fTorrents release];
if (fPeers)
[fPeers release];
if (fFiles)
@@ -399,8 +405,8 @@
if ([fTorrents count] != 1)
return;
[[fTorrents objectAtIndex: 0] updateFileProgress];
[fFileOutline reloadData];
if ([[fTorrents objectAtIndex: 0] updateFileProgress])
[fFileOutline reloadData];
}
- (void) updateInfoSettings
@@ -710,7 +716,7 @@
}
- (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell
forTableColumn: (NSTableColumn *) tableColumn item:(id) item
forTableColumn: (NSTableColumn *) tableColumn item: (id) item
{
if ([[tableColumn identifier] isEqualToString: @"Name"])
{
@@ -723,8 +729,16 @@
}
else if ([[tableColumn identifier] isEqualToString: @"Check"])
{
/*[(NSButtonCell *)cell setImagePosition: item ? NSImageOnly : NSNoImage];
[cell setEnabled: NO];*/
/*if (!item)
{
[(NSButtonCell *)cell setImagePosition: NSNoImage];
[cell setEnabled: NO];
return;
}
[(NSButtonCell *)cell setImagePosition: NSImageOnly];
[cell setEnabled: [[item objectForKey: @"IsFolder"] boolValue] ? [[item objectForKey: @"Remaining"] intValue] > 0
: [[item objectForKey: @"Progress"] floatValue] < 1.0];*/
[(NSButtonCell *)cell setImagePosition: NSNoImage];
}
else;
@@ -741,6 +755,16 @@
[fFileOutline reloadItem: topItem reloadChildren: YES];
}
- (void) fileFinished: (NSNotification *) notification
{
NSMutableDictionary * item = [notification object];
[item setObject: [NSNumber numberWithInt: NSOnState] forKey: @"Check"];
NSMutableDictionary * topItem = [self resetFileCheckStateForItemParent: item];
[fFileOutline reloadItem: topItem reloadChildren: YES];
}
- (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item
{
[item setObject: [NSNumber numberWithInt: state] forKey: @"Check"];