#import <vlc_keys.h>
#import <vlc_interface.h>
#import <vlc_dialog.h>
+#import <vlc_modules.h>
#import "misc.h"
#import "intf.h"
#import "AppleRemote.h"
-#import <Sparkle/Sparkle.h> //for o_intf_last_update_lbl
+#import <Sparkle/Sparkle.h> //for o_intf_last_update_lbl
static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier";
static NSString* VLCIntfSettingToolbarIdentifier = @"Intf Settings Item Identifier";
if( val & KEY_MODIFIER_COMMAND )
[o_temp_str appendString: [NSString stringWithUTF8String: "\xE2\x8C\x98"]];
- const char *base = KeyToString( val & ~KEY_MODIFIER );
+ char *base = KeyToString( val & ~KEY_MODIFIER );
if( base )
+ {
[o_temp_str appendString: [NSString stringWithUTF8String: base]];
+ free( base );
+ }
else
o_temp_str = [NSMutableString stringWithString:_NS("Not Set")];
return o_temp_str;
- (void)awakeFromNib
{
[self initStrings];
-
+
/* setup the toolbar */
NSToolbar * o_sprefs_toolbar = [[[NSToolbar alloc] initWithIdentifier: VLCSPrefsToolbarIdentifier] autorelease];
[o_sprefs_toolbar setAllowsUserCustomization: NO];
[o_sprefs_toolbar setSizeMode: NSToolbarSizeModeRegular];
[o_sprefs_toolbar setDelegate: self];
[o_sprefs_win setToolbar: o_sprefs_toolbar];
-
+
/* setup useful stuff */
o_hotkeysNonUseableKeys = [[NSArray arrayWithObjects:
[NSNumber numberWithInt: KEY_MODIFIER_COMMAND|'c'],
return o_toolbarItem;
}
-- (NSToolbarItem *) toolbar: (NSToolbar *)o_sprefs_toolbar
- itemForItemIdentifier: (NSString *)o_itemIdent
+- (NSToolbarItem *) toolbar: (NSToolbar *)o_sprefs_toolbar
+ itemForItemIdentifier: (NSString *)o_itemIdent
willBeInsertedIntoToolbar: (BOOL)b_willBeInserted
{
NSToolbarItem *o_toolbarItem = nil;
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
+ return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
+ return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
+ return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, nil];
}
[o_video_snap_format_txt setStringValue: _NS("Format")];
[o_video_snap_prefix_txt setStringValue: _NS("Prefix")];
[o_video_snap_seqnum_ckb setTitle: _NS("Sequential numbering")];
-
+
/* generic stuff */
[[o_sprefs_basicFull_matrix cellAtRow: 0 column: 0] setStringValue: _NS("Basic")];
[[o_sprefs_basicFull_matrix cellAtRow: 0 column: 1] setStringValue: _NS("All")];
else if( p_config->psz_text )
return p_config->psz_text;
else
- msg_Warn( p_this, "option %s does not include any help" );
+ msg_Warn( p_this, "option %s does not include any help", psz_name );
return NULL;
}
}
else if( p_item->ppsz_list[i] )
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: p_item->ppsz_list[i]] action:NULL keyEquivalent: @""];
- else NSLog( @"item %d of pref %s failed to be created", i, name);
+ else
+ msg_Err( p_intf, "item %d of pref %s failed to be created", i, name );
[mi setRepresentedObject:[NSString stringWithUTF8String: p_item->ppsz_list[i]]];
[[object menu] addItem: [mi autorelease]];
if( p_item->value.psz && !strcmp( p_item->value.psz, p_item->ppsz_list[i] ) )
mi = [[NSMenuItem alloc] initWithTitle: _NS( p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""];
else if( p_item->pi_list[i] )
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->pi_list[i]] action:NULL keyEquivalent: @""];
- else NSLog( @"item %d of pref %s failed to be created", i, name);
+ else
+ msg_Err( p_intf, "item %d of pref %s failed to be created", i, name);
[mi setRepresentedObject:[NSNumber numberWithInt: p_item->pi_list[i]]];
[[object menu] addItem: [mi autorelease]];
if( p_item->value.i == p_item->pi_list[i] )
module_config_t *p_item;
module_t *p_parser, **p_list;
int y = 0;
-
+
[object removeAllItems];
-
+
p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
p_list = module_list_get( NULL );
if( !p_item ||!p_list )
{
if( p_list ) module_list_free(p_list);
- NSLog( @"serious problem, item or list not found" );
+ msg_Err( p_intf, "serious problem, item or list not found" );
return;
}
[[o_sprefs_basicFull_matrix cellAtRow:0 column:0] setState: NSOnState];
[[o_sprefs_basicFull_matrix cellAtRow:0 column:1] setState: NSOffState];
-
+
/**********************
* interface settings *
**********************/
while( i < y )
{
NSRect s_rect = [[[NSScreen screens] objectAtIndex: i] frame];
- [o_video_device_pop addItemWithTitle:
+ [o_video_device_pop addItemWithTitle:
[NSString stringWithFormat: @"%@ %i (%ix%i)", _NS("Screen"), i+1,
(int)s_rect.size.width, (int)s_rect.size.height]];
[[o_video_device_pop lastItem] setTag: (int)[[[NSScreen screens] objectAtIndex: i] displayID]];
[self setupButton: o_input_skipLoop_pop forIntList: "ffmpeg-skiploopfilter"];
[o_input_cachelevel_pop removeAllItems];
- [o_input_cachelevel_pop addItemsWithTitles:
+ [o_input_cachelevel_pop addItemsWithTitles:
[NSArray arrayWithObjects: _NS("Custom"), _NS("Lowest latency"), _NS("Low latency"), _NS("Normal"),
_NS("High latency"), _NS("Higher latency"), nil]];
[[o_input_cachelevel_pop itemAtIndex: 0] setTag: 0];
[[o_input_cachelevel_pop itemAtIndex: 3] setTag: 300];
[[o_input_cachelevel_pop itemAtIndex: 4] setTag: 400];
[[o_input_cachelevel_pop itemAtIndex: 5] setTag: 500];
-
+
#define TestCaC( name ) \
b_cache_equal = b_cache_equal && \
( i_cache == config_GetInt( p_intf, name ) )
/* Select the accurate value of the PopupButton */
bool b_cache_equal = true;
int i_cache = config_GetInt( p_intf, "file-caching");
-
+
TestCaC( "udp-caching" );
if( module_exists ("dvdread") )
TestCaC( "dvdread-caching" );
if( module_exists ("dvdnav") )
TestCaC( "dvdnav-caching" );
TestCaC( "tcp-caching" );
- TestCaC( "fake-caching" );
TestCaC( "cdda-caching" );
TestCaC( "screen-caching" );
TestCaC( "vcd-caching" );
* subtitle settings *
*********************/
[self setupButton: o_osd_osd_ckb forBoolValue: "osd"];
-
+
[self setupButton: o_osd_encoding_pop forStringList: "subsdec-encoding"];
[self setupField: o_osd_lang_fld forOption: "sub-language" ];
-
+
if( module_exists( "quartztext" ) )
{
[self setupField: o_osd_font_fld forOption: "quartztext-font"];
[self setupButton: o_osd_font_color_pop forIntList: "quartztext-color"];
[self setupButton: o_osd_font_size_pop forIntList: "quartztext-rel-fontsize"];
}
- else
+ else
{
/* fallback on freetype */
[self setupField: o_osd_font_fld forOption: "freetype-font"];
[[o_sprefs_win toolbar] setSelectedItemIdentifier: VLCIntfSettingToolbarIdentifier];
[self showInterfaceSettings];
}
-
+
[self resetControls];
[o_sprefs_win center];
msg_Warn( p_intf, "unknown buttonAction sender" );
}
-- (void)sheetDidEnd:(NSWindow *)o_sheet
+- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context
{
p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
p_stringobject = (NSString *)[[object selectedItem] representedObject];
assert([p_stringobject isKindOfClass:[NSString class]]);
- if( p_stringobject )
+ if( p_stringobject )
{
config_PutPsz( p_intf, name, [p_stringobject UTF8String] );
- [p_stringobject release];
}
}
{
char *psz_tmp;
int i;
-
+
#define SaveIntList( object, name ) save_int_list( p_intf, object, name )
-
+
#define SaveStringList( object, name ) save_string_list( p_intf, object, name )
#define SaveModuleList( object, name ) save_module_list( p_intf, object, name )
[[[VLCMain sharedInstance] appleRemoteController] startListening: [VLCMain sharedInstance]];
else
[[[VLCMain sharedInstance] appleRemoteController] stopListening: [VLCMain sharedInstance]];
- [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
- object: nil
+ [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
+ object: nil
userInfo: nil];
/* okay, let's save our changes to vlcrc */
b_intfSettingChanged = NO;
}
-
+
/******************
* audio settings *
******************/
{
config_PutInt( p_intf, "audio", [o_audio_enable_ckb state] );
config_PutInt( p_intf, "volume", ([o_audio_vol_sld intValue] * 2.56));
- NSLog( @"slider=%i, pref=%i", [o_audio_vol_sld intValue], config_GetInt( p_intf, "volume" ));
config_PutInt( p_intf, "spdif", [o_audio_spdif_ckb state] );
SaveIntList( o_audio_dolby_pop, "force-dolby-surround" );
/* Last.FM is optional */
if( module_exists( "audioscrobbler" ) )
- {
+ {
[o_audio_last_ckb setEnabled: YES];
if( [o_audio_last_ckb state] == NSOnState )
config_AddIntf( p_intf, "audioscrobbler" );
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;
}
-
+
/******************
* video settings *
******************/
}
b_videoSettingChanged = NO;
}
-
+
/***************************
* input & codecs settings *
***************************/
i = i + config_SaveConfigFile( p_intf, "dvdnav" );
}
CaC( "tcp-caching" ); CaC( "vcd-caching" );
- CaC( "fake-caching" ); CaC( "cdda-caching" ); CaC( "file-caching" );
+ CaC( "cdda-caching" ); CaC( "file-caching" );
CaC( "screen-caching" );
CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 );
CaCi( "http-caching", 4 );
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, "access_fake" );
i = i + config_SaveConfigFile( p_intf, "cdda" );
i = i + config_SaveConfigFile( p_intf, "screen" );
i = i + config_SaveConfigFile( p_intf, "vcd" );
}
b_inputSettingChanged = NO;
}
-
+
/**********************
* subtitles settings *
**********************/
config_PutPsz( p_intf, "subsdec-encoding", "" );
config_PutPsz( p_intf, "sub-language", [[o_osd_lang_fld stringValue] UTF8String] );
-
+
if( module_exists( "quartztext" ) )
{
config_PutPsz( p_intf, "quartztext-font", [[o_osd_font_fld stringValue] UTF8String] );
/* fallback on freetype */
config_PutPsz( p_intf, "freetype-font", [[o_osd_font_fld stringValue] UTF8String] );
SaveIntList( o_osd_font_color_pop, "freetype-color" );
- SaveIntList( o_osd_font_size_pop, "freetype-rel-fontsize" );
+ SaveIntList( o_osd_font_size_pop, "freetype-rel-fontsize" );
}
i = config_SaveConfigFile( p_intf, NULL );
}
b_osdSettingChanged = NO;
}
-
+
/********************
* hotkeys settings *
********************/
{
config_PutInt( p_intf, p_hotkeys[i].psz_action, [[o_hotkeySettings objectAtIndex: i-1] intValue] );
i++;
- }
+ }
i = config_SaveConfigFile( p_intf, "main" );
NSRect o_win_rect, o_view_rect, o_old_view_rect;
o_win_rect = [o_sprefs_win frame];
o_view_rect = [o_new_category_view frame];
-
+
if( o_currentlyShownCategoryView != nil )
{
/* restore our window's height, if we've shown another category previously */
/* remove our previous category view */
[o_currentlyShownCategoryView removeFromSuperviewWithoutNeedingDisplay];
}
-
+
o_win_rect.size.height = o_win_rect.size.height + o_view_rect.size.height;
-
+
[o_sprefs_win displayIfNeeded];
[o_sprefs_win setFrame: o_win_rect display:YES animate: YES];
-
- [o_new_category_view setFrame: NSMakeRect( 0,
- [o_sprefs_controls_box frame].size.height,
- o_view_rect.size.width,
+
+ [o_new_category_view setFrame: NSMakeRect( 0,
+ [o_sprefs_controls_box frame].size.height,
+ o_view_rect.size.width,
o_view_rect.size.height )];
[o_new_category_view setNeedsDisplay: YES];
[o_new_category_view setAutoresizesSubviews: YES];
[[o_sprefs_win contentView] addSubview: o_new_category_view];
-
+
/* keep our current category for further reference */
[o_currentlyShownCategoryView release];
o_currentlyShownCategoryView = o_new_category_view;
{
[o_audio_norm_stepper setEnabled: [o_audio_norm_ckb state]];
[o_audio_norm_fld setEnabled: [o_audio_norm_ckb state]];
- }
-
+ }
+
if( sender == o_audio_last_ckb )
{
if( [o_audio_last_ckb state] == NSOnState )
[o_selectFolderPanel setMessage: _NS("Choose the folder to save your video snapshots to.")];
[o_selectFolderPanel setCanCreateDirectories: YES];
[o_selectFolderPanel setPrompt: _NS("Choose")];
- [o_selectFolderPanel beginSheetForDirectory: nil file: nil modalForWindow: o_sprefs_win
- modalDelegate: self
+ [o_selectFolderPanel beginSheetForDirectory: nil file: nil modalForWindow: o_sprefs_win
+ modalDelegate: self
didEndSelector: @selector(savePanelDidEnd:returnCode:contextInfo:)
contextInfo: o_video_snap_folder_btn];
}
{
if( sender == o_hotkeys_change_btn || sender == o_hotkeys_listbox )
{
- [o_hotkeys_change_lbl setStringValue: [NSString stringWithFormat: _NS("Press new keys for\n\"%@\""),
+ [o_hotkeys_change_lbl setStringValue: [NSString stringWithFormat: _NS("Press new keys for\n\"%@\""),
[o_hotkeyDescriptions objectAtIndex: [o_hotkeys_listbox selectedRow]]]];
[o_hotkeys_change_keys_lbl setStringValue: [self OSXKeyToString:[[o_hotkeySettings objectAtIndex: [o_hotkeys_listbox selectedRow]] intValue]]];
[o_hotkeys_change_taken_lbl setStringValue: @""];
return YES;
}
}
-
+
@end
/********************