]> git.sesse.net Git - vlc/commitdiff
* Brought the new options system to the OSX gui.
authorDerk-Jan Hartman <hartman@videolan.org>
Sun, 27 Jul 2003 23:05:41 +0000 (23:05 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sun, 27 Jul 2003 23:05:41 +0000 (23:05 +0000)
  and some small fixes.

extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
modules/gui/macosx/intf.m
modules/gui/macosx/open.h
modules/gui/macosx/open.m
modules/gui/macosx/output.h
modules/gui/macosx/output.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index 94fa319378545928f62cf43b5f522ca9356d6c39..6116211b841b2863a74dfb37aa1f01e969fd03a9 100644 (file)
                 "o_net_udpm_port" = id; 
                 "o_net_udpm_port_lbl" = id; 
                 "o_net_udpm_port_stp" = id; 
+                "o_output_ckbox" = id; 
                 "o_panel" = id; 
                 "o_playlist" = id; 
+                "o_sout_options" = id; 
                 "o_tabview" = id; 
             }; 
             SUPERCLASS = NSObject; 
index 72e0f3d59cb566a7c309ca1000e2cd0f2a605f6c..24dd17e8e88087b395bac615b1b93e559fce3929 100644 (file)
        <array>
                <integer>977</integer>
        </array>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>636</integer>
+       </array>
        <key>IBSystem Version</key>
        <string>6L60</string>
 </dict>
index ab3579c8e88a7c72b3d465f0c0b83ad724f01801..4beeb6e1b116ab4f7aced60867913fb14e052aa5 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index d632797890c260b395e7a813afc5bd72ef763456..2b70749219523e91c223a43793428707f63d199c 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.92 2003/07/27 14:10:02 massiot Exp $
+ * $Id: intf.m,v 1.93 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -465,15 +465,9 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 
 - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename
 {
-    intf_thread_t * p_intf = [NSApp getIntf];
-    
-    config_PutPsz( p_intf, "sub-file", "" );
-    config_PutInt( p_intf, "sub-delay", 0 );
-    config_PutFloat( p_intf, "sub-fps", 0.0 );
-    config_PutPsz( p_intf, "sout", "" );
-    
+    NSDictionary *o_dic = [NSDictionary dictionaryWithObjectsAndKeys: o_filename, @"ITEM_URL", nil];
     [o_playlist appendArray:
-        [NSArray arrayWithObject: o_filename] atPos: -1 enqueue: NO];
+        [NSArray arrayWithObject: o_dic] atPos: -1 enqueue: NO];
             
     return( TRUE );
 }
index 02a8baa509958575347ded3b5623a9ba31d96172..2aec2f9cf5172229efcbb0ad3b520ef8546d4b78 100644 (file)
@@ -2,7 +2,7 @@
  * open.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: open.h,v 1.14 2003/04/30 23:58:56 hartman Exp $
+ * $Id: open.h,v 1.15 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -84,6 +84,9 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
     IBOutlet id o_file_sub_fps_lbl;
     IBOutlet id o_file_sub_fps_stp;
     IBOutlet id o_file_sub_ok_btn;
+    
+    IBOutlet id o_output_ckbox;
+    IBOutlet id o_sout_options;
 }
 
 - (void)openTarget:(int)i_type;
index d45581791b46fca5bbdcd4958290fa67c0386812..9dc8e7e8e1f68c8accfb4f4ca0c60a313a6e7f61 100644 (file)
@@ -2,7 +2,7 @@
  * open.m: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: open.m,v 1.35 2003/05/25 17:27:13 massiot Exp $
+ * $Id: open.m,v 1.36 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -40,6 +40,7 @@
 #include "intf.h"
 #include "playlist.h"
 #include "open.h"
