]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/wizard.m
macosx: create new classes for all controls bar related code
[vlc] / modules / gui / macosx / wizard.m
index 95d30c78bc807d97064fe756821c5c3a3cb1bc15..d6ebf6827a9f6be8e839351d5fb6631e96d78661 100644 (file)
@@ -73,7 +73,7 @@ static VLCWizard *_o_sharedInstance = nil;
 
 - (void)awakeFromNib
 {
-    if (OSX_LION)
+    if (!OSX_SNOW_LEOPARD)
         [o_wizard_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
 
     /* some minor cleanup */
@@ -1217,21 +1217,35 @@ static VLCWizard *_o_sharedInstance = nil;
             input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED );
 
             if(! [[o_userSelections objectForKey:@"partExtractFrom"]
-                isEqualToString:@""] )
-            {
-                input_item_AddOption( p_input, [[NSString
-                    stringWithFormat: @"start-time=%@", [o_userSelections
-                    objectForKey: @"partExtractFrom"]] UTF8String],
-                    VLC_INPUT_OPTION_TRUSTED );
+                isEqualToString:@""]) {
+                NSArray * components = [[o_userSelections objectForKey: @"partExtractFrom"] componentsSeparatedByString:@":"];
+                NSUInteger componentCount = [components count];
+                NSUInteger time = 0;
+                if (componentCount == 1)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue]);
+                else if (componentCount == 2)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
+                else if (componentCount == 3)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
+                else
+                    msg_Err(VLCIntf, "Invalid string format for time");
+                input_item_AddOption(p_input, [[NSString stringWithFormat: @"start-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
             }
 
             if(! [[o_userSelections objectForKey:@"partExtractTo"]
-                isEqualToString:@""] )
-            {
-                input_item_AddOption( p_input, [[NSString
-                    stringWithFormat: @"stop-time=%@", [o_userSelections
-                    objectForKey: @"partExtractTo"]] UTF8String],
-                    VLC_INPUT_OPTION_TRUSTED );
+                isEqualToString:@""]) {
+                NSArray * components = [[o_userSelections objectForKey: @"partExtractTo"] componentsSeparatedByString:@":"];
+                NSUInteger componentCount = [components count];
+                NSUInteger time = 0;
+                if (componentCount == 1)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue]);
+                else if (componentCount == 2)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
+                else if (componentCount == 3)
+                    time = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
+                else
+                    msg_Err(VLCIntf, "Invalid string format for time");
+                input_item_AddOption(p_input, [[NSString stringWithFormat: @"stop-time=%lu", time] UTF8String], VLC_INPUT_OPTION_TRUSTED);
             }
 
             input_item_AddOption( p_input, [[NSString stringWithFormat:
@@ -1239,11 +1253,9 @@ static VLCWizard *_o_sharedInstance = nil;
                 UTF8String],
                 VLC_INPUT_OPTION_TRUSTED );
 
-            /* FIXME: playlist_AddInput() can fail */
-            playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP,
-                PLAYLIST_END, true, pl_Unlocked );
+            int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked );
 
-            if( x == 0 )
+            if( x == 0 && returnValue != VLC_SUCCESS)
             {
                 /* play the first item and add the others afterwards */
                 PL_LOCK;
@@ -1313,7 +1325,7 @@ static VLCWizard *_o_sharedInstance = nil;
     if ([[o_userSelections objectForKey:@"partExtract"] isEqualToString: @"YES"])
     {
         [o_t8_fld_partExtract setStringValue: [NSString stringWithFormat:
-            _NS("yes: from %@ to %@ secs"),
+            _NS("yes: from %@ to %@"),
             [o_userSelections objectForKey:@"partExtractFrom"],
             [o_userSelections objectForKey:@"partExtractTo"]]];
     } else {