Changeset 7308
- Timestamp:
- Dec 7, 2008, 6:20:14 PM (12 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/FileOutlineController.h
r5864 r7308 31 31 { 32 32 Torrent * fTorrent; 33 NSArray * fFileList; 33 34 34 35 IBOutlet FileOutlineView * fOutline; 36 37 NSString * fFilterText; 35 38 } 36 39 … … 38 41 39 42 - (void) setTorrent: (Torrent *) torrent; 43 44 - (void) setFilterText: (NSString *) text; 40 45 41 46 - (void) reloadData; -
trunk/macosx/FileOutlineController.m
r7005 r7308 73 73 } 74 74 75 - (void) dealloc 76 { 77 [fFileList release]; 78 [fFilterText release]; 79 [super dealloc]; 80 } 81 75 82 - (FileOutlineView *) outlineView 76 83 { 77 84 return fOutline; 78 }79 80 - (void) outlineViewSelectionDidChange: (NSNotification *) notification81 {82 [[QuickLookController quickLook] updateQuickLook];83 85 } 84 86 … … 88 90 [fOutline setTorrent: fTorrent]; 89 91 92 [fFileList release]; 93 fFileList = [[fTorrent fileList] retain]; 94 95 [fFilterText release]; 96 fFilterText = nil; 97 90 98 [fOutline deselectAll: nil]; 91 99 [fOutline reloadData]; 92 100 } 93 101 102 - (void) setFilterText: (NSString *) text 103 { 104 if ([text isEqualToString: @""]) 105 text = nil; 106 107 if (text == fFilterText || [text isEqualToString: fFilterText]) 108 return; 109 110 [fFilterText release]; 111 fFilterText = [text retain]; 112 113 [fFileList release]; 114 if (!fFilterText) 115 fFileList = [[fTorrent fileList] retain]; 116 else 117 { 118 NSMutableArray * list = [NSMutableArray arrayWithCapacity: [fTorrent fileCount]]; 119 120 NSEnumerator * enumerator = [[fTorrent flatFileList] objectEnumerator]; 121 FileListNode * node; 122 while ((node = [enumerator nextObject])) 123 if ([[node name] rangeOfString: fFilterText options: NSCaseInsensitiveSearch].location != NSNotFound) 124 [list addObject: node]; 125 126 fFileList = [[NSArray alloc] initWithArray: list]; 127 } 128 129 [fOutline reloadData]; 130 } 131 94 132 - (void) reloadData 95 133 { … … 98 136 } 99 137 138 - (void) outlineViewSelectionDidChange: (NSNotification *) notification 139 { 140 [[QuickLookController quickLook] updateQuickLook]; 141 } 142 100 143 - (NSInteger) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item 101 144 { 102 145 if (!item) 103 return f Torrent ? [[fTorrent fileList]count] : 0;146 return fFileList ? [fFileList count] : 0; 104 147 else 105 148 { … … 116 159 - (id) outlineView: (NSOutlineView *) outlineView child: (NSInteger) index ofItem: (id) item 117 160 { 118 return [(item ? [(FileListNode *)item children] : [fTorrent fileList]) objectAtIndex: index];161 return [(item ? [(FileListNode *)item children] : fFileList) objectAtIndex: index]; 119 162 } 120 163 … … 296 339 for (NSInteger i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 297 340 if ([[NSFileManager defaultManager] fileExistsAtPath: 298 [downloadFolder stringByAppendingPathComponent: [[ [fTorrent fileList]objectAtIndex: i] fullPath]]])341 [downloadFolder stringByAppendingPathComponent: [[fFileList objectAtIndex: i] fullPath]]]) 299 342 return YES; 300 343 return NO; -
trunk/macosx/Torrent.m
r7307 r7308 467 467 while ((node = [nodeEnumerator nextObject])) 468 468 { 469 #warning this could be more thorough 469 470 if ([[node fullPath] hasPrefix: file]) 470 471 {
Note: See TracChangeset
for help on using the changeset viewer.