diff options
author | ritsuka <[email protected]> | 2014-12-23 10:26:39 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-23 10:26:39 +0000 |
commit | 9297c8f803c220c58b0cb187be8c584643ac3418 (patch) | |
tree | bd88e8e632a3121d6232eeb9d8b342e19657bb6e /macosx | |
parent | a66b692e29674de9c444fd54f0493d03b4900abc (diff) |
MacGui: remove some unused #import. Move again more things in HBController to HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6644 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 6 | ||||
-rw-r--r-- | macosx/Controller.m | 329 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.xib | 33 | ||||
-rw-r--r-- | macosx/HBAddPresetController.h | 1 | ||||
-rw-r--r-- | macosx/HBAddPresetController.m | 1 | ||||
-rw-r--r-- | macosx/HBPreviewController.h | 9 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 8 | ||||
-rw-r--r-- | macosx/HBVideoController.h | 2 | ||||
-rw-r--r-- | macosx/HBVideoController.m | 17 | ||||
-rw-r--r-- | macosx/PictureController.h | 4 | ||||
-rw-r--r-- | macosx/PictureController.m | 33 |
11 files changed, 131 insertions, 312 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 5e81c1595..cb7610f26 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -20,9 +20,6 @@ #import "HBPreferencesController.h" -extern NSString *HBContainerChangedNotification; -extern NSString *keyContainerTag; - @class HBOutputPanelController; @class HBPresetsViewController; @class HBPresetsManager; @@ -176,9 +173,6 @@ extern NSString *keyContainerTag; - (IBAction) titlePopUpChanged: (id) sender; - (IBAction) chapterPopUpChanged: (id) sender; -- (IBAction) startEndSecValueChanged: (id) sender; -- (IBAction) startEndFrameValueChanged: (id) sender; - - (IBAction) formatPopUpChanged: (id) sender; - (IBAction) autoSetM4vExtension: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index a13849748..17055ff64 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -17,19 +17,18 @@ #import "HBPresetsViewController.h" #import "HBAddPresetController.h" +#import "HBPicture+UIAdditions.h" + #import "HBAudioDefaults.h" #import "HBSubtitlesDefaults.h" #import "HBCore.h" #import "HBJob.h" -NSString *HBContainerChangedNotification = @"HBContainerChangedNotification"; -NSString *keyContainerTag = @"keyContainerTag"; - // DockTile update freqency in total percent increment #define dockTileUpdateFrequency 0.1f -@interface HBController () <HBPresetsViewControllerDelegate> +@interface HBController () <HBPresetsViewControllerDelegate, HBPreviewControllerDelegate> // The current job. @property (nonatomic, retain) HBJob *job; @@ -76,7 +75,7 @@ NSString *keyContainerTag = @"keyContainerTag"; // Inits the controllers outputPanel = [[HBOutputPanelController alloc] init]; fPictureController = [[HBPictureController alloc] init]; - fPreviewController = [[HBPreviewController alloc] init]; + fPreviewController = [[HBPreviewController alloc] initWithDelegate:self]; fQueueController = [[HBQueueController alloc] init]; // we init the HBPresetsManager class @@ -123,7 +122,6 @@ NSString *keyContainerTag = @"keyContainerTag"; [fPictureController setDelegate:self]; - fPreviewController.delegate = self; [fPreviewController setCore:self.core]; [fQueueController setHandle:self.queueCore.hb_handle]; @@ -132,6 +130,7 @@ NSString *keyContainerTag = @"keyContainerTag"; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(autoSetM4vExtension:) name:HBMixdownChangedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBPictureChangedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBFiltersChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(formatPopUpChanged:) name:HBContainerChangedNotification object:nil]; } return self; @@ -1930,10 +1929,8 @@ static void queueFSEventStreamCallback( - (NSDictionary *)createQueueFileItem { NSMutableDictionary *queueFileJob = [[NSMutableDictionary alloc] init]; - - hb_list_t * list = hb_get_titles(self.core.hb_handle); - hb_title_t * title = (hb_title_t *) hb_list_item( list, - (int)[fSrcTitlePopUp indexOfSelectedItem] ); + + hb_title_t *title = self.job.title.hb_title; /* We use a number system to set the encode status of the queue item * 0 == already encoded @@ -2292,10 +2289,8 @@ static void queueFSEventStreamCallback( /* since the queue only scans a single title, its already been selected in showNewScan so do not try to reset it here. However if we do decide to do full source scans on a queue edit rescan, we would need it. So leaving in for now but commenting out. */ - //[fSrcTitlePopUp selectItemAtIndex: [[queueToApply objectForKey:@"TitleNumber"] intValue] - 1]; - - [fSrcChapterStartPopUp selectItemAtIndex: [[queueToApply objectForKey:@"ChapterStart"] intValue] - 1]; - [fSrcChapterEndPopUp selectItemAtIndex: [[queueToApply objectForKey:@"ChapterEnd"] intValue] - 1]; + self.job.range.chapterStart = [[queueToApply objectForKey:@"ChapterStart"] intValue] - 1; + self.job.range.chapterStop = [[queueToApply objectForKey:@"ChapterEnd"] intValue] - 1; /* File Format */ [fDstFormatPopUp selectItemWithTag:[queueToApply[@"JobFileFormatMux"] integerValue]]; @@ -3317,7 +3312,7 @@ static void queueFSEventStreamCallback( // Generate a new file name NSString *fileName = [HBUtilities automaticNameForSource:title.name title:title.hb_title->index - chapters:NSMakeRange([fSrcChapterStartPopUp indexOfSelectedItem] + 1, [fSrcChapterEndPopUp indexOfSelectedItem] + 1) + chapters:NSMakeRange(self.job.range.chapterStart + 1, self.job.range.chapterStop + 1) quality:self.job.video.qualityType ? self.job.video.quality : 0 bitrate:!self.job.video.qualityType ? self.job.video.avgBitrate : 0 videoCodec:self.job.video.encoder]; @@ -3341,6 +3336,21 @@ static void queueFSEventStreamCallback( HBJob *job = [[[HBJob alloc] initWithTitle:hbtitle andPreset:self.selectedPreset] autorelease]; + // Set the jobs info to the view controllers + fPictureController.picture = job.picture; + fPictureController.filters = job.filters; + fPreviewController.job = job; + + fVideoController.video = job.video; + fAudioController.job = job; + fSubtitlesViewController.job = job; + fChapterTitlesController.job = job; + + // Set Auto Crop to on upon selecting a new title + job.picture.autocrop = YES; + + self.job = job; + hb_title_t *title = hbtitle.hb_title; // If we are a stream type and a batch scan, grok the output file name from title->name upon title change @@ -3355,27 +3365,7 @@ static void queueFSEventStreamCallback( // Change the source to read out the parent folder also [fSrcDVD2Field setStringValue:[NSString stringWithFormat:@"%@/%@", browsedSourceDisplayName,[NSString stringWithUTF8String: title->name]]]; } - - // For point a to point b pts encoding, set the start and end fields to 0 and the title duration in seconds respectively - int duration = (title->hours * 3600) + (title->minutes * 60) + (title->seconds); - [fSrcTimeStartEncodingField setStringValue: [NSString stringWithFormat: @"%d", 0]]; - [fSrcTimeEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration]]; - // For point a to point b frame encoding, set the start and end fields to 0 and the title duration * announced fps in seconds respectively - [fSrcFrameStartEncodingField setStringValue: [NSString stringWithFormat: @"%d", 1]]; - [fSrcFrameEndEncodingField setStringValue: [NSString stringWithFormat: @"%d", duration * (title->vrate.num / title->vrate.den)]]; - - // Update chapter popups - [fSrcChapterStartPopUp removeAllItems]; - [fSrcChapterEndPopUp removeAllItems]; - - [hbtitle.chapters enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - NSString *title = [NSString stringWithFormat: @"%lu", idx + 1]; - [fSrcChapterStartPopUp addItemWithTitle:title]; - [fSrcChapterEndPopUp addItemWithTitle: title]; - }]; - [fSrcChapterStartPopUp selectItemAtIndex: 0]; - [fSrcChapterEndPopUp selectItemAtIndex:hbtitle.chapters.count - 1]; [self chapterPopUpChanged:nil]; [fSrcAnglePopUp removeAllItems]; @@ -3386,21 +3376,6 @@ static void queueFSEventStreamCallback( } [fSrcAnglePopUp selectItemAtIndex: 0]; - // Set the jobs info to the view controllers - fPictureController.picture = job.picture; - fPictureController.filters = job.filters; - fPreviewController.job = job; - - fVideoController.video = job.video; - fAudioController.job = job; - fSubtitlesViewController.job = job; - fChapterTitlesController.job = job; - - // Set Auto Crop to on upon selecting a new title - job.picture.autocrop = YES; - - self.job = job; - // If Auto Naming is on. We create an output filename of dvd name - title number if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"]) { @@ -3413,136 +3388,73 @@ static void queueFSEventStreamCallback( - (IBAction) encodeStartStopPopUpChanged: (id) sender; { - if( [fEncodeStartStopPopUp isEnabled] ) + // We are chapters + if ([fEncodeStartStopPopUp indexOfSelectedItem] == 0) { - /* We are chapters */ - if( [fEncodeStartStopPopUp indexOfSelectedItem] == 0 ) - { - [fSrcChapterStartPopUp setHidden: NO]; - [fSrcChapterEndPopUp setHidden: NO]; - - [fSrcTimeStartEncodingField setHidden: YES]; - [fSrcTimeEndEncodingField setHidden: YES]; - - [fSrcFrameStartEncodingField setHidden: YES]; - [fSrcFrameEndEncodingField setHidden: YES]; - - [self chapterPopUpChanged:nil]; - } - /* We are time based (seconds) */ - else if ([fEncodeStartStopPopUp indexOfSelectedItem] == 1) - { - [fSrcChapterStartPopUp setHidden: YES]; - [fSrcChapterEndPopUp setHidden: YES]; - - [fSrcTimeStartEncodingField setHidden: NO]; - [fSrcTimeEndEncodingField setHidden: NO]; - - [fSrcFrameStartEncodingField setHidden: YES]; - [fSrcFrameEndEncodingField setHidden: YES]; - - [self startEndSecValueChanged:nil]; - } - /* We are frame based */ - else if ([fEncodeStartStopPopUp indexOfSelectedItem] == 2) - { - [fSrcChapterStartPopUp setHidden: YES]; - [fSrcChapterEndPopUp setHidden: YES]; - - [fSrcTimeStartEncodingField setHidden: YES]; - [fSrcTimeEndEncodingField setHidden: YES]; - - [fSrcFrameStartEncodingField setHidden: NO]; - [fSrcFrameEndEncodingField setHidden: NO]; - - [self startEndFrameValueChanged:nil]; - } - } -} + self.job.range.type = HBRangeTypeChapters; -- (IBAction) chapterPopUpChanged: (id) sender -{ + [fSrcChapterStartPopUp setHidden: NO]; + [fSrcChapterEndPopUp setHidden: NO]; - /* If start chapter popup is greater than end chapter popup, - we set the end chapter popup to the same as start chapter popup */ - if ([fSrcChapterStartPopUp indexOfSelectedItem] > [fSrcChapterEndPopUp indexOfSelectedItem]) - { - [fSrcChapterEndPopUp selectItemAtIndex: [fSrcChapterStartPopUp indexOfSelectedItem]]; + [fSrcTimeStartEncodingField setHidden: YES]; + [fSrcTimeEndEncodingField setHidden: YES]; + + [fSrcFrameStartEncodingField setHidden: YES]; + [fSrcFrameEndEncodingField setHidden: YES]; + + [self chapterPopUpChanged:nil]; } + // We are time based (seconds) + else if ([fEncodeStartStopPopUp indexOfSelectedItem] == 1) + { + self.job.range.type = HBRangeTypeSeconds; - - hb_list_t * list = hb_get_titles( self.core.hb_handle); - hb_title_t * title = (hb_title_t *) - hb_list_item( list, (int)[fSrcTitlePopUp indexOfSelectedItem] ); - - hb_chapter_t * chapter; - int64_t duration = 0; - for( NSInteger i = [fSrcChapterStartPopUp indexOfSelectedItem]; - i <= [fSrcChapterEndPopUp indexOfSelectedItem]; i++ ) + [fSrcChapterStartPopUp setHidden: YES]; + [fSrcChapterEndPopUp setHidden: YES]; + + [fSrcTimeStartEncodingField setHidden: NO]; + [fSrcTimeEndEncodingField setHidden: NO]; + + [fSrcFrameStartEncodingField setHidden: YES]; + [fSrcFrameEndEncodingField setHidden: YES]; + } + // We are frame based + else if ([fEncodeStartStopPopUp indexOfSelectedItem] == 2) { - chapter = (hb_chapter_t *) hb_list_item( title->list_chapter, (int)i ); - duration += chapter->duration; + self.job.range.type = HBRangeTypeFrames; + + [fSrcChapterStartPopUp setHidden: YES]; + [fSrcChapterEndPopUp setHidden: YES]; + + [fSrcTimeStartEncodingField setHidden: YES]; + [fSrcTimeEndEncodingField setHidden: YES]; + + [fSrcFrameStartEncodingField setHidden: NO]; + [fSrcFrameEndEncodingField setHidden: NO]; } - - duration /= 90000; /* pts -> seconds */ - [fSrcDuration2Field setStringValue: [NSString stringWithFormat: - @"%02lld:%02lld:%02lld", duration / 3600, ( duration / 60 ) % 60, - duration % 60]]; +} - /* We're changing the chapter range - we may need to flip the m4v/mp4 extension */ +- (IBAction) chapterPopUpChanged: (id) sender +{ + // We're changing the chapter range - we may need to flip the m4v/mp4 extension if ([[fDstFormatPopUp selectedItem] tag] & HB_MUX_MASK_MP4) { [self autoSetM4vExtension:sender]; } - /* If Auto Naming is on it might need to be update if it includes the chapters range */ + // If Auto Naming is on it might need to be update if it includes the chapters range if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"]) { [self updateFileName]; } } -- (IBAction) startEndSecValueChanged: (id) sender -{ - - int duration = [fSrcTimeEndEncodingField intValue] - [fSrcTimeStartEncodingField intValue]; - [fSrcDuration2Field setStringValue: [NSString stringWithFormat: - @"%02d:%02d:%02d", duration / 3600, ( duration / 60 ) % 60, - duration % 60]]; -} - -- (IBAction) startEndFrameValueChanged: (id) sender -{ - hb_list_t * list = hb_get_titles(self.core.hb_handle); - hb_title_t * title = (hb_title_t*) - hb_list_item( list, (int)[fSrcTitlePopUp indexOfSelectedItem] ); - - int duration = ([fSrcFrameEndEncodingField intValue] - [fSrcFrameStartEncodingField intValue]) / (title->vrate.num / title->vrate.den); - [fSrcDuration2Field setStringValue: [NSString stringWithFormat: - @"%02d:%02d:%02d", duration / 3600, ( duration / 60 ) % 60, - duration % 60]]; -} - - (IBAction) formatPopUpChanged: (id) sender { NSString *string = [fDstFile2Field stringValue]; - int videoContainer = (int)[[fDstFormatPopUp selectedItem] tag]; + int videoContainer = self.job.container; const char *ext = NULL; - // enable chapter markers and hide muxer-specific options - [fDstMp4HttpOptFileCheck setHidden:YES]; - [fDstMp4iPodFileCheck setHidden:YES]; - - switch (videoContainer) - { - case HB_MUX_AV_MP4: - [fDstMp4HttpOptFileCheck setHidden:NO]; - [fDstMp4iPodFileCheck setHidden:NO]; - break; - - default: - break; - } // set the file extension ext = hb_container_get_default_extension(videoContainer); [fDstFile2Field setStringValue:[NSString stringWithFormat:@"%@.%s", @@ -3552,61 +3464,35 @@ static void queueFSEventStreamCallback( { [self autoSetM4vExtension:sender]; } - - /* post a notification for any interested observers to indicate that our video container has changed */ - [[NSNotificationCenter defaultCenter] postNotification: - [NSNotification notificationWithName:HBContainerChangedNotification - object:self - userInfo:[NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithInt:videoContainer], keyContainerTag, - nil]]]; - - [self customSettingUsed:sender]; } - (void) autoSetM4vExtension:(NSNotification *)notification { - if (!([[fDstFormatPopUp selectedItem] tag] & HB_MUX_MASK_MP4)) + if (!(self.job.container & HB_MUX_MASK_MP4)) return; - NSString * extension = @"mp4"; + NSString *extension = @"mp4"; BOOL anyCodecAC3 = [fAudioController anyCodecMatches: HB_ACODEC_AC3] || [fAudioController anyCodecMatches: HB_ACODEC_AC3_PASS]; - /* Chapter markers are enabled if the checkbox is ticked and we are doing p2p or we have > 1 chapter */ + // Chapter markers are enabled if the checkbox is ticked and we are doing p2p or we have > 1 chapter BOOL chapterMarkers = (self.job.chaptersEnabled) && - ([fEncodeStartStopPopUp indexOfSelectedItem] != 0 || - [fSrcChapterStartPopUp indexOfSelectedItem] < [fSrcChapterEndPopUp indexOfSelectedItem]); - + (self.job.range.type != HBRangeTypeChapters || + self.job.range.chapterStart < self.job.range.chapterStop); + if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @".m4v"] || ((YES == anyCodecAC3 || YES == chapterMarkers) && - [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"] )) + [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString: @"Auto"])) { extension = @"m4v"; } - if( [extension isEqualTo: [[fDstFile2Field stringValue] pathExtension]] ) + if ([extension isEqualTo: [[fDstFile2Field stringValue] pathExtension]] ) return; else [fDstFile2Field setStringValue: [NSString stringWithFormat:@"%@.%@", [[fDstFile2Field stringValue] stringByDeletingPathExtension], extension]]; } -- (void)updateMp4Checkboxes:(NSNotification *)notification -{ - if (self.job.video.encoder != HB_VCODEC_X264) - { - /* We set the iPod atom checkbox to disabled and uncheck it as its only for x264 in the mp4 - * container. Format is taken care of in formatPopUpChanged method by hiding and unchecking - * anything other than MP4. */ - [fDstMp4iPodFileCheck setEnabled: NO]; - [fDstMp4iPodFileCheck setState: NSOffState]; - } - else - { - [fDstMp4iPodFileCheck setEnabled: YES]; - } -} - /* Method to determine if we should change the UI To reflect whether or not a Preset is being used or if the user is using "Custom" settings by determining the sender*/ @@ -3634,17 +3520,12 @@ the user is using "Custom" settings by determining the sender*/ /** * Registers changes made in the Picture Settings Window. */ - - (void)pictureSettingsDidChange { // align picture settings and video filters in the UI using tabs fVideoController.pictureSettings = [self pictureSettingsSummary]; fVideoController.pictureFilters = self.job.filters.summary; - /* Store storage resolution for unparse */ - fVideoController.video.widthForUnparse = self.job.picture.width; - fVideoController.video.heightForUnparse = self.job.picture.height; - [fPreviewController reloadPreviews]; } @@ -3671,18 +3552,14 @@ the user is using "Custom" settings by determining the sender*/ return [NSString stringWithString:summary]; } -- (NSString*) muxerOptionsSummary +- (NSString *) muxerOptionsSummary { NSMutableString *summary = [NSMutableString stringWithString:@""]; - if ([fDstMp4HttpOptFileCheck isHidden] == NO && - [fDstMp4HttpOptFileCheck isEnabled] == YES && - [fDstMp4HttpOptFileCheck state] == NSOnState) + if ((self.job.container & HB_MUX_MASK_MP4) && self.job.mp4HttpOptimize) { [summary appendString:@" - Web optimized"]; } - if ([fDstMp4iPodFileCheck isHidden] == NO && - [fDstMp4iPodFileCheck isEnabled] == YES && - [fDstMp4iPodFileCheck state] == NSOnState) + if ((self.job.container & HB_MUX_MASK_MP4) && self.job.mp4iPodCompatible) { [summary appendString:@" - iPod 5G support"]; } @@ -3797,31 +3674,18 @@ the user is using "Custom" settings by determining the sender*/ [fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]]; } - /* File Format */ - /* map legacy container names via libhb */ - int format = hb_container_get_from_name(hb_container_sanitize_name([chosenPreset[@"FileFormat"] UTF8String])); - [fDstFormatPopUp selectItemWithTag:format]; - [self formatPopUpChanged:nil]; + // Apply the preset to the current job + [self.job applyPreset:preset]; - /* check to see if we have only one chapter */ + // check to see if we have only one chapter [self chapterPopUpChanged:nil]; - - /* Mux mp4 with http optimization */ - [fDstMp4HttpOptFileCheck setState:[[chosenPreset objectForKey:@"Mp4HttpOptimize"] intValue]]; - /* Lets run through the following functions to get variables set there */ - /* Set the state of ipod compatible with Mp4iPodCompatible. Only for x264*/ - [fDstMp4iPodFileCheck setState:[[chosenPreset objectForKey:@"Mp4iPodCompatible"] intValue]]; - - /* Audio */ + // Audio [fAudioController applySettingsFromPreset: chosenPreset]; - /*Subtitles*/ + // Subtitles [fSubtitlesViewController applySettingsFromPreset:chosenPreset]; - // Apply the preset to the current job - [self.job applyPreset:preset]; - [self pictureSettingsDidChange]; } } @@ -3896,35 +3760,14 @@ the user is using "Custom" settings by determining the sender*/ // Get whether or not to use the current Picture Filter settings for the preset preset[@"UsesPictureFilters"] = currentPreset[@"UsesPictureFilters"]; - preset[@"PresetDescription"] = currentPreset[@"PresetDescription"]; - preset[@"FileFormat"] = fDstFormatPopUp.titleOfSelectedItem; - preset[@"ChapterMarkers"] = @(self.job.chaptersEnabled); - - // Mux mp4 with http optimization - preset[@"Mp4HttpOptimize"] = @(fDstMp4HttpOptFileCheck.state); - // Add iPod uuid atom - preset[@"Mp4iPodCompatible"] = @(fDstMp4iPodFileCheck.state); - - // Video encoder - [self.job.video prepareVideoForPreset:preset]; - preset[@"PictureWidth"] = currentPreset[@"PictureWidth"]; preset[@"PictureHeight"] = currentPreset[@"PictureHeight"]; - // Picture Filters - [self.job.filters prepareFiltersForPreset:preset]; - - // Picture Size - [self.job.picture preparePictureForPreset:preset]; - - // Audio - [self.job.audioDefaults prepareAudioDefaultsForPreset:preset]; + preset[@"PresetDescription"] = currentPreset[@"PresetDescription"]; - // Subtitles - [self.job.subtitlesDefaults prepareSubtitlesDefaultsForPreset:preset]; + [self.job applyCurrentSettingsToPreset:preset]; return [[[HBPreset alloc] initWithName:preset[@"PresetName"] content:preset builtIn:NO] autorelease]; - } #pragma mark - diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib index 61e9daaec..439f95472 100644 --- a/macosx/English.lproj/MainMenu.xib +++ b/macosx/English.lproj/MainMenu.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C68k" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C81f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" identifier="macosx"/> <development version="5100" identifier="xcode"/> @@ -185,6 +185,9 @@ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" red="0.76630436999999996" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/> </textFieldCell> + <connections> + <binding destination="240" name="value" keyPath="self.job.range.duration" id="D3F-S5-u15"/> + </connections> </textField> <textField verticalHuggingPriority="750" id="1555"> <rect key="frame" x="20" y="486" width="70" height="14"/> @@ -209,7 +212,7 @@ </popUpButtonCell> <accessibility description="Format"/> <connections> - <action selector="formatPopUpChanged:" target="240" id="1614"/> + <binding destination="240" name="selectedTag" keyPath="self.job.container" id="ful-Gq-2mt"/> </connections> </popUpButton> <button verticalHuggingPriority="750" id="1562"> @@ -257,7 +260,7 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="startEndSecValueChanged:" target="240" id="5528"/> + <binding destination="240" name="value" keyPath="self.job.range.secondsStart" id="yuS-GN-avp"/> </connections> </textField> <textField hidden="YES" verticalHuggingPriority="750" id="5521"> @@ -269,7 +272,7 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="startEndFrameValueChanged:" target="240" id="5530"/> + <binding destination="240" name="value" keyPath="self.job.range.frameStart" id="7yg-HW-q0R"/> </connections> </textField> <textField hidden="YES" verticalHuggingPriority="750" id="5493"> @@ -281,7 +284,7 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="startEndSecValueChanged:" target="240" id="5529"/> + <binding destination="240" name="value" keyPath="self.job.range.secondsStop" id="BUI-Zz-m1A"/> </connections> </textField> <textField hidden="YES" verticalHuggingPriority="750" id="5523"> @@ -293,7 +296,7 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <action selector="startEndFrameValueChanged:" target="240" id="5531"/> + <binding destination="240" name="value" keyPath="self.job.range.frameStop" id="8G6-K0-vyD"/> </connections> </textField> <textField verticalHuggingPriority="750" id="1627"> @@ -358,7 +361,12 @@ <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> - <action selector="customSettingUsed:" target="240" id="4971"/> + <binding destination="240" name="value" keyPath="self.job.mp4HttpOptimize" id="b1e-md-dT3"/> + <binding destination="240" name="hidden" keyPath="self.job.mp4OptionsEnabled" id="D27-Mk-6hO"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSNegateBoolean</string> + </dictionary> + </binding> </connections> </button> <button toolTip="This option adds an atom to the MP4 file which allows older iPods (5th Generation classic style) to play the file." id="4967"> @@ -369,7 +377,12 @@ <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> - <action selector="customSettingUsed:" target="240" id="4970"/> + <binding destination="240" name="hidden" keyPath="self.job.mp4OptionsEnabled" id="Vlg-uB-45p"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSNegateBoolean</string> + </dictionary> + </binding> + <binding destination="240" name="value" keyPath="self.job.mp4iPodCompatible" id="GWA-QG-Bfu"/> </connections> </button> <textField verticalHuggingPriority="750" id="5505"> @@ -396,6 +409,8 @@ <accessibility description="Start Chapter"/> <connections> <action selector="chapterPopUpChanged:" target="240" id="1615"/> + <binding destination="240" name="content" keyPath="self.job.range.chapters" id="6kP-TS-bEc"/> + <binding destination="240" name="selectedIndex" keyPath="self.job.range.chapterStart" previousBinding="6kP-TS-bEc" id="U76-2W-TvD"/> </connections> </popUpButton> <popUpButton verticalHuggingPriority="750" id="1548"> @@ -413,6 +428,8 @@ <accessibility description="End Chapter"/> <connections> <action selector="chapterPopUpChanged:" target="240" id="1616"/> + <binding destination="240" name="content" keyPath="self.job.range.chapters" id="Yqp-Sg-lBf"/> + <binding destination="240" name="selectedIndex" keyPath="self.job.range.chapterStop" previousBinding="Yqp-Sg-lBf" id="4k2-Sm-RoJ"/> </connections> </popUpButton> </subviews> diff --git a/macosx/HBAddPresetController.h b/macosx/HBAddPresetController.h index 3fa4bf921..f86b2e4f4 100644 --- a/macosx/HBAddPresetController.h +++ b/macosx/HBAddPresetController.h @@ -7,7 +7,6 @@ // #import <Cocoa/Cocoa.h> -#include "hb.h" @class HBPreset; diff --git a/macosx/HBAddPresetController.m b/macosx/HBAddPresetController.m index a53482c0c..82d965854 100644 --- a/macosx/HBAddPresetController.m +++ b/macosx/HBAddPresetController.m @@ -8,6 +8,7 @@ #import "HBAddPresetController.h" #import "HBPreset.h" +#include "hb.h" @interface HBAddPresetController () diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index 36a71faed..a90f8f957 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -11,9 +11,16 @@ @class HBCore; @class HBJob; +@protocol HBPreviewControllerDelegate <NSObject> + +- (IBAction)showPicturePanel:(id)sender; + +@end + @interface HBPreviewController : NSWindowController <NSWindowDelegate> -@property (nonatomic, assign) HBController *delegate; +- (id)initWithDelegate:(id <HBPreviewControllerDelegate>)delegate; + @property (nonatomic, assign) HBCore *core; @property (nonatomic, assign) HBJob *job; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 96a631d80..b31dc255a 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -7,11 +7,10 @@ #import "HBPreviewController.h" #import "HBPreviewGenerator.h" #import "HBUtilities.h" -#import "Controller.h" #import <QTKit/QTKit.h> -#import "HBPicture.h" #import "HBJob.h" +#import "HBPicture+UIAdditions.h" @implementation QTMovieView (HBQTMovieViewExtensions) @@ -98,6 +97,8 @@ typedef enum ViewMode : NSUInteger { IBOutlet NSPopUpButton * fPreviewMovieLengthPopUp; } +@property (nonatomic, assign) id <HBPreviewControllerDelegate> delegate; + @property (nonatomic) CALayer *backLayer; @property (nonatomic) CALayer *pictureLayer; @@ -134,7 +135,7 @@ typedef enum ViewMode : NSUInteger { @implementation HBPreviewController -- (id) init +- (id)initWithDelegate:(id <HBPreviewControllerDelegate>)delegate { if (self = [super initWithWindowNibName:@"PicturePreview"]) { @@ -147,6 +148,7 @@ typedef enum ViewMode : NSUInteger { // If/when we switch a lot of this stuff to bindings, this can probably // go away. [self window]; + _delegate = delegate; } return self; diff --git a/macosx/HBVideoController.h b/macosx/HBVideoController.h index 9ebc2cb54..3289b58ee 100644 --- a/macosx/HBVideoController.h +++ b/macosx/HBVideoController.h @@ -14,8 +14,6 @@ /** * HBVideoController - * - * Responds to HBContainerChangedNotification notifications. */ @interface HBVideoController : NSViewController <HBViewValidation> diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index 42ee4d542..8819ac93e 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -5,9 +5,8 @@ It may be used under the terms of the GNU General Public License. */ #import "HBVideoController.h" -#import "Controller.h" #import "HBAdvancedController.h" -#import "HBVideo.h" +#import "HBVideo+UIAdditions.h" #include "hb.h" @@ -67,9 +66,6 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; // will use the HBJob one in the future. _video = [[HBVideo alloc] init]; - // register that we are interested in changes made to the video container. - [[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(containerChanged:) name:HBContainerChangedNotification object:nil]; - // Observe the advanced tab pref shown/hided state. [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.HBShowAdvancedTab" @@ -92,12 +88,6 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; return self; } -- (void)loadView -{ - [super loadView]; - [self switchPresetView]; -} - - (void)setEnabled:(BOOL)flag { _enabled = flag; @@ -182,11 +172,6 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; } } -- (void)containerChanged:(NSNotification *)aNotification -{ - self.video.container = [[aNotification userInfo][keyContainerTag] intValue]; -} - #pragma mark - Interface setup /* diff --git a/macosx/PictureController.h b/macosx/PictureController.h index c2ea23d5c..6328cc7ab 100644 --- a/macosx/PictureController.h +++ b/macosx/PictureController.h @@ -6,8 +6,8 @@ #import <Cocoa/Cocoa.h> -#import "HBFilters.h" -#import "HBPicture.h" +@class HBFilters; +@class HBPicture; @protocol HBPictureControllerDelegate <NSObject> diff --git a/macosx/PictureController.m b/macosx/PictureController.m index c1a813ae5..7d65d5664 100644 --- a/macosx/PictureController.m +++ b/macosx/PictureController.m @@ -4,36 +4,9 @@ Homepage: <http://handbrake.fr/>. It may be used under the terms of the GNU General Public License. */ -#import "Controller.h" #import "PictureController.h" -#import "HBPreviewController.h" - -#import "HBTitle.h" - -@interface HBCustomFilterTransformer : NSValueTransformer -@end - -@implementation HBCustomFilterTransformer - -+ (Class)transformedValueClass -{ - return [NSNumber class]; -} - -- (id)transformedValue:(id)value -{ - if ([value intValue] == 1) - return @NO; - else - return @YES; -} - -+ (BOOL)allowsReverseTransformation -{ - return NO; -} - -@end +#import "HBFilters.h" +#import "HBPicture.h" static void *HBPictureControllerContext = &HBPictureControllerContext; @@ -308,7 +281,7 @@ static void *HBPictureControllerContext = &HBPictureControllerContext; NSSize pictureCropBoxSize = [fPictureCropBox frame].size; NSPoint fPictureCropBoxOrigin = [fPictureCropBox frame].origin; - if ([fAnamorphicPopUp indexOfSelectedItem] == HB_ANAMORPHIC_CUSTOM) + if ([fAnamorphicPopUp indexOfSelectedItem] == 3) { // custom / power user jamboree pictureSizingBoxSize.width = 350; } |