]> git.sesse.net Git - vlc/commitdiff
macosx: adapted to latest config API changes
authorFelix Paul Kühne <fkuehne@videolan.org>
Mon, 2 May 2011 17:56:12 +0000 (19:56 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Mon, 2 May 2011 17:57:32 +0000 (19:57 +0200)
modules/gui/macosx/AudioEffects.h
modules/gui/macosx/AudioEffects.m
modules/gui/macosx/equalizer.m
modules/gui/macosx/extended.h
modules/gui/macosx/extended.m
modules/gui/macosx/intf.m
modules/gui/macosx/prefs.m
modules/gui/macosx/simple_prefs.m

index a7e11b3bf3d7a4942d81b5b22e127d35c4b17925..9c477438b0b0e6d6ded8eccda08f4561c1fc5476 100644 (file)
 + (VLCAudioEffects *)sharedInstance;
 - (IBAction)toggleWindow:(id)sender;
 - (void)setAudioFilter: (char *)psz_name on:(BOOL)b_on;
-- (void)savePrefs;
 
 /* Equalizer */
 - (void)setupEqualizer;
index 1356d1c4689155f96142ced1c03e26b6cc9d73cf..705b43bc43f2bdd0507361ff36f3f170a16e3530 100644 (file)
@@ -151,25 +151,6 @@ static VLCAudioEffects *_o_sharedInstance = nil;
     }
 }
 
