]> granicus.if.org Git - handbrake/commitdiff
MacGui: changed the preset selection code a little bit again.
authorritsuka <damiog@gmail.com>
Sun, 17 Aug 2014 06:10:35 +0000 (06:10 +0000)
committerritsuka <damiog@gmail.com>
Sun, 17 Aug 2014 06:10:35 +0000 (06:10 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6304 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m
macosx/HBPresetsViewController.h
macosx/HBPresetsViewController.m

index e4c0ff95e862b306050440f25107e427716cebef..e1a45d206b5203aba8c82769c314f21671098b81 100644 (file)
@@ -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];
 }
 
 /**
index 6b3de5f08d8ba14241eb9cfd27cd828f0be16fb1..f2ab9dc1988af5eb78f9bc64e616161e386e9394 100644 (file)
@@ -24,7 +24,7 @@
 @property (nonatomic, readwrite, assign) id<HBPresetsViewControllerDelegate> delegate;
 
 - (void)deselect;
-- (void)selectPreset:(HBPreset *)preset;
+- (void)setSelection:(HBPreset *)preset;
 
 - (IBAction)insertFolder:(id)sender;
 
index 08e03e31e71e6f42d5b222cab00a91b0d0563f65..a5cb8c6adea73e275f62ecf9032fa5a24c5368a1 100644 (file)
@@ -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];
     }
     [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];
     }
 }