Changeset 2033
- Timestamp:
- Jun 10, 2007, 10:03:01 PM (15 years ago)
- Location:
- branches/file_selection/macosx
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/file_selection/macosx/English.lproj/InfoWindow.nib/classes.nib
r1949 r2033 8 8 revealFile = id; 9 9 revealTorrentFile = id; 10 setCheck = id; 10 11 setLimitSetting = id; 11 12 setPex = id; 13 setPriority = id; 12 14 setRatioLimit = id; 13 15 setRatioSetting = id; … … 33 35 fDownloadingFromField = NSTextField; 34 36 fErrorMessageView = NSTextView; 37 fFileCheckItem = NSMenuItem; 35 38 fFileOutline = NSOutlineView; 39 fFilePriorityHigh = NSMenuItem; 40 fFilePriorityLow = NSMenuItem; 41 fFilePriorityNormal = NSMenuItem; 36 42 fFileTableStatusField = NSTextField; 43 fFileUncheckItem = NSMenuItem; 37 44 fHashField = NSTextField; 38 45 fImageView = NSImageView; -
branches/file_selection/macosx/English.lproj/InfoWindow.nib/info.nib
r1799 r2033 8 8 <dict> 9 9 <key>549</key> 10 <string> 364 417 144 490 0 1152 842 </string>10 <string>565 283 144 118 0 0 1152 842 </string> 11 11 </dict> 12 12 <key>IBFramework Version</key> … … 22 22 <key>IBOpenObjects</key> 23 23 <array> 24 <integer>549</integer> 24 25 <integer>5</integer> 25 26 </array> -
branches/file_selection/macosx/FileOutlineView.m
r2026 r2033 80 80 } 81 81 82 - (NSMenu *) menuForEvent: (NSEvent *) e 82 - (NSMenu *) menuForEvent: (NSEvent *) event 83 83 { 84 int row = [self rowAtPoint: [self convertPoint: [e locationInWindow] fromView: nil]];84 int row = [self rowAtPoint: [self convertPoint: [event locationInWindow] fromView: nil]]; 85 85 86 86 if (row >= 0) 87 87 { 88 if ( [self itemAtRow: row] &&![self isRowSelected: row])88 if (![self isRowSelected: row]) 89 89 [self selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection: NO]; 90 90 } -
branches/file_selection/macosx/InfoWindowController.h
r2012 r2033 55 55 IBOutlet NSOutlineView * fFileOutline; 56 56 IBOutlet NSTextField * fFileTableStatusField; 57 IBOutlet NSMenuItem * fFileCheckItem, * fFileUncheckItem, 58 * fFilePriorityNormal, * fFilePriorityHigh, * fFilePriorityLow; 57 59 58 60 IBOutlet NSPopUpButton * fRatioPopUp, * fUploadLimitPopUp, * fDownloadLimitPopUp; … … 74 76 - (void) revealFile: (id) sender; 75 77 78 - (void) setCheck: (id) sender; 79 - (void) setPriority: (id) sender; 80 76 81 - (void) setLimitSetting: (id) sender; 77 82 - (void) setSpeedLimit: (id) sender; -
branches/file_selection/macosx/InfoWindowController.m
r2026 r2033 589 589 return [fFileOutline numberOfSelectedRows] > 0 && 590 590 [[[fTabView selectedTabViewItem] identifier] isEqualToString: TAB_FILES_IDENT]; 591 592 if (action == @selector(setCheck:)) 593 { 594 Torrent * torrent = [fTorrents objectAtIndex: 0]; 595 NSDictionary * item; 596 NSIndexSet * indexSet = [fFileOutline selectedRowIndexes], * itemIndexes; 597 int i, index, state = (menuItem == fFileCheckItem) ? NSOnState : NSOffState; 598 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 599 { 600 item = [fFileOutline itemAtRow: i]; 601 if ([[item objectForKey: @"IsFolder"] boolValue]) 602 { 603 itemIndexes = [item objectForKey: @"Indexes"]; 604 if ([torrent checkForFileFolder: itemIndexes] != state 605 && [torrent canChangeDownloadCheckForFileFolder: itemIndexes]) 606 return YES; 607 } 608 else 609 { 610 index = [[item objectForKey: @"Index"] intValue]; 611 if ([torrent checkForFile: index] != state && [torrent canChangeDownloadCheckFile: index]) 612 return YES; 613 } 614 } 615 return NO; 616 } 617 618 if (action == @selector(setPriority:)) 619 { 620 return [fFileOutline numberOfSelectedRows] > 0; 621 } 591 622 592 623 return YES; … … 813 844 else if ([[tableColumn identifier] isEqualToString: @"Check"]) 814 845 { 815 //[(NSButtonCell *)cell setImagePosition: NSImageOnly];816 817 846 Torrent * torrent = [fTorrents objectAtIndex: 0]; 818 847 if ([[item objectForKey: @"IsFolder"] boolValue]) … … 902 931 [[NSWorkspace sharedWorkspace] selectFile: [folder stringByAppendingPathComponent: 903 932 [[fFileOutline itemAtRow: i] objectForKey: @"Path"]] inFileViewerRootedAtPath: nil]; 933 } 934 935 - (void) setCheck: (id) sender 936 { 937 int state = sender == fFileCheckItem ? NSOnState : NSOffState; 938 939 Torrent * torrent = [fTorrents objectAtIndex: 0]; 940 NSIndexSet * indexSet = [fFileOutline selectedRowIndexes]; 941 int i; 942 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 943 [torrent setFileCheckState: state forFileItem: [fFileOutline itemAtRow: i]]; 944 945 [fFileOutline reloadData]; 946 } 947 948 - (void) setPriority: (id) sender 949 { 950 int priority; 951 if (sender == fFilePriorityHigh) 952 priority = PRIORITY_HIGH; 953 else if (sender == fFilePriorityLow) 954 priority = PRIORITY_LOW; 955 else 956 priority = PRIORITY_NORMAL; 957 958 Torrent * torrent = [fTorrents objectAtIndex: 0]; 959 NSIndexSet * indexSet = [fFileOutline selectedRowIndexes]; 960 int i; 961 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 962 [torrent setFilePriority: priority forFileItem: [fFileOutline itemAtRow: i]]; 963 964 [fFileOutline reloadData]; 904 965 } 905 966 -
branches/file_selection/macosx/Torrent.m
r2025 r2033 1379 1379 - (void) setFilePriority: (int) priority forFileItem: (NSMutableDictionary *) item 1380 1380 { 1381 if ([[item objectForKey: @"IsFolder"] boolValue]) 1382 return; 1383 1384 [item setObject: [NSNumber numberWithInt: priority] forKey: @"Priority"]; 1385 1386 int index = [[item objectForKey: @"Index"] intValue]; 1387 if ([self checkForFile: index] == NSOnState) 1388 { 1389 tr_priority_t actualPriority; 1390 if (priority == PRIORITY_HIGH) 1391 actualPriority = TR_PRI_HIGH; 1392 else if (priority == PRIORITY_LOW) 1393 actualPriority = TR_PRI_LOW; 1394 else 1395 actualPriority = TR_PRI_NORMAL; 1396 tr_torrentSetFilePriority(fHandle, index, actualPriority); 1381 if (![[item objectForKey: @"IsFolder"] boolValue]) 1382 { 1383 [item setObject: [NSNumber numberWithInt: priority] forKey: @"Priority"]; 1384 1385 int index = [[item objectForKey: @"Index"] intValue]; 1386 if ([self checkForFile: index] == NSOnState) 1387 { 1388 tr_priority_t actualPriority; 1389 if (priority == PRIORITY_HIGH) 1390 actualPriority = TR_PRI_HIGH; 1391 else if (priority == PRIORITY_LOW) 1392 actualPriority = TR_PRI_LOW; 1393 else 1394 actualPriority = TR_PRI_NORMAL; 1395 tr_torrentSetFilePriority(fHandle, index, actualPriority); 1396 } 1397 } 1398 else 1399 { 1400 NSEnumerator * enumerator = [[item objectForKey: @"Children"] objectEnumerator]; 1401 NSMutableDictionary * child; 1402 while ((child = [enumerator nextObject])) 1403 [self setFilePriority: priority forFileItem: child]; 1397 1404 } 1398 1405 }
Note: See TracChangeset
for help on using the changeset viewer.