MacGui: run the Xcode "convert to modern objective-c" on the entire project.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7075 b64f7644-9d1e-0410-96f1-a4d463321fa5
This commit is contained in:
ritsuka 2015-04-09 19:43:33 +00:00
parent f0cc63a21d
commit f360714523
43 changed files with 111 additions and 111 deletions

View File

@ -15,7 +15,7 @@
@synthesize startColor = _startColor; @synthesize startColor = _startColor;
@synthesize endColor = _endColor; @synthesize endColor = _endColor;
- (id)initWithFrame:(NSRect)frame - (instancetype)initWithFrame:(NSRect)frame
{ {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {

View File

@ -416,7 +416,7 @@
NSUInteger currentOptsArrayCount = [currentOptsArray count]; NSUInteger currentOptsArrayCount = [currentOptsArray count];
for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++) for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)
{ {
thisOpt = [currentOptsArray objectAtIndex:loopcounter]; thisOpt = currentOptsArray[loopcounter];
NSRange splitOptRange = [thisOpt rangeOfString:@"="]; NSRange splitOptRange = [thisOpt rangeOfString:@"="];
if (splitOptRange.location != NSNotFound) if (splitOptRange.location != NSNotFound)
@ -735,7 +735,7 @@
NSUInteger currentOptsArrayCount = [currentOptsArray count]; NSUInteger currentOptsArrayCount = [currentOptsArray count];
for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++) for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)
{ {
thisOpt = [currentOptsArray objectAtIndex:loopcounter]; thisOpt = currentOptsArray[loopcounter];
/* Verify the option sets a value */ /* Verify the option sets a value */
NSRange splitOptRange = [thisOpt rangeOfString:@"="]; NSRange splitOptRange = [thisOpt rangeOfString:@"="];
@ -1332,7 +1332,7 @@
NSUInteger currentOptsArrayCount = [currentOptsArray count]; NSUInteger currentOptsArrayCount = [currentOptsArray count];
for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++) for (loopcounter = 0; loopcounter < currentOptsArrayCount; loopcounter++)
{ {
thisOpt = [currentOptsArray objectAtIndex:loopcounter]; thisOpt = currentOptsArray[loopcounter];
NSRange splitOptRange = [thisOpt rangeOfString:@"="]; NSRange splitOptRange = [thisOpt rangeOfString:@"="];
if (splitOptRange.location != NSNotFound) if (splitOptRange.location != NSNotFound)

View File

@ -16,6 +16,8 @@
#import "HBCore.h" #import "HBCore.h"
#import "HBController.h" #import "HBController.h"
#define PRESET_FILE @"UserPresets.plist"
@interface HBAppDelegate () @interface HBAppDelegate ()
@property (nonatomic, strong) HBPresetsManager *presetsManager; @property (nonatomic, strong) HBPresetsManager *presetsManager;
@ -49,7 +51,7 @@
_outputPanel = [[HBOutputPanelController alloc] init]; _outputPanel = [[HBOutputPanelController alloc] init];
// we init the HBPresetsManager // we init the HBPresetsManager
NSURL *presetsURL = [[HBUtilities appSupportURL] URLByAppendingPathComponent:@"UserPresets.plist"]; NSURL *presetsURL = [[HBUtilities appSupportURL] URLByAppendingPathComponent:PRESET_FILE];
_presetsManager = [[HBPresetsManager alloc] initWithURL:presetsURL]; _presetsManager = [[HBPresetsManager alloc] initWithURL:presetsURL];
_queueController = [[HBQueueController alloc] init]; _queueController = [[HBQueueController alloc] init];

View File

@ -34,7 +34,7 @@ extern NSString *HBAudioChangedNotification;
@interface HBAudio (KVC) @interface HBAudio (KVC)
- (NSUInteger)countOfTracks; @property (nonatomic, readonly) NSUInteger countOfTracks;
- (HBAudioTrack *)objectInTracksAtIndex:(NSUInteger)index; - (HBAudioTrack *)objectInTracksAtIndex:(NSUInteger)index;
- (void)insertObject:(HBAudioTrack *)track inTracksAtIndex:(NSUInteger)index; - (void)insertObject:(HBAudioTrack *)track inTracksAtIndex:(NSUInteger)index;
- (void)removeObjectFromTracksAtIndex:(NSUInteger)index; - (void)removeObjectFromTracksAtIndex:(NSUInteger)index;

View File

@ -387,7 +387,7 @@ NSString *HBAudioChangedNotification = @"HBAudioChangedNotification";
encodeObject(_defaults); encodeObject(_defaults);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -285,7 +285,7 @@
encodeBool(_secondaryEncoderMode); encodeBool(_secondaryEncoderMode);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -607,7 +607,7 @@ static NSMutableArray *masterBitRateArray = nil;
encodeObject(_bitRates); encodeObject(_bitRates);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -277,7 +277,7 @@ static void *HBAudioEncoderContex = &HBAudioEncoderContex;
encodeInt(_container); encodeInt(_container);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -48,9 +48,8 @@
{ {
if (aTableColumn != nil && [[aTableColumn identifier] intValue] == 2) if (aTableColumn != nil && [[aTableColumn identifier] intValue] == 2)
{ {
[self.chapterTitles replaceObjectAtIndex:rowIndex (self.chapterTitles)[rowIndex] = [NSString
withObject:[NSString stringWithString:anObject];
stringWithString:anObject]];
} }
} }
@ -64,8 +63,7 @@
} }
else else
{ {
return [NSString stringWithString:[self.chapterTitles return [NSString stringWithString:(self.chapterTitles)[rowIndex]];
objectAtIndex:rowIndex]];
} }
return @"__DATA ERROR__"; 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 // Edit the cell in the next row, same column
row++; row++;
textMovement = [[[notification userInfo] objectForKey:@"NSTextMovement"] integerValue]; textMovement = [[notification userInfo][@"NSTextMovement"] integerValue];
if( textMovement == NSReturnTextMovement && row < [chapterTable numberOfRows] ) if( textMovement == NSReturnTextMovement && row < [chapterTable numberOfRows] )
{ {
NSArray *info = [NSArray arrayWithObjects:chapterTable, NSArray *info = @[chapterTable,
[NSNumber numberWithInteger:column], [NSNumber numberWithInteger:row], nil]; @(column), @(row)];
/* The delay is unimportant; editNextRow: won't be called until the responder /* 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 */ chain finishes because the event loop containing the timer is on this thread */
[self performSelector:@selector(editNextRow:) withObject:info afterDelay:0.0]; [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 - (void)editNextRow: (id) objects
{ {
NSTableView *chapterTable = [objects objectAtIndex:0]; NSTableView *chapterTable = objects[0];
NSInteger column = [[objects objectAtIndex:1] integerValue]; NSInteger column = [objects[1] integerValue];
NSInteger row = [[objects objectAtIndex:2] integerValue]; NSInteger row = [objects[2] integerValue];
if( row >= 0 && row < [chapterTable numberOfRows] ) 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 ([chaptersMutableArray count] > 0)
{ {
/* if last item is empty remove it */ /* if last item is empty remove it */
if ([[chaptersMutableArray objectAtIndex:[chaptersArray count]-1] length] == 0) if ([chaptersMutableArray[[chaptersArray count]-1] length] == 0)
{ {
[chaptersMutableArray removeLastObject]; [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++) for (i=0; i<chapters; i++)
{ {
if([[chaptersMutableArray objectAtIndex:i] length] > 5) if([chaptersMutableArray[i] length] > 5)
{ {
/* avoid a segfault */ /* avoid a segfault */
/* Get the Range.location of the first comma in the line and then put everything after that into chapterTitle */ /* 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:@","]; NSRange firstCommaRange = [chaptersMutableArray[i] rangeOfString:@","];
NSString *chapterTitle = [[chaptersMutableArray objectAtIndex:i] substringFromIndex:firstCommaRange.location + 1]; 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 */ /* Since we store our chapterTitle commas as "\," for the cli, we now need to remove the escaping "\" from the title */
chapterTitle = [chapterTitle stringByReplacingOccurrencesOfString:@"\\," withString:@","]; chapterTitle = [chapterTitle stringByReplacingOccurrencesOfString:@"\\," withString:@","];
[self tableView:fChapterTable [self tableView:fChapterTable

View File

@ -69,8 +69,7 @@
{ {
// Init libhb // Init libhb
int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
_core = [[HBCore alloc] initWithLoggingLevel:loggingLevel]; _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"ScanCore"];
_core.name = @"ScanCore";
// Inits the controllers // Inits the controllers
fPreviewController = [[HBPreviewController alloc] init]; fPreviewController = [[HBPreviewController alloc] init];
@ -1323,7 +1322,7 @@
NSMutableDictionary *preset = [NSMutableDictionary dictionary]; NSMutableDictionary *preset = [NSMutableDictionary dictionary];
NSDictionary *currentPreset = self.selectedPreset.content; 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[@"PresetName"] = self.job.presetName;
preset[@"Folder"] = @NO; preset[@"Folder"] = @NO;

View File

@ -62,9 +62,18 @@ typedef void (^HBCoreCompletionHandler)(BOOL success);
* Opens low level HandBrake library. This should be called once before other * Opens low level HandBrake library. This should be called once before other
* functions HBCore are used. * 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. * Current state of HBCore.
@ -123,7 +132,7 @@ typedef void (^HBCoreCompletionHandler)(BOOL success);
- (CGImageRef)copyImageAtIndex:(NSUInteger)index - (CGImageRef)copyImageAtIndex:(NSUInteger)index
forTitle:(HBTitle *)title forTitle:(HBTitle *)title
pictureFrame:(HBPicture *)frame pictureFrame:(HBPicture *)frame
deinterlace:(BOOL)deinterlace; deinterlace:(BOOL)deinterlace CF_RETURNS_RETAINED;
/** /**
* Initiates an asynchronous encode operation and returns immediately. * Initiates an asynchronous encode operation and returns immediately.

View File

@ -81,21 +81,12 @@ static void hb_error_handler(const char *errmsg)
hb_register_error_handler(&hb_error_handler); hb_register_error_handler(&hb_error_handler);
} }
/**
* Initializes HBCore.
*/
- (instancetype)init - (instancetype)init
{ {
return [self initWithLoggingLevel:0]; return [self initWithLogLevel:0];
} }
/** - (instancetype)initWithLogLevel:(int)level
* 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
{ {
self = [super init]; self = [super init];
if (self) if (self)
@ -105,7 +96,7 @@ static void hb_error_handler(const char *errmsg)
_updateTimerQueue = dispatch_queue_create("fr.handbrake.coreQueue", DISPATCH_QUEUE_SERIAL); _updateTimerQueue = dispatch_queue_create("fr.handbrake.coreQueue", DISPATCH_QUEUE_SERIAL);
_hb_state = malloc(sizeof(struct hb_state_s)); _hb_state = malloc(sizeof(struct hb_state_s));
_hb_handle = hb_init(loggingLevel, 0); _hb_handle = hb_init(level, 0);
if (!_hb_handle) if (!_hb_handle)
{ {
return nil; return nil;
@ -115,6 +106,16 @@ static void hb_error_handler(const char *errmsg)
return self; return self;
} }
- (instancetype)initWithLogLevel:(int)level name:(NSString *)name
{
self = [self initWithLogLevel:level];
if (self)
{
_name = [name copy];
}
return self;
}
/** /**
* Releases resources. * Releases resources.
*/ */

View File

@ -17,9 +17,9 @@
} }
+ (HBDVDDetector *)detectorForPath: (NSString *)aPath; + (HBDVDDetector *)detectorForPath: (NSString *)aPath;
- (HBDVDDetector *)initWithPath: (NSString *)aPath; - (HBDVDDetector *)initWithPath: (NSString *)aPath NS_DESIGNATED_INITIALIZER;
- (BOOL)isVideoDVD; @property (nonatomic, getter=isVideoDVD, readonly) BOOL videoDVD;
- (NSString *)devicePath; @property (nonatomic, readonly, copy) NSString *devicePath;
@end @end

View File

@ -292,7 +292,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject - (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject
{ {
[self.array replaceObjectAtIndex:index withObject:[self wrapObjectIfNeeded:anObject]]; (self.array)[index] = [self wrapObjectIfNeeded:anObject];
} }
- (NSUInteger)count - (NSUInteger)count
@ -302,7 +302,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
- (id)objectAtIndex:(NSUInteger)index - (id)objectAtIndex:(NSUInteger)index
{ {
return [self.array objectAtIndex:index]; return (self.array)[index];
} }
@end @end

View File

@ -10,7 +10,7 @@
@interface HBDockTile : NSObject @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, * Updates two DockTextFields on the dockTile,

View File

@ -8,7 +8,7 @@
@implementation HBExceptionAlertController @implementation HBExceptionAlertController
- (id)init - (instancetype)init
{ {
return [self initWithWindowNibName:@"ExceptionAlert"]; return [self initWithWindowNibName:@"ExceptionAlert"];
} }

View File

@ -278,7 +278,7 @@ NSDictionary *_HandBrake_nlmeansTunesDict;
encodeBool(_useDecomb); encodeBool(_useDecomb);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -8,23 +8,12 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@interface HBImageAndTextCell : NSTextFieldCell @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; @property (strong) NSImage *image;
- (NSImage *) image; @property (nonatomic) NSImageAlignment imageAlignment;
@property (nonatomic) NSSize imageSpacing;
- (void) setImageAlignment:(NSImageAlignment)alignment;
- (NSImageAlignment) imageAlignment;
- (void)setImageSpacing:(NSSize)aSize;
- (NSSize)imageSpacing;
- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; - (void) drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
- (NSSize) cellSize; @property (readonly) NSSize cellSize;
@end @end

View File

@ -70,8 +70,14 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
#endif #endif
@implementation HBImageAndTextCell @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]) if (self = [super initTextCell:aString])
{ {
@ -81,7 +87,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
return self; return self;
} }
-(id)initWithCoder:(NSCoder *)decoder -(instancetype)initWithCoder:(NSCoder *)decoder
{ {
if (self = [super initWithCoder:decoder]) if (self = [super initWithCoder:decoder])
{ {

View File

@ -64,7 +64,7 @@ static NSDictionary *shortHeightAttr;
} }
else else
{ {
title = [NSString stringWithUTF8String:container->name]; title = @(container->name);
} }
[containers addObject:title]; [containers addObject:title];
} }

View File

@ -215,7 +215,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
encodeObject(_chapterTitles); encodeObject(_chapterTitles);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -14,6 +14,6 @@
*/ */
@interface HBJobOutputFileWriter : HBOutputFileWriter @interface HBJobOutputFileWriter : HBOutputFileWriter
- (instancetype)initWithJob:(HBJob *)job; - (instancetype)initWithJob:(HBJob *)job NS_DESIGNATED_INITIALIZER;
@end @end

View File

@ -21,7 +21,7 @@
@property (nonatomic, readonly) NSString *language; @property (nonatomic, readonly) NSString *language;
@property (nonatomic, readonly) NSString *iso639_2; @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; @end;
@ -33,7 +33,7 @@
@property (nonatomic, readonly) NSMutableArray *languagesArray; @property (nonatomic, readonly) NSMutableArray *languagesArray;
@property (nonatomic, readonly) NSArray *selectedLanguages; @property (nonatomic, readonly) NSArray *selectedLanguages;
- (instancetype)initWithLanguages:(NSArray *)languages; - (instancetype)initWithLanguages:(NSArray *)languages NS_DESIGNATED_INITIALIZER;
@end @end

View File

@ -139,7 +139,7 @@
- (IBAction)copyAllOutputToPasteboard:(id)sender - (IBAction)copyAllOutputToPasteboard:(id)sender
{ {
NSPasteboard *pboard = [NSPasteboard generalPasteboard]; NSPasteboard *pboard = [NSPasteboard generalPasteboard];
[pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; [pboard declareTypes:@[NSStringPboardType] owner:nil];
[pboard setString:[outputTextStorage string] forType:NSStringPboardType]; [pboard setString:[outputTextStorage string] forType:NSStringPboardType];
} }

View File

@ -35,7 +35,7 @@ static int stderrwrite(void *inFD, const char *buffer, int size);
@interface HBOutputRedirect (Private) @interface HBOutputRedirect (Private)
- (id)initWithStream:(FILE *)aStream selector:(SEL)aSelector; - (instancetype)initWithStream:(FILE *)aStream selector:(SEL)aSelector;
- (void)startRedirect; - (void)startRedirect;
- (void)stopRedirect; - (void)stopRedirect;
- (void)forwardOutput:(NSData *)data; - (void)forwardOutput:(NSData *)data;
@ -142,7 +142,7 @@ int stderrwrite(void *inFD, const char *buffer, int size)
* *
* @return New HBOutputRedirect object. * @return New HBOutputRedirect object.
*/ */
- (id)initWithStream:(FILE *)aStream selector:(SEL)aSelector - (instancetype)initWithStream:(FILE *)aStream selector:(SEL)aSelector
{ {
if (self = [super init]) if (self = [super init])
{ {

View File

@ -486,7 +486,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
encodeInt(_cropRight); encodeInt(_cropRight);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -238,7 +238,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification";
if (parentNode.children.count > currIdx) 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.count > currIdx)
{ {
if ([[parentNode.children objectAtIndex:currIdx] isDefault]) if ([(parentNode.children)[currIdx] isDefault])
{ {
[parentNode removeObjectFromChildrenAtIndex:currIdx]; [parentNode removeObjectFromChildrenAtIndex:currIdx];
// Try to select a new default preset // Try to select a new default preset
@ -365,7 +365,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification";
// set a new Default preset // set a new Default preset
[self selectNewDefault]; [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 - (void)deleteBuiltInPresets

View File

@ -194,7 +194,7 @@ typedef enum ViewMode : NSUInteger {
NSMutableDictionary *actions = [NSMutableDictionary NSMutableDictionary *actions = [NSMutableDictionary
dictionaryWithDictionary:[self.pictureLayer actions]]; dictionaryWithDictionary:[self.pictureLayer actions]];
[actions setObject:[NSNull null] forKey:@"contents"]; actions[@"contents"] = [NSNull null];
[self.pictureLayer setActions:actions]; [self.pictureLayer setActions:actions];
[[[[self window] contentView] layer] insertSublayer:self.backLayer below: [fMovieView layer]]; [[[[self window] contentView] layer] insertSublayer:self.backLayer below: [fMovieView layer]];
@ -289,8 +289,7 @@ typedef enum ViewMode : NSUInteger {
NSWindow *theWindow = (NSWindow *)[notification object]; NSWindow *theWindow = (NSWindow *)[notification object];
CGFloat newBackingScaleFactor = [theWindow backingScaleFactor]; CGFloat newBackingScaleFactor = [theWindow backingScaleFactor];
CGFloat oldBackingScaleFactor = [[[notification userInfo] CGFloat oldBackingScaleFactor = [[notification userInfo][@"NSBackingPropertyOldScaleFactorKey"]
objectForKey:@"NSBackingPropertyOldScaleFactorKey"]
doubleValue]; doubleValue];
if (newBackingScaleFactor != oldBackingScaleFactor) if (newBackingScaleFactor != oldBackingScaleFactor)
@ -855,7 +854,7 @@ typedef enum ViewMode : NSUInteger {
if (subtitlesArray && [subtitlesArray count]) if (subtitlesArray && [subtitlesArray count])
{ {
// enable the first tx3g subtitle track // enable the first tx3g subtitle track
[[subtitlesArray objectAtIndex: 0] setEnabled: YES]; [subtitlesArray[0] setEnabled: YES];
} }
else else
{ {
@ -865,7 +864,7 @@ typedef enum ViewMode : NSUInteger {
{ {
// track 0 should be video, other video tracks should // track 0 should be video, other video tracks should
// be subtitles; force-enable the first subs track // be subtitles; force-enable the first subs track
[[subtitlesArray objectAtIndex: 1] setEnabled: YES]; [subtitlesArray[1] setEnabled: YES];
} }
} }

View File

@ -24,15 +24,15 @@
@property (nonatomic, unsafe_unretained) id <HBPreviewGeneratorDelegate> delegate; @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 */ /* Still image generator */
- (CGImageRef) copyImageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache; - (CGImageRef) copyImageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache CF_RETURNS_RETAINED;
- (NSUInteger) imagesCount; @property (nonatomic, readonly) NSUInteger imagesCount;
- (CGSize)imageSize; @property (nonatomic, readonly) CGSize imageSize;
- (void) purgeImageCache; - (void) purgeImageCache;
- (NSString *)info; @property (nonatomic, readonly, copy) NSString *info;
/* Video generator */ /* Video generator */
- (BOOL) createMovieAsyncWithImageAtIndex: (NSUInteger) index duration: (NSUInteger) seconds; - (BOOL) createMovieAsyncWithImageAtIndex: (NSUInteger) index duration: (NSUInteger) seconds;

View File

@ -15,7 +15,6 @@
@interface HBPreviewGenerator () @interface HBPreviewGenerator ()
@property (nonatomic, readonly) NSMutableDictionary *picturePreviews; @property (nonatomic, readonly) NSMutableDictionary *picturePreviews;
@property (nonatomic, readonly) NSUInteger imagesCount;
@property (unsafe_unretained, nonatomic, readonly) HBCore *scanCore; @property (unsafe_unretained, nonatomic, readonly) HBCore *scanCore;
@property (unsafe_unretained, nonatomic, readonly) HBJob *job; @property (unsafe_unretained, nonatomic, readonly) HBJob *job;
@ -62,7 +61,7 @@
// The preview for the specified index may not currently exist, so this method // The preview for the specified index may not currently exist, so this method
// generates it if necessary. // generates it if necessary.
CGImageRef theImage = (__bridge CGImageRef)[self.picturePreviews objectForKey:@(index)]; CGImageRef theImage = (__bridge CGImageRef)(self.picturePreviews)[@(index)];
if (!theImage) if (!theImage)
{ {
@ -75,7 +74,7 @@
deinterlace:deinterlace]; deinterlace:deinterlace];
if (cache && theImage) if (cache && theImage)
{ {
[self.picturePreviews setObject:(__bridge id)theImage forKey:@(index)]; (self.picturePreviews)[@(index)] = (__bridge id)theImage;
} }
} }
else else
@ -178,9 +177,8 @@
job.video.twoPass = NO; job.video.twoPass = NO;
// Init the libhb core // Init the libhb core
int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; int level = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
self.core = [[HBCore alloc] initWithLoggingLevel:loggingLevel]; self.core = [[HBCore alloc] initWithLogLevel:level name:@"PreviewCore"];
self.core.name = @"PreviewCore";
// start the actual encode // start the actual encode
[self.core encodeJob:job [self.core encodeJob:job

View File

@ -77,8 +77,7 @@
int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
// Init a separate instance of libhb for the queue // Init a separate instance of libhb for the queue
_core = [[HBCore alloc] initWithLoggingLevel:loggingLevel]; _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"QueueCore"];
_core.name = @"QueueCore";
[self loadQueueFile]; [self loadQueueFile];
} }

View File

@ -41,6 +41,6 @@
* If the selected row indexes contain the clicked row index, it returns every selected row, * If the selected row indexes contain the clicked row index, it returns every selected row,
* otherwise it returns only the clicked row index. * otherwise it returns only the clicked row index.
*/ */
- (NSIndexSet *)targetedRowIndexes; @property (nonatomic, readonly, copy) NSIndexSet *targetedRowIndexes;
@end @end

View File

@ -159,7 +159,7 @@ NSString *HBRangeChangedNotification = @"HBRangeChangedNotification";
encodeInt(_frameStop); encodeInt(_frameStop);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -61,7 +61,7 @@ extern NSString *keySubTrackLanguageIndex;
@interface HBSubtitles (KVC) @interface HBSubtitles (KVC)
- (NSUInteger)countOfTracks; @property (nonatomic, readonly) NSUInteger countOfTracks;
- (id)objectInTracksAtIndex:(NSUInteger)index; - (id)objectInTracksAtIndex:(NSUInteger)index;
- (void)insertObject:(id)audioObject inTracksAtIndex:(NSUInteger)index; - (void)insertObject:(id)audioObject inTracksAtIndex:(NSUInteger)index;
- (void)removeObjectFromTracksAtIndex:(NSUInteger)index; - (void)removeObjectFromTracksAtIndex:(NSUInteger)index;

View File

@ -497,7 +497,7 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
encodeObject(_defaults); encodeObject(_defaults);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -143,7 +143,7 @@
encodeBool(_burnInBluraySubtitles); encodeBool(_burnInBluraySubtitles);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];

View File

@ -20,7 +20,7 @@
* @param title the libhb title to wrap. * @param title the libhb title to wrap.
* @param featured whether the title is the featured one or not. * @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) NSString *name;
@property (nonatomic, readonly, getter=isFeatured) BOOL featured; @property (nonatomic, readonly, getter=isFeatured) BOOL featured;

View File

@ -36,7 +36,7 @@
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSIndexPath *idx, BOOL *stop))block; - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSIndexPath *idx, BOOL *stop))block;
// KVC Accessor Methods // KVC Accessor Methods
- (NSUInteger)countOfChildren; @property (nonatomic, readonly) NSUInteger countOfChildren;
- (id)objectInChildrenAtIndex:(NSUInteger)index; - (id)objectInChildrenAtIndex:(NSUInteger)index;
- (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index; - (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index;
- (void)removeObjectFromChildrenAtIndex:(NSUInteger)index; - (void)removeObjectFromChildrenAtIndex:(NSUInteger)index;

View File

@ -25,7 +25,7 @@
- (id)objectInChildrenAtIndex:(NSUInteger)index - (id)objectInChildrenAtIndex:(NSUInteger)index
{ {
return [self.children objectAtIndex:index]; return (self.children)[index];
} }
- (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index - (void)insertObject:(HBTreeNode *)presetObject inChildrenAtIndex:(NSUInteger)index

View File

@ -122,7 +122,7 @@
else else
{ {
// Append the right quality suffix for the selected codec (rf/qp) // 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]]; [name appendString:[NSString stringWithFormat:@"%0.2f", quality]];
} }
} }

View File

@ -41,9 +41,9 @@
@end @end
@interface HBPresetsTransformer : NSValueTransformer @interface HBPresetsTransformer : NSValueTransformer
- (instancetype)initWithEncoder:(int)encoder; - (instancetype)initWithEncoder:(int)encoder NS_DESIGNATED_INITIALIZER;
@end @end
@interface HBQualityTransformer : NSValueTransformer @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 @end

View File

@ -132,7 +132,7 @@
// update the text field // update the text field
if (fX264PresetsUnparsedUTF8String != NULL) if (fX264PresetsUnparsedUTF8String != NULL)
{ {
tmpString = [NSString stringWithUTF8String:fX264PresetsUnparsedUTF8String]; tmpString = @(fX264PresetsUnparsedUTF8String);
free(fX264PresetsUnparsedUTF8String); free(fX264PresetsUnparsedUTF8String);
} }
else else

View File

@ -421,7 +421,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
encodeBool(_fastDecode); encodeBool(_fastDecode);
} }
- (id)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
{ {
self = [super init]; self = [super init];