1 /*****************************************************************************
2 * VLCController.m: VLC.app main controller
3 *****************************************************************************
4 * Copyright (C) 2007 Pierre d'Herbemont
5 * Copyright (C) 2007 the VideoLAN team
8 * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
27 #import "VLCController.h"
28 #import "VLCAppAdditions.h"
29 #import "VLCValueTransformer.h"
31 @interface VLCController ()
32 @property (readwrite,retain) NSArray * arrayOfMasters;
33 @property (readwrite,retain) NSArray * arrayOfVideoViewMasters;
36 /******************************************************************************
37 * VLCBrowsableVideoView
39 @implementation VLCController
40 @synthesize arrayOfMasters;
41 @synthesize arrayOfVideoViewMasters;
45 // [NSException raise:@"Hello" format:@"Hello"];
46 /***********************************
47 * Register our bindings value transformer
49 VLCFloat10000FoldTransformer *float100fold;
50 float100fold = [[[VLCFloat10000FoldTransformer alloc] init] autorelease];
51 [NSValueTransformer setValueTransformer:(id)float100fold forName:@"Float10000FoldTransformer"];
52 VLCNonNilAsBoolTransformer *nonNilAsBool;
53 nonNilAsBool = [[[VLCNonNilAsBoolTransformer alloc] init] autorelease];
54 [NSValueTransformer setValueTransformer:(id)nonNilAsBool forName:@"NonNilAsBoolTransformer"];
56 /***********************************
57 * arrayOfMasters: MasterView OutlineView content
59 NSArray * arrayOfMediaDiscoverer = [NSArray arrayWithObjects:
60 [[[VLCMediaDiscoverer alloc] initWithName:@"shoutcasttv"] autorelease],
61 [[[VLCMediaDiscoverer alloc] initWithName:@"shoutcast"] autorelease],
62 [[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease],
63 [[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] autorelease], nil];
65 arrayOfPlaylists = [NSMutableArray arrayWithObjects:[VLCMedia mediaAsNodeWithName:@"Default Playlist"], nil];
67 NSDictionary * playlists = [NSMutableDictionary dictionaryWithObjectsAndKeys:
68 [@"Playlists" uppercaseString], @"descriptionInMasterView",
69 [@"Playlists" uppercaseString], @"descriptionInVideoView",
70 [NSNumber numberWithBool:NO], @"selectableInMasterView",
71 arrayOfPlaylists, @"childrenInMasterView",
72 arrayOfPlaylists, @"childrenInVideoView",
75 self.arrayOfMasters = [NSArray arrayWithObjects:
76 [NSMutableDictionary dictionaryWithObjectsAndKeys:
77 [@"Service Discovery" uppercaseString], @"descriptionInMasterView",
78 [NSNumber numberWithBool:NO], @"selectableInMasterView",
79 arrayOfMediaDiscoverer, @"childrenInMasterView",
85 /***********************************
88 self.arrayOfVideoViewMasters = [NSArray arrayWithObjects:
89 [NSDictionary dictionaryWithObjectsAndKeys:
90 @"Service Discovery", @"descriptionInVideoView",
91 arrayOfMediaDiscoverer, @"childrenInVideoView",
96 /* Execution will continue in applicationDidFinishLaunching */
97 [NSApp setDelegate:self];
100 - (void)applicationDidFinishLaunching:(NSNotification *)notification
102 [self newMainWindow: self];
105 - (void)newMainWindow:(id)sender
107 if (![NSBundle loadNibNamed:@"MainWindow" owner:self])
109 NSLog(@"Warning! Could not load MainWindow file.\n");
111 /* We are done. Should be on screen if Visible at launch time is checked */
114 - (void)addPlaylist:(id)sender
116 [[arrayOfMasters mutableArrayValueForKey:@"[0].childrenInMasterView"] addObject:[VLCMedia mediaAsNodeWithName:@"Untitled Playlist"]];
121 @implementation VLCController (ExceptionHandlerDelegating)