- (void) open: (NSArray *) files
{
NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: files, @"Filenames",
- [NSNumber numberWithInt: ADD_MANUAL], @"AddType", nil];
+ @(ADD_MANUAL), @"AddType", nil];
[self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dict waitUntilDone: NO];
}
[filenames addObject: [url path]];
NSDictionary * dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: filenames, @"Filenames",
- [NSNumber numberWithInt: sender == fOpenIgnoreDownloadFolder ? ADD_SHOW_OPTIONS : ADD_MANUAL], @"AddType", nil];
+ sender == fOpenIgnoreDownloadFolder ? @(ADD_SHOW_OPTIONS) : @(ADD_MANUAL), @"AddType", nil];
[self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dictionary waitUntilDone: NO];
}
}];
NSMutableDictionary * groupsByIndex = [NSMutableDictionary dictionaryWithCapacity: [fDisplayedTorrents count]];
for (TorrentGroup * group in fDisplayedTorrents)
- [groupsByIndex setObject: group forKey: [NSNumber numberWithInteger: [group groupIndex]]];
+ [groupsByIndex setObject: group forKey: @([group groupIndex])];
const NSUInteger originalGroupCount = [fDisplayedTorrents count];
for (NSUInteger index = 0; index < originalGroupCount; ++index)
const NSInteger groupValue = [torrent groupValue];
if (groupValue != [group groupIndex])
{
- TorrentGroup * newGroup = [groupsByIndex objectForKey: [NSNumber numberWithInteger: groupValue]];
+ TorrentGroup * newGroup = [groupsByIndex objectForKey: @(groupValue)];
if (!newGroup)
{
newGroup = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
- [groupsByIndex setObject: newGroup forKey: [NSNumber numberWithInteger: groupValue]];
+ [groupsByIndex setObject: newGroup forKey: @(groupValue)];
[fDisplayedTorrents addObject: newGroup];
[fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndex: [fDisplayedTorrents count]-1] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
for (Torrent * torrent in [allTorrents objectsAtIndexes: unusedAllTorrentsIndexes])
{
const NSInteger groupValue = [torrent groupValue];
- TorrentGroup * group = [groupsByIndex objectForKey: [NSNumber numberWithInteger: groupValue]];
+ TorrentGroup * group = [groupsByIndex objectForKey: @(groupValue)];
if (!group)
{
group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
- [groupsByIndex setObject: group forKey: [NSNumber numberWithInteger: groupValue]];
+ [groupsByIndex setObject: group forKey: @(groupValue)];
[fDisplayedTorrents addObject: group];
[fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndex: [fDisplayedTorrents count]-1] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
for (Torrent * torrent in allTorrents)
{
const NSInteger groupValue = [torrent groupValue];
- TorrentGroup * group = [groupsByIndex objectForKey: [NSNumber numberWithInteger: groupValue]];
+ TorrentGroup * group = [groupsByIndex objectForKey: @(groupValue)];
if (!group)
{
group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
- [groupsByIndex setObject: group forKey: [NSNumber numberWithInteger: groupValue]];
+ [groupsByIndex setObject: group forKey: @(groupValue)];
}
[[group torrents] addObject: torrent];
- (id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn: (NSTableColumn *) tableColumn byItem: (id) item
{
if ([[tableColumn identifier] isEqualToString: @"Check"])
- return [NSNumber numberWithInteger: [fTorrent checkForFiles: [(FileListNode *)item indexes]]];
+ return @([fTorrent checkForFiles: [(FileListNode *)item indexes]]);
else
return item;
}
{
FilePriorityCell * cell = (FilePriorityCell *)[self preparedCellAtColumn: col row: row];
- NSDictionary * userInfo = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: row] forKey: @"Row"];
+ NSDictionary * userInfo = [NSDictionary dictionaryWithObject: @(row) forKey: @"Row"];
[cell addTrackingAreasForView: self inRect: [self frameOfCellAtColumn: col row: row] withUserInfo: userInfo
mouseLocation: mouseLocation];
}
const NSUInteger count = [priorities count];
if (fHoverRow && count > 0)
{
- [super setSelected: [priorities containsObject: [NSNumber numberWithInteger: TR_PRI_LOW]] forSegment: 0];
- [super setSelected: [priorities containsObject: [NSNumber numberWithInteger: TR_PRI_NORMAL]] forSegment: 1];
- [super setSelected: [priorities containsObject: [NSNumber numberWithInteger: TR_PRI_HIGH]] forSegment: 2];
+ [super setSelected: [priorities containsObject: @(TR_PRI_LOW)] forSegment: 0];
+ [super setSelected: [priorities containsObject: @(TR_PRI_NORMAL)] forSegment: 1];
+ [super setSelected: [priorities containsObject: @(TR_PRI_HIGH)] forSegment: 2];
[super drawWithFrame: cellFrame inView: controlView];
}
NSColor * priorityColor = [self backgroundStyle] == NSBackgroundStyleDark ? [NSColor whiteColor] : [NSColor darkGrayColor];
totalWidth = 0.0;
- if ([priorities containsObject: [NSNumber numberWithInteger: TR_PRI_LOW]])
+ if ([priorities containsObject: @(TR_PRI_LOW)])
{
NSImage * image = [[NSImage imageNamed: @"PriorityLowTemplate"] imageWithColor: priorityColor];
[images addObject: image];
totalWidth += [image size].width;
}
- if ([priorities containsObject: [NSNumber numberWithInteger: TR_PRI_NORMAL]])
+ if ([priorities containsObject: @(TR_PRI_NORMAL)])
{
NSImage * image = [[NSImage imageNamed: @"PriorityNormalTemplate"] imageWithColor: priorityColor];
[images addObject: image];
totalWidth += [image size].width;
}
- if ([priorities containsObject: [NSNumber numberWithInteger: TR_PRI_HIGH]])
+ if ([priorities containsObject: @(TR_PRI_HIGH)])
{
NSImage * image = [[NSImage imageNamed: @"PriorityHighTemplate"] imageWithColor: priorityColor];
[images addObject: image];
NSMutableDictionary * red = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor redColor], @"Color",
NSLocalizedString(@"Red", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 0], @"Index", nil];
+ @0, @"Index", nil];
NSMutableDictionary * orange = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor orangeColor], @"Color",
NSLocalizedString(@"Orange", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 1], @"Index", nil];
+ @1, @"Index", nil];
NSMutableDictionary * yellow = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor yellowColor], @"Color",
NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 2], @"Index", nil];
+ @2, @"Index", nil];
NSMutableDictionary * green = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor greenColor], @"Color",
NSLocalizedString(@"Green", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 3], @"Index", nil];
+ @3, @"Index", nil];
NSMutableDictionary * blue = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor blueColor], @"Color",
NSLocalizedString(@"Blue", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 4], @"Index", nil];
+ @4, @"Index", nil];
NSMutableDictionary * purple = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor purpleColor], @"Color",
NSLocalizedString(@"Purple", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 5], @"Index", nil];
+ @5, @"Index", nil];
NSMutableDictionary * gray = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSColor grayColor], @"Color",
NSLocalizedString(@"Gray", "Groups -> Name"), @"Name",
- [NSNumber numberWithInteger: 6], @"Index", nil];
+ @6, @"Index", nil];
fGroups = [[NSMutableArray alloc] initWithObjects: red, orange, yellow, green, blue, purple, gray, nil];
[self saveGroups]; //make sure this is saved right away
{
NSMutableDictionary * dict = [fGroups objectAtIndex: [self rowValueForIndex: index]];
- [dict setObject: [NSNumber numberWithBool: useCustomLocation] forKey: @"UsesCustomDownloadLocation"];
+ [dict setObject: @(useCustomLocation) forKey: @"UsesCustomDownloadLocation"];
[[GroupsController groups] saveGroups];
}
{
NSMutableDictionary * dict = [fGroups objectAtIndex: [self rowValueForIndex: index]];
- [dict setObject: [NSNumber numberWithBool: useAutoAssignRules] forKey: @"UsesAutoGroupRules"];
+ [dict setObject: @(useAutoAssignRules) forKey: @"UsesAutoGroupRules"];
[[GroupsController groups] saveGroups];
}
const NSInteger index = [candidates firstIndex];
- [fGroups addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger: index], @"Index",
+ [fGroups addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: @(index), @"Index",
[NSColor colorWithCalibratedRed: 0.0 green: 0.65 blue: 1.0 alpha: 1.0], @"Color", @"", @"Name", nil]];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
[fGroups removeObjectAtIndex: row];
[[NSNotificationCenter defaultCenter] postNotificationName: @"GroupValueRemoved" object: self userInfo:
- [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: index] forKey: @"Index"]];
+ [NSDictionary dictionaryWithObject: @(index) forKey: @"Index"]];
if (index == [[NSUserDefaults standardUserDefaults] integerForKey: @"FilterGroup"])
[[NSUserDefaults standardUserDefaults] setInteger: -2 forKey: @"FilterGroup"];
NSAssert1([fTorrents count] == 1, @"Attempting to add tracker with %ld transfers selected", [fTorrents count]);
- [fTrackers addObject: [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: -1] forKey: @"Tier"]];
+ [fTrackers addObject: [NSDictionary dictionaryWithObject: @-1 forKey: @"Tier"]];
[fTrackers addObject: @""];
[fTrackerTable setTrackers: fTrackers];
NSDictionary * message = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String: currentMessage->message], @"Message",
[NSDate dateWithTimeIntervalSince1970: currentMessage->when], @"Date",
- [NSNumber numberWithUnsignedInteger: currentIndex++], @"Index", //more accurate when sorting by date
- [NSNumber numberWithInteger: currentMessage->level], @"Level",
+ @(currentIndex++), @"Index", //more accurate when sorting by date
+ @(currentMessage->level), @"Level",
name, @"Name",
file, @"File", nil];
[numberFormatter setMinimumFractionDigits: 0];
[numberFormatter setMaximumFractionDigits: decimals];
- NSString * fileSizeString = [numberFormatter stringFromNumber: [NSNumber numberWithFloat: convertedSize]];
+ NSString * fileSizeString = [numberFormatter stringFromNumber: @(convertedSize)];
[numberFormatter release];
if (!notAllowedUnit || ![unit isEqualToString: notAllowedUnit])
fStatus = PORT_STATUS_CHECKING;
- fTimer = [[NSTimer scheduledTimerWithTimeInterval: CHECK_FIRE target: self selector: @selector(startProbe:) userInfo: [NSNumber numberWithInteger: portNumber] repeats: NO] retain];
+ fTimer = [[NSTimer scheduledTimerWithTimeInterval: CHECK_FIRE target: self selector: @selector(startProbe:) userInfo: @(portNumber) repeats: NO] retain];
if (!delay)
[fTimer fire];
}
{
int num = [component intValue];
if (num >= 0 && num < 256)
- [newComponents addObject: [[NSNumber numberWithInt: num] stringValue]];
+ [newComponents addObject: [@(num) stringValue]];
else
{
valid = false;
return [NSDictionary dictionaryWithObjectsAndKeys:
[self torrentLocation], @"InternalTorrentPath",
[self hashString], @"TorrentHash",
- [NSNumber numberWithBool: [self isActive]], @"Active",
- [NSNumber numberWithBool: [self waitingToStart]], @"WaitToStart",
- [NSNumber numberWithInt: fGroupValue], @"GroupValue",
- [NSNumber numberWithBool: fRemoveWhenFinishSeeding], @"RemoveWhenFinishSeeding", nil];
+ @([self isActive]), @"Active",
+ @([self waitingToStart]), @"WaitToStart",
+ @(fGroupValue), @"GroupValue",
+ @(fRemoveWhenFinishSeeding), @"RemoveWhenFinishSeeding", nil];
}
- (void) dealloc
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 12];
[dict setObject: [self name] forKey: @"Name"];
- [dict setObject: [NSNumber numberWithInt: peer->from] forKey: @"From"];
+ [dict setObject: @(peer->from) forKey: @"From"];
[dict setObject: [NSString stringWithUTF8String: peer->addr] forKey: @"IP"];
- [dict setObject: [NSNumber numberWithInt: peer->port] forKey: @"Port"];
- [dict setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
- [dict setObject: [NSNumber numberWithBool: peer->isSeed] forKey: @"Seed"];
- [dict setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"];
- [dict setObject: [NSNumber numberWithBool: peer->isUTP] forKey: @"uTP"];
+ [dict setObject: @(peer->port) forKey: @"Port"];
+ [dict setObject: @(peer->progress) forKey: @"Progress"];
+ [dict setObject: @(peer->isSeed) forKey: @"Seed"];
+ [dict setObject: @(peer->isEncrypted) forKey: @"Encryption"];
+ [dict setObject: @(peer->isUTP) forKey: @"uTP"];
[dict setObject: [NSString stringWithUTF8String: peer->client] forKey: @"Client"];
[dict setObject: [NSString stringWithUTF8String: peer->flagStr] forKey: @"Flags"];
if (peer->isUploadingTo)
- [dict setObject: [NSNumber numberWithDouble: peer->rateToPeer_KBps] forKey: @"UL To Rate"];
+ [dict setObject: @(peer->rateToPeer_KBps) forKey: @"UL To Rate"];
if (peer->isDownloadingFrom)
- [dict setObject: [NSNumber numberWithDouble: peer->rateToClient_KBps] forKey: @"DL From Rate"];
+ [dict setObject: @(peer->rateToClient_KBps) forKey: @"DL From Rate"];
[peerDicts addObject: dict];
}
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
if (dlSpeeds[i] != -1.0)
- [dict setObject: [NSNumber numberWithDouble: dlSpeeds[i]] forKey: @"DL From Rate"];
+ [dict setObject: @(dlSpeeds[i]) forKey: @"DL From Rate"];
[webSeeds addObject: dict];
}
NSAssert2(NO, @"Unknown priority %d for file index %ld", priority, index);
}
- [priorities addObject: [NSNumber numberWithInteger: priority]];
+ [priorities addObject: @(priority)];
if (low && normal && high)
break;
}
if (![[self itemAtRow: row] isKindOfClass: [Torrent class]])
continue;
- NSDictionary * userInfo = [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: row] forKey: @"Row"];
+ NSDictionary * userInfo = [NSDictionary dictionaryWithObject: @(row) forKey: @"Row"];
TorrentCell * cell = (TorrentCell *)[self preparedCellAtColumn: -1 row: row];
[cell addTrackingAreasForView: self inRect: [self rectOfRow: row] withUserInfo: userInfo mouseLocation: mouseLocation];
}
"Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimit:)
keyEquivalent: @""];
[item setTarget: self];
- [item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
+ [item setRepresentedObject: @(speedLimitActionValue[i])];
[menu addItem: item];
[item release];
}
item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
action: @selector(setQuickRatio:) keyEquivalent: @""];
[item setTarget: self];
- [item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
+ [item setRepresentedObject: @(ratioLimitActionValue[i])];
[menu addItem: item];
[item release];
}
{
NSMutableArray * progressMarks = [NSMutableArray arrayWithCapacity: 16];
for (NSAnimationProgress i = 0.0625; i <= 1.0; i += 0.0625)
- [progressMarks addObject: [NSNumber numberWithFloat: i]];
+ [progressMarks addObject: @(i)];
//this stops a previous animation
[fPiecesBarAnimation release];