+#include "output.h"
 
 /*****************************************************************************
  * GetEjectableMediaOfClass 
@@ -232,28 +233,26 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
     {
         intf_thread_t * p_intf = [NSApp getIntf];
 
-        NSString *o_source = [o_mrl stringValue];
+        NSMutableDictionary *o_dic;
+        NSMutableArray *o_options = [NSMutableArray array];
         BOOL b_enq = [o_ckbox_enqueue state] == NSOnState ? YES : NO;
-        NSString *subPath = [o_file_sub_path stringValue];
+        o_dic = [NSMutableDictionary dictionaryWithObject: [o_mrl stringValue] forKey: @"ITEM_URL"];
         
-        if (([o_file_sub_ckbox state] == NSOnState) && !([subPath isEqualTo: @""]))
+        if( [o_file_sub_ckbox state] == NSOnState )
         {
-            config_PutPsz( p_intf, "sub-file", strdup( [subPath UTF8String] ) );
-            if ( [o_file_sub_override state] )
+            [o_options addObject: [NSString stringWithFormat: @"sub-file=%s", [[o_file_sub_path stringValue] UTF8String]]];
+            if( [o_file_sub_override state] == NSOnState )
             {
-                config_PutInt( p_intf, "sub-delay", (int)( [o_file_sub_delay intValue] * 10 ) );
-                config_PutFloat( p_intf, "sub-fps", [o_file_sub_fps floatValue] );
+                [o_options addObject: [NSString stringWithFormat: @"sub-delay=%i", (int)( [o_file_sub_delay intValue] * 10 )]];
+                [o_options addObject: [NSString stringWithFormat: @"sub-fps=%f", [o_file_sub_fps floatValue]]];
             }
         }
-        else
+        if( [o_output_ckbox state] == NSOnState )
         {
-            config_PutPsz( p_intf, "sub-file", "" );
-            config_PutInt( p_intf, "sub-delay", 0 );
-            config_PutFloat( p_intf, "sub-fps", 0.0 );
+            [o_options addObject: [NSString stringWithFormat: @"sout=%@", [(VLCOutput *)o_sout_options getMRL]]];
         }
-        
-        [o_playlist appendArray: 
-            [NSArray arrayWithObject: o_source] atPos: -1 enqueue:b_enq];
+        [o_dic setObject: (NSArray *)[o_options copy] forKey: @"ITEM_OPTIONS"];
+        [o_playlist appendArray: [NSArray arrayWithObject: o_dic] atPos: -1 enqueue:b_enq];
     }
 }
 
@@ -624,6 +623,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
 - (IBAction)openFile:(id)sender
 {
     NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
+    int i;
     
     [o_open_panel setAllowsMultipleSelection: YES];
     [o_open_panel setCanChooseDirectories: YES];
@@ -633,18 +633,17 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
     if( [o_open_panel runModalForDirectory: nil
             file: nil types: nil] == NSOKButton )
     {
-        intf_thread_t * p_intf = [NSApp getIntf];
-        config_PutPsz( p_intf, "sout", NULL );
-        
+        NSArray *o_array = [NSArray array];
         NSArray *o_values = [[o_open_panel filenames]
                 sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
-        
-        config_PutPsz( p_intf, "sub-file", "" );
-        config_PutInt( p_intf, "sub-delay", 0 );
-        config_PutFloat( p_intf, "sub-fps", 0.0 );
-        config_PutPsz( p_intf, "sout", "" );
-        
-        [o_playlist appendArray: o_values atPos: -1 enqueue:NO];
+
+        for( i = 0; i < [o_values count]; i++)
+        {
+            NSDictionary *o_dic;
+            o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
+            o_array = [o_array arrayByAddingObject: o_dic];
+        }
+        [o_playlist appendArray: o_array atPos: -1 enqueue:NO];
     }
 }
 
index 61d8856c18b8940faebe9a4696a073e2ebe398ec..809f45fc921c373ab8a3a7c2443017e7251b578e 100644 (file)
@@ -2,7 +2,7 @@
  * output.h: MacOS X Output Dialog
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: output.h,v 1.2 2003/07/20 19:48:30 hartman Exp $
+ * $Id: output.h,v 1.3 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -74,6 +74,7 @@
 }
 
 - (void)setMRL:(NSString *)o_mrl_string;
+- (NSString *)getMRL;
 - (void)setTranscode:(NSString *)o_transcode_string;
 
 - (void)initStrings;
index 6ccf407b4697768ebae0a8933520aa25a0eb494a..dfeb4390f35fc07317dca8d0cebb63bd1037974f 100644 (file)
@@ -2,7 +2,7 @@
  * output.m: MacOS X Output Dialog
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: output.m,v 1.10 2003/07/20 19:48:30 hartman Exp $
+ * $Id: output.m,v 1.11 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *          Christophe Massiot <massiot@via.ecp.fr>
     o_mrl = [o_mrl_string copy];
 }
 
+- (NSString *)getMRL
+{
+    return [o_mrl copy];
+}
+
 - (void)setTranscode:(NSString *)o_transcode_string
 {
     [o_transcode autorelease];
 
 - (void)awakeFromNib
 {
-    intf_thread_t * p_intf = [NSApp getIntf];
-    char * psz_sout = config_GetPsz( p_intf, "sout" );
-
-    if ( psz_sout != NULL && *psz_sout )
-    {
-        [o_output_ckbox setState: YES];
-    }
-    else
-    {
-        [o_output_ckbox setState: NO];
-    }
-    free(psz_sout);
-
     [self initStrings];
     
     [[NSNotificationCenter defaultCenter] addObserver: self
     }
     else
     {
-        intf_thread_t * p_intf = [NSApp getIntf];
-        config_PutPsz( p_intf, "sout", NULL );
         [o_output_settings setEnabled:NO];
     }
 }
 - (IBAction)outputCloseSheet:(id)sender
 {
     intf_thread_t * p_intf = [NSApp getIntf];
-    config_PutPsz( p_intf, "sout", [o_mrl UTF8String] );
+    //export sout[o_mrl UTF8String]
     
     [o_output_sheet orderOut:sender];
     [NSApp endSheet: o_output_sheet];
index 49e3819bf0d0376c6da1e0055bc90a07bf8b5366..9e99e6f22d1fa8f8adb0663b76c32bb6ad494290 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.h,v 1.9 2003/03/26 00:21:55 sam Exp $
+ * $Id: playlist.h,v 1.10 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
@@ -57,7 +57,7 @@
 - (IBAction)deleteItems:(id)sender;
 - (IBAction)selectAll:(id)sender;
 
-- (void)appendArray:(NSArray*)o_array atPos:(int)i_pos enqueue:(BOOL)b_enqueue;
+- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
 
 - (void)updateRowSelection;
 - (void)playlistUpdated;
index d382b6082da25d61fcd67cd2607a2eaf052d671a..cfe780ae57b33c4a7d6d8f05b3d32ca497e34e06 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.m,v 1.28 2003/07/23 01:13:47 gbazin Exp $
+ * $Id: playlist.m,v 1.29 2003/07/27 23:05:41 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
@@ -286,11 +286,9 @@ int MacVersion102 = -1;
     [o_table_view selectAll: nil];
 }
 
-- (void)appendArray:(NSArray*)o_array atPos:(int)i_pos enqueue:(BOOL)b_enqueue
+- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
 {
-    int i_items;
-    NSString * o_value;
-    NSEnumerator * o_enum;
+    int i_item;
     intf_thread_t * p_intf = [NSApp getIntf];
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                        FIND_ANYWHERE );
@@ -300,28 +298,58 @@ int MacVersion102 = -1;
         return;
     }
 
-    i_items = 0;
-    o_enum = [o_array objectEnumerator];
-    while( ( o_value = [o_enum nextObject] ) )
+    for ( i_item = 0; i_item < [o_array count]; i_item++ )
     {
-        NSURL * o_url;
-
+        /* One item */
+        NSDictionary *o_one_item;
+        NSString *o_url;
+        NSString *o_name;
+        NSArray *o_options;
+        int j, i_total_options = 0;
+        char **ppsz_options = NULL;
         int i_mode = PLAYLIST_INSERT;
         
