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

macosx: modernize API use for sheet dialogs

parent 2378131a
......@@ -531,11 +531,8 @@
[alert setAlertStyle:NSCriticalAlertStyle];
[alert setMessageText:_NS("Please enter a unique name for the new profile.")];
[alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")];
[alert beginSheetModalForWindow:_self.window
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
completionHandler:nil];
return;
}
......
......@@ -208,11 +208,21 @@
input_thread_t * p_input = pl_CurrentInput(getIntf());
if (!p_input) {
NSBeginCriticalAlertSheet(_NS("No input"), _NS("OK"), @"", @"", self.window, nil, nil, nil, nil, @"%@",_NS("No input found. A stream must be playing or paused for bookmarks to work."));
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSCriticalAlertStyle];
[alert setMessageText:_NS("No input")];
[alert setInformativeText:_NS("No input found. A stream must be playing or paused for bookmarks to work.")];
[alert beginSheetModalForWindow:self.window
completionHandler:nil];
return;
}
if (p_old_input != p_input) {
NSBeginCriticalAlertSheet(_NS("Input has changed"), _NS("OK"), @"", @"", self.window, nil, nil, nil, nil, @"%@",_NS("Input has changed, unable to save bookmark. Suspending playback with \"Pause\" while editing bookmarks to ensure to keep the same input."));
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSCriticalAlertStyle];
[alert setMessageText:_NS("Input has changed")];
[alert setInformativeText:_NS("Input has changed, unable to save bookmark. Suspending playback with \"Pause\" while editing bookmarks to ensure to keep the same input.")];
[alert beginSheetModalForWindow:self.window
completionHandler:nil];
vlc_object_release(p_input);
return;
}
......
......@@ -267,10 +267,13 @@
if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"HTTP"]) {
NSString *muxformat = [self.currentProfile firstObject];
if ([muxformat isEqualToString:@"wav"] || [muxformat isEqualToString:@"mov"] || [muxformat isEqualToString:@"mp4"] || [muxformat isEqualToString:@"mkv"]) {
NSBeginInformationalAlertSheet(_NS("Invalid container format for HTTP streaming"), _NS("OK"), @"", @"", self.window,
nil, nil, nil, nil,
_NS("Media encapsulated as %@ cannot be streamed through the HTTP protocol for technical reasons."),
[[self currentEncapsulationFormatAsFileExtension:YES] uppercaseString]);
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:_NS("Invalid container format for HTTP streaming")];
[alert setInformativeText:[NSString stringWithFormat:_NS("Media encapsulated as %@ cannot be streamed through the HTTP protocol for technical reasons."),
[[self currentEncapsulationFormatAsFileExtension:YES] uppercaseString]]];
[alert beginSheetModalForWindow:self.window
completionHandler:nil];
return;
}
}
......
......@@ -241,11 +241,12 @@ static void updateProgressCallback(void *p_data,
- (void)displayQuestion:(NSArray *)dialogData
{
NSAlert *alert = [NSAlert alertWithMessageText:[dialogData objectAtIndex:1]
defaultButton:[dialogData objectAtIndex:5]
alternateButton:[dialogData objectAtIndex:6]
otherButton:[dialogData objectAtIndex:4]
informativeTextWithFormat:@"%@", [dialogData objectAtIndex:2]];
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:[dialogData objectAtIndex:1]];
[alert setInformativeText:[dialogData objectAtIndex:2]];
[alert addButtonWithTitle:[dialogData objectAtIndex:5]];
[alert addButtonWithTitle:[dialogData objectAtIndex:6]];
[alert addButtonWithTitle:[dialogData objectAtIndex:4]];
switch ([[dialogData objectAtIndex:3] intValue]) {
case VLC_DIALOG_QUESTION_WARNING:
......@@ -261,15 +262,15 @@ static void updateProgressCallback(void *p_data,
NSInteger returnValue = [alert runModal];
switch (returnValue) {
case NSAlertDefaultReturn:
case NSAlertFirstButtonReturn:
vlc_dialog_id_post_action([[dialogData objectAtIndex:0] pointerValue], 1);
break;
case NSAlertAlternateReturn:
case NSAlertSecondButtonReturn:
vlc_dialog_id_post_action([[dialogData objectAtIndex:0] pointerValue], 2);
break;
case NSAlertOtherReturn:
case NSAlertThirdButtonReturn:
default:
vlc_dialog_id_dismiss([[dialogData objectAtIndex:0] pointerValue]);
}
......
......@@ -224,9 +224,14 @@ static const float f_min_window_height = 307.;
[_sidebarView expandItem:nil expandChildren:YES];
NSAlert *albumArtAlert = [NSAlert alertWithMessageText:_NS("Check for album art and metadata?") defaultButton:_NS("Enable Metadata Retrieval") alternateButton:_NS("No, Thanks") otherButton:nil informativeTextWithFormat:@"%@",_NS("VLC can check online for album art and metadata to enrich your playback experience, e.g. by providing track information when playing Audio CDs. To provide this functionality, VLC will send information about your contents to trusted services in an anonymized form.")];
NSAlert *albumArtAlert = [[NSAlert alloc] init];
[albumArtAlert setMessageText:_NS("Check for album art and metadata?")];
[albumArtAlert setInformativeText:_NS("VLC can check online for album art and metadata to enrich your playback experience, e.g. by providing track information when playing Audio CDs. To provide this functionality, VLC will send information about your contents to trusted services in an anonymized form.")];
[albumArtAlert addButtonWithTitle:_NS("Enable Metadata Retrieval")];
[albumArtAlert addButtonWithTitle:_NS("No, Thanks")];
NSInteger returnValue = [albumArtAlert runModal];
config_PutInt("metadata-network-access", returnValue == NSAlertDefaultReturn);
config_PutInt("metadata-network-access", returnValue == NSAlertFirstButtonReturn);
}
[_playlistScrollView setBorderType:NSNoBorder];
......
......@@ -613,11 +613,7 @@ static NSString *kCaptureTabViewId = @"capture";
if (!b_outputNibLoaded)
b_outputNibLoaded = [NSBundle loadNibNamed:@"StreamOutput" owner:_output];
[NSApp beginSheet:_output.outputSheet
modalForWindow:self.window
modalDelegate:self
didEndSelector:NULL
contextInfo:nil];
[self.window beginSheet:_output.outputSheet completionHandler:nil];
}
#pragma mark -
......
......@@ -809,11 +809,8 @@
[alert setAlertStyle:NSCriticalAlertStyle];
[alert setMessageText:_NS("Please enter a unique name for the new profile.")];
[alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")];
[alert beginSheetModalForWindow:_self.window
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
completionHandler:nil];
return;
}
......
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