-- (void)savePrefs
-{
-    /* save settings for some of our modules */
-    int returnedValue;
-    NSArray * theModules;
-    theModules = [[NSArray alloc] initWithObjects: @"main", @"headphone", @"normvol", @"headphone_channel_mixer", @"compressor", @"spatializer", nil];
-
-    for( int x = 0; x < [theModules count]; x++ )
-    {
-        returnedValue = config_SaveConfigFile( p_intf, [[theModules objectAtIndex: x] UTF8String] );
-
-        if (returnedValue != 0)
-            msg_Err(p_intf, "unable to save settings for '%s' (%i)", [[theModules objectAtIndex: x] UTF8String], returnedValue);
-    }
-
-    msg_Dbg(p_intf, "AudioFilters: saved certain preferences successfully");
-    [theModules release];
-}
-
 #pragma mark -
 #pragma mark Equalizer
 static bool GetEqualizerStatus( intf_thread_t *p_custom_intf,
@@ -387,9 +368,6 @@ static bool GetEqualizerStatus( intf_thread_t *p_custom_intf,
     {
         /* save changed to config */
         config_PutPsz( p_intf, "equalizer-bands", psz_values );
-        
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
     
     vlc_object_release( p_object );
@@ -422,9 +400,6 @@ static bool GetEqualizerStatus( intf_thread_t *p_custom_intf,
         config_PutPsz( p_intf, "equalizer-bands", psz_values );
         config_PutFloat( p_intf, "equalizer-preamp", eqz_preset_10b[[sender indexOfSelectedItem]]->f_preamp );
         config_PutPsz( p_intf, "equalizer-preset", preset_list[[sender indexOfSelectedItem]] );
-        
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
     
     vlc_object_release( p_object );
@@ -443,9 +418,6 @@ static bool GetEqualizerStatus( intf_thread_t *p_custom_intf,
     {
         /* save changed to config */
         config_PutFloat( p_intf, "equalizer-preamp", f_preamp );
-
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
 
     vlc_object_release( p_object );
@@ -464,9 +436,6 @@ static bool GetEqualizerStatus( intf_thread_t *p_custom_intf,
     {
         /* save changed to config */
         config_PutInt( p_intf, "equalizer-2pass", (int)b_2p );
-        
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
     
     vlc_object_release( p_object );
index 79904b938be1dc097654cf0ee3fb6a3be6379ce4..01ed0595c631221a610c8068c060d1bac2520d8c 100644 (file)
@@ -247,9 +247,6 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     {
         /* save changed to config */
         config_PutPsz( p_intf, "equalizer-bands", psz_values );
-
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
 
     vlc_object_release( p_object );
@@ -285,9 +282,6 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
         config_PutPsz( p_intf, "equalizer-bands", psz_values );
         config_PutFloat( p_intf, "equalizer-preamp", eqz_preset_10b[[sender indexOfSelectedItem]]->f_preamp );
         config_PutPsz( p_intf, "equalizer-preset", preset_list[[sender indexOfSelectedItem]] );
-
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
 
     vlc_object_release( p_object );
@@ -315,9 +309,6 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     {
         /* save changed to config */
         config_PutFloat( p_intf, "equalizer-preamp", f_preamp );
-
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
 
     vlc_object_release( p_object );
@@ -352,9 +343,6 @@ static bool GetFiltersStatus( intf_thread_t *p_intf,
     {
         /* save changed to config */
         config_PutInt( p_intf, "equalizer-2pass", (int)b_2p );
-
-        /* save to vlcrc */
-        config_SaveConfigFile( p_intf, "equalizer" );
     }
 
     vlc_object_release( p_object );
index ed8ad986ead462fcf2785072a99dbd58709f7ae7..0a33f6354114b52cf4be086cabffc5829f421004 100644 (file)
@@ -80,7 +80,6 @@
 
     /* global variables */
     NSView * o_currentlyshown_view;
-    BOOL o_config_changed;
 }
 
 - (IBAction)viewSelectorAction:(id)sender;
 - (IBAction)moreInfoVideoFilters:(id)sender;
 
 + (VLCExtended *)sharedInstance;
-- (BOOL)configChanged;
 
 - (void)showPanel;
 - (void)initStrings;
 - (void)changeVoutFiltersString: (char *)psz_name onOrOff: (bool )b_add;
 - (void)changeVideoFiltersString: (char *)psz_name onOrOff: (bool )b_add;
 - (void)changeAFiltersString: (char *)psz_name onOrOff: (bool )b_add;
-- (void)savePrefs;
 @end
index b4f38bc4905b38ef347311d31009356ff92c7cfc..919fa80247b140d8245e86ddaf3706ac3085e807 100644 (file)
@@ -181,11 +181,6 @@ static VLCExtended *_o_sharedInstance = nil;
     [self initStrings];
 }
 
-- (BOOL)configChanged
-{
-    return o_config_changed;
-}
-
 - (void)showPanel
 {
     /* get the correct slider values from the prefs, in case they were changed
@@ -398,8 +393,6 @@ static VLCExtended *_o_sharedInstance = nil;
         vlc_object_release( p_filter );
         vlc_object_release( p_vout );
     }
-
-    o_config_changed = YES;
 }
 
 /* change the opaqueness of the vouts */
@@ -437,8 +430,6 @@ static VLCExtended *_o_sharedInstance = nil;
 
     /* store to prefs */
     config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
-
-    o_config_changed = YES;
 }
 
 - (IBAction)enableHeadphoneVirtualizer:(id)sender
@@ -463,8 +454,6 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 
     config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] );
-
-    o_config_changed = YES;
 }
 
 - (IBAction)enableVolumeNormalization:(id)sender
@@ -601,11 +590,8 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 
     free( psz_string );
-
-    o_config_changed = YES;
 }
 
-
 - (void)changeVideoFiltersString:(char *)psz_name onOrOff:(bool )b_add
 {
     /* same as changeVoutFiltersString but addressing the "video-filter"
@@ -667,8 +653,6 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 
     free( psz_string );
-
-    o_config_changed = YES;
 }
 
 - (void)changeAFiltersString: (char *)psz_name onOrOff: (bool )b_add;
@@ -738,52 +722,5 @@ static VLCExtended *_o_sharedInstance = nil;
         aout_EnableFilter( pl_Get( p_intf ), psz_string, b_add );
     }
     free( psz_string );
-
-    o_config_changed = YES;
-}
-
-- (void)savePrefs
-{
-    /* save the preferences to make sure that our module-changes will up on
-     * next launch again */
-    playlist_t * p_playlist = pl_Get( VLCIntf );
-    int returnedValue;
-    NSArray * theModules;
-    theModules = [[NSArray alloc] initWithObjects: @"main", 
-        @"headphone",
-        @"transform", 
-        @"adjust", 
-        @"invert", 
-        @"motionblur", 
-        @"distort",
-        @"clone", 
-        @"crop", 
-        @"normvol", 
-        @"headphone_channel_mixer", 
-        @"macosx",
-        nil];
-    unsigned int x = 0;
-    while ( x != [theModules count] )
-    {
-        returnedValue = config_SaveConfigFile( p_playlist, [[theModules
-            objectAtIndex: x] UTF8String] );
-
-        if (returnedValue != 0)
-        {
-            msg_Err(p_playlist, "unable to save the preferences of the "
-            "extended control attribute '%s' (%i)",
-            [[theModules objectAtIndex: x] UTF8String] , returnedValue);
-            [theModules release];
-            return;
-        }
-
-        x = ( x + 1 );
-    }
-    msg_Dbg( VLCIntf, "VLCExtended: saved certain preferences successfully" );
-    [theModules release];
 }
 @end
index 31804862e0456f552c80df0610ed4af6046febee..f75bb1764c62400573ed18906b1b99d2550efada 100644 (file)
@@ -818,11 +818,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     /* make sure that the current volume is saved */
     config_PutInt( p_intf->p_libvlc, "volume", i_lastShownVolume );
 
-    /* save the prefs if they were changed in the extended panel */
-    if(o_extended && [o_extended configChanged])
-        [o_extended savePrefs];
-    [o_audioeffects savePrefs];
-
     /* unsubscribe from the interactive dialogues */
     dialog_Unregister( p_intf );
     var_DelCallback( p_intf, "dialog-error", DialogCallback, self );
index aa3ec6210c635d9ec1559967cba86adee2ac2238..de04314bfa4cbd474d35a091a87c9b62c8802581 100644 (file)
@@ -212,7 +212,7 @@ static VLCPrefs *_o_sharedMainInstance = nil;
 {
     /* TODO: call savePrefs on Root item */
     [_rootTreeItem applyChanges];
-    config_SaveConfigFile( p_intf, NULL );
+    config_SaveConfigFile( p_intf );
     [o_prefs_window orderOut:self];
 }
 
index 37322f7ee6f7cd4cd86acec9504d96be22a94f8e..3f35feab15fd743e66b250f91fcec22e0c08dd1e 100644 (file)
@@ -701,7 +701,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
     {
         config_ResetAll( p_intf );
         [self resetControls];
-        config_SaveConfigFile( p_intf, NULL );
+        config_SaveConfigFile( p_intf );
     }
 }
 
@@ -757,7 +757,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
 - (void)saveChangedSettings
 {
     char *psz_tmp;
-    int i;
 
 #define SaveIntList( object, name ) save_int_list( p_intf, object, name )
 
@@ -809,19 +808,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
                                                             object: nil
                                                           userInfo: nil];
-
-        /* okay, let's save our changes to vlcrc */
-        i = config_SaveConfigFile( p_intf, "main" );
-        i = i + config_SaveConfigFile( p_intf, "macosx" );
-
-        if( i != 0 )
-        {
-            msg_Err( p_intf, "An error occurred while saving the Interface settings using SimplePrefs (%i)", i );
-            dialog_Fatal( p_intf, _("Interface Settings not saved"),
-                        _("An error occured while saving your settings via SimplePrefs (%i)."), i );
-            i = 0;
-        }
-
         b_intfSettingChanged = NO;
     }
 
@@ -880,20 +866,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         }
         else
             [o_audio_last_ckb setEnabled: NO];
-
-        /* okay, let's save our changes to vlcrc */
-        i = config_SaveConfigFile( p_intf, "main" );
-        i = i + config_SaveConfigFile( p_intf, "audioscrobbler" );
-        i = i + config_SaveConfigFile( p_intf, "volnorm" );
-
-        if( i != 0 )
-        {
-            msg_Err( p_intf, "An error occurred while saving the Audio settings using SimplePrefs (%i)", i );
-            dialog_Fatal( p_intf, _("Audio Settings not saved"),
-                        _("An error occured while saving your settings via SimplePrefs (%i)."), i );
-
-            i = 0;
-        }
         b_audioSettingChanged = NO;
     }
 
@@ -915,17 +887,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         config_PutPsz( p_intf, "snapshot-prefix", [[o_video_snap_prefix_fld stringValue] UTF8String] );
         config_PutInt( p_intf, "snapshot-sequential", [o_video_snap_seqnum_ckb state] );
         SaveStringList( o_video_snap_format_pop, "snapshot-format" );
-
-        i = config_SaveConfigFile( p_intf, "main" );
-        i = i + config_SaveConfigFile( p_intf, "macosx" );
-
-        if( i != 0 )
-        {
-            msg_Err( p_intf, "An error occurred while saving the Video settings using SimplePrefs (%i)", i );
-            dialog_Fatal( p_intf, _("Video Settings not saved"),
-                        _("An error occured while saving your settings via SimplePrefs (%i)."), i );
-            i = 0;
-        }
         b_videoSettingChanged = NO;
     }
 
