Changeset 721 for trunk/macosx
- Timestamp:
- Aug 6, 2006, 5:06:05 PM (16 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/BarButton.m
r720 r721 36 36 - (id) initWithCoder: (NSCoder *) coder 37 37 { 38 38 if ((self = [super initWithCoder: coder])) 39 39 { 40 40 fEnabled = NO; … … 56 56 [nc addObserver: self selector: @selector(resetBounds:) 57 57 name: NSViewBoundsDidChangeNotification object: nil]; 58 59 58 } 59 return self; 60 60 } 61 61 -
trunk/macosx/Controller.h
r716 r721 43 43 int fCompleted; 44 44 45 NSMutableArray * fTorrents, * f FilteredTorrents;45 NSMutableArray * fTorrents, * fDisplayedTorrents; 46 46 47 47 PrefsController * fPrefsController; -
trunk/macosx/Controller.m
r720 r721 70 70 71 71 fTorrents = [[NSMutableArray alloc] initWithCapacity: 10]; 72 f FilteredTorrents = [[NSMutableArray alloc] initWithCapacity: 10];72 fDisplayedTorrents = [[NSMutableArray alloc] initWithCapacity: 10]; 73 73 74 74 fDefaults = [NSUserDefaults standardUserDefaults]; … … 89 89 90 90 [fTorrents release]; 91 [f FilteredTorrents release];91 [fDisplayedTorrents release]; 92 92 93 93 [fToolbar release]; … … 184 184 [fSpeedLimitButton setToolTip: @"Speed Limit overrides the total bandwidth limits with its own limits."]; 185 185 186 [fTableView setTorrents: f FilteredTorrents];186 [fTableView setTorrents: fDisplayedTorrents]; 187 187 [[fTableView tableColumnWithIdentifier: @"Torrent"] setDataCell: [[TorrentCell alloc] init]]; 188 188 … … 433 433 - (NSArray *) torrentsAtIndexes: (NSIndexSet *) indexSet 434 434 { 435 if ([f FilteredTorrents respondsToSelector: @selector(objectsAtIndexes:)])436 return [f FilteredTorrents objectsAtIndexes: indexSet];435 if ([fDisplayedTorrents respondsToSelector: @selector(objectsAtIndexes:)]) 436 return [fDisplayedTorrents objectsAtIndexes: indexSet]; 437 437 else 438 438 { … … 440 440 unsigned int i; 441 441 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 442 [torrents addObject: [f FilteredTorrents objectAtIndex: i]];442 [torrents addObject: [fDisplayedTorrents objectAtIndex: i]]; 443 443 444 444 return torrents; 445 445 } 446 }447 448 - (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code449 contextInfo: (Torrent *) torrent450 {451 if (code == NSOKButton)452 {453 [torrent setDownloadFolder: [[openPanel filenames] objectAtIndex: 0]];454 [torrent update];455 [self attemptToStartAuto: torrent];456 457 [fTorrents addObject: torrent];458 }459 460 [NSApp stopModal];461 446 } 462 447 … … 519 504 } 520 505 506 - (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code 507 contextInfo: (Torrent *) torrent 508 { 509 if (code == NSOKButton) 510 { 511 [torrent setDownloadFolder: [[openPanel filenames] objectAtIndex: 0]]; 512 [torrent update]; 513 [self attemptToStartAuto: torrent]; 514 515 [fTorrents addObject: torrent]; 516 } 517 518 [NSApp stopModal]; 519 } 520 521 521 //called on by applescript 522 522 - (void) open: (NSArray *) files … … 652 652 { 653 653 title = [NSString stringWithFormat: @"Comfirm Removal of \"%@\"", 654 [[f FilteredTorrents objectAtIndex: [fTableView selectedRow]] name]];654 [[fDisplayedTorrents objectAtIndex: [fTableView selectedRow]] name]]; 655 655 message = @"This transfer is active." 656 656 " Once removed, continuing the transfer will require the torrent file." … … 721 721 722 722 [fTorrents removeObject: torrent]; 723 [f FilteredTorrents removeObject: torrent];723 [fDisplayedTorrents removeObject: torrent]; 724 724 } 725 725 [torrents release]; … … 834 834 unsigned int i; 835 835 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 836 [[f FilteredTorrents objectAtIndex: i] revealData];836 [[fDisplayedTorrents objectAtIndex: i] revealData]; 837 837 } 838 838 … … 931 931 NSArray * selectedTorrents = nil; 932 932 int numSelected = [fTableView numberOfSelectedRows]; 933 if (numSelected > 0 && numSelected < [f FilteredTorrents count])933 if (numSelected > 0 && numSelected < [fDisplayedTorrents count]) 934 934 selectedTorrents = [self torrentsAtIndexes: [fTableView selectedRowIndexes]]; 935 935 … … 943 943 NSMutableIndexSet * indexSet = [[NSMutableIndexSet alloc] init]; 944 944 while ((torrent = [enumerator nextObject])) 945 [indexSet addIndex: [f FilteredTorrents indexOfObject: torrent]];945 [indexSet addIndex: [fDisplayedTorrents indexOfObject: torrent]]; 946 946 947 947 [fTableView selectRowIndexes: indexSet byExtendingSelection: NO]; … … 987 987 descriptors = [[NSArray alloc] initWithObjects: orderDescriptor, nil]; 988 988 989 [f FilteredTorrents sortUsingDescriptors: descriptors];989 [fDisplayedTorrents sortUsingDescriptors: descriptors]; 990 990 [descriptors release]; 991 991 … … 1120 1120 } 1121 1121 1122 [f FilteredTorrents setArray: tempTorrents];1122 [fDisplayedTorrents setArray: tempTorrents]; 1123 1123 [tempTorrents release]; 1124 1124 … … 1133 1133 unsigned index; 1134 1134 while ((torrent = [enumerator nextObject])) 1135 if ((index = [f FilteredTorrents indexOfObject: torrent]) != NSNotFound)1135 if ((index = [fDisplayedTorrents indexOfObject: torrent]) != NSNotFound) 1136 1136 [indexSet addIndex: index]; 1137 1137 … … 1143 1143 NSMutableString * totalTorrentsString = [NSMutableString stringWithString: @""]; 1144 1144 if (filtering) 1145 [totalTorrentsString appendFormat: @"%d/", [f FilteredTorrents count]];1145 [totalTorrentsString appendFormat: @"%d/", [fDisplayedTorrents count]]; 1146 1146 1147 1147 int totalCount = [fTorrents count]; … … 1466 1466 - (int) numberOfRowsInTableView: (NSTableView *) t 1467 1467 { 1468 return [f FilteredTorrents count];1468 return [fDisplayedTorrents count]; 1469 1469 } 1470 1470 … … 1472 1472 forTableColumn: (NSTableColumn *) tableColumn row: (int) row 1473 1473 { 1474 [cell setTorrent: [f FilteredTorrents objectAtIndex: row]];1474 [cell setTorrent: [fDisplayedTorrents objectAtIndex: row]]; 1475 1475 } 1476 1476 … … 1511 1511 return NSDragOperationGeneric; 1512 1512 } 1513 else; 1514 1515 return NSDragOperationNone; 1513 else 1514 return NSDragOperationNone; 1516 1515 } 1517 1516 … … 1538 1537 NSArray * selectedTorrents = nil; 1539 1538 int numSelected = [fTableView numberOfSelectedRows]; 1540 if (numSelected > 0 && numSelected < [f FilteredTorrents count])1539 if (numSelected > 0 && numSelected < [fDisplayedTorrents count]) 1541 1540 selectedTorrents = [self torrentsAtIndexes: [fTableView selectedRowIndexes]]; 1542 1541 … … 1546 1545 //move torrent in array 1547 1546 NSArray * movingTorrents = [[self torrentsAtIndexes: indexes] retain]; 1548 [f FilteredTorrents removeObjectsInArray: movingTorrents];1547 [fDisplayedTorrents removeObjectsInArray: movingTorrents]; 1549 1548 1550 1549 //determine the insertion index now that transfers to move have been removed … … 1555 1554 //insert objects at new location 1556 1555 for (i = 0; i < [movingTorrents count]; i++) 1557 [f FilteredTorrents insertObject: [movingTorrents objectAtIndex: i] atIndex: newRow - decrease + i];1556 [fDisplayedTorrents insertObject: [movingTorrents objectAtIndex: i] atIndex: newRow - decrease + i]; 1558 1557 1559 1558 [movingTorrents release]; … … 1568 1567 1569 1568 for (i = low; i <= high; i++) 1570 [[f FilteredTorrents objectAtIndex: i] setOrderValue: i];1569 [[fDisplayedTorrents objectAtIndex: i] setOrderValue: i]; 1571 1570 1572 1571 [fTableView reloadData]; … … 1579 1578 NSMutableIndexSet * indexSet = [[NSMutableIndexSet alloc] init]; 1580 1579 while ((torrent = [enumerator nextObject])) 1581 [indexSet addIndex: [f FilteredTorrents indexOfObject: torrent]];1580 [indexSet addIndex: [fDisplayedTorrents indexOfObject: torrent]]; 1582 1581 1583 1582 [fTableView selectRowIndexes: indexSet byExtendingSelection: NO]; … … 1636 1635 - (void) showStatusBar: (BOOL) show animate: (BOOL) animate 1637 1636 { 1638 if (show == ![fStatusBar isHidden])1637 if (show != [fStatusBar isHidden]) 1639 1638 return; 1640 1639 … … 1697 1696 - (void) showFilterBar: (BOOL) show animate: (BOOL) animate 1698 1697 { 1699 if (show == ![fFilterBar isHidden])1698 if (show != [fFilterBar isHidden]) 1700 1699 return; 1701 1700 … … 1896 1895 1897 1896 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 1898 if ([[f FilteredTorrents objectAtIndex: i] isActive])1897 if ([[fDisplayedTorrents objectAtIndex: i] isActive]) 1899 1898 return YES; 1900 1899 return NO; … … 1908 1907 1909 1908 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 1910 if ([[f FilteredTorrents objectAtIndex: i] isPaused])1909 if ([[fDisplayedTorrents objectAtIndex: i] isPaused]) 1911 1910 return YES; 1912 1911 return NO; … … 1922 1921 //only enable some items if it is in a context menu or the window is useable 1923 1922 BOOL canUseMenu = [fWindow isKeyWindow] || [[[menuItem menu] title] isEqualToString: @"Context"]; 1923 1924 //enable open items 1925 if (action == @selector(openShowSheet:)) 1926 return [fWindow attachedSheet] == nil; 1924 1927 1925 1928 //enable show info … … 1974 1977 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 1975 1978 { 1976 torrent = [f FilteredTorrents objectAtIndex: i];1979 torrent = [fDisplayedTorrents objectAtIndex: i]; 1977 1980 if (!warning && [torrent isActive]) 1978 1981 { … … 2053 2056 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 2054 2057 { 2055 torrent = [f FilteredTorrents objectAtIndex: i];2058 torrent = [fDisplayedTorrents objectAtIndex: i]; 2056 2059 if ([torrent isActive]) 2057 2060 return YES; … … 2072 2075 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 2073 2076 { 2074 torrent = [f FilteredTorrents objectAtIndex: i];2077 torrent = [fDisplayedTorrents objectAtIndex: i]; 2075 2078 if ([torrent isPaused]) 2076 2079 return YES; … … 2172 2175 NSRect frame = [fWindow frame]; 2173 2176 float newHeight = frame.size.height - [fScrollView frame].size.height 2174 + [f FilteredTorrents count] * ([fTableView rowHeight] + [fTableView intercellSpacing].height);2177 + [fDisplayedTorrents count] * ([fTableView rowHeight] + [fTableView intercellSpacing].height); 2175 2178 2176 2179 float minHeight = [fWindow minSize].height;
Note: See TracChangeset
for help on using the changeset viewer.