Changeset 9227
- Timestamp:
- Oct 1, 2009, 1:15:37 AM (13 years ago)
- Location:
- trunk/macosx
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/InfoWindowController.m
r9225 r9227 379 379 [self setWebSeedTableHidden: YES animate: YES]; 380 380 381 [fTrackerTable setTorrent: nil]; 382 381 383 [fTrackers release]; 382 384 fTrackers = nil; … … 468 470 } 469 471 472 [fTrackerTable setTorrent: torrent]; 470 473 [fTrackerTable deselectAll: self]; 471 474 [fTrackerAddRemoveControl setEnabled: YES forSegment: TRACKER_ADD_TAG]; … … 1720 1723 if ([item isKindOfClass: [NSNumber class]]) 1721 1724 { 1722 ++i; 1723 for (NSInteger j = i; j < [fTrackers count] && ![[fTrackers objectAtIndex: j] isKindOfClass: [NSNumber class]]; ++j, ++i) 1724 [addresses addObject: [[fTrackers objectAtIndex: j] fullAnnounceAddress]]; 1725 for (++i; i < [fTrackers count] && ![[fTrackers objectAtIndex: i] isKindOfClass: [NSNumber class]]; ++i) 1726 [addresses addObject: [[fTrackers objectAtIndex: i] fullAnnounceAddress]]; 1725 1727 --i; 1726 1728 } -
trunk/macosx/Torrent.h
r9221 r9227 28 28 29 29 @class FileListNode; 30 31 #warning remove!?32 #define STAT_TIME_NONE -133 #define STAT_TIME_NOW -234 30 35 31 @interface Torrent : NSObject <QLPreviewItem> -
trunk/macosx/Torrent.m
r9221 r9227 706 706 } 707 707 708 #warning check for duplicates? 708 709 - (BOOL) addTrackerToNewTier: (NSString *) tracker 709 710 { -
trunk/macosx/TrackerTableView.h
r9219 r9227 25 25 #import <Cocoa/Cocoa.h> 26 26 27 @class Torrent; 28 27 29 @interface TrackerTableView : NSTableView 28 30 { 31 //weak references 32 Torrent * fTorrent; 29 33 NSArray * fTrackers; 30 34 } 31 35 36 - (void) setTorrent: (Torrent *) torrent; 32 37 - (void) setTrackers: (NSArray *) trackers; 33 38 34 - (IBAction) copy: (id) sender; 39 - (void) copy: (id) sender; 40 - (void) paste: (id) sender; 35 41 36 42 @end -
trunk/macosx/TrackerTableView.m
r9220 r9227 25 25 #import "TrackerTableView.h" 26 26 #import "NSApplicationAdditions.h" 27 #import "Torrent.h" 27 28 #import "TrackerNode.h" 28 29 … … 35 36 } 36 37 38 - (void) setTorrent: (Torrent *) torrent 39 { 40 fTorrent = torrent; 41 } 42 37 43 - (void) setTrackers: (NSArray *) trackers 38 44 { … … 40 46 } 41 47 42 - ( IBAction) copy: (id) sender48 - (void) copy: (id) sender 43 49 { 44 50 NSMutableArray * addresses = [NSMutableArray arrayWithCapacity: [fTrackers count]]; … … 72 78 } 73 79 80 - (void) paste: (id) sender 81 { 82 if (!fTorrent) 83 return; 84 85 if ([NSApp isOnSnowLeopardOrBetter]) 86 { 87 NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: 88 [NSArray arrayWithObject: [NSString class]] options: nil]; 89 NSAssert(items != nil, @"no string items to paste; should not be able to call this method"); 90 91 BOOL added = NO; 92 for (NSString * pbItem in items) 93 { 94 for (NSString * item in [pbItem componentsSeparatedByString: @"\n"]) 95 if ([fTorrent addTrackerToNewTier: item]) 96 added = YES; 97 } 98 99 //none added 100 if (!added) 101 NSBeep(); 102 } 103 } 104 74 105 - (BOOL) validateMenuItem: (NSMenuItem *) menuItem 75 106 { … … 78 109 if (action == @selector(copy:)) 79 110 return [self numberOfSelectedRows] > 0; 111 112 if (action == @selector(paste:)) 113 return [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; 80 114 81 115 return YES;
Note: See TracChangeset
for help on using the changeset viewer.