@@ -949,48 +910,17 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         msg_Dbg( p_intf, "Adjusting all cache values to: %i", (int)[[o_input_cachelevel_pop selectedItem] tag] );
         CaC( "udp-caching" );
         if( module_exists ( "dvdread" ) )
-        {
             CaC( "dvdread-caching" );
-            i = i + config_SaveConfigFile( p_intf, "dvdread" );
-        }
         if( module_exists ( "dvdnav" ) )
-        {
             CaC( "dvdnav-caching" );
-            i = i + config_SaveConfigFile( p_intf, "dvdnav" );
-        }
         CaC( "tcp-caching" ); CaC( "vcd-caching" );
         CaC( "cdda-caching" ); CaC( "file-caching" );
         CaC( "screen-caching" );
         CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 );
         CaCi( "http-caching", 4 );
         if( module_exists ( "access_realrtsp" ) )
-        {
             CaCi( "realrtsp-caching", 10 );
-            i = i + config_SaveConfigFile( p_intf, "access_realrtsp" );
-        }
         CaCi( "mms-caching", 19 );
-
-        i = config_SaveConfigFile( p_intf, "main" );
-        i = i + config_SaveConfigFile( p_intf, "avcodec" );
-        i = i + config_SaveConfigFile( p_intf, "postproc" );
-        i = i + config_SaveConfigFile( p_intf, "access_http" );
-        i = i + config_SaveConfigFile( p_intf, "access_file" );
-        i = i + config_SaveConfigFile( p_intf, "access_tcp" );
-        i = i + config_SaveConfigFile( p_intf, "cdda" );
-        i = i + config_SaveConfigFile( p_intf, "screen" );
-        i = i + config_SaveConfigFile( p_intf, "vcd" );
-        i = i + config_SaveConfigFile( p_intf, "access_ftp" );
-        i = i + config_SaveConfigFile( p_intf, "access_mms" );
-        i = i + config_SaveConfigFile( p_intf, "live555" );
-        i = i + config_SaveConfigFile( p_intf, "avi" );
-
-        if( i != 0 )
-        {
-            msg_Err( p_intf, "An error occurred while saving the Input settings using SimplePrefs (%i)", i );
-            dialog_Fatal( p_intf, _("Input Settings not saved"),
-                        _("An error occured while saving your settings via SimplePrefs (%i)."), i );
-            i = 0;
-        }
         b_inputSettingChanged = NO;
     }
 
