]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/prefs.m
macosx gui: use vlc_path2uri.
[vlc] / modules / gui / macosx / prefs.m
index 03f977ba31ec7cf228b1ef0c5fed4d52ea399b74..ae4812be8ef64511836c13720e9388fc1cf53465 100644 (file)
@@ -1,11 +1,12 @@
 /*****************************************************************************
  * prefs.m: MacOS X module for vlc
  *****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
+ * Copyright (C) 2002-2012 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <hartman at videolan dot org>
+ *          Felix Paul Kühne <fkuehne at videolan dot org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <vlc_common.h>
 #include <vlc_config_cat.h>
 
+#import "CompatibilityFixes.h"
 #import "intf.h"
 #import "prefs.h"
 #import "simple_prefs.h"
 #import "prefs_widgets.h"
+#import "CoreInteraction.h"
 #import <vlc_keys.h>
 #import <vlc_modules.h>
+#import <vlc_plugin.h>
 
 /* /!\ Warning: Unreadable code :/ */
 
@@ -175,7 +179,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 {
     p_intf = VLCIntf;
 
-    if (NSAppKitVersionNumber >= 1115.2)
+    if (OSX_LION)
         [o_prefs_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
 
     [self initStrings];
@@ -183,7 +187,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
     [o_prefs_view setHasVerticalScroller: YES];
     [o_prefs_view setDrawsBackground: NO];
     [o_prefs_view setDocumentView: o_empty_view];
-       [o_tree selectRowIndexes: [NSIndexSet indexSetWithIndex: 0] byExtendingSelection: NO];
+    [o_tree selectRowIndexes: [NSIndexSet indexSetWithIndex: 0] byExtendingSelection: NO];
 }
 
 - (void)setTitle: (NSString *) o_title_name
@@ -191,11 +195,9 @@ static VLCPrefs *_o_sharedMainInstance = nil;
     [o_title setStringValue: o_title_name];
 }
 
-- (void)showPrefs
+- (void)showPrefsWithLevel:(NSInteger)i_window_level
 {
-    [[o_basicFull_matrix cellAtRow:0 column:0] setState: NSOffState];
-    [[o_basicFull_matrix cellAtRow:0 column:1] setState: NSOnState];
-    
+    [o_prefs_window setLevel: i_window_level];
     [o_prefs_window center];
     [o_prefs_window makeKeyAndOrderFront:self];
     [_rootTreeItem resetView];
@@ -207,14 +209,14 @@ static VLCPrefs *_o_sharedMainInstance = nil;
     [o_save_btn setTitle: _NS("Save")];
     [o_cancel_btn setTitle: _NS("Cancel")];
     [o_reset_btn setTitle: _NS("Reset All")];
-    [[o_basicFull_matrix cellAtRow: 0 column: 0] setStringValue: _NS("Basic")];
-    [[o_basicFull_matrix cellAtRow: 0 column: 1] setStringValue: _NS("All")];
+    [o_showBasic_btn setTitle: _NS("Show Basic")];
 }
 
 - (IBAction)savePrefs: (id)sender
 {
     /* TODO: call savePrefs on Root item */
     [_rootTreeItem applyChanges];
+    [[VLCCoreInteraction sharedInstance] fixPreferences];
     config_SaveConfigFile( p_intf );
     [o_prefs_window orderOut:self];
 }
@@ -246,8 +248,6 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 - (IBAction)buttonAction: (id)sender
 {
     [o_prefs_window orderOut: self];
-    [[o_basicFull_matrix cellAtRow:0 column:0] setState: NSOnState];
-    [[o_basicFull_matrix cellAtRow:0 column:1] setState: NSOffState];
     [[[VLCMain sharedInstance] simplePreferences] showSimplePrefs];
 }
 
@@ -388,7 +388,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
                     }
                 }
             }
-            
+
             if( module_is_main( p_module) && CONFIG_ITEM(configType) )
             {
                 if( categoryItem && [self isSubCategoryGeneral:lastsubcat] )
@@ -425,11 +425,11 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 }
 - (id)initWithCategory:(int)category
 {
-    NSString * name = [[VLCMain sharedInstance] localizedString: config_CategoryNameGet( category )];
+    NSString * name = _NS(config_CategoryNameGet( category ));
     if(self = [super initWithName:name])
     {
         _category = category;
-        //_help = [[[VLCMain sharedInstance] localizedString: config_CategoryHelpGet( category )] retain];
+        //_help = [_NS(config_CategoryHelpGet( category )) retain];
     }
     return self;
 }
@@ -457,11 +457,11 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 @implementation VLCTreeSubCategoryItem
 - (id)initWithSubCategory:(int)subCategory
 {
-    NSString * name = [[VLCMain sharedInstance] localizedString: config_CategoryNameGet( subCategory )];
+    NSString * name = _NS(config_CategoryNameGet( subCategory ));
     if(self = [super initWithName:name])
     {
         _subCategory = subCategory;
-        //_help = [[[VLCMain sharedInstance] localizedString: config_CategoryHelpGet( subCategory )] retain];
+        //_help = [_NS(config_CategoryHelpGet( subCategory )) retain];
     }
     return self;
 }
@@ -483,12 +483,12 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 @implementation VLCTreePluginItem
 - (id)initWithPlugin:(module_t *)plugin
 {
-    NSString * name = [[VLCMain sharedInstance] localizedString: module_get_name( plugin, false )?:""];
+    NSString * name = _NS( module_get_name( plugin, false )?:"" );
     if(self = [super initWithName:name])
     {
         _configItems = module_config_get( plugin, &_configSize );
         //_plugin = plugin;
-        //_help = [[[VLCMain sharedInstance] localizedString: config_CategoryHelpGet( subCategory )] retain];
+        //_help = [_NS(config_CategoryHelpGet( subCategory )) retain];
     }
     return self;
 }
@@ -521,7 +521,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 
 - (id)initWithConfigItem: (module_config_t *) configItem
 {
-    NSString * name = [[VLCMain sharedInstance] localizedString:configItem->psz_name];
+    NSString * name = _NS(configItem->psz_name);
     self = [super initWithName:name];
     [name release];
     if( self != nil )
@@ -605,7 +605,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
     }
 
     assert(view);
-    
+
     int i_lastItem = 0;
     int i_yPos = -2;
     int i_max_label = 0;