OSDN Git Service

macGui: fix bug in Advanced x264 option widgets
authordynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 15 May 2007 20:33:42 +0000 (20:33 +0000)
committerdynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 15 May 2007 20:33:42 +0000 (20:33 +0000)
Modify the test to see if an optName already exists to avoid conflict with similar name patterns in the -X264AdvancedOptionsChanged: method where we test for the presence of the optNameToChange in the existing string.

This change starts on line 2215.

git-svn-id: svn://localhost/HandBrake/trunk@583 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.mm

index 58c9750..06c460f 100644 (file)
@@ -2210,9 +2210,17 @@ the user is using "Custom" settings by determining the sender*/
 
     /*verify there is an occurrence of the opt specified by the sender to change */
     /*take care of any multi-value opt names here. This is extremely kludgy, but test for functionality
-    and worry about pretty later */    
-    NSRange currentOptRange = [currentOptString rangeOfString:optNameToChange];
-    if (currentOptRange.location != NSNotFound)
+    and worry about pretty later */
+       
+       /*First, we create a pattern to check for ":"optNameToChange"=" to modify the option if the name falls after
+       the first character of the opt string (hence the ":") */
+       NSString *checkOptNameToChange = [NSString stringWithFormat:@":%@=",optNameToChange];
+    NSRange currentOptRange = [currentOptString rangeOfString:checkOptNameToChange];
+       /*Then we create a pattern to check for "<beginning of line>"optNameToChange"=" to modify the option to
+       see if the name falls at the beginning of the line, where we would not have the ":" as a pattern to test against*/
+       NSString *checkOptNameToChangeBeginning = [NSString stringWithFormat:@"%@=",optNameToChange];
+    NSRange currentOptRangeBeginning = [currentOptString rangeOfString:checkOptNameToChangeBeginning];
+    if (currentOptRange.location != NSNotFound || currentOptRangeBeginning.location == 0)
     {
         /* Create new empty opt string*/
         NSString *changedOptString = @"";