Commit fbb8a437 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: modernize the remaining sheet dialogs

parent a50dad91
......@@ -184,7 +184,7 @@
p_old_input = p_input;
vlc_object_release(p_input);
[NSApp beginSheet: _editBookmarksWindow modalForWindow: self.window modalDelegate: _editBookmarksWindow didEndSelector: nil contextInfo: nil];
[self.window beginSheet:_editBookmarksWindow completionHandler:nil];
// Clear the bookmark list
for (int i = 0; i < i_bookmarks; i++)
......
......@@ -435,7 +435,7 @@
- (IBAction)customizeProfile:(id)sender
{
[NSApp beginSheet:_customizePanel modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[self.window beginSheet:_customizePanel completionHandler:nil];
}
- (IBAction)closeCustomizationSheet:(id)sender
......@@ -447,8 +447,6 @@
[self updateCurrentProfile];
}
- (IBAction)videoSettingsChanged:(id)sender
{
bool enableSettings = [_customizeVidCheckbox state] == NSOnState && [_customizeVidKeepCheckbox state] == NSOffState;
......@@ -510,7 +508,7 @@
- (IBAction)showStreamPanel:(id)sender
{
[NSApp beginSheet:_streamPanel modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[self.window beginSheet:_streamPanel completionHandler:nil];
}
- (IBAction)closeStreamPanel:(id)sender
......@@ -531,23 +529,32 @@
/* catch obvious errors */
if ([[_streamAddressField stringValue] length] == 0) {
NSBeginInformationalAlertSheet(_NS("No Address given"),
_NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
@"%@", _NS("In order to stream, a valid destination address is required."));
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:_NS("No Address given")];
[alert setInformativeText:_NS("In order to stream, a valid destination address is required.")];
[alert beginSheetModalForWindow:_streamPanel
completionHandler:nil];
return;
}
if ([_streamSAPCheckbox state] && [[_streamChannelField stringValue] length] == 0) {
NSBeginInformationalAlertSheet(_NS("No Channel Name given"),
_NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
@"%@", _NS("SAP stream announcement is enabled. However, no channel name is provided."));
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:_NS("No Channel Name given")];
[alert setInformativeText:_NS("SAP stream announcement is enabled. However, no channel name is provided.")];
[alert beginSheetModalForWindow:_streamPanel
completionHandler:nil];
return;
}
if ([_streamSDPMatrix isEnabled] && [_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0] && [[_streamSDPField stringValue] length] == 0) {
NSBeginInformationalAlertSheet(_NS("No SDP URL given"),
_NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
@"%@", _NS("A SDP export is requested, but no URL is provided."));
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:_NS("No SDP URL given")];
[alert setInformativeText:_NS("A SDP export is requested, but no URL is provided.")];
[alert beginSheetModalForWindow:_streamPanel
completionHandler:nil];
return;
}
......
......@@ -610,8 +610,9 @@ static NSString *kCaptureTabViewId = @"capture";
return;
}
if (!b_outputNibLoaded)
b_outputNibLoaded = [NSBundle loadNibNamed:@"StreamOutput" owner:_output];
if (!b_outputNibLoaded) {
b_outputNibLoaded = [[NSBundle mainBundle] loadNibNamed:@"StreamOutput" owner:_output topLevelObjects:nil];
}
[self.window beginSheet:_output.outputSheet completionHandler:nil];
}
......@@ -1043,11 +1044,8 @@ static NSString *kCaptureTabViewId = @"capture";
- (IBAction)openNetUDPButtonAction:(id)sender
{
if (sender == _netOpenUDPButton) {
[NSApp beginSheet: self.netUDPPanel
modalForWindow: self.window
modalDelegate: self
didEndSelector: NULL
contextInfo: nil];
[self.window beginSheet:self.netUDPPanel
completionHandler:nil];
[self openNetInfoChanged:nil];
}
else if (sender == _netUDPCancelButton) {
......@@ -1240,11 +1238,7 @@ static NSString *kCaptureTabViewId = @"capture";
- (IBAction)subSettings:(id)sender
{
[NSApp beginSheet: self.fileSubSheet
modalForWindow: [sender window]
modalDelegate: self
didEndSelector: NULL
contextInfo: nil];
[[self window] beginSheet:self.fileSubSheet completionHandler:nil];
}
- (IBAction)subCloseSheet:(id)sender
......
......@@ -61,7 +61,7 @@
_completionBlock = [handler copy];
[NSApp beginSheet:self.window modalForWindow:window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[window beginSheet:self.window completionHandler:nil];
}
@end
......@@ -222,9 +222,6 @@
- (IBAction)buttonAction:(id)sender;
- (IBAction)resetPreferences:(id)sender;
- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context;
/* interface */
- (IBAction)interfaceSettingChanged:(id)sender;
......
......@@ -805,42 +805,40 @@ static inline const char * __config_GetLabel(vlc_object_t *p_this, const char *p
- (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
{
if (i_return == NSAlertAlternateReturn) {
/* reset VLC's config */
config_ResetAll();
[self resetControls];
/* force config file creation, since libvlc won't exit normally */
config_SaveConfigFile(p_intf);
/* reset OS X defaults */
[[VLCMain sharedInstance] resetAndReinitializeUserDefaults];
/* 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;
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:_NS("Reset Preferences")];
[alert setInformativeText:_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?")];
[alert addButtonWithTitle:_NS("Cancel")];
[alert addButtonWithTitle:_NS("Continue")];
[alert beginSheetModalForWindow:[sender window] completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertSecondButtonReturn) {
/* reset VLC's config */
config_ResetAll();
[self resetControls];
/* force config file creation, since libvlc won't exit normally */
config_SaveConfigFile(p_intf);
/* reset OS X defaults */
[[VLCMain sharedInstance] resetAndReinitializeUserDefaults];
/* 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);
}
execl(path, path, NULL);
}
}];
}
static inline void save_int_list(intf_thread_t * p_intf, id object, const char * name)
......@@ -1327,8 +1325,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
fillUrlHandlerPopup(@"smb", _urlhandler_smbPopup);
fillUrlHandlerPopup(@"udp", _urlhandler_udpPopup);
[NSApp beginSheet:_urlhandler_win modalForWindow:self.window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[self.window beginSheet:_urlhandler_win completionHandler:nil];
} else {
[_urlhandler_win orderOut:sender];
[NSApp endSheet:_urlhandler_win];
......
......@@ -32,7 +32,6 @@
@implementation VLCTextfieldPanelController
- (id)init
{
self = [super initWithWindowNibName:@"TextfieldPanel"];
......@@ -61,7 +60,7 @@
_completionBlock = [handler copy];
[NSApp beginSheet:self.window modalForWindow:window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[window beginSheet:self.window completionHandler:nil];
}
@end
......@@ -89,10 +89,8 @@
[_stepper setMaxValue:self.maxValue];
_completionHandler = [handler copy];
[NSApp beginSheet:self.window
modalForWindow:window modalDelegate:self
didEndSelector:nil
contextInfo:nil];
[window beginSheet:self.window completionHandler:nil];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment