Skip to content

Commit

Permalink
MacGui: send integerForKey: instead of [objectForKey:] intValue]
Browse files Browse the repository at this point in the history
  • Loading branch information
galad87 committed Feb 12, 2019
1 parent b183dc8 commit 1807772
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions macosx/HBController.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ - (instancetype)initWithQueue:(HBQueueController *)queueController presetsManage
if (self)
{
// Init libhb
int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
NSInteger loggingLevel = [[NSUserDefaults standardUserDefaults] integerForKey:@"LoggingLevel"];
_core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"ScanCore"];

// Inits the controllers
Expand Down Expand Up @@ -626,8 +626,8 @@ - (void)scanURL:(NSURL *)fileURL titleIndex:(NSUInteger)index completionHandler:

if (canScan)
{
int hb_num_previews = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PreviewsNumber"] intValue];
int min_title_duration_seconds = [[[NSUserDefaults standardUserDefaults] objectForKey:@"MinTitleScanSeconds"] intValue];
NSUInteger hb_num_previews = [[NSUserDefaults standardUserDefaults] integerForKey:@"PreviewsNumber"];
NSUInteger min_title_duration_seconds = [[NSUserDefaults standardUserDefaults] integerForKey:@"MinTitleScanSeconds"];

[self.core scanURL:mediaURL
titleIndex:index
Expand Down
6 changes: 3 additions & 3 deletions macosx/HBCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result);
* @param level the desired libhb logging level.
* @param queue the queue on which the callbacks will be called.
*/
- (instancetype)initWithLogLevel:(int)level queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithLogLevel:(NSInteger)level queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER;

/**
* Opens low level HandBrake library. This should be called once before other
Expand All @@ -100,12 +100,12 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result);
* @param level the desired libhb logging level
* @param name the instance debug name
*/
- (instancetype)initWithLogLevel:(int)level name:(NSString *)name;
- (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name;

/**
* Log level.
*/
@property (nonatomic, readwrite) int logLevel;
@property (nonatomic, readwrite) NSInteger logLevel;

/**
* Set whether system sleep will be disable or not during a scan/encode
Expand Down
4 changes: 2 additions & 2 deletions macosx/HBCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ - (instancetype)init
return [self initWithLogLevel:0 queue:dispatch_get_main_queue()];
}

- (instancetype)initWithLogLevel:(int)level queue:(dispatch_queue_t)queue
- (instancetype)initWithLogLevel:(NSInteger)level queue:(dispatch_queue_t)queue
{
self = [super init];
if (self)
Expand All @@ -122,7 +122,7 @@ - (instancetype)initWithLogLevel:(int)level queue:(dispatch_queue_t)queue
return self;
}

- (instancetype)initWithLogLevel:(int)level name:(NSString *)name
- (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name
{
self = [self initWithLogLevel:level queue:dispatch_get_main_queue()];
if (self)
Expand Down
2 changes: 1 addition & 1 deletion macosx/HBFilters.m
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ - (void)applyPreset:(HBPreset *)preset jobSettings:(NSDictionary *)settings
{
self.notificationsEnabled = NO;

// If the preset has an objectForKey:@"UsesPictureFilters", and handle the filters here
// If the preset has "UsesPictureFilters", handle the filters here
if ([preset[@"UsesPictureFilters"] boolValue])
{
// Deinterlace
Expand Down
2 changes: 1 addition & 1 deletion macosx/HBPreviewGenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ - (BOOL) createMovieAsyncWithImageAtIndex: (NSUInteger) index duration: (NSUInte
job.video.twoPass = NO;

// Init the libhb core
int level = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
NSInteger level = [[NSUserDefaults standardUserDefaults] integerForKey:@"LoggingLevel"];
self.core = [[HBCore alloc] initWithLogLevel:level name:@"PreviewCore"];

HBStateFormatter *formatter = [[HBStateFormatter alloc] init];
Expand Down
2 changes: 1 addition & 1 deletion macosx/HBQueueController.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ - (instancetype)initWithURL:(NSURL *)queueURL;
_dockTile = [[HBDockTile alloc] initWithDockTile:[[NSApplication sharedApplication] dockTile]
image:[[NSApplication sharedApplication] applicationIconImage]];

int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
NSInteger loggingLevel = [[NSUserDefaults standardUserDefaults] integerForKey:@"LoggingLevel"];

// Init a separate instance of libhb for the queue
_core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"QueueCore"];
Expand Down
7 changes: 4 additions & 3 deletions macosx/HBUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ + (NSString *)automaticExtForJob:(HBJob *)job
BOOL chapterMarkers = (job.chaptersEnabled) &&
(job.range.type != HBRangeTypeChapters || job.range.chapterStart < job.range.chapterStop);

if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString:@".m4v"] ||
((YES == anyCodecAC3 || YES == chapterMarkers) &&
[[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString:@"Auto"]))
NSString *defaultExtension = [[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"];

if ([defaultExtension isEqualToString:@".m4v"] ||
((YES == anyCodecAC3 || YES == chapterMarkers) && [defaultExtension isEqualToString:@"Auto"]))
{
extension = @"m4v";
}
Expand Down

0 comments on commit 1807772

Please sign in to comment.