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 *****************************************************************************/
25 #import <VLCKit/VLCKit.h>
27 #import "VLCController.h"
28 #import "VLCAppAdditions.h"
29 #import "VLCValueTransformer.h"
31 @interface VLCController ()
32 @property (readwrite,retain) NSArray * categories;
35 /******************************************************************************
36 * VLCBrowsableVideoView
38 @implementation VLCController
39 @synthesize categories;
43 /***********************************
44 * Register our bindings value transformer
46 VLCFloat10000FoldTransformer *float100fold;
47 float100fold = [[[VLCFloat10000FoldTransformer alloc] init] autorelease];
48 [NSValueTransformer setValueTransformer:(id)float100fold forName:@"Float10000FoldTransformer"];
49 VLCNonNilAsBoolTransformer *nonNilAsBool;
50 nonNilAsBool = [[[VLCNonNilAsBoolTransformer alloc] init] autorelease];
51 [NSValueTransformer setValueTransformer:(id)nonNilAsBool forName:@"NonNilAsBoolTransformer"];
52 VLCURLToRepresentedFileNameTransformer *urlToRepresentedFileName;
53 urlToRepresentedFileName = [[[VLCURLToRepresentedFileNameTransformer alloc] init] autorelease];
54 [NSValueTransformer setValueTransformer:(id)urlToRepresentedFileName forName:@"URLToRepresentedFileNameTransformer"];
55 VLCSelectionIndexToDescriptionTransformer *indexToDescription;
56 indexToDescription = [[[VLCSelectionIndexToDescriptionTransformer alloc] init] autorelease];
57 [NSValueTransformer setValueTransformer:(id)indexToDescription forName:@"SelectionIndexToDescriptionTransformer"];
59 /***********************************
60 * categories: Main content
62 NSArray * mediaDiscoverers = [NSArray arrayWithObjects:
63 [[[VLCMediaDiscoverer alloc] initWithName:@"shoutcasttv"] autorelease],
64 [[[VLCMediaDiscoverer alloc] initWithName:@"shoutcast"] autorelease],
65 [[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease],
66 [[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] autorelease], nil];
68 self.categories = [NSArray arrayWithObjects:
69 [NSMutableDictionary dictionaryWithObjectsAndKeys:
70 [@"Service Discovery" uppercaseString], @"descriptionInCategoriesList",
71 @"Service Discovery", @"descriptionInVideoView",
72 [NSNumber numberWithBool:NO], @"selectableInCategoriesList",
73 mediaDiscoverers, @"childrenInCategoriesList",
74 mediaDiscoverers, @"childrenInVideoView",
76 [VLCMedia mediaAsNodeWithName:@"Playlist"],
79 /* Execution will continue in applicationDidFinishLaunching */
80 [NSApp setDelegate:self];
83 - (void)newMainWindow:(id)sender
85 if (![NSBundle loadNibNamed:@"MainWindow" owner:self])
87 NSLog(@"Warning! Could not load MainWindow file.\n");
89 /* We are done. Should be on screen if Visible at launch time is checked */
92 - (void)addPlaylist:(id)sender
95 NSLog(@"unimplemented!");
100 @implementation VLCController (NSAppDelegate)
101 - (void)applicationDidFinishLaunching:(NSNotification *)notification
103 [self newMainWindow: self];