[o_hotkeys_listbox setDoubleAction:@selector(hotkeyTableDoubleClick:)];
/* setup useful stuff */
- o_hotkeysNonUseableKeys = [[NSArray arrayWithObjects: @"Command-c", @"Command-x", @"Command-v", @"Command-a", @"Command-," , @"Command-h", @"Command-Alt-h", @"Command-Shift-o", @"Command-o", @"Command-d", @"Command-n", @"Command-s", @"Command-z", @"Command-l", @"Command-r", @"Command-3", @"Command-m", @"Command-w", @"Command-Shift-w", @"Command-Shift-c", @"Command-Shift-p", @"Command-i", @"Command-e", @"Command-Shift-e", @"Command-b", @"Command-Shift-m", @"Command-Ctrl-m", @"Command-?", @"Command-Alt-?", nil] retain];
+ o_hotkeysNonUseableKeys = [@[@"Command-c", @"Command-x", @"Command-v", @"Command-a", @"Command-," , @"Command-h", @"Command-Alt-h", @"Command-Shift-o", @"Command-o", @"Command-d", @"Command-n", @"Command-s", @"Command-z", @"Command-l", @"Command-r", @"Command-3", @"Command-m", @"Command-w", @"Command-Shift-w", @"Command-Shift-c", @"Command-Shift-p", @"Command-i", @"Command-e", @"Command-Shift-e", @"Command-b", @"Command-Shift-m", @"Command-Ctrl-m", @"Command-?", @"Command-Alt-?"] retain];
}
#define CreateToolbarItem(o_name, o_desc, o_img, sel) \
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("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);
}
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
- VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
+ return @[VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
+ VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier,
+ NSToolbarFlexibleSpaceItemIdentifier];
}
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
- VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
+ return @[VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
+ VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier,
+ NSToolbarFlexibleSpaceItemIdentifier];
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
- VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, nil];
+ return @[VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
+ VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier];
}
- (void)initStrings
/* 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_cachelevel_txt setStringValue: _NS("Default Caching Level")];
[o_input_caching_box setTitle: _NS("Caching")];
[o_input_cachelevel_custom_txt setStringValue: _NS("Use the complete preferences to configure custom caching values for each access module.")];
- [o_input_httpproxy_txt setStringValue: _NS("HTTP Proxy")];
- [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_txt setStringValue: _NS("Hardware Acceleration")];
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
[o_osd_font_box setTitle: _NS("Display Settings")];
[o_osd_font_btn setTitle: _NS("Choose...")];
- [o_osd_font_color_txt setStringValue: _NS("Font Color")];
- [o_osd_font_size_txt setStringValue: _NS("Font Size")];
+ [o_osd_font_color_txt setStringValue: _NS("Font color")];
+ [o_osd_font_size_txt setStringValue: _NS("Font size")];
[o_osd_font_txt setStringValue: _NS("Font")];
- [o_osd_lang_box setTitle: _NS("Subtitle Languages")];
- [o_osd_lang_txt setStringValue: _NS("Preferred Subtitle Language")];
+ [o_osd_lang_box setTitle: _NS("Subtitle languages")];
+ [o_osd_lang_txt setStringValue: _NS("Preferred subtitle language")];
[o_osd_osd_box setTitle: _NS("On Screen Display")];
[o_osd_osd_ckb setTitle: _NS("Enable OSD")];
[o_osd_opacity_txt setStringValue: _NS("Opacity")];
- [o_osd_forcebold_ckb setTitle: _NS("Force Bold")];
- [o_osd_outline_color_txt setStringValue: _NS("Outline Color")];
- [o_osd_outline_thickness_txt setStringValue: _NS("Outline Thickness")];
+ [o_osd_forcebold_ckb setTitle: _NS("Force bold")];
+ [o_osd_outline_color_txt setStringValue: _NS("Outline color")];
+ [o_osd_outline_thickness_txt setStringValue: _NS("Outline thickness")];
/* video */
[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")];
continue;
}
else if (p_item->list.psz[i])
- mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: p_item->list.psz[i]] action:NULL keyEquivalent: @""];
+ mi = [[NSMenuItem alloc] initWithTitle: @(p_item->list.psz[i]) action:NULL keyEquivalent: @""];
else
msg_Err(p_intf, "item %d of pref %s failed to be created", i, name);
- [mi setRepresentedObject:[NSString stringWithUTF8String: p_item->list.psz[i]]];
+ [mi setRepresentedObject:@(p_item->list.psz[i])];
[[object menu] addItem: [mi autorelease]];
if (p_item->value.psz && !strcmp(p_item->value.psz, p_item->list.psz[i]))
[object selectItem:[object lastItem]];
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->list.i[i]] action:NULL keyEquivalent: @""];
else
msg_Err(p_intf, "item %d of pref %s failed to be created", i, name);
- [mi setRepresentedObject:[NSNumber numberWithInt: p_item->list.i[i]]];
+ [mi setRepresentedObject:@(p_item->list.i[i])];
[[object menu] addItem: [mi autorelease]];
if (p_item->value.i == p_item->list.i[i])
[object selectItem:[object lastItem]];
for (size_t i_index = 0; i_index < count; i_index++) {
p_parser = p_list[i_index];
if (module_provides(p_parser, p_item->psz_type)) {
- [object addItemWithTitle: [NSString stringWithUTF8String: _(module_GetLongName(p_parser)) ?: ""]];
- if (p_item->value.psz && !strcmp(p_item->value.psz, module_get_object(p_parser)))
+ [object addItemWithTitle: @(_(module_GetLongName(p_parser)) ?: "")];
+ if (p_item->value.psz && !strcmp(p_item->value.psz, module_get_name(p_parser, false)))
[object selectItem: [object lastItem]];
}
}
- (void)setupField:(NSTextField *)o_object forOption:(const char *)psz_option
{
char *psz_tmp = config_GetPsz(p_intf, psz_option);
- [o_object setStringValue: [NSString stringWithUTF8String: psz_tmp ?: ""]];
+ [o_object setStringValue: @(psz_tmp ?: "")];
[o_object setToolTip: _NS(config_GetLabel(p_intf, psz_option))];
free(psz_tmp);
}
[o_video_device_pop addItemWithTitle: _NS("Default")];
[[o_video_device_pop lastItem] setTag: 0];
while (i < y) {
- NSRect s_rect = [[[NSScreen screens] objectAtIndex: i] frame];
+ NSRect s_rect = [[[NSScreen screens] objectAtIndex:i] frame];
[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]];
+ [[o_video_device_pop lastItem] setTag: (int)[[[NSScreen screens] objectAtIndex:i] displayID]];
i++;
}
[o_video_device_pop selectItemAtIndex: 0];
* input & codecs settings *
***************************/
[self setupField: o_input_record_fld forOption:"input-record-path"];
- [self setupField: o_input_httpproxy_fld forOption:"http-proxy"];
- [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_pop forModuleList: "avcodec-hw"];
[self setupButton: o_input_mkv_preload_dir_ckb forBoolValue: "mkv-preload-local-dir"];
[o_input_cachelevel_pop removeAllItems];
- [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 addItemsWithTitles: @[_NS("Custom"), _NS("Lowest latency"),
+ _NS("Low latency"), _NS("Normal"), _NS("High latency"), _NS("Higher latency")]];
[[o_input_cachelevel_pop itemAtIndex: 0] setTag: 0];
[[o_input_cachelevel_pop itemAtIndex: 1] setTag: 100];
[[o_input_cachelevel_pop itemAtIndex: 2] setTag: 200];
&& !strncmp(p_item->psz_name , "key-", 4)
&& !EMPTY_STR(p_item->psz_text)) {
[o_tempArray_desc addObject: _NS(p_item->psz_text)];
- [o_tempArray_names addObject: [NSString stringWithUTF8String:p_item->psz_name]];
+ [o_tempArray_names addObject: @(p_item->psz_name)];
if (p_item->value.psz)
- [o_hotkeySettings addObject: [NSString stringWithUTF8String:p_item->value.psz]];
+ [o_hotkeySettings addObject: @(p_item->value.psz)];
else
[o_hotkeySettings addObject: [NSString string]];
}
[self saveChangedSettings];
[[NSFontPanel sharedFontPanel] close];
[o_sprefs_win orderOut: sender];
- } 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, @"%@",
- _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) {
+ } else if (sender == o_sprefs_showAll_btn) {
[o_sprefs_win orderOut: self];
[[[VLCMain sharedInstance] preferences] showPrefsWithLevel:[o_sprefs_win level]];
} else
msg_Warn(p_intf, "unknown buttonAction sender");
}
+- (IBAction)resetPreferences:(NSControl *)sender
+{
+ NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
+ _NS("Continue"), nil, [sender window], self,
+ @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
+ _NS("This will reset VLC media player's preferences.\n\n"
+ "Note that VLC will restart during the process, so your current "
+ "playlist will be emptied and eventual playback, streaming or "
+ "transcoding activities will stop immediately.\n\n"
+ "The Media Library will not be affected.\n\n"
+ "Are you sure you want to continue?"));
+}
+
- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context
/* reset VLC's config */
config_ResetAll(p_intf);
[self resetControls];
+
+ /* force config file creation, since libvlc won't exit normally */
config_SaveConfigFile(p_intf);
/* reset OS X defaults */
[NSUserDefaults resetStandardUserDefaults];
[[NSUserDefaults standardUserDefaults] synchronize];
+
+ /* Relaunch now */
+ const char * path = [[[NSBundle mainBundle] executablePath] UTF8String];
+
+ /* For some reason we need to fork(), not just execl(), which reports a ENOTSUP then. */
+ if (fork() != 0) {
+ exit(0);
+ return;
+ }
+ execl(path, path, NULL);
}
}
p_parser = p_list[i_module_index];
if (p_item->i_type == CONFIG_ITEM_MODULE && module_provides(p_parser, p_item->psz_type)) {
- if ([objectTitle isEqualToString: _NS(module_GetLongName(p_parser))])
- {
- config_PutPsz(p_intf, name, strdup(module_get_object(p_parser)));
+ if ([objectTitle isEqualToString: _NS(module_GetLongName(p_parser))]) {
+ config_PutPsz(p_intf, name, strdup(module_get_name(p_parser, false)));
break;
}
}
}
module_list_free(p_list);
- if ([objectTitle isEqualToString: _NS("Default")])
- config_PutPsz(p_intf, name, "");
+ if ([objectTitle isEqualToString: _NS("Default")]) {
+ if (!strcmp(name, "vout"))
+ config_PutPsz(p_intf, name, "");
+ else
+ config_PutPsz(p_intf, name, "none");
+ }
}
- (void)saveChangedSettings
***************************/
if (b_inputSettingChanged) {
config_PutPsz(p_intf, "input-record-path", [[o_input_record_fld stringValue] UTF8String]);
- config_PutPsz(p_intf, "http-proxy", [[o_input_httpproxy_fld stringValue] UTF8String]);
- config_PutPsz(p_intf, "http-proxy-pwd", [[o_input_httpproxypwd_sfld stringValue] UTF8String]);
config_PutInt(p_intf, "postproc-q", [o_input_postproc_fld intValue]);
SaveIntList(o_input_avi_pop, "avi-index");
notificationObject == o_audio_vol_fld)
b_audioSettingChanged = YES;
else if (notificationObject == o_input_record_fld ||
- notificationObject == o_input_httpproxy_fld ||
- notificationObject == o_input_httpproxypwd_sfld ||
notificationObject == o_input_postproc_fld)
b_inputSettingChanged = YES;
else if (notificationObject == o_osd_font_fld ||
- (IBAction)showFontPicker:(id)sender
{
char * font = config_GetPsz(p_intf, "freetype-font");
- NSString * fontName = font ? [NSString stringWithUTF8String: font] : nil;
+ NSString * fontName = font ? @(font) : nil;
free(font);
if (fontName) {
NSFont * font = [NSFont fontWithName:fontName size:0.0];
{
if (sender == o_hotkeys_change_btn || sender == o_hotkeys_listbox) {
[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: [[VLCStringUtility sharedInstance] OSXStringKeyToString:[o_hotkeySettings objectAtIndex: [o_hotkeys_listbox selectedRow]]]];
+ [o_hotkeyDescriptions objectAtIndex:[o_hotkeys_listbox selectedRow]]]];
+ [o_hotkeys_change_keys_lbl setStringValue: [[VLCStringUtility sharedInstance] OSXStringKeyToString:[o_hotkeySettings objectAtIndex:[o_hotkeys_listbox selectedRow]]]];
[o_hotkeys_change_taken_lbl setStringValue: @""];
[o_hotkeys_change_win setInitialFirstResponder: [o_hotkeys_change_win contentView]];
[o_hotkeys_change_win makeFirstResponder: [o_hotkeys_change_win contentView]];
NSString * identifier = [aTableColumn identifier];
if ([identifier isEqualToString: @"action"])
- return [o_hotkeyDescriptions objectAtIndex: rowIndex];
+ return [o_hotkeyDescriptions objectAtIndex:rowIndex];
else if ([identifier isEqualToString: @"shortcut"])
- return [[VLCStringUtility sharedInstance] OSXStringKeyToString:[o_hotkeySettings objectAtIndex: rowIndex]];
+ return [[VLCStringUtility sharedInstance] OSXStringKeyToString:[o_hotkeySettings objectAtIndex:rowIndex]];
else {
msg_Err(p_intf, "unknown TableColumn identifier (%s)!", [identifier UTF8String]);
return NULL;
if (i_returnValue != NSNotFound)
[o_hotkeys_change_taken_lbl setStringValue: [NSString stringWithFormat:
_NS("This combination is already taken by \"%@\"."),
- [o_hotkeyDescriptions objectAtIndex: i_returnValue]]];
+ [o_hotkeyDescriptions objectAtIndex:i_returnValue]]];
else if (i_returnValue2 != NSNotFound)
[o_hotkeys_change_taken_lbl setStringValue: [NSString stringWithFormat:
_NS("This combination is already taken by \"%@\"."),
- [o_hotkeyDescriptions objectAtIndex: i_returnValue2]]];
+ [o_hotkeyDescriptions objectAtIndex:i_returnValue2]]];
else
[o_hotkeys_change_taken_lbl setStringValue: @""];