From 4c859fbdbadb78cc822f6a5437444e3615d95e2d Mon Sep 17 00:00:00 2001 From: ritsuka Date: Sun, 17 Aug 2014 06:10:35 +0000 Subject: MacGui: changed the preset selection code a little bit again. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6304 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.m | 23 ++++++++++++----------- macosx/HBPresetsViewController.h | 2 +- macosx/HBPresetsViewController.m | 7 +++---- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'macosx') diff --git a/macosx/Controller.m b/macosx/Controller.m index e4c0ff95e..e1a45d206 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -2043,13 +2043,14 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* if not then select the main feature title */ [fSrcTitlePopUp selectItemAtIndex: feature_title]; } - [self titlePopUpChanged:nil]; - + SuccessfulScan = YES; - [self enableUI: YES]; + [self titlePopUpChanged:nil]; [self encodeStartStopPopUpChanged:nil]; + [self enableUI: YES]; + // Open preview window now if it was visible when HB was closed if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PreviewWindowIsOpen"]) [self showPreviewWindow:nil]; @@ -4876,7 +4877,9 @@ the user is using "Custom" settings by determining the sender*/ - (void)applyPreset:(HBPreset *)preset { - if (preset != nil) + self.selectedPreset = preset; + + if (preset != nil && SuccessfulScan) { hb_job_t * job = fTitle->job; @@ -5139,11 +5142,7 @@ the user is using "Custom" settings by determining the sender*/ - (void)selectionDidChange { - self.selectedPreset = fPresetsView.selectedPreset; - if (SuccessfulScan) - { - [self applyPreset:self.selectedPreset]; - } + [self applyPreset:fPresetsView.selectedPreset]; } #pragma mark - @@ -5419,7 +5418,8 @@ the user is using "Custom" settings by determining the sender*/ - (IBAction)selectDefaultPreset:(id)sender { - [fPresetsView selectPreset:presetManager.defaultPreset]; + [self applyPreset:presetManager.defaultPreset]; + [fPresetsView setSelection:_selectedPreset]; } - (IBAction)insertFolder:(id)sender @@ -5444,7 +5444,8 @@ the user is using "Custom" settings by determining the sender*/ i++; }]; - [fPresetsView selectPreset:preset]; + [self applyPreset:preset]; + [fPresetsView setSelection:_selectedPreset]; } /** diff --git a/macosx/HBPresetsViewController.h b/macosx/HBPresetsViewController.h index 6b3de5f08..f2ab9dc19 100644 --- a/macosx/HBPresetsViewController.h +++ b/macosx/HBPresetsViewController.h @@ -24,7 +24,7 @@ @property (nonatomic, readwrite, assign) id delegate; - (void)deselect; -- (void)selectPreset:(HBPreset *)preset; +- (void)setSelection:(HBPreset *)preset; - (IBAction)insertFolder:(id)sender; diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m index 08e03e31e..a5cb8c6ad 100644 --- a/macosx/HBPresetsViewController.m +++ b/macosx/HBPresetsViewController.m @@ -65,7 +65,7 @@ // Re-expand the items [self expandNodes:[self.treeController.arrangedObjects childNodes]]; - [self deselect]; + [self.treeController setSelectionIndexPath:[self.presets indexPathOfPreset:self.presets.defaultPreset]]; } - (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem @@ -94,7 +94,7 @@ - (IBAction)clicked:(id)sender { - if (self.delegate && [[self.treeController.selectedObjects firstObject] isLeaf] && self.enabled) + if (self.delegate && [[self.treeController.selectedObjects firstObject] isLeaf]) { [self.delegate selectionDidChange]; } @@ -159,14 +159,13 @@ [self.treeController setSelectionIndexPath:nil]; } -- (void)selectPreset:(HBPreset *)preset +- (void)setSelection:(HBPreset *)preset { NSIndexPath *idx = [self.presets indexPathOfPreset:preset]; if (idx) { [self.treeController setSelectionIndexPath:idx]; - [self clicked:self]; } } -- cgit v1.2.3