/*****************************************************************************
* simple_prefs.m: Simple Preferences for Mac OS X
*****************************************************************************
-* Copyright (C) 2008-2012 VLC authors and VideoLAN
+* Copyright (C) 2008-2013 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
if ([o_itemIdent isEqual: VLCIntfSettingToolbarIdentifier]) {
CreateToolbarItem(_NS("Interface"), _NS("Interface Settings"), @"spref_cone_Interface_64", showInterfaceSettings);
} else if ([o_itemIdent isEqual: VLCAudioSettingToolbarIdentifier]) {
- CreateToolbarItem(_NS("Audio"), _NS("General Audio Settings"), @"spref_cone_Audio_64", showAudioSettings);
+ CreateToolbarItem(_NS("Audio"), _NS("Audio Settings"), @"spref_cone_Audio_64", showAudioSettings);
} else if ([o_itemIdent isEqual: VLCVideoSettingToolbarIdentifier]) {
- CreateToolbarItem(_NS("Video"), _NS("General Video Settings"), @"spref_cone_Video_64", showVideoSettings);
+ CreateToolbarItem(_NS("Video"), _NS("Video Settings"), @"spref_cone_Video_64", showVideoSettings);
} else if ([o_itemIdent isEqual: VLCOSDSettingToolbarIdentifier]) {
- CreateToolbarItem(_NS(SUBPIC_TITLE), _NS("Subtitles & On Screen Display Settings"), @"spref_cone_Subtitles_64", showOSDSettings);
+ CreateToolbarItem(_NS(SUBPIC_TITLE), _NS("Subtitle & On Screen Display Settings"), @"spref_cone_Subtitles_64", showOSDSettings);
} else if ([o_itemIdent isEqual: VLCInputSettingToolbarIdentifier]) {
- CreateToolbarItem(_NS(INPUT_TITLE), _NS("Input & Codec settings"), @"spref_cone_Input_64", showInputSettings);
+ CreateToolbarItem(_NS(INPUT_TITLE), _NS("Input & Codec Settings"), @"spref_cone_Input_64", showInputSettings);
} else if ([o_itemIdent isEqual: VLCHotkeysSettingToolbarIdentifier]) {
CreateToolbarItem(_NS("Hotkeys"), _NS("Hotkeys settings"), @"spref_cone_Hotkeys_64", showHotkeySettings);
}
/* audio */
[o_audio_dolby_txt setStringValue: _NS("Force detection of Dolby Surround")];
[o_audio_effects_box setTitle: _NS("Effects")];
- [o_audio_enable_ckb setTitle: _NS("Enable Audio")];
+ [o_audio_enable_ckb setTitle: _NS("Enable audio")];
[o_audio_general_box setTitle: _NS("General Audio")];
[o_audio_lang_txt setStringValue: _NS("Preferred Audio language")];
[o_audio_last_ckb setTitle: _NS("Enable Last.fm submissions")];
[o_input_httpproxypwd_txt setStringValue: _NS("Password for HTTP Proxy")];
[o_input_mux_box setTitle: _NS("Codecs / Muxers")];
[o_input_net_box setTitle: _NS("Network")];
- [o_input_avcodec_hw_ckb setTitle: _NS("Hardware Acceleration")];
+ [o_input_avcodec_hw_txt setStringValue: _NS("Hardware Acceleration")];
[o_input_postproc_txt setStringValue: _NS("Post-Processing Quality")];
[o_input_rtsp_ckb setTitle: _NS("Use RTP over RTSP (TCP)")];
[o_input_skipLoop_txt setStringValue: _NS("Skip the loop filter for H.264 decoding")];
[o_input_mkv_preload_dir_ckb setTitle: _NS("Preload MKV files in the same directory")];
+ [o_input_urlhandler_btn setTitle: _NS("Edit default application settings for network protocols")];
+
+ /* url handler */
+ [o_urlhandler_title_txt setStringValue: _NS("Open network streams using the following protocols")];
+ [o_urlhandler_subtitle_txt setStringValue: _NS("Note that these are system-wide settings.")];
+ [o_urlhandler_save_btn setTitle: _NS("Save")];
+ [o_urlhandler_cancel_btn setTitle: _NS("Cancel")];
/* interface */
[o_intf_style_txt setStringValue: _NS("Interface style")];
[o_intf_style_bright_bcell setTitle: _NS("Bright")];
[o_intf_art_txt setStringValue: _NS("Album art download policy")];
[o_intf_embedded_ckb setTitle: _NS("Show video within the main window")];
- [o_intf_nativefullscreen_ckb setTitle: _NS("Use the native fullscreen mode on OS X Lion")];
+ [o_intf_nativefullscreen_ckb setTitle: _NS("Use the native fullscreen mode")];
[o_intf_fspanel_ckb setTitle: _NS("Show Fullscreen Controller")];
[o_intf_network_box setTitle: _NS("Privacy / Network Interaction")];
[o_intf_appleremote_ckb setTitle: _NS("Control playback with the Apple Remote")];
[o_video_black_ckb setTitle: _NS("Black screens in Fullscreen mode")];
[o_video_device_txt setStringValue: _NS("Fullscreen Video Device")];
[o_video_display_box setTitle: _NS("Display")];
- [o_video_enable_ckb setTitle: _NS("Enable Video")];
+ [o_video_enable_ckb setTitle: _NS("Enable video")];
[o_video_fullscreen_ckb setTitle: _NS("Fullscreen")];
[o_video_videodeco_ckb setTitle: _NS("Window decorations")];
[o_video_onTop_ckb setTitle: _NS("Always on top")];
- (void)setupButton: (NSButton *)object forBoolValue: (const char *)name
{
[object setState: config_GetInt(p_intf, name)];
- [object setToolTip: _NS(config_GetLabel(p_intf, name) ?: "")];
+ [object setToolTip: _NS(config_GetLabel(p_intf, name))];
}
- (void)setupField:(NSTextField *)o_object forOption:(const char *)psz_option
[o_audio_vol_fld setEnabled: YES];
[o_audio_vol_sld setEnabled: YES];
- i = config_GetInt(p_intf, "volume");
- i = i * 200.0 / AOUT_VOLUME_MAX + 0.5;
+ i = var_InheritInteger(p_intf, "auhal-volume");
+ i = i * 200. / AOUT_VOLUME_MAX;
[o_audio_vol_sld setIntValue: i];
[o_audio_vol_fld setIntValue: i];
}
[self setupField: o_input_httpproxypwd_sfld forOption:"http-proxy-pwd"];
[o_input_postproc_fld setIntValue: config_GetInt(p_intf, "postproc-q")];
[o_input_postproc_fld setToolTip: _NS(config_GetLabel(p_intf, "postproc-q"))];
- [self setupButton: o_input_avcodec_hw_ckb forBoolValue:"avcodec-hw"];
+ [self setupButton: o_input_avcodec_hw_pop forModuleList: "avcodec-hw"];
[self setupButton: o_input_avi_pop forIntList: "avi-index"];
} else if (sender == o_sprefs_reset_btn)
NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, o_sprefs_win, self,
- @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil,
+ @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
_NS("Beware this will reset the VLC media player preferences.\n"
"Are you sure you want to continue?"));
else if (sender == o_sprefs_showAll_btn) {
******************/
if (b_audioSettingChanged) {
config_PutInt(p_intf, "audio", [o_audio_enable_ckb state]);
- if ([o_audio_vol_fld isEnabled])
- config_PutInt(p_intf, "volume", [o_audio_vol_fld intValue] * AOUT_VOLUME_MAX / 200.0 + 0.5);
config_PutInt(p_intf, "volume-save", [o_audio_autosavevol_yes_bcell state]);
+ var_SetBool(p_intf, "volume-save", [o_audio_autosavevol_yes_bcell state]);
config_PutInt(p_intf, "spdif", [o_audio_spdif_ckb state]);
+ if ([o_audio_vol_fld isEnabled])
+ config_PutInt(p_intf, "auhal-volume", ([o_audio_vol_fld intValue] * AOUT_VOLUME_MAX) / 200);
SaveIntList(o_audio_dolby_pop, "force-dolby-surround");
SaveIntList(o_input_avi_pop, "avi-index");
config_PutInt(p_intf, "rtsp-tcp", [o_input_rtsp_ckb state]);
- config_PutInt(p_intf, "avcodec-hw", [o_input_avcodec_hw_ckb state]);
+ SaveModuleList(o_input_avcodec_hw_pop, "avcodec-hw");
SaveIntList(o_input_skipLoop_pop, "avcodec-skiploopfilter");
config_PutInt(p_intf, "mkv-preload-local-dir", [o_input_mkv_preload_dir_ckb state]);
- (IBAction)interfaceSettingChanged:(id)sender
{
- if (sender == o_intf_embedded_ckb && [o_intf_embedded_ckb state] == NSOffState)
- [o_intf_nativefullscreen_ckb setState: NSOffState];
-
- if (sender == o_intf_nativefullscreen_ckb && [o_intf_nativefullscreen_ckb state] == NSOnState)
- [o_intf_embedded_ckb setState: NSOnState];
-
b_intfSettingChanged = YES;
}
[self showSettingsForCategory: o_input_view];
}
+- (NSString *)bundleIdentifierForApplicationName:(NSString *)appName
+{
+ NSWorkspace * workspace = [NSWorkspace sharedWorkspace];
+ NSString * appPath = [workspace fullPathForApplication:appName];
+ if (appPath) {
+ NSBundle * appBundle = [NSBundle bundleWithPath:appPath];
+ return [appBundle bundleIdentifier];
+ }
+ return nil;
+}
+
+- (NSString *)applicationNameForBundleIdentifier:(NSString *)bundleIdentifier
+{
+ return [[[NSFileManager defaultManager] displayNameAtPath:[[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:bundleIdentifier]] stringByDeletingPathExtension];
+}
+
+- (NSImage *)iconForBundleIdentifier:(NSString *)bundleIdentifier
+{
+ NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
+ NSSize iconSize = NSMakeSize(16., 16.);
+ NSImage *icon = [workspace iconForFile:[workspace absolutePathForAppBundleWithIdentifier:bundleIdentifier]];
+ [icon setSize:iconSize];
+ return icon;
+}
+
+- (IBAction)urlHandlerAction:(id)sender
+{
+ NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
+
+ if (sender == o_input_urlhandler_btn) {
+ NSArray *handlers;
+ NSString *handler;
+ NSString *rawhandler;
+ NSMutableArray *rawHandlers;
+ NSUInteger count;
+
+#define fillUrlHandlerPopup( protocol, object ) \
+ handlers = (NSArray *)LSCopyAllHandlersForURLScheme(CFSTR( protocol )); \
+ rawHandlers = [[NSMutableArray alloc] init]; \
+ [object removeAllItems]; \
+ count = [handlers count]; \
+ for (NSUInteger x = 0; x < count; x++) { \
+ rawhandler = [handlers objectAtIndex:x]; \
+ handler = [self applicationNameForBundleIdentifier:rawhandler]; \
+ if (handler && ![handler isEqualToString:@""]) { \
+ [object addItemWithTitle:handler]; \
+ [[object lastItem] setImage: [self iconForBundleIdentifier:[handlers objectAtIndex:x]]]; \
+ [rawHandlers addObject: rawhandler]; \
+ } \
+ } \
+ [object selectItemAtIndex: [rawHandlers indexOfObject:(id)LSCopyDefaultHandlerForURLScheme(CFSTR( protocol ))]]; \
+ [rawHandlers release]
+
+ fillUrlHandlerPopup( "ftp", o_urlhandler_ftp_pop);
+ fillUrlHandlerPopup( "mms", o_urlhandler_mms_pop);
+ fillUrlHandlerPopup( "rtmp", o_urlhandler_rtmp_pop);
+ fillUrlHandlerPopup( "rtp", o_urlhandler_rtp_pop);
+ fillUrlHandlerPopup( "rtsp", o_urlhandler_rtsp_pop);
+ fillUrlHandlerPopup( "sftp", o_urlhandler_sftp_pop);
+ fillUrlHandlerPopup( "smb", o_urlhandler_smb_pop);
+ fillUrlHandlerPopup( "udp", o_urlhandler_udp_pop);
+
+#undef fillUrlHandlerPopup
+
+ [NSApp beginSheet:o_urlhandler_win modalForWindow:o_sprefs_win modalDelegate:self didEndSelector:NULL contextInfo:nil];
+ } else {
+ [o_urlhandler_win orderOut:sender];
+ [NSApp endSheet: o_urlhandler_win];
+
+ if (sender == o_urlhandler_save_btn) {
+ LSSetDefaultHandlerForURLScheme(CFSTR("ftp"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_ftp_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("mms"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_mms_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("mmsh"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_mms_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("rtmp"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_rtmp_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("rtp"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_rtp_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("rtsp"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_rtsp_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("sftp"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_sftp_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("smb"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_smb_pop selectedItem] title]]);
+ LSSetDefaultHandlerForURLScheme(CFSTR("udp"), (CFStringRef)[self bundleIdentifierForApplicationName:[[o_urlhandler_udp_pop selectedItem] title]]);
+ }
+ }
+}
+
#pragma mark -
#pragma mark Hotkey actions
[tempString appendString:@"Delete"];
else if (key == NSBackspaceCharacter)
[tempString appendString:@"Backspace"];
+ else if (key == 0x001B)
+ [tempString appendString:@"Esc"];
+ else if (key == ' ')
+ [tempString appendString:@"Space"];
else if (![[[o_theEvent charactersIgnoringModifiers] lowercaseString] isEqualToString:@""]) //plain characters
[tempString appendString:[[o_theEvent charactersIgnoringModifiers] lowercaseString]];
else