Use properties instead of ivars (#2453)

This commit is contained in:
Dmitry Serov
2022-02-22 16:04:20 +00:00
committed by GitHub
parent 95e30768c4
commit 54d1a02e92
103 changed files with 3653 additions and 3917 deletions

View File

@@ -14,28 +14,18 @@
[super mouseDown:event];
}
- (void)setTorrent:(Torrent*)torrent
{
fTorrent = torrent;
}
- (void)setTrackers:(NSArray*)trackers
{
fTrackers = trackers;
}
- (void)copy:(id)sender
{
NSMutableArray* addresses = [NSMutableArray arrayWithCapacity:fTrackers.count];
NSMutableArray* addresses = [NSMutableArray arrayWithCapacity:self.trackers.count];
NSIndexSet* indexes = self.selectedRowIndexes;
for (NSUInteger i = indexes.firstIndex; i != NSNotFound; i = [indexes indexGreaterThanIndex:i])
{
id item = fTrackers[i];
id item = self.trackers[i];
if (![item isKindOfClass:[TrackerNode class]])
{
for (++i; i < fTrackers.count && [fTrackers[i] isKindOfClass:[TrackerNode class]]; ++i)
for (++i; i < self.trackers.count && [self.trackers[i] isKindOfClass:[TrackerNode class]]; ++i)
{
[addresses addObject:((TrackerNode*)fTrackers[i]).fullAnnounceAddress];
[addresses addObject:((TrackerNode*)self.trackers[i]).fullAnnounceAddress];
}
--i;
}
@@ -54,7 +44,7 @@
- (void)paste:(id)sender
{
NSAssert(fTorrent != nil, @"no torrent but trying to paste; should not be able to call this method");
NSAssert(self.torrent != nil, @"no torrent but trying to paste; should not be able to call this method");
BOOL added = NO;
@@ -65,7 +55,7 @@
{
for (NSString* item in [pbItem componentsSeparatedByString:@"\n"])
{
if ([fTorrent addTrackerToNewTier:item])
if ([self.torrent addTrackerToNewTier:item])
{
added = YES;
}
@@ -90,7 +80,7 @@
if (action == @selector(paste:))
{
return fTorrent && [NSPasteboard.generalPasteboard canReadObjectForClasses:@[ [NSString class] ] options:nil];
return self.torrent && [NSPasteboard.generalPasteboard canReadObjectForClasses:@[ [NSString class] ] options:nil];
}
return YES;