Commit 42701994 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Brought the new options system to the OSX gui.

  and some small fixes.
parent 802b24bc
......@@ -242,8 +242,10 @@
"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;
......
......@@ -21,6 +21,10 @@
<array>
<integer>977</integer>
</array>
<key>IBOpenObjects</key>
<array>
<integer>636</integer>
</array>
<key>IBSystem Version</key>
<string>6L60</string>
</dict>
......
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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];
}
}
......
......@@ -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;
......
......@@ -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>
......@@ -58,6 +58,11 @@
o_mrl = [o_mrl_string copy];
}
- (NSString *)getMRL
{
return [o_mrl copy];
}
- (void)setTranscode:(NSString *)o_transcode_string
{
[o_transcode autorelease];
......@@ -66,19 +71,6 @@
- (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
......@@ -183,8 +175,6 @@
}
else
{
intf_thread_t * p_intf = [NSApp getIntf];
config_PutPsz( p_intf, "sout", NULL );
[o_output_settings setEnabled:NO];
}
}
......@@ -201,7 +191,7 @@
- (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];
......
......@@ -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;
......
......@@ -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];
o_url = [NSURL fileURLWithPath: o_value];
if( o_url != nil )
/* Allocate ppsz_options */
for( j = 0; j < i_total_options; j++ )
{
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL: o_url];
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 );
i_items++;
/* 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_true_url];
}
}
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 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment