mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
[macOS] Apply ObjC modernizations once again. (#3358)
This doesn't include designated initializers refactoring.
This commit is contained in:
committed by
GitHub
parent
88a3149ce4
commit
37f7f83d4d
@@ -122,7 +122,7 @@ typedef NS_ENUM(unsigned int, sortOrderTag) { //
|
||||
|
||||
static void altSpeedToggledCallback([[maybe_unused]] tr_session* handle, bool active, bool byUser, void* controller)
|
||||
{
|
||||
NSDictionary* dict = [[NSDictionary alloc] initWithObjects:@[ @(active), @(byUser) ] forKeys:@[ @"Active", @"ByUser" ]];
|
||||
NSDictionary* dict = @{@"Active" : @(active), @"ByUser" : @(byUser)};
|
||||
[(__bridge Controller*)controller performSelectorOnMainThread:@selector(altSpeedToggledCallbackIsLimited:) withObject:dict
|
||||
waitUntilDone:NO];
|
||||
}
|
||||
@@ -512,7 +512,7 @@ static void removeKeRangerRansomware()
|
||||
_fLib = tr_sessionInit(configDir, YES, &settings);
|
||||
tr_variantFree(&settings);
|
||||
|
||||
_fConfigDirectory = [[NSString alloc] initWithUTF8String:configDir];
|
||||
_fConfigDirectory = @(configDir);
|
||||
|
||||
NSApp.delegate = self;
|
||||
|
||||
@@ -569,7 +569,7 @@ static void removeKeRangerRansomware()
|
||||
self.fWindow.excludedFromWindowsMenu = YES;
|
||||
|
||||
//make window primary view in fullscreen
|
||||
[self.fWindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
self.fWindow.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
|
||||
//set table size
|
||||
BOOL const small = [self.fDefaults boolForKey:@"SmallView"];
|
||||
@@ -1021,7 +1021,7 @@ static void removeKeRangerRansomware()
|
||||
NSString* message = [NSString
|
||||
stringWithFormat:NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.", "Download not a torrent -> message"),
|
||||
suggestedName,
|
||||
[download.request.URL.absoluteString stringByRemovingPercentEncoding]];
|
||||
download.request.URL.absoluteString.stringByRemovingPercentEncoding];
|
||||
|
||||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"OK", "Download not a torrent -> button")];
|
||||
@@ -1046,7 +1046,7 @@ static void removeKeRangerRansomware()
|
||||
{
|
||||
NSString* message = [NSString
|
||||
stringWithFormat:NSLocalizedString(@"The torrent could not be downloaded from %@: %@.", "Torrent download failed -> message"),
|
||||
[download.request.URL.absoluteString stringByRemovingPercentEncoding],
|
||||
download.request.URL.absoluteString.stringByRemovingPercentEncoding,
|
||||
error.localizedDescription];
|
||||
|
||||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
@@ -1351,7 +1351,7 @@ static void removeKeRangerRansomware()
|
||||
//called on by applescript
|
||||
- (void)open:(NSArray*)files
|
||||
{
|
||||
NSDictionary* dict = [[NSDictionary alloc] initWithObjects:@[ files, @(ADD_MANUAL) ] forKeys:@[ @"Filenames", @"AddType" ]];
|
||||
NSDictionary* dict = @{ @"Filenames" : files, @"AddType" : @(ADD_MANUAL) };
|
||||
[self performSelectorOnMainThread:@selector(openFilesWithDict:) withObject:dict waitUntilDone:NO];
|
||||
}
|
||||
|
||||
@@ -1374,9 +1374,10 @@ static void removeKeRangerRansomware()
|
||||
[filenames addObject:url.path];
|
||||
}
|
||||
|
||||
NSDictionary* dictionary = [[NSDictionary alloc]
|
||||
initWithObjects:@[ filenames, sender == self.fOpenIgnoreDownloadFolder ? @(ADD_SHOW_OPTIONS) : @(ADD_MANUAL) ]
|
||||
forKeys:@[ @"Filenames", @"AddType" ]];
|
||||
NSDictionary* dictionary = @{
|
||||
@"Filenames" : filenames,
|
||||
@"AddType" : sender == self.fOpenIgnoreDownloadFolder ? @(ADD_SHOW_OPTIONS) : @(ADD_MANUAL)
|
||||
};
|
||||
[self performSelectorOnMainThread:@selector(openFilesWithDict:) withObject:dictionary waitUntilDone:NO];
|
||||
}
|
||||
}];
|
||||
@@ -1552,7 +1553,7 @@ static void removeKeRangerRansomware()
|
||||
[self.fWindow beginSheet:self.fUrlSheetController.window completionHandler:^(NSModalResponse returnCode) {
|
||||
if (returnCode == 1)
|
||||
{
|
||||
NSString* urlString = [self.fUrlSheetController urlString];
|
||||
NSString* urlString = self.fUrlSheetController.urlString;
|
||||
urlString = [urlString stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self openURL:urlString];
|
||||
|
||||
Reference in New Issue
Block a user