-        if (i_items == 0 && !b_enqueue)
+        /* Get the item */
+        o_one_item = [o_array objectAtIndex: i_item];
+        o_url = (NSString *)[o_one_item objectForKey: @"ITEM_URL"];
+        o_name = (NSString *)[o_one_item objectForKey: @"ITEM_NAME"];
+        o_options = (NSArray *)[o_one_item objectForKey: @"ITEM_OPTIONS"];
+        
+        if( !o_name) o_name = o_url;
+        
+        if (i_item == 0 && !b_enqueue)
             i_mode |= PLAYLIST_GO;
 
-        playlist_Add( p_playlist, [o_value fileSystemRepresentation],
-            0, 0, i_mode, i_pos == -1 ? PLAYLIST_END : i_pos + i_items );
+        if( o_options && [o_options count] > 0 )
+        {
+            /* Count the input options */
+            i_total_options = [o_options count];
+    
+            /* Allocate ppsz_options */
+            for( j = 0; j < i_total_options; j++ )
+            {
+                if( !ppsz_options )
+                    ppsz_options = (char **)malloc( sizeof(char *) * i_total_options );
+    
+                ppsz_options[j] = strdup([[o_options objectAtIndex:j] UTF8String]);
+            }
+        }
+        
+        playlist_AddName( p_playlist, [o_url fileSystemRepresentation], [o_name UTF8String],
+            (ppsz_options != NULL ) ? (const char **)ppsz_options : 0, i_total_options,
+            i_mode, i_position == -1 ? PLAYLIST_END : i_position + i_item );
 
-        o_url = [NSURL fileURLWithPath: o_value];
-        if( o_url != nil )
+        /* clean up */
+        for( j = 0; j < i_total_options; j++ )
+            free( ppsz_options[j] );
+        if( ppsz_options ) free( ppsz_options );
+
+        NSURL *o_true_url = [NSURL fileURLWithPath: o_url];
+        if( o_true_url != nil )
         { 
             [[NSDocumentController sharedDocumentController]
-                noteNewRecentDocumentURL: o_url]; 
+                noteNewRecentDocumentURL: o_true_url]; 
         }
-
-        i_items++;
     }
 
     vlc_object_release( p_playlist );
@@ -468,7 +496,6 @@ int MacVersion102 = -1;
     }
     else
     {
-        NSArray * o_values;
         NSPasteboard * o_pasteboard;
         
         intf_thread_t * p_intf = [NSApp getIntf];
@@ -476,15 +503,18 @@ int MacVersion102 = -1;
         
         if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
         {
-            o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType]
+            int i;
+            NSArray *o_array = [NSArray array];
+            NSArray *o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType]
                         sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
 
-            config_PutPsz( p_intf, "sub-file", "" );
-            config_PutInt( p_intf, "sub-delay", 0 );
-            config_PutFloat( p_intf, "sub-fps", 0.0 );
-            config_PutPsz( p_intf, "sout", "" );
-
-            [self appendArray: o_values atPos: i_proposed_row enqueue:YES];
+            for( i = 0; i < [o_values count]; i++)
+            {
+                NSDictionary *o_dic;
+                o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
+                o_array = [o_array arrayByAddingObject: o_dic];
+            }
+            [self appendArray: o_array atPos: i_proposed_row enqueue:YES];
 
             return( YES );
         }