NSArray init literals
This commit is contained in:
parent
87b6c451ac
commit
b743b64262
|
@ -204,12 +204,12 @@ BlocklistDownloader * fBLDownloader = nil;
|
||||||
NSTask * unzip = [[NSTask alloc] init];
|
NSTask * unzip = [[NSTask alloc] init];
|
||||||
[unzip setLaunchPath: @"/usr/bin/unzip"];
|
[unzip setLaunchPath: @"/usr/bin/unzip"];
|
||||||
[unzip setCurrentDirectoryPath: workingDirectory];
|
[unzip setCurrentDirectoryPath: workingDirectory];
|
||||||
[unzip setArguments: [NSArray arrayWithObjects:
|
[unzip setArguments: @[
|
||||||
@"-o", /* overwrite */
|
@"-o", /* overwrite */
|
||||||
@"-q", /* quiet! */
|
@"-q", /* quiet! */
|
||||||
fDestination, /* source zip file */
|
fDestination, /* source zip file */
|
||||||
@"-d", workingDirectory, /*destination*/
|
@"-d", workingDirectory /*destination*/
|
||||||
nil]];
|
]];
|
||||||
|
|
||||||
@try
|
@try
|
||||||
{
|
{
|
||||||
|
@ -231,10 +231,10 @@ BlocklistDownloader * fBLDownloader = nil;
|
||||||
|
|
||||||
zipinfo = [[NSTask alloc] init];
|
zipinfo = [[NSTask alloc] init];
|
||||||
[zipinfo setLaunchPath: @"/usr/bin/zipinfo"];
|
[zipinfo setLaunchPath: @"/usr/bin/zipinfo"];
|
||||||
[zipinfo setArguments: [NSArray arrayWithObjects:
|
[zipinfo setArguments: @[
|
||||||
@"-1", /* just the filename */
|
@"-1", /* just the filename */
|
||||||
fDestination, /* source zip file */
|
fDestination /* source zip file */
|
||||||
nil]];
|
]];
|
||||||
[zipinfo setStandardOutput: [NSPipe pipe]];
|
[zipinfo setStandardOutput: [NSPipe pipe]];
|
||||||
|
|
||||||
@try
|
@try
|
||||||
|
|
|
@ -507,8 +507,8 @@ static void removeKeRangerRansomware()
|
||||||
[fClearCompletedButton setToolTip: NSLocalizedString(@"Remove all transfers that have completed seeding.",
|
[fClearCompletedButton setToolTip: NSLocalizedString(@"Remove all transfers that have completed seeding.",
|
||||||
"Main window -> 3rd bottom left button (remove all) tooltip")];
|
"Main window -> 3rd bottom left button (remove all) tooltip")];
|
||||||
|
|
||||||
[fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
|
[fTableView registerForDraggedTypes: @[TORRENT_TABLE_VIEW_DATA_TYPE]];
|
||||||
[fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]];
|
[fWindow registerForDraggedTypes: @[NSFilenamesPboardType, NSURLPboardType]];
|
||||||
|
|
||||||
//sort the sort menu items (localization is from strings file)
|
//sort the sort menu items (localization is from strings file)
|
||||||
NSMutableArray * sortMenuItems = [NSMutableArray arrayWithCapacity: 7];
|
NSMutableArray * sortMenuItems = [NSMutableArray arrayWithCapacity: 7];
|
||||||
|
@ -531,7 +531,7 @@ static void removeKeRangerRansomware()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[sortMenuItems sortUsingDescriptors: [NSArray arrayWithObject: [NSSortDescriptor sortDescriptorWithKey: @"title" ascending: YES selector: @selector(localizedCompare:)]]];
|
[sortMenuItems sortUsingDescriptors: @[[NSSortDescriptor sortDescriptorWithKey: @"title" ascending: YES selector: @selector(localizedCompare:)]]];
|
||||||
|
|
||||||
for (NSMenuItem * item in sortMenuItems)
|
for (NSMenuItem * item in sortMenuItems)
|
||||||
[fSortMenu insertItem: item atIndex: sortMenuIndex++];
|
[fSortMenu insertItem: item atIndex: sortMenuIndex++];
|
||||||
|
@ -929,7 +929,7 @@ static void removeKeRangerRansomware()
|
||||||
{
|
{
|
||||||
NSString * path = [[fPendingTorrentDownloads objectForKey: [[download request] URL]] objectForKey: @"Path"];
|
NSString * path = [[fPendingTorrentDownloads objectForKey: [[download request] URL]] objectForKey: @"Path"];
|
||||||
|
|
||||||
[self openFiles: [NSArray arrayWithObject: path] addType: ADD_URL forcePath: nil];
|
[self openFiles: @[path] addType: ADD_URL forcePath: nil];
|
||||||
|
|
||||||
//delete the torrent file after opening
|
//delete the torrent file after opening
|
||||||
[[NSFileManager defaultManager] removeItemAtPath: path error: NULL];
|
[[NSFileManager defaultManager] removeItemAtPath: path error: NULL];
|
||||||
|
@ -1184,7 +1184,7 @@ static void removeKeRangerRansomware()
|
||||||
- (void) openCreatedFile: (NSNotification *) notification
|
- (void) openCreatedFile: (NSNotification *) notification
|
||||||
{
|
{
|
||||||
NSDictionary * dict = [notification userInfo];
|
NSDictionary * dict = [notification userInfo];
|
||||||
[self openFiles: [NSArray arrayWithObject: [dict objectForKey: @"File"]] addType: ADD_CREATED forcePath: [dict objectForKey: @"Path"]];
|
[self openFiles: @[[dict objectForKey: @"File"]] addType: ADD_CREATED forcePath: [dict objectForKey: @"Path"]];
|
||||||
[dict release];
|
[dict release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,7 +1211,7 @@ static void removeKeRangerRansomware()
|
||||||
[panel setCanChooseFiles: YES];
|
[panel setCanChooseFiles: YES];
|
||||||
[panel setCanChooseDirectories: NO];
|
[panel setCanChooseDirectories: NO];
|
||||||
|
|
||||||
[panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]];
|
[panel setAllowedFileTypes: @[@"org.bittorrent.torrent", @"torrent"]];
|
||||||
|
|
||||||
[panel beginSheetModalForWindow: fWindow completionHandler: ^(NSInteger result) {
|
[panel beginSheetModalForWindow: fWindow completionHandler: ^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton)
|
if (result == NSFileHandlingPanelOKButton)
|
||||||
|
@ -1726,7 +1726,7 @@ static void removeKeRangerRansomware()
|
||||||
if (![torrent isMagnet] && [[NSFileManager defaultManager] fileExistsAtPath: [torrent torrentLocation]])
|
if (![torrent isMagnet] && [[NSFileManager defaultManager] fileExistsAtPath: [torrent torrentLocation]])
|
||||||
{
|
{
|
||||||
NSSavePanel * panel = [NSSavePanel savePanel];
|
NSSavePanel * panel = [NSSavePanel savePanel];
|
||||||
[panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]];
|
[panel setAllowedFileTypes: @[@"org.bittorrent.torrent", @"torrent"]];
|
||||||
[panel setExtensionHidden: NO];
|
[panel setExtensionHidden: NO];
|
||||||
|
|
||||||
[panel setNameFieldStringValue: [torrent name]];
|
[panel setNameFieldStringValue: [torrent name]];
|
||||||
|
@ -1777,7 +1777,7 @@ static void removeKeRangerRansomware()
|
||||||
|
|
||||||
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
||||||
[pb clearContents];
|
[pb clearContents];
|
||||||
[pb writeObjects: [NSArray arrayWithObject: text]];
|
[pb writeObjects: @[text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) revealFile: (id) sender
|
- (void) revealFile: (id) sender
|
||||||
|
@ -2279,7 +2279,7 @@ static void removeKeRangerRansomware()
|
||||||
* progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc],
|
* progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc],
|
||||||
* ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc];
|
* ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObjects: stateDescriptor, progressDescriptor, ratioDescriptor, nameDescriptor, nil];
|
descriptors = @[stateDescriptor, progressDescriptor, ratioDescriptor, nameDescriptor];
|
||||||
}
|
}
|
||||||
else if ([sortType isEqualToString: SORT_PROGRESS])
|
else if ([sortType isEqualToString: SORT_PROGRESS])
|
||||||
{
|
{
|
||||||
|
@ -2287,36 +2287,36 @@ static void removeKeRangerRansomware()
|
||||||
* ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc],
|
* ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc],
|
||||||
* ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc];
|
* ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObjects: progressDescriptor, ratioProgressDescriptor, ratioDescriptor, nameDescriptor, nil];
|
descriptors = @[progressDescriptor, ratioProgressDescriptor, ratioDescriptor, nameDescriptor];
|
||||||
}
|
}
|
||||||
else if ([sortType isEqualToString: SORT_TRACKER])
|
else if ([sortType isEqualToString: SORT_TRACKER])
|
||||||
{
|
{
|
||||||
NSSortDescriptor * trackerDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"trackerSortKey" ascending: asc selector: @selector(localizedCaseInsensitiveCompare:)];
|
NSSortDescriptor * trackerDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"trackerSortKey" ascending: asc selector: @selector(localizedCaseInsensitiveCompare:)];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObjects: trackerDescriptor, nameDescriptor, nil];
|
descriptors = @[trackerDescriptor, nameDescriptor];
|
||||||
}
|
}
|
||||||
else if ([sortType isEqualToString: SORT_ACTIVITY])
|
else if ([sortType isEqualToString: SORT_ACTIVITY])
|
||||||
{
|
{
|
||||||
NSSortDescriptor * rateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"totalRate" ascending: !asc];
|
NSSortDescriptor * rateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"totalRate" ascending: !asc];
|
||||||
NSSortDescriptor * activityDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"dateActivityOrAdd" ascending: !asc];
|
NSSortDescriptor * activityDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"dateActivityOrAdd" ascending: !asc];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObjects: rateDescriptor, activityDescriptor, nameDescriptor, nil];
|
descriptors = @[rateDescriptor, activityDescriptor, nameDescriptor];
|
||||||
}
|
}
|
||||||
else if ([sortType isEqualToString: SORT_DATE])
|
else if ([sortType isEqualToString: SORT_DATE])
|
||||||
{
|
{
|
||||||
NSSortDescriptor * dateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"dateAdded" ascending: asc];
|
NSSortDescriptor * dateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"dateAdded" ascending: asc];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObjects: dateDescriptor, nameDescriptor, nil];
|
descriptors = @[dateDescriptor, nameDescriptor];
|
||||||
}
|
}
|
||||||
else if ([sortType isEqualToString: SORT_SIZE])
|
else if ([sortType isEqualToString: SORT_SIZE])
|
||||||
{
|
{
|
||||||
NSSortDescriptor * sizeDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"size" ascending: asc];
|
NSSortDescriptor * sizeDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"size" ascending: asc];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObjects: sizeDescriptor, nameDescriptor, nil];
|
descriptors = @[sizeDescriptor, nameDescriptor];
|
||||||
}
|
}
|
||||||
else if ([sortType isEqualToString: SORT_NAME])
|
else if ([sortType isEqualToString: SORT_NAME])
|
||||||
{
|
{
|
||||||
descriptors = [NSArray arrayWithObject: nameDescriptor];
|
descriptors = @[nameDescriptor];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2327,7 +2327,7 @@ static void removeKeRangerRansomware()
|
||||||
|
|
||||||
NSSortDescriptor * orderDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"queuePosition" ascending: asc];
|
NSSortDescriptor * orderDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"queuePosition" ascending: asc];
|
||||||
|
|
||||||
descriptors = [NSArray arrayWithObject: orderDescriptor];
|
descriptors = @[orderDescriptor];
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL beganTableUpdate = !callUpdates;
|
BOOL beganTableUpdate = !callUpdates;
|
||||||
|
@ -2677,7 +2677,7 @@ static void removeKeRangerRansomware()
|
||||||
|
|
||||||
//now that all groups are there, sort them - don't insert on the fly in case groups were reordered in prefs
|
//now that all groups are there, sort them - don't insert on the fly in case groups were reordered in prefs
|
||||||
NSSortDescriptor * groupDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"groupOrderValue" ascending: YES];
|
NSSortDescriptor * groupDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"groupOrderValue" ascending: YES];
|
||||||
[self rearrangeTorrentTableArray: fDisplayedTorrents forParent: nil withSortDescriptors: [NSArray arrayWithObject: groupDescriptor] beganTableUpdate: &beganUpdates];
|
[self rearrangeTorrentTableArray: fDisplayedTorrents forParent: nil withSortDescriptors: @[groupDescriptor] beganTableUpdate: &beganUpdates];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2716,7 +2716,7 @@ static void removeKeRangerRansomware()
|
||||||
|
|
||||||
//we need the groups to be sorted, and we can do it without moving items in the table, too!
|
//we need the groups to be sorted, and we can do it without moving items in the table, too!
|
||||||
NSSortDescriptor * groupDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"groupOrderValue" ascending: YES];
|
NSSortDescriptor * groupDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"groupOrderValue" ascending: YES];
|
||||||
[fDisplayedTorrents sortUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
|
[fDisplayedTorrents sortUsingDescriptors: @[groupDescriptor]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
[fDisplayedTorrents setArray: allTorrents];
|
[fDisplayedTorrents setArray: allTorrents];
|
||||||
|
@ -2939,7 +2939,7 @@ static void removeKeRangerRansomware()
|
||||||
switch (tr_torrentParse(ctor, NULL))
|
switch (tr_torrentParse(ctor, NULL))
|
||||||
{
|
{
|
||||||
case TR_PARSE_OK:
|
case TR_PARSE_OK:
|
||||||
[self openFiles: [NSArray arrayWithObject: fullFile] addType: ADD_AUTO forcePath: nil];
|
[self openFiles: @[fullFile] addType: ADD_AUTO forcePath: nil];
|
||||||
|
|
||||||
NSString * notificationTitle = NSLocalizedString(@"Torrent File Auto Added", "notification title");
|
NSString * notificationTitle = NSLocalizedString(@"Torrent File Auto Added", "notification title");
|
||||||
NSUserNotification* notification = [[NSUserNotification alloc] init];
|
NSUserNotification* notification = [[NSUserNotification alloc] init];
|
||||||
|
@ -3059,7 +3059,7 @@ static void removeKeRangerRansomware()
|
||||||
[indexSet addIndex: [fTableView rowForItem: torrent]];
|
[indexSet addIndex: [fTableView rowForItem: torrent]];
|
||||||
}
|
}
|
||||||
|
|
||||||
[pasteboard declareTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE] owner: self];
|
[pasteboard declareTypes: @[TORRENT_TABLE_VIEW_DATA_TYPE] owner: self];
|
||||||
[pasteboard setData: [NSKeyedArchiver archivedDataWithRootObject: indexSet] forType: TORRENT_TABLE_VIEW_DATA_TYPE];
|
[pasteboard setData: [NSKeyedArchiver archivedDataWithRootObject: indexSet] forType: TORRENT_TABLE_VIEW_DATA_TYPE];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -3837,7 +3837,7 @@ static void removeKeRangerRansomware()
|
||||||
[groupItem setTarget: self];
|
[groupItem setTarget: self];
|
||||||
[groupItem setAction: @selector(allToolbarClicked:)];
|
[groupItem setAction: @selector(allToolbarClicked:)];
|
||||||
|
|
||||||
[groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, nil]];
|
[groupItem setIdentifiers: @[TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL]];
|
||||||
|
|
||||||
[segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
|
[segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
|
||||||
[segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseAllTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
|
[segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseAllTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
|
||||||
|
@ -3849,8 +3849,8 @@ static void removeKeRangerRansomware()
|
||||||
[segmentedCell setToolTip: NSLocalizedString(@"Resume all transfers",
|
[segmentedCell setToolTip: NSLocalizedString(@"Resume all transfers",
|
||||||
"All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
|
"All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
|
||||||
|
|
||||||
[groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"),
|
[groupItem createMenu: @[NSLocalizedString(@"Pause All", "All toolbar item -> label"),
|
||||||
NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
|
NSLocalizedString(@"Resume All", "All toolbar item -> label")]];
|
||||||
|
|
||||||
[segmentedControl release];
|
[segmentedControl release];
|
||||||
|
|
||||||
|
@ -3883,7 +3883,7 @@ static void removeKeRangerRansomware()
|
||||||
[groupItem setTarget: self];
|
[groupItem setTarget: self];
|
||||||
[groupItem setAction: @selector(selectedToolbarClicked:)];
|
[groupItem setAction: @selector(selectedToolbarClicked:)];
|
||||||
|
|
||||||
[groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED, nil]];
|
[groupItem setIdentifiers: @[TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED]];
|
||||||
|
|
||||||
[segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
|
[segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
|
||||||
[segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseSelectedTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
|
[segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseSelectedTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
|
||||||
|
@ -3895,8 +3895,8 @@ static void removeKeRangerRansomware()
|
||||||
[segmentedCell setToolTip: NSLocalizedString(@"Resume selected transfers",
|
[segmentedCell setToolTip: NSLocalizedString(@"Resume selected transfers",
|
||||||
"Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
|
"Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
|
||||||
|
|
||||||
[groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"),
|
[groupItem createMenu: @[NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"),
|
||||||
NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
|
NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label")]];
|
||||||
|
|
||||||
[segmentedControl release];
|
[segmentedControl release];
|
||||||
|
|
||||||
|
@ -4637,7 +4637,7 @@ static void removeKeRangerRansomware()
|
||||||
&& (location = [clickContext objectForKey: @"Location"]))
|
&& (location = [clickContext objectForKey: @"Location"]))
|
||||||
{
|
{
|
||||||
NSURL * file = [NSURL fileURLWithPath: location];
|
NSURL * file = [NSURL fileURLWithPath: location];
|
||||||
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
|
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[file]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4778,7 +4778,7 @@ static void removeKeRangerRansomware()
|
||||||
[torrent update];
|
[torrent update];
|
||||||
|
|
||||||
NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"queuePosition" ascending: YES];
|
NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"queuePosition" ascending: YES];
|
||||||
NSArray * descriptors = [NSArray arrayWithObject: descriptor];
|
NSArray * descriptors = @[descriptor];
|
||||||
[fTorrents sortUsingDescriptors: descriptors];
|
[fTorrents sortUsingDescriptors: descriptors];
|
||||||
|
|
||||||
[self sortTorrents: YES];
|
[self sortTorrents: YES];
|
||||||
|
|
|
@ -254,7 +254,7 @@
|
||||||
[panel setMessage: NSLocalizedString(@"Select the name and location for the torrent file.",
|
[panel setMessage: NSLocalizedString(@"Select the name and location for the torrent file.",
|
||||||
"Create torrent -> location sheet -> message")];
|
"Create torrent -> location sheet -> message")];
|
||||||
|
|
||||||
[panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]];
|
[panel setAllowedFileTypes: @[@"org.bittorrent.torrent", @"torrent"]];
|
||||||
[panel setCanSelectHiddenExtension: YES];
|
[panel setCanSelectHiddenExtension: YES];
|
||||||
|
|
||||||
[panel setDirectoryURL: [fLocation URLByDeletingLastPathComponent]];
|
[panel setDirectoryURL: [fLocation URLByDeletingLastPathComponent]];
|
||||||
|
@ -387,7 +387,7 @@
|
||||||
|
|
||||||
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
||||||
[pb clearContents];
|
[pb clearContents];
|
||||||
[pb writeObjects: [NSArray arrayWithObject: text]];
|
[pb writeObjects: @[text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
||||||
|
@ -399,7 +399,7 @@
|
||||||
|
|
||||||
if (action == @selector(paste:))
|
if (action == @selector(paste:))
|
||||||
return [[self window] firstResponder] == fTrackerTable
|
return [[self window] firstResponder] == fTrackerTable
|
||||||
&& [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
|
&& [[NSPasteboard generalPasteboard] canReadObjectForClasses: @[[NSString class]] options: nil];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@
|
||||||
{
|
{
|
||||||
NSMutableArray * tempTrackers = [NSMutableArray array];
|
NSMutableArray * tempTrackers = [NSMutableArray array];
|
||||||
|
|
||||||
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
|
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil];
|
||||||
NSAssert(items != nil, @"no string items to paste; should not be able to call this method");
|
NSAssert(items != nil, @"no string items to paste; should not be able to call this method");
|
||||||
|
|
||||||
for (NSString * pbItem in items)
|
for (NSString * pbItem in items)
|
||||||
|
|
|
@ -51,13 +51,13 @@
|
||||||
[self setReleasedWhenClosed: NO];
|
[self setReleasedWhenClosed: NO];
|
||||||
[self setIgnoresMouseEvents: YES];
|
[self setIgnoresMouseEvents: YES];
|
||||||
|
|
||||||
fFadeInAnimation = [[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObject:
|
fFadeInAnimation = [[NSViewAnimation alloc] initWithViewAnimations: @[
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey,
|
[NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey,
|
||||||
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]]];
|
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]]];
|
||||||
[fFadeInAnimation setDuration: 0.15];
|
[fFadeInAnimation setDuration: 0.15];
|
||||||
[fFadeInAnimation setAnimationBlockingMode: NSAnimationNonblockingThreaded];
|
[fFadeInAnimation setAnimationBlockingMode: NSAnimationNonblockingThreaded];
|
||||||
|
|
||||||
fFadeOutAnimation = [[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObject:
|
fFadeOutAnimation = [[NSViewAnimation alloc] initWithViewAnimations: @[
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey,
|
[NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey,
|
||||||
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]]];
|
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]]];
|
||||||
[fFadeOutAnimation setDuration: 0.5];
|
[fFadeOutAnimation setDuration: 0.5];
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
[fTableView registerForDraggedTypes: [NSArray arrayWithObject: GROUP_TABLE_VIEW_DATA_TYPE]];
|
[fTableView registerForDraggedTypes: @[GROUP_TABLE_VIEW_DATA_TYPE]];
|
||||||
|
|
||||||
[fSelectedColorView addObserver: self forKeyPath: @"color" options: 0 context: NULL];
|
[fSelectedColorView addObserver: self forKeyPath: @"color" options: 0 context: NULL];
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
|
|
||||||
- (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) rowIndexes toPasteboard: (NSPasteboard *) pboard
|
- (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) rowIndexes toPasteboard: (NSPasteboard *) pboard
|
||||||
{
|
{
|
||||||
[pboard declareTypes: [NSArray arrayWithObject: GROUP_TABLE_VIEW_DATA_TYPE] owner: self];
|
[pboard declareTypes: @[GROUP_TABLE_VIEW_DATA_TYPE] owner: self];
|
||||||
[pboard setData: [NSKeyedArchiver archivedDataWithRootObject: rowIndexes] forType: GROUP_TABLE_VIEW_DATA_TYPE];
|
[pboard setData: [NSKeyedArchiver archivedDataWithRootObject: rowIndexes] forType: GROUP_TABLE_VIEW_DATA_TYPE];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSURL * file = [NSURL fileURLWithPath: location];
|
NSURL * file = [NSURL fileURLWithPath: location];
|
||||||
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
|
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[file]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -325,7 +325,7 @@
|
||||||
|
|
||||||
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
||||||
[pb clearContents];
|
[pb clearContents];
|
||||||
[pb writeObjects: [NSArray arrayWithObject: messageString]];
|
[pb writeObjects: @[messageString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
||||||
|
@ -397,7 +397,7 @@
|
||||||
- (void) writeToFile: (id) sender
|
- (void) writeToFile: (id) sender
|
||||||
{
|
{
|
||||||
NSSavePanel * panel = [NSSavePanel savePanel];
|
NSSavePanel * panel = [NSSavePanel savePanel];
|
||||||
[panel setAllowedFileTypes: [NSArray arrayWithObject: @"txt"]];
|
[panel setAllowedFileTypes: @[@"txt"]];
|
||||||
[panel setCanSelectHiddenExtension: YES];
|
[panel setCanSelectHiddenExtension: YES];
|
||||||
|
|
||||||
[panel setNameFieldStringValue: NSLocalizedString(@"untitled", "Save log panel -> default file name")];
|
[panel setNameFieldStringValue: NSLocalizedString(@"untitled", "Save log panel -> default file name")];
|
||||||
|
|
|
@ -315,8 +315,8 @@
|
||||||
|
|
||||||
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
|
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, TOOLBAR_GROUPS, TOOLBAR_BANDWIDTH,
|
return @[TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, TOOLBAR_GROUPS, TOOLBAR_BANDWIDTH,
|
||||||
TOOLBAR_PEERS, TOOLBAR_NETWORK, TOOLBAR_REMOTE, nil];
|
TOOLBAR_PEERS, TOOLBAR_NETWORK, TOOLBAR_REMOTE];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) toolbarSelectableItemIdentifiers: (NSToolbar *) toolbar
|
- (NSArray *) toolbarSelectableItemIdentifiers: (NSToolbar *) toolbar
|
||||||
|
|
|
@ -528,7 +528,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
||||||
//attempt to move to trash
|
//attempt to move to trash
|
||||||
if (![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation
|
if (![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation
|
||||||
source: [path stringByDeletingLastPathComponent] destination: @""
|
source: [path stringByDeletingLastPathComponent] destination: @""
|
||||||
files: [NSArray arrayWithObject: [path lastPathComponent]] tag: nil])
|
files: @[[path lastPathComponent]] tag: nil])
|
||||||
{
|
{
|
||||||
//if cannot trash, just delete it (will work if it's on a remote volume)
|
//if cannot trash, just delete it (will work if it's on a remote volume)
|
||||||
NSError * localError;
|
NSError * localError;
|
||||||
|
@ -1781,7 +1781,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileListNode * node = [[FileListNode alloc] initWithFileName: [self name] path: @"" size: [self size] index: 0 torrent: self];
|
FileListNode * node = [[FileListNode alloc] initWithFileName: [self name] path: @"" size: [self size] index: 0 torrent: self];
|
||||||
fFileList = [[NSArray arrayWithObject: node] retain];
|
fFileList = [@[node] retain];
|
||||||
fFlatFileList = [fFileList retain];
|
fFlatFileList = [fFileList retain];
|
||||||
[node release];
|
[node release];
|
||||||
}
|
}
|
||||||
|
@ -1835,7 +1835,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
||||||
- (void) sortFileList: (NSMutableArray *) fileNodes
|
- (void) sortFileList: (NSMutableArray *) fileNodes
|
||||||
{
|
{
|
||||||
NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"name" ascending: YES selector: @selector(localizedStandardCompare:)];
|
NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"name" ascending: YES selector: @selector(localizedStandardCompare:)];
|
||||||
[fileNodes sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
|
[fileNodes sortUsingDescriptors: @[descriptor]];
|
||||||
|
|
||||||
[fileNodes enumerateObjectsWithOptions: NSEnumerationConcurrent usingBlock: ^(FileListNode * node, NSUInteger idx, BOOL * stop) {
|
[fileNodes enumerateObjectsWithOptions: NSEnumerationConcurrent usingBlock: ^(FileListNode * node, NSUInteger idx, BOOL * stop) {
|
||||||
if ([node isFolder])
|
if ([node isFolder])
|
||||||
|
|
|
@ -211,7 +211,7 @@
|
||||||
if (location)
|
if (location)
|
||||||
{
|
{
|
||||||
NSURL * file = [NSURL fileURLWithPath: location];
|
NSURL * file = [NSURL fileURLWithPath: location];
|
||||||
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]];
|
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[file]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else;
|
else;
|
||||||
|
|
|
@ -533,7 +533,7 @@
|
||||||
[fController openURL: [url absoluteString]];
|
[fController openURL: [url absoluteString]];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
|
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil];
|
||||||
if (items)
|
if (items)
|
||||||
{
|
{
|
||||||
NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
|
NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
|
||||||
|
@ -562,7 +562,7 @@
|
||||||
if ([[[NSPasteboard generalPasteboard] types] containsObject: NSURLPboardType])
|
if ([[[NSPasteboard generalPasteboard] types] containsObject: NSURLPboardType])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
|
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil];
|
||||||
if (items)
|
if (items)
|
||||||
{
|
{
|
||||||
NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
|
NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil];
|
||||||
|
@ -584,15 +584,15 @@
|
||||||
- (void) toggleControlForTorrent: (Torrent *) torrent
|
- (void) toggleControlForTorrent: (Torrent *) torrent
|
||||||
{
|
{
|
||||||
if ([torrent isActive])
|
if ([torrent isActive])
|
||||||
[fController stopTorrents: [NSArray arrayWithObject: torrent]];
|
[fController stopTorrents: @[torrent]];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ([NSEvent modifierFlags] & NSAlternateKeyMask)
|
if ([NSEvent modifierFlags] & NSAlternateKeyMask)
|
||||||
[fController resumeTorrentsNoWait: [NSArray arrayWithObject: torrent]];
|
[fController resumeTorrentsNoWait: @[torrent]];
|
||||||
else if ([torrent waitingToStart])
|
else if ([torrent waitingToStart])
|
||||||
[fController stopTorrents: [NSArray arrayWithObject: torrent]];
|
[fController stopTorrents: @[torrent]];
|
||||||
else
|
else
|
||||||
[fController resumeTorrents: [NSArray arrayWithObject: torrent]];
|
[fController resumeTorrents: @[torrent]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@
|
||||||
[popover setDelegate: self];
|
[popover setDelegate: self];
|
||||||
|
|
||||||
[popover showRelativeToRect: rect ofView: self preferredEdge: NSMaxYEdge];
|
[popover showRelativeToRect: rect ofView: self preferredEdge: NSMaxYEdge];
|
||||||
[infoViewController setInfoForTorrents: [NSArray arrayWithObject: torrent]];
|
[infoViewController setInfoForTorrents: @[torrent]];
|
||||||
[infoViewController updateInfo];
|
[infoViewController updateInfo];
|
||||||
|
|
||||||
[infoViewController release];
|
[infoViewController release];
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
||||||
[pb clearContents];
|
[pb clearContents];
|
||||||
[pb writeObjects: [NSArray arrayWithObject: text]];
|
[pb writeObjects: @[text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) paste: (id) sender
|
- (void) paste: (id) sender
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
BOOL added = NO;
|
BOOL added = NO;
|
||||||
|
|
||||||
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
|
NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil];
|
||||||
NSAssert(items != nil, @"no string items to paste; should not be able to call this method");
|
NSAssert(items != nil, @"no string items to paste; should not be able to call this method");
|
||||||
|
|
||||||
for (NSString * pbItem in items)
|
for (NSString * pbItem in items)
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
return [self numberOfSelectedRows] > 0;
|
return [self numberOfSelectedRows] > 0;
|
||||||
|
|
||||||
if (action == @selector(paste:))
|
if (action == @selector(paste:))
|
||||||
return fTorrent && [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil];
|
return fTorrent && [[NSPasteboard generalPasteboard] canReadObjectForClasses: @[[NSString class]] options: nil];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
NSPasteboard * pb = [NSPasteboard generalPasteboard];
|
||||||
[pb clearContents];
|
[pb clearContents];
|
||||||
[pb writeObjects: [NSArray arrayWithObject: text]];
|
[pb writeObjects: @[text]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
|
||||||
|
|
Loading…
Reference in New Issue