@@ -1021,16 +951,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
                        SaveIntList( o_osd_font_color_pop, "freetype-color" );
                        SaveIntList( o_osd_font_size_pop, "freetype-rel-fontsize" );
                }
-
-        i = config_SaveConfigFile( p_intf, NULL );
-
-        if( i != 0 )
-        {
-            msg_Err( p_intf, "An error occurred while saving the OSD/Subtitle settings using SimplePrefs (%i)", i );
-            dialog_Fatal( p_intf, _("On Screen Display/Subtitle Settings not saved"),
-                        _("An error occured while saving your settings via SimplePrefs (%i)."), i );
-            i = 0;
-        }
         b_osdSettingChanged = NO;
     }
 
@@ -1039,24 +959,13 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
      ********************/
     if( b_hotkeyChanged )
     {
-        i = 0;
-        while( i < [o_hotkeySettings count] )
-        {
+        for( NSUInteger i = 0; i < [o_hotkeySettings count]; i++ )
             config_PutPsz( p_intf, [[o_hotkeyNames objectAtIndex:i] UTF8String], [[o_hotkeySettings objectAtIndex:i]UTF8String] );
-            i++;
-        }
-
-        i = config_SaveConfigFile( p_intf, "main" );
-
-        if( i != 0 )
-        {
-            msg_Err( p_intf, "An error occurred while saving the Hotkey settings using SimplePrefs (%i)", i );
-            dialog_Fatal( p_intf, _("Hotkeys not saved"),
-                        _("An error occured while saving your settings via SimplePrefs (%i)."), i );
-            i = 0;
-        }
         b_hotkeyChanged = NO;
     }
+
+    /* okay, let's save our changes to vlcrc */
+    config_SaveConfigFile( p_intf );
 }
 
 - (void)showSettingsForCategory: (id)o_new_category_view