diff options
Diffstat (limited to 'macosx')
43 files changed, 111 insertions, 111 deletions
diff --git a/macosx/DockTextField.m b/macosx/DockTextField.m index f576f7964..976ee54e6 100644 --- a/macosx/DockTextField.m +++ b/macosx/DockTextField.m @@ -15,7 +15,7 @@ @synthesize startColor = _startColor; @synthesize endColor = _endColor; -- (id)initWithFrame:(NSRect)frame +- (instancetype)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { diff --git a/macosx/HBAdvancedController.m b/macosx/HBAdvancedController.m index d4859a634..5f75a6502 100644 --- a/macosx/HBAdvancedController.m +++ b/macosx/HBAdvancedController.m @@ -416,7 +416,7 @@ NSUInteger currentOptsArrayCount = [currentOptsArray count]; for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++) { - thisOpt = [currentOptsArray objectAtIndex:loopcounter]; + thisOpt = currentOptsArray[loopcounter]; NSRange splitOptRange = [thisOpt rangeOfString:@"="]; if (splitOptRange.location != NSNotFound) @@ -735,7 +735,7 @@ NSUInteger currentOptsArrayCount = [currentOptsArray count]; for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++) { - thisOpt = [currentOptsArray objectAtIndex:loopcounter]; + thisOpt = currentOptsArray[loopcounter]; /* Verify the option sets a value */ NSRange splitOptRange = [thisOpt rangeOfString:@"="]; @@ -1332,7 +1332,7 @@ NSUInteger currentOptsArrayCount = [currentOptsArray count]; for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++) { - thisOpt = [currentOptsArray objectAtIndex:loopcounter]; + thisOpt = currentOptsArray[loopcounter]; NSRange splitOptRange = [thisOpt rangeOfString:@"="]; if (splitOptRange.location != NSNotFound) diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m index 87bf0f45d..4f998ce2d 100644 --- a/macosx/HBAppDelegate.m +++ b/macosx/HBAppDelegate.m @@ -16,6 +16,8 @@ #import "HBCore.h" #import "HBController.h" +#define PRESET_FILE @"UserPresets.plist" + @interface HBAppDelegate () @property (nonatomic, strong) HBPresetsManager *presetsManager; @@ -49,7 +51,7 @@ _outputPanel = [[HBOutputPanelController alloc] init]; // we init the HBPresetsManager - NSURL *presetsURL = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"UserPresets.plist"]; + NSURL *presetsURL = [[HBUtilities appSupportURL] URLByAppendingPathComponent:PRESET_FILE]; _presetsManager = [[HBPresetsManager alloc] initWithURL:presetsURL]; _queueController = [[HBQueueController alloc] init]; diff --git a/macosx/HBAudio.h b/macosx/HBAudio.h index 601e7ff47..0c38f05c1 100644 --- a/macosx/HBAudio.h +++ b/macosx/HBAudio.h @@ -34,7 +34,7 @@ extern NSString *HBAudioChangedNotification; @interface HBAudio (KVC) -- (NSUInteger)countOfTracks; +@property (nonatomic, readonly) NSUInteger countOfTracks; - (HBAudioTrack *)objectInTracksAtIndex:(NSUInteger)index; - (void)insertObject:(HBAudioTrack *)track inTracksAtIndex:(NSUInteger)index; - (void)removeObjectFromTracksAtIndex:(NSUInteger)index; diff --git a/macosx/HBAudio.m b/macosx/HBAudio.m index c58156443..e45e3cf53 100644 --- a/macosx/HBAudio.m +++ b/macosx/HBAudio.m @@ -387,7 +387,7 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification"; encodeObject(_defaults); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBAudioDefaults.m b/macosx/HBAudioDefaults.m index 0454c4b9b..fc2d9a9e1 100644 --- a/macosx/HBAudioDefaults.m +++ b/macosx/HBAudioDefaults.m @@ -285,7 +285,7 @@ encodeBool(_secondaryEncoderMode); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBAudioTrack.m b/macosx/HBAudioTrack.m index f6e6c9e27..d29661158 100644 --- a/macosx/HBAudioTrack.m +++ b/macosx/HBAudioTrack.m @@ -607,7 +607,7 @@ static NSMutableArray *masterBitRateArray = nil; encodeObject(_bitRates); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBAudioTrackPreset.m b/macosx/HBAudioTrackPreset.m index 1e9bc021e..f7f7f94bf 100644 --- a/macosx/HBAudioTrackPreset.m +++ b/macosx/HBAudioTrackPreset.m @@ -277,7 +277,7 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex; encodeInt(_container); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBChapterTitlesController.m b/macosx/HBChapterTitlesController.m index b3daebc9e..633e3fad6 100644 --- a/macosx/HBChapterTitlesController.m +++ b/macosx/HBChapterTitlesController.m @@ -48,9 +48,8 @@ { if (aTableColumn != nil && [[aTableColumn identifier] intValue] == 2) { - [self.chapterTitles replaceObjectAtIndex:rowIndex - withObject:[NSString - stringWithString:anObject]]; + (self.chapterTitles)[rowIndex] = [NSString + stringWithString:anObject]; } } @@ -64,8 +63,7 @@ } else { - return [NSString stringWithString:[self.chapterTitles - objectAtIndex:rowIndex]]; + return [NSString stringWithString:(self.chapterTitles)[rowIndex]]; } return @"__DATA ERROR__"; } @@ -81,11 +79,11 @@ a timer to avoid interfering with the chain of events that handles the edit. */ // Edit the cell in the next row, same column row++; - textMovement = [[[notification userInfo] objectForKey:@"NSTextMovement"] integerValue]; + textMovement = [[notification userInfo][@"NSTextMovement"] integerValue]; if( textMovement == NSReturnTextMovement && row < [chapterTable numberOfRows] ) { - NSArray *info = [NSArray arrayWithObjects:chapterTable, - [NSNumber numberWithInteger:column], [NSNumber numberWithInteger:row], nil]; + NSArray *info = @[chapterTable, + @(column), @(row)]; /* The delay is unimportant; editNextRow: won't be called until the responder chain finishes because the event loop containing the timer is on this thread */ [self performSelector:@selector(editNextRow:) withObject:info afterDelay:0.0]; @@ -94,9 +92,9 @@ a timer to avoid interfering with the chain of events that handles the edit. */ - (void)editNextRow: (id) objects { - NSTableView *chapterTable = [objects objectAtIndex:0]; - NSInteger column = [[objects objectAtIndex:1] integerValue]; - NSInteger row = [[objects objectAtIndex:2] integerValue]; + NSTableView *chapterTable = objects[0]; + NSInteger column = [objects[1] integerValue]; + NSInteger row = [objects[2] integerValue]; if( row >= 0 && row < [chapterTable numberOfRows] ) { @@ -133,7 +131,7 @@ a timer to avoid interfering with the chain of events that handles the edit. */ if ([chaptersMutableArray count] > 0) { /* if last item is empty remove it */ - if ([[chaptersMutableArray objectAtIndex:[chaptersArray count]-1] length] == 0) + if ([chaptersMutableArray[[chaptersArray count]-1] length] == 0) { [chaptersMutableArray removeLastObject]; } @@ -154,12 +152,12 @@ a timer to avoid interfering with the chain of events that handles the edit. */ for (i=0; i<chapters; i++) { - if([[chaptersMutableArray objectAtIndex:i] length] > 5) + if([chaptersMutableArray[i] length] > 5) { /* avoid a segfault */ /* Get the Range.location of the first comma in the line and then put everything after that into chapterTitle */ - NSRange firstCommaRange = [[chaptersMutableArray objectAtIndex:i] rangeOfString:@","]; - NSString *chapterTitle = [[chaptersMutableArray objectAtIndex:i] substringFromIndex:firstCommaRange.location + 1]; + NSRange firstCommaRange = [chaptersMutableArray[i] rangeOfString:@","]; + NSString *chapterTitle = [chaptersMutableArray[i] substringFromIndex:firstCommaRange.location + 1]; /* Since we store our chapterTitle commas as "\," for the cli, we now need to remove the escaping "\" from the title */ chapterTitle = [chapterTitle stringByReplacingOccurrencesOfString:@"\\," withString:@","]; [self tableView:fChapterTable diff --git a/macosx/HBController.m b/macosx/HBController.m index 9379abf43..f25b5607d 100644 --- a/macosx/HBController.m +++ b/macosx/HBController.m @@ -69,8 +69,7 @@ { // Init libhb int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; - _core = [[HBCore alloc] initWithLoggingLevel:loggingLevel]; - _core.name = @"ScanCore"; + _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"ScanCore"]; // Inits the controllers fPreviewController = [[HBPreviewController alloc] init]; @@ -1323,7 +1322,7 @@ NSMutableDictionary *preset = [NSMutableDictionary dictionary]; NSDictionary *currentPreset = self.selectedPreset.content; - preset[@"PresetBuildNumber"] = [NSString stringWithFormat: @"%d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]; + preset[@"PresetBuildNumber"] = [NSString stringWithFormat: @"%d", [[[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"] intValue]]; preset[@"PresetName"] = self.job.presetName; preset[@"Folder"] = @NO; diff --git a/macosx/HBCore.h b/macosx/HBCore.h index 083ac5d51..58ecb43ca 100644 --- a/macosx/HBCore.h +++ b/macosx/HBCore.h @@ -62,9 +62,18 @@ typedef void (^HBCoreCompletionHandler)(BOOL success); * Opens low level HandBrake library. This should be called once before other * functions HBCore are used. * - * @param loggingLevel the desired libhb logging level. + * @param level the desired libhb logging level. */ -- (instancetype)initWithLoggingLevel:(int)loggingLevel; +- (instancetype)initWithLogLevel:(int)level NS_DESIGNATED_INITIALIZER; + +/** + * Opens low level HandBrake library. This should be called once before other + * functions HBCore are used. + * + * @param level the desired libhb logging level + * @param name the instance debug name + */ +- (instancetype)initWithLogLevel:(int)level name:(NSString *)name; /** * Current state of HBCore. @@ -123,7 +132,7 @@ typedef void (^HBCoreCompletionHandler)(BOOL success); - (CGImageRef)copyImageAtIndex:(NSUInteger)index forTitle:(HBTitle *)title pictureFrame:(HBPicture *)frame - deinterlace:(BOOL)deinterlace; + deinterlace:(BOOL)deinterlace CF_RETURNS_RETAINED; /** * Initiates an asynchronous encode operation and returns immediately. diff --git a/macosx/HBCore.m b/macosx/HBCore.m index 13590aa8a..998dcd022 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -81,21 +81,12 @@ static void hb_error_handler(const char *errmsg) hb_register_error_handler(&hb_error_handler); } -/** - * Initializes HBCore. - */ - (instancetype)init { - return [self initWithLoggingLevel:0]; + return [self initWithLogLevel:0]; } -/** - * Opens low level HandBrake library. This should be called once before other - * functions HBCore are used. - * - * @param debugMode If set to YES, libhb will print verbose debug output. - */ -- (instancetype)initWithLoggingLevel:(int)loggingLevel +- (instancetype)initWithLogLevel:(int)level { self = [super init]; if (self) @@ -105,7 +96,7 @@ static void hb_error_handler(const char *errmsg) _updateTimerQueue = dispatch_queue_create("fr.handbrake.coreQueue", DISPATCH_QUEUE_SERIAL); _hb_state = malloc(sizeof(struct hb_state_s)); - _hb_handle = hb_init(loggingLevel, 0); + _hb_handle = hb_init(level, 0); if (!_hb_handle) { return nil; @@ -115,6 +106,16 @@ static void hb_error_handler(const char *errmsg) return self; } +- (instancetype)initWithLogLevel:(int)level name:(NSString *)name +{ + self = [self initWithLogLevel:level]; + if (self) + { + _name = [name copy]; + } + return self; +} + /** * Releases resources. */ diff --git a/macosx/HBDVDDetector.h b/macosx/HBDVDDetector.h index 5f5331c81..6e761f8de 100644 --- a/macosx/HBDVDDetector.h +++ b/macosx/HBDVDDetector.h @@ -17,9 +17,9 @@ } + (HBDVDDetector *)detectorForPath: (NSString *)aPath; -- (HBDVDDetector *)initWithPath: (NSString *)aPath; +- (HBDVDDetector *)initWithPath: (NSString *)aPath NS_DESIGNATED_INITIALIZER; -- (BOOL)isVideoDVD; -- (NSString *)devicePath; +@property (nonatomic, getter=isVideoDVD, readonly) BOOL videoDVD; +@property (nonatomic, readonly, copy) NSString *devicePath; @end
\ No newline at end of file diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m index a8764cfbb..704f828c4 100644 --- a/macosx/HBDistributedArray.m +++ b/macosx/HBDistributedArray.m @@ -292,7 +292,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk"; - (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject { - [self.array replaceObjectAtIndex:index withObject:[self wrapObjectIfNeeded:anObject]]; + (self.array)[index] = [self wrapObjectIfNeeded:anObject]; } - (NSUInteger)count @@ -302,7 +302,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk"; - (id)objectAtIndex:(NSUInteger)index { - return [self.array objectAtIndex:index]; + return (self.array)[index]; } @end diff --git a/macosx/HBDockTile.h b/macosx/HBDockTile.h index f7bfde7c8..4e20c9fdf 100644 --- a/macosx/HBDockTile.h +++ b/macosx/HBDockTile.h @@ -10,7 +10,7 @@ @interface HBDockTile : NSObject -- (instancetype)initWithDockTile:(NSDockTile *)dockTile image:(NSImage *)image; +- (instancetype)initWithDockTile:(NSDockTile *)dockTile image:(NSImage *)image NS_DESIGNATED_INITIALIZER; /** * Updates two DockTextFields on the dockTile, diff --git a/macosx/HBExceptionAlertController.m b/macosx/HBExceptionAlertController.m index 001794cac..5fc69dcbc 100644 --- a/macosx/HBExceptionAlertController.m +++ b/macosx/HBExceptionAlertController.m @@ -8,7 +8,7 @@ @implementation HBExceptionAlertController -- (id)init +- (instancetype)init { return [self initWithWindowNibName:@"ExceptionAlert"]; } diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m index 90f3b932d..c2f97c411 100644 --- a/macosx/HBFilters.m +++ b/macosx/HBFilters.m @@ -278,7 +278,7 @@ NSDictionary *_HandBrake_nlmeansTunesDict; encodeBool(_useDecomb); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBImageAndTextCell.h b/macosx/HBImageAndTextCell.h index 855067c51..1cebae4be 100644 --- a/macosx/HBImageAndTextCell.h +++ b/macosx/HBImageAndTextCell.h @@ -8,23 +8,12 @@ #import <Cocoa/Cocoa.h> @interface HBImageAndTextCell : NSTextFieldCell -{ -@private - NSImage *image; - NSImageAlignment imageAlignment; // defaults to NSImageAlignTop. Supports NSImageAlignCenter & NSImageAlignBottom - NSSize imageSpacing; // horizontal and vertical spacing around the image -} -- (void) setImage:(NSImage *)anImage; -- (NSImage *) image; - -- (void) setImageAlignment:(NSImageAlignment)alignment; -- (NSImageAlignment) imageAlignment; - -- (void)setImageSpacing:(NSSize)aSize; -- (NSSize)imageSpacing; +@property (strong) NSImage *image; +@property (nonatomic) NSImageAlignment imageAlignment; +@property (nonatomic) NSSize imageSpacing; - (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; -- (NSSize) cellSize; +@property (readonly) NSSize cellSize; @end diff --git a/macosx/HBImageAndTextCell.m b/macosx/HBImageAndTextCell.m index 57a4b023b..b0c400edb 100644 --- a/macosx/HBImageAndTextCell.m +++ b/macosx/HBImageAndTextCell.m @@ -70,8 +70,14 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect) #endif @implementation HBImageAndTextCell +{ +@private + NSImage *image; + NSImageAlignment imageAlignment; // defaults to NSImageAlignTop. Supports NSImageAlignCenter & NSImageAlignBottom + NSSize imageSpacing; // horizontal and vertical spacing around the image +} --(id)initTextCell:(NSString *)aString +-(instancetype)initTextCell:(NSString *)aString { if (self = [super initTextCell:aString]) { @@ -81,7 +87,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect) return self; } --(id)initWithCoder:(NSCoder *)decoder +-(instancetype)initWithCoder:(NSCoder *)decoder { if (self = [super initWithCoder:decoder]) { diff --git a/macosx/HBJob+UIAdditions.m b/macosx/HBJob+UIAdditions.m index a289ddb51..498c4f551 100644 --- a/macosx/HBJob+UIAdditions.m +++ b/macosx/HBJob+UIAdditions.m @@ -64,7 +64,7 @@ static NSDictionary *shortHeightAttr; } else { - title = [NSString stringWithUTF8String:container->name]; + title = @(container->name); } [containers addObject:title]; } diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 778e36210..574fd375e 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -215,7 +215,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; encodeObject(_chapterTitles); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBJobOutputFileWriter.h b/macosx/HBJobOutputFileWriter.h index 3cf2e7f88..b7dcdfaab 100644 --- a/macosx/HBJobOutputFileWriter.h +++ b/macosx/HBJobOutputFileWriter.h @@ -14,6 +14,6 @@ */ @interface HBJobOutputFileWriter : HBOutputFileWriter -- (instancetype)initWithJob:(HBJob *)job; +- (instancetype)initWithJob:(HBJob *)job NS_DESIGNATED_INITIALIZER; @end diff --git a/macosx/HBLanguagesSelection.h b/macosx/HBLanguagesSelection.h index 4bcfecb21..edaa8f140 100644 --- a/macosx/HBLanguagesSelection.h +++ b/macosx/HBLanguagesSelection.h @@ -21,7 +21,7 @@ @property (nonatomic, readonly) NSString *language; @property (nonatomic, readonly) NSString *iso639_2; -- (instancetype)initWithLanguage:(NSString *)value iso639_2code:(NSString *)code; +- (instancetype)initWithLanguage:(NSString *)value iso639_2code:(NSString *)code NS_DESIGNATED_INITIALIZER; @end; @@ -33,7 +33,7 @@ @property (nonatomic, readonly) NSMutableArray *languagesArray; @property (nonatomic, readonly) NSArray *selectedLanguages; -- (instancetype)initWithLanguages:(NSArray *)languages; +- (instancetype)initWithLanguages:(NSArray *)languages NS_DESIGNATED_INITIALIZER; @end diff --git a/macosx/HBOutputPanelController.m b/macosx/HBOutputPanelController.m index 7555afe77..9f91f4a9c 100644 --- a/macosx/HBOutputPanelController.m +++ b/macosx/HBOutputPanelController.m @@ -139,7 +139,7 @@ - (IBAction)copyAllOutputToPasteboard:(id)sender { NSPasteboard *pboard = [NSPasteboard generalPasteboard]; - [pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; + [pboard declareTypes:@[NSStringPboardType] owner:nil]; [pboard setString:[outputTextStorage string] forType:NSStringPboardType]; } diff --git a/macosx/HBOutputRedirect.m b/macosx/HBOutputRedirect.m index f0561888f..2dfc297e1 100644 --- a/macosx/HBOutputRedirect.m +++ b/macosx/HBOutputRedirect.m @@ -35,7 +35,7 @@ static int stderrwrite(void *inFD, const char *buffer, int size); @interface HBOutputRedirect (Private) -- (id)initWithStream:(FILE *)aStream selector:(SEL)aSelector; +- (instancetype)initWithStream:(FILE *)aStream selector:(SEL)aSelector; - (void)startRedirect; - (void)stopRedirect; - (void)forwardOutput:(NSData *)data; @@ -142,7 +142,7 @@ int stderrwrite(void *inFD, const char *buffer, int size) * * @return New HBOutputRedirect object. */ -- (id)initWithStream:(FILE *)aStream selector:(SEL)aSelector +- (instancetype)initWithStream:(FILE *)aStream selector:(SEL)aSelector { if (self = [super init]) { diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m index e3cafa722..0da6af2d6 100644 --- a/macosx/HBPicture.m +++ b/macosx/HBPicture.m @@ -486,7 +486,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification"; encodeInt(_cropRight); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m index 523e7f906..5587d0c4a 100644 --- a/macosx/HBPresetsManager.m +++ b/macosx/HBPresetsManager.m @@ -238,7 +238,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; if (parentNode.children.count > currIdx) { - parentNode = [parentNode.children objectAtIndex:currIdx]; + parentNode = (parentNode.children)[currIdx]; } } @@ -246,7 +246,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; if (parentNode.children.count > currIdx) { - if ([[parentNode.children objectAtIndex:currIdx] isDefault]) + if ([(parentNode.children)[currIdx] isDefault]) { [parentNode removeObjectFromChildrenAtIndex:currIdx]; // Try to select a new default preset @@ -365,7 +365,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; // set a new Default preset [self selectNewDefault]; - [HBUtilities writeToActivityLog: "built in presets updated to build number: %d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]; + [HBUtilities writeToActivityLog: "built in presets updated to build number: %d", [[[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"] intValue]]; } - (void)deleteBuiltInPresets diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 92e779685..1313682c7 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -194,7 +194,7 @@ typedef enum ViewMode : NSUInteger { NSMutableDictionary *actions = [NSMutableDictionary dictionaryWithDictionary:[self.pictureLayer actions]]; - [actions setObject:[NSNull null] forKey:@"contents"]; + actions[@"contents"] = [NSNull null]; [self.pictureLayer setActions:actions]; [[[[self window] contentView] layer] insertSublayer:self.backLayer below: [fMovieView layer]]; @@ -289,8 +289,7 @@ typedef enum ViewMode : NSUInteger { NSWindow *theWindow = (NSWindow *)[notification object]; CGFloat newBackingScaleFactor = [theWindow backingScaleFactor]; - CGFloat oldBackingScaleFactor = [[[notification userInfo] - objectForKey:@"NSBackingPropertyOldScaleFactorKey"] + CGFloat oldBackingScaleFactor = [[notification userInfo][@"NSBackingPropertyOldScaleFactorKey"] doubleValue]; if (newBackingScaleFactor != oldBackingScaleFactor) @@ -855,7 +854,7 @@ typedef enum ViewMode : NSUInteger { if (subtitlesArray && [subtitlesArray count]) { // enable the first tx3g subtitle track - [[subtitlesArray objectAtIndex: 0] setEnabled: YES]; + [subtitlesArray[0] setEnabled: YES]; } else { @@ -865,7 +864,7 @@ typedef enum ViewMode : NSUInteger { { // track 0 should be video, other video tracks should // be subtitles; force-enable the first subs track - [[subtitlesArray objectAtIndex: 1] setEnabled: YES]; + [subtitlesArray[1] setEnabled: YES]; } } diff --git a/macosx/HBPreviewGenerator.h b/macosx/HBPreviewGenerator.h index b80f5b122..4aa019c99 100644 --- a/macosx/HBPreviewGenerator.h +++ b/macosx/HBPreviewGenerator.h @@ -24,15 +24,15 @@ @property (nonatomic, unsafe_unretained) id <HBPreviewGeneratorDelegate> delegate; -- (instancetype)initWithCore:(HBCore *)core job:(HBJob *)job; +- (instancetype)initWithCore:(HBCore *)core job:(HBJob *)job NS_DESIGNATED_INITIALIZER; /* Still image generator */ -- (CGImageRef) copyImageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache; -- (NSUInteger) imagesCount; -- (CGSize)imageSize; +- (CGImageRef) copyImageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache CF_RETURNS_RETAINED; +@property (nonatomic, readonly) NSUInteger imagesCount; +@property (nonatomic, readonly) CGSize imageSize; - (void) purgeImageCache; -- (NSString *)info; +@property (nonatomic, readonly, copy) NSString *info; /* Video generator */ - (BOOL) createMovieAsyncWithImageAtIndex: (NSUInteger) index duration: (NSUInteger) seconds; diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m index d999791f6..75d2b0ab8 100644 --- a/macosx/HBPreviewGenerator.m +++ b/macosx/HBPreviewGenerator.m @@ -15,7 +15,6 @@ @interface HBPreviewGenerator () @property (nonatomic, readonly) NSMutableDictionary *picturePreviews; -@property (nonatomic, readonly) NSUInteger imagesCount; @property (unsafe_unretained, nonatomic, readonly) HBCore *scanCore; @property (unsafe_unretained, nonatomic, readonly) HBJob *job; @@ -62,7 +61,7 @@ // The preview for the specified index may not currently exist, so this method // generates it if necessary. - CGImageRef theImage = (__bridge CGImageRef)[self.picturePreviews objectForKey:@(index)]; + CGImageRef theImage = (__bridge CGImageRef)(self.picturePreviews)[@(index)]; if (!theImage) { @@ -75,7 +74,7 @@ deinterlace:deinterlace]; if (cache && theImage) { - [self.picturePreviews setObject:(__bridge id)theImage forKey:@(index)]; + (self.picturePreviews)[@(index)] = (__bridge id)theImage; } } else @@ -178,9 +177,8 @@ job.video.twoPass = NO; // Init the libhb core - int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; - self.core = [[HBCore alloc] initWithLoggingLevel:loggingLevel]; - self.core.name = @"PreviewCore"; + int level = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; + self.core = [[HBCore alloc] initWithLogLevel:level name:@"PreviewCore"]; // start the actual encode [self.core encodeJob:job diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index 4d0905dc1..13261cf67 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -77,8 +77,7 @@ int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; // Init a separate instance of libhb for the queue - _core = [[HBCore alloc] initWithLoggingLevel:loggingLevel]; - _core.name = @"QueueCore"; + _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"QueueCore"]; [self loadQueueFile]; } diff --git a/macosx/HBQueueOutlineView.h b/macosx/HBQueueOutlineView.h index 964c4f0d0..20401f241 100644 --- a/macosx/HBQueueOutlineView.h +++ b/macosx/HBQueueOutlineView.h @@ -41,6 +41,6 @@ * If the selected row indexes contain the clicked row index, it returns every selected row, * otherwise it returns only the clicked row index. */ -- (NSIndexSet *)targetedRowIndexes; +@property (nonatomic, readonly, copy) NSIndexSet *targetedRowIndexes; @end
\ No newline at end of file diff --git a/macosx/HBRange.m b/macosx/HBRange.m index 73e8909cb..44f5f36cd 100644 --- a/macosx/HBRange.m +++ b/macosx/HBRange.m @@ -159,7 +159,7 @@ NSString *HBRangeChangedNotification = @"HBRangeChangedNotification"; encodeInt(_frameStop); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBSubtitles.h b/macosx/HBSubtitles.h index 4b3eb2288..9b8c84313 100644 --- a/macosx/HBSubtitles.h +++ b/macosx/HBSubtitles.h @@ -61,7 +61,7 @@ extern NSString *keySubTrackLanguageIndex; @interface HBSubtitles (KVC) -- (NSUInteger)countOfTracks; +@property (nonatomic, readonly) NSUInteger countOfTracks; - (id)objectInTracksAtIndex:(NSUInteger)index; - (void)insertObject:(id)audioObject inTracksAtIndex:(NSUInteger)index; - (void)removeObjectFromTracksAtIndex:(NSUInteger)index; diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m index a0d7402bd..740e16bcb 100644 --- a/macosx/HBSubtitles.m +++ b/macosx/HBSubtitles.m @@ -497,7 +497,7 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; encodeObject(_defaults); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBSubtitlesDefaults.m b/macosx/HBSubtitlesDefaults.m index e634ecda9..834417572 100644 --- a/macosx/HBSubtitlesDefaults.m +++ b/macosx/HBSubtitlesDefaults.m @@ -143,7 +143,7 @@ encodeBool(_burnInBluraySubtitles); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h index a961e048b..d4d7cc1c7 100644 --- a/macosx/HBTitle.h +++ b/macosx/HBTitle.h @@ -20,7 +20,7 @@ * @param title the libhb title to wrap. * @param featured whether the title is the featured one or not. */ -- (instancetype)initWithTitle:(hb_title_t *)title featured:(BOOL)featured; +- (instancetype)initWithTitle:(hb_title_t *)title featured:(BOOL)featured NS_DESIGNATED_INITIALIZER; @property (nonatomic, readonly) NSString *name; @property (nonatomic, readonly, getter=isFeatured) BOOL featured; diff --git a/macosx/HBTreeNode.h b/macosx/HBTreeNode.h index 1c804b94d..0a8ade45b 100644 --- a/macosx/HBTreeNode.h +++ b/macosx/HBTreeNode.h @@ -36,7 +36,7 @@ - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSIndexPath *idx, BOOL *stop))block; // KVC Accessor Methods -- (NSUInteger)countOfChildren; +@property (nonatomic, readonly) NSUInteger countOfChildren; - (id)objectInChildrenAtIndex:(NSUInteger)index; - (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index; - (void)removeObjectFromChildrenAtIndex:(NSUInteger)index; diff --git a/macosx/HBTreeNode.m b/macosx/HBTreeNode.m index a2a69f406..7b4a3bd76 100644 --- a/macosx/HBTreeNode.m +++ b/macosx/HBTreeNode.m @@ -25,7 +25,7 @@ - (id)objectInChildrenAtIndex:(NSUInteger)index { - return [self.children objectAtIndex:index]; + return (self.children)[index]; } - (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index cf57feb35..9471d5a27 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -122,7 +122,7 @@ else { // Append the right quality suffix for the selected codec (rf/qp) - [name appendString:[[NSString stringWithUTF8String:hb_video_quality_get_name(codec)] lowercaseString]]; + [name appendString:[@(hb_video_quality_get_name(codec)) lowercaseString]]; [name appendString:[NSString stringWithFormat:@"%0.2f", quality]]; } } diff --git a/macosx/HBVideo+UIAdditions.h b/macosx/HBVideo+UIAdditions.h index e836700b4..6817b7162 100644 --- a/macosx/HBVideo+UIAdditions.h +++ b/macosx/HBVideo+UIAdditions.h @@ -41,9 +41,9 @@ @end @interface HBPresetsTransformer : NSValueTransformer -- (instancetype)initWithEncoder:(int)encoder; +- (instancetype)initWithEncoder:(int)encoder NS_DESIGNATED_INITIALIZER; @end @interface HBQualityTransformer : NSValueTransformer -- (instancetype)initWithReversedDirection:(BOOL)reverse min:(double)min max:(double)max; +- (instancetype)initWithReversedDirection:(BOOL)reverse min:(double)min max:(double)max NS_DESIGNATED_INITIALIZER; @end diff --git a/macosx/HBVideo+UIAdditions.m b/macosx/HBVideo+UIAdditions.m index 5c4461835..7de227676 100644 --- a/macosx/HBVideo+UIAdditions.m +++ b/macosx/HBVideo+UIAdditions.m @@ -132,7 +132,7 @@ // update the text field if (fX264PresetsUnparsedUTF8String != NULL) { - tmpString = [NSString stringWithUTF8String:fX264PresetsUnparsedUTF8String]; + tmpString = @(fX264PresetsUnparsedUTF8String); free(fX264PresetsUnparsedUTF8String); } else diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index f4cdaf424..e7e9b9798 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -421,7 +421,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; encodeBool(_fastDecode); } -- (id)initWithCoder:(NSCoder *)decoder +- (instancetype)initWithCoder:(NSCoder *)decoder { self = [super init]; |