Commit 3820b435 authored by Jon Lech Johansen's avatar Jon Lech Johansen

./extras/MacOSX/.../MainMenu.nib: added Open Target panel

  ./modules/gui/macosx/open.[mh]: Open Target code
parent 89987e11
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
}; };
CLASS = VLCControls; CLASS = VLCControls;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = {o_open = id; }; OUTLETS = {"o_open" = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
...@@ -32,106 +32,119 @@ ...@@ -32,106 +32,119 @@
CLASS = VLCMain; CLASS = VLCMain;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = { OUTLETS = {
o_controls = id; "o_controls" = id;
o_dmi_pause = id; "o_dmi_pause" = id;
o_dmi_play = id; "o_dmi_play" = id;
o_dmi_stop = id; "o_dmi_stop" = id;
o_messages = id; "o_messages" = id;
o_mi_about = id; "o_mi_about" = id;
o_mi_bring_atf = id; "o_mi_bring_atf" = id;
o_mi_chapter = id; "o_mi_chapter" = id;
o_mi_clear = id; "o_mi_clear" = id;
o_mi_copy = id; "o_mi_copy" = id;
o_mi_cut = id; "o_mi_cut" = id;
o_mi_deinterlace = id; "o_mi_deinterlace" = id;
o_mi_faster = id; "o_mi_faster" = id;
o_mi_fullscreen = id; "o_mi_fullscreen" = id;
o_mi_hide = id; "o_mi_hide" = id;
o_mi_hide_others = id; "o_mi_hide_others" = id;
o_mi_language = id; "o_mi_language" = id;
o_mi_loop = id; "o_mi_loop" = id;
o_mi_messages = id; "o_mi_messages" = id;
o_mi_minimize = id; "o_mi_minimize" = id;
o_mi_mute = id; "o_mi_mute" = id;
o_mi_next = id; "o_mi_next" = id;
o_mi_open_disc = id; "o_mi_open_disc" = id;
o_mi_open_file = id; "o_mi_open_file" = id;
o_mi_open_net = id; "o_mi_open_net" = id;
o_mi_open_quickly = id; "o_mi_open_quickly" = id;
o_mi_open_recent = id; "o_mi_open_recent" = id;
o_mi_open_recent_cm = id; "o_mi_open_recent_cm" = id;
o_mi_paste = id; "o_mi_paste" = id;
o_mi_pause = id; "o_mi_pause" = id;
o_mi_play = id; "o_mi_play" = id;
o_mi_playlist = id; "o_mi_playlist" = id;
o_mi_previous = id; "o_mi_previous" = id;
o_mi_program = id; "o_mi_program" = id;
o_mi_quit = id; "o_mi_quit" = id;
o_mi_select_all = id; "o_mi_select_all" = id;
o_mi_show_all = id; "o_mi_show_all" = id;
o_mi_slower = id; "o_mi_slower" = id;
o_mi_stop = id; "o_mi_stop" = id;
o_mi_subtitle = id; "o_mi_subtitle" = id;
o_mi_title = id; "o_mi_title" = id;
o_mi_vol_down = id; "o_mi_vol_down" = id;
o_mi_vol_up = id; "o_mi_vol_up" = id;
o_msgs_btn_ok = id; "o_msgs_btn_ok" = id;
o_msgs_panel = id; "o_msgs_panel" = id;
o_mu_controls = id; "o_mu_controls" = id;
o_mu_edit = id; "o_mu_edit" = id;
o_mu_file = id; "o_mu_file" = id;
o_mu_view = id; "o_mu_view" = id;
o_mu_window = id; "o_mu_window" = id;
o_playlist = id; "o_playlist" = id;
o_window = id; "o_window" = id;
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
ACTIONS = { ACTIONS = {
openDisc = id; openDisc = id;
openDiscStepperChanged = id;
openDiscTypeChanged = id; openDiscTypeChanged = id;
openFile = id; openFile = id;
openFileBrowse = id;
openFilePathChanged = id;
openNet = id; openNet = id;
openNetModeChanged = id; openNetModeChanged = id;
openQuickly = id; openNetStepperChanged = id;
panelCancel = id; panelCancel = id;
panelOk = id; panelOk = id;
}; };
CLASS = VLCOpen; CLASS = VLCOpen;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = { OUTLETS = {
o_disc_btn_cancel = id; "o_btn_cancel" = id;
o_disc_btn_ok = id; "o_btn_ok" = id;
o_disc_chapter = id; "o_disc_chapter" = id;
o_disc_device = id; "o_disc_chapter_lbl" = id;
o_disc_lbl_sp = id; "o_disc_chapter_stp" = id;
o_disc_lbl_type = id; "o_disc_device" = id;
o_disc_panel = id; "o_disc_device_lbl" = id;
o_disc_title = id; "o_disc_title" = id;
o_disc_type = id; "o_disc_title_lbl" = id;
o_net_address = id; "o_disc_title_stp" = id;
o_net_box_addr = id; "o_disc_type" = id;
o_net_box_mode = id; "o_disc_type_lbl" = id;
o_net_btn_cancel = id; "o_file_btn_browse" = id;
o_net_btn_ok = id; "o_file_path" = id;
o_net_mode = id; "o_mrl" = id;
o_net_panel = id; "o_net_cs_addr" = id;
o_net_port = id; "o_net_cs_addr_lbl" = id;
o_net_port_lbl = id; "o_net_cs_port" = id;
o_net_port_stp = id; "o_net_cs_port_lbl" = id;
o_playlist = id; "o_net_cs_port_stp" = id;
o_quickly_btn_cancel = id; "o_net_http_url" = id;
o_quickly_btn_ok = id; "o_net_http_url_lbl" = id;
o_quickly_panel = id; "o_net_mode" = id;
o_quickly_source = id; "o_net_udp_port" = id;
"o_net_udp_port_lbl" = id;
"o_net_udp_port_stp" = id;
"o_net_udpm_addr" = id;
"o_net_udpm_addr_lbl" = id;
"o_net_udpm_port" = id;
"o_net_udpm_port_lbl" = id;
"o_net_udpm_port_stp" = id;
"o_panel" = id;
"o_playlist" = id;
"o_tabview" = id;
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
CLASS = VLCPlaylist; CLASS = VLCPlaylist;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = {o_btn_close = id; o_panel = id; o_table_view = id; }; OUTLETS = {"o_btn_close" = id; "o_panel" = id; "o_table_view" = id; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; } {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="0.9"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>98 729 428 434 0 0 1600 1178 </string> <string>98 729 428 434 0 0 1600 1178 </string>
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
<string>93 566 72 114 0 0 1600 1178 </string> <string>93 566 72 114 0 0 1600 1178 </string>
</dict> </dict>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>263.2</string> <string>283.0</string>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>21</integer> <integer>636</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>5S66</string> <string>6D52</string>
</dict> </dict>
</plist> </plist>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.h: MacOS X plugin for vlc * open.h: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: open.h,v 1.1 2002/08/04 17:23:43 sam Exp $ * $Id: open.h,v 1.2 2002/10/05 00:10:17 jlj Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* *
...@@ -30,42 +30,61 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ); ...@@ -30,42 +30,61 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
{ {
IBOutlet id o_playlist; IBOutlet id o_playlist;
IBOutlet id o_disc_panel; IBOutlet id o_panel;
IBOutlet id o_disc_btn_ok;
IBOutlet id o_disc_btn_cancel; IBOutlet id o_mrl;
IBOutlet id o_disc_lbl_type; IBOutlet id o_tabview;
IBOutlet id o_disc_lbl_sp;
IBOutlet id o_btn_ok;
IBOutlet id o_btn_cancel;
IBOutlet id o_file_path;
IBOutlet id o_file_btn_browse;
IBOutlet id o_disc_type; IBOutlet id o_disc_type;
IBOutlet id o_disc_type_lbl;
IBOutlet id o_disc_device;
IBOutlet id o_disc_device_lbl;
IBOutlet id o_disc_title; IBOutlet id o_disc_title;
IBOutlet id o_disc_title_lbl;
IBOutlet id o_disc_title_stp;
IBOutlet id o_disc_chapter; IBOutlet id o_disc_chapter;
IBOutlet id o_disc_device; IBOutlet id o_disc_chapter_lbl;
IBOutlet id o_disc_chapter_stp;
IBOutlet id o_net_panel;
IBOutlet id o_net_btn_ok;
IBOutlet id o_net_btn_cancel;
IBOutlet id o_net_box_mode;
IBOutlet id o_net_box_addr;
IBOutlet id o_net_mode;
IBOutlet id o_net_address;
IBOutlet id o_net_port;
IBOutlet id o_net_port_lbl;
IBOutlet id o_net_port_stp;
IBOutlet id o_quickly_panel; IBOutlet id o_net_mode;
IBOutlet id o_quickly_btn_ok; IBOutlet id o_net_udp_port;
IBOutlet id o_quickly_btn_cancel; IBOutlet id o_net_udp_port_lbl;
IBOutlet id o_quickly_source; IBOutlet id o_net_udp_port_stp;
IBOutlet id o_net_udpm_addr;
IBOutlet id o_net_udpm_addr_lbl;
IBOutlet id o_net_udpm_port;
IBOutlet id o_net_udpm_port_lbl;
IBOutlet id o_net_udpm_port_stp;
IBOutlet id o_net_cs_addr;
IBOutlet id o_net_cs_addr_lbl;
IBOutlet id o_net_cs_port;
IBOutlet id o_net_cs_port_lbl;
IBOutlet id o_net_cs_port_stp;
IBOutlet id o_net_http_url;
IBOutlet id o_net_http_url_lbl;
} }
- (void)openTarget:(int)i_type;
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi;
- (IBAction)openFile:(id)sender; - (IBAction)openFile:(id)sender;
- (void)openFilePathChanged:(NSNotification *)o_notification;
- (IBAction)openDisc:(id)sender; - (IBAction)openDisc:(id)sender;
- (IBAction)openDiscTypeChanged:(id)sender; - (IBAction)openDiscTypeChanged:(id)sender;
- (IBAction)openDiscStepperChanged:(id)sender;
- (void)openDiscInfoChanged:(NSNotification *)o_notification;
- (IBAction)openNet:(id)sender; - (IBAction)openNet:(id)sender;
- (IBAction)openNetModeChanged:(id)sender; - (IBAction)openNetModeChanged:(id)sender;
- (IBAction)openNetStepperChanged:(id)sender;
- (IBAction)openQuickly:(id)sender; - (void)openNetInfoChanged:(NSNotification *)o_notification;
- (IBAction)panelCancel:(id)sender; - (IBAction)panelCancel:(id)sender;
- (IBAction)panelOk:(id)sender; - (IBAction)panelOk:(id)sender;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.m: MacOS X plugin for vlc * open.m: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: open.m,v 1.2 2002/08/06 23:43:58 jlj Exp $ * $Id: open.m,v 1.3 2002/10/05 00:10:17 jlj Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* *
...@@ -134,51 +134,136 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -134,51 +134,136 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
- (void)awakeFromNib - (void)awakeFromNib
{ {
[o_disc_panel setTitle: _NS("Open Disc")]; [o_panel setTitle: _NS("Open Target")];
[o_disc_btn_ok setTitle: _NS("OK")];
[o_disc_btn_cancel setTitle: _NS("Cancel")]; [o_btn_ok setTitle: _NS("OK")];
[o_disc_lbl_type setTitle: _NS("Disc type")]; [o_btn_cancel setTitle: _NS("Cancel")];
[o_disc_lbl_sp setTitle: _NS("Starting position")];
[o_disc_title setTitle: _NS("Title")]; [[o_tabview tabViewItemAtIndex: 0] setLabel: _NS("File")];
[o_disc_chapter setTitle: _NS("Chapter")]; [[o_tabview tabViewItemAtIndex: 1] setLabel: _NS("Disc")];
[[o_tabview tabViewItemAtIndex: 2] setLabel: _NS("Network")];
[o_net_panel setTitle: _NS("Open Network")];
[o_net_box_mode setTitle: _NS("Network mode")]; [o_file_btn_browse setTitle: _NS("Browse...")];
[o_net_box_addr setTitle: _NS("Address")];
[o_net_port_lbl setStringValue: _NS("Port")]; [o_disc_type_lbl setStringValue: _NS("Disc type")];
[o_disc_device_lbl setStringValue: _NS("Device name")];
[o_quickly_panel setTitle: _NS("Open Quickly")]; [o_disc_title_lbl setStringValue: _NS("Title")];
[o_quickly_btn_ok setTitle: _NS("OK")]; [o_disc_chapter_lbl setStringValue: _NS("Chapter")];
[o_quickly_btn_cancel setTitle: _NS("Cancel")];
[o_net_udp_port_lbl setStringValue: _NS("Port")];
[o_net_udpm_addr_lbl setStringValue: _NS("Address")];
[o_net_udpm_port_lbl setStringValue: _NS("Port")];
[o_net_cs_addr_lbl setStringValue: _NS("Address")];
[o_net_cs_port_lbl setStringValue: _NS("Port")];
[o_net_http_url_lbl setStringValue: _NS("URL")];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openFilePathChanged:)
name: NSControlTextDidChangeNotification
object: o_file_path];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openDiscInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_disc_device];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openDiscInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_disc_title];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openDiscInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_disc_chapter];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_udp_port];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_udpm_addr];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_udpm_port];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_cs_addr];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_cs_port];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_http_url];
} }
- (IBAction)openDisc:(id)sender - (void)openTarget:(int)i_type
{ {
int i_result; int i_result;
[self openDiscTypeChanged: nil]; [o_tabview selectTabViewItemAtIndex: i_type];
[o_disc_panel makeKeyAndOrderFront: self]; i_result = [NSApp runModalForWindow: o_panel];
i_result = [NSApp runModalForWindow: o_disc_panel]; [o_panel close];
[o_disc_panel close];
if( i_result ) if( i_result )
{ {
NSString *o_source; NSString *o_source = [o_mrl stringValue];
NSString *o_type = [[o_disc_type selectedCell] title];
NSString *o_device = [o_disc_device stringValue];
int i_title = [o_disc_title intValue];
int i_chapter = [o_disc_chapter intValue];
o_source = [NSString stringWithFormat: @"%@:%@@%d,%d",
[o_type lowercaseString], o_device, i_title, i_chapter];
[o_playlist appendArray: [o_playlist appendArray:
[NSArray arrayWithObject: o_source] atPos: -1]; [NSArray arrayWithObject: o_source] atPos: -1];
} }
} }
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
{
NSString *o_label = [o_tvi label];
if( [o_label isEqualToString: _NS("File")] )
{
[self openFilePathChanged: nil];
}
else if( [o_label isEqualToString: _NS("Disc")] )
{
[self openDiscTypeChanged: nil];
}
else if( [o_label isEqualToString: _NS("Network")] )
{
[self openNetModeChanged: nil];
}
}
- (IBAction)openFile:(id)sender
{
[self openFilePathChanged: nil];
[self openTarget: 0];
}
- (IBAction)openDisc:(id)sender
{
[self openDiscTypeChanged: nil];
[self openTarget: 1];
}
- (IBAction)openNet:(id)sender
{
[self openNetModeChanged: nil];
[self openTarget: 2];
}
- (void)openFilePathChanged:(NSNotification *)o_notification
{
NSString *o_mrl_string;
NSString *o_filename = [o_file_path stringValue];
o_mrl_string = [NSString stringWithFormat: @"file://%@", o_filename];
[o_mrl setStringValue: o_mrl_string];
}
- (IBAction)openDiscTypeChanged:(id)sender - (IBAction)openDiscTypeChanged:(id)sender
{ {
NSString *o_type; NSString *o_type;
...@@ -214,158 +299,177 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -214,158 +299,177 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
} }
[o_disc_device selectItemAtIndex: 0]; [o_disc_device selectItemAtIndex: 0];
[o_disc_btn_ok setEnabled: TRUE];
} }
else else
{ {
[o_disc_device setStringValue: [o_disc_device setStringValue:
[NSString stringWithFormat: @"No %@s found", o_type]]; [NSString stringWithFormat: @"No %@s found", o_type]];
[o_disc_btn_ok setEnabled: FALSE];
} }
} }
[self openDiscInfoChanged: nil];
} }
- (IBAction)openFile:(id)sender - (IBAction)openDiscStepperChanged:(id)sender
{ {
NSOpenPanel *o_panel = [NSOpenPanel openPanel]; int i_tag = [sender tag];
[o_panel setAllowsMultipleSelection: YES];
if( [o_panel runModalForDirectory: nil if( i_tag == 0 )
file: nil types: nil] == NSOKButton )
{ {
[o_playlist appendArray: [o_panel filenames] atPos: -1]; [o_disc_title setIntValue: [o_disc_title_stp intValue]];
} }
} else if( i_tag == 1 )
- (IBAction)openNet:(id)sender
{
int i_result;
intf_thread_t * p_intf = [NSApp getIntf];
[o_net_panel makeKeyAndOrderFront: self];
i_result = [NSApp runModalForWindow: o_net_panel];
[o_net_panel close];
if( i_result )
{ {
NSString * o_source = nil; [o_disc_chapter setIntValue: [o_disc_chapter_stp intValue]];
UInt32 i_port = [o_net_port intValue]; }
NSString * o_addr = [o_net_address stringValue];
NSString * o_mode = [[o_net_mode selectedCell] title];
if( i_port > 65536 )
{
NSBeep();
return;
}
if( [o_mode isEqualToString: @"UDP"] ) [self openDiscInfoChanged: nil];
{ }
o_source = [NSString
stringWithFormat: @"udp:@:%i", i_port];
}
else if( [o_mode isEqualToString: @"UDP Multicase"] )
{
o_source = [NSString
stringWithFormat: @"udp:@%@:%i", o_addr, i_port];
}
else if( [o_mode isEqualToString: @"Channel server"] )
{
if( p_intf->p_vlc->p_channel == NULL )
{
network_ChannelCreate( p_intf );
}
config_PutPsz( p_intf, "channel-server", - (void)openDiscInfoChanged:(NSNotification *)o_notification
(char *)[o_addr lossyCString] ); {
config_PutInt( p_intf, "channel-port", i_port ); NSString *o_type;
NSString *o_device;
NSString *o_mrl_string;
int i_title, i_chapter;
p_intf->p_sys->b_playing = 1; o_type = [[o_disc_type selectedCell] title];
} o_device = [o_disc_device stringValue];
else if( [o_mode isEqualToString: @"HTTP"] ) i_title = [o_disc_title intValue];
{ i_chapter = [o_disc_chapter intValue];
o_source = o_addr;
} o_mrl_string = [NSString stringWithFormat: @"%@://%@@%i,%i",
[o_type lowercaseString], o_device, i_title, i_chapter];
if( o_source != nil ) [o_mrl setStringValue: o_mrl_string];
{
[o_playlist appendArray:
[NSArray arrayWithObject: o_source] atPos: -1];
}
}
} }
- (IBAction)openNetModeChanged:(id)sender - (IBAction)openNetModeChanged:(id)sender
{ {
NSString * o_mode; NSString *o_mode;
SInt32 i_port = 1234; BOOL b_udp = FALSE;
NSString * o_addr = nil; BOOL b_udpm = FALSE;
BOOL b_cs = FALSE;
BOOL b_http = FALSE;
o_mode = [[o_net_mode selectedCell] title]; o_mode = [[o_net_mode selectedCell] title];
if( [o_mode isEqualToString: @"UDP Multicast"] ) if( [o_mode isEqualToString: @"UDP"] ) b_udp = TRUE;
else if( [o_mode isEqualToString: @"UDP Multicast"] ) b_udpm = TRUE;
else if( [o_mode isEqualToString: @"Channel server"] ) b_cs = TRUE;
else if( [o_mode isEqualToString: @"HTTP"] ) b_http = TRUE;
[o_net_udp_port setEnabled: b_udp];
[o_net_udp_port_stp setEnabled: b_udp];
[o_net_udpm_addr setEnabled: b_udpm];
[o_net_udpm_port setEnabled: b_udpm];
[o_net_udpm_port_stp setEnabled: b_udpm];
[o_net_cs_addr setEnabled: b_cs];
[o_net_cs_port setEnabled: b_cs];
[o_net_cs_port_stp setEnabled: b_cs];
[o_net_http_url setEnabled: b_http];
[self openNetInfoChanged: nil];
}
- (IBAction)openNetStepperChanged:(id)sender
{
int i_tag = [sender tag];
if( i_tag == 0 )
{ {
o_addr = @""; [o_net_udp_port setIntValue: [o_net_udp_port_stp intValue]];
} }
else if( [o_mode isEqualToString: @"Channel server"] ) else if( i_tag == 1 )
{ {
o_addr = @"localhost"; [o_net_udpm_port setIntValue: [o_net_udpm_port_stp intValue]];
i_port = 6010;
} }
else if( [o_mode isEqualToString: @"HTTP"] ) else if( i_tag == 2 )
{ {
o_addr = @"http://"; [o_net_cs_port setIntValue: [o_net_cs_port_stp intValue]];
i_port = -1;
} }
if( o_addr != nil ) [self openNetInfoChanged: nil];
}
- (void)openNetInfoChanged:(NSNotification *)o_notification
{
NSString *o_mode;
vlc_bool_t b_channel;
NSString *o_mrl_string = [NSString string];
intf_thread_t * p_intf = [NSApp getIntf];
o_mode = [[o_net_mode selectedCell] title];
b_channel = (vlc_bool_t)[o_mode isEqualToString: @"Channel server"];
config_PutInt( p_intf, "network-channel", b_channel );
if( [o_mode isEqualToString: @"UDP"] )
{ {
[o_net_address setEnabled: TRUE]; int i_port = [o_net_udp_port intValue];
[o_net_address setStringValue: o_addr];
o_mrl_string = [NSString stringWithString: @"udp://"];
if( i_port != 1234 )
{
o_mrl_string =
[o_mrl_string stringByAppendingFormat: @"@:%i", i_port];
}
} }
else else if( [o_mode isEqualToString: @"UDP Multicast"] )
{ {
[o_net_address setEnabled: FALSE]; NSString *o_addr = [o_net_udpm_addr stringValue];
} int i_port = [o_net_udpm_port intValue];
o_mrl_string = [NSString stringWithFormat: @"udp://@%@", o_addr];
if( i_port > -1 ) if( i_port != 1234 )
{
o_mrl_string =
[o_mrl_string stringByAppendingFormat: @":%i", i_port];
}
}
else if( [o_mode isEqualToString: @"Channel server"] )
{ {
[o_net_port setEnabled: TRUE]; NSString *o_addr = [o_net_cs_addr stringValue];
[o_net_port_stp setEnabled: TRUE]; int i_port = [o_net_cs_port intValue];
[o_net_port setIntValue: i_port];
if( p_intf->p_vlc->p_channel == NULL )
{
network_ChannelCreate( p_intf );
}
config_PutPsz( p_intf, "channel-server", [o_addr lossyCString] );
if( i_port < 65536 )
{
config_PutInt( p_intf, "channel-port", i_port );
}
/* FIXME: we should use a playlist server instead */
o_mrl_string = [NSString stringWithString: @"udp://"];
} }
else else if( [o_mode isEqualToString: @"HTTP"] )
{ {
[o_net_port setEnabled: FALSE]; NSString *o_url = [o_net_http_url stringValue];
[o_net_port_stp setEnabled: FALSE];
o_mrl_string = [NSString stringWithFormat: @"http://%@", o_url];
} }
[o_mrl setStringValue: o_mrl_string];
} }
- (IBAction)openQuickly:(id)sender - (IBAction)openFileBrowse:(id)sender
{ {
int i_result; NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
[o_quickly_source setStringValue: @""]; [o_open_panel setAllowsMultipleSelection: NO];
[o_quickly_panel makeKeyAndOrderFront: self];
i_result = [NSApp runModalForWindow: o_quickly_panel];
[o_quickly_panel close];
if( i_result ) if( [o_open_panel runModalForDirectory: nil
file: nil types: nil] == NSOKButton )
{ {
NSString * o_source; NSString *o_filename = [[o_open_panel filenames] objectAtIndex: 0];
[o_file_path setStringValue: o_filename];
o_source = [o_quickly_source stringValue]; [self openFilePathChanged: nil];
if( [o_source length] > 0 )
{
[o_playlist appendArray:
[NSArray arrayWithObject: o_source] atPos: -1];
}
else
{
NSBeep();
}
} }
} }
...@@ -376,7 +480,14 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -376,7 +480,14 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
- (IBAction)panelOk:(id)sender - (IBAction)panelOk:(id)sender
{ {
[NSApp stopModalWithCode: 1]; if( [[o_mrl stringValue] length] )
{
[NSApp stopModalWithCode: 1];
}
else
{
NSBeep();
}
} }
@end @end
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