From ac616df17d3d5f2482ab1263f0560ee8e1a253ea Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Mon, 3 Aug 2020 16:33:02 +0200 Subject: MacGui: fix a couple layout issues on macOS 11. --- macosx/HBQueueController.m | 49 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'macosx/HBQueueController.m') diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index 3830a3e02..d67f11483 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -96,10 +96,10 @@ self.window.tabbingMode = NSWindowTabbingModeDisallowed; } -#if defined(NSAppKitVersionNumber10_15) - if (@available (macOS 10.16, *)) +#if defined(__MAC_11_0) + if (@available (macOS 11, *)) { - self.window.toolbarStyle = NSWindowToolbarStyleExpanded; + self.window.toolbarStyle = NSWindowToolbarStyleUnified; } #endif @@ -152,24 +152,39 @@ [self _touchBar_validateUserInterfaceItems]; } - NSString *string; + NSString *subtitle; if (self.queue.pendingItemsCount == 0) { self.window.title = NSLocalizedString(@"Queue", @"Queue window title"); + subtitle = NSLocalizedString(@"No encode pending", @"Queue status"); } else { if (self.queue.pendingItemsCount == 1) { - string = [NSString stringWithFormat: NSLocalizedString(@"%lu encode pending", @"Queue status"), (unsigned long)self.queue.pendingItemsCount]; + subtitle = [NSString stringWithFormat: NSLocalizedString(@"%lu encode pending", @"Queue status"), (unsigned long)self.queue.pendingItemsCount]; } else { - string = [NSString stringWithFormat: NSLocalizedString(@"%lu encodes pending", @"Queue status"), (unsigned long)self.queue.pendingItemsCount]; + subtitle = [NSString stringWithFormat: NSLocalizedString(@"%lu encodes pending", @"Queue status"), (unsigned long)self.queue.pendingItemsCount]; } - self.window.title = [NSString stringWithFormat: NSLocalizedString(@"Queue (%@)", @"Queue window title"), string]; +#if defined(__MAC_11_0) + if (@available(macOS 11, *)) {} else + { +#endif + self.window.title = [NSString stringWithFormat: NSLocalizedString(@"Queue (%@)", @"Queue window title"), subtitle]; +#if defined(__MAC_11_0) + } +#endif + } + +#if defined(__MAC_11_0) + if (@available(macOS 11, *)) + { + self.window.subtitle = subtitle; } +#endif } #pragma mark Toolbar @@ -312,8 +327,8 @@ [alert setInformativeText:NSLocalizedString(@"Your movie will be lost if you don't continue encoding.", @"Queue Stop Alert -> stop and remove informative text")]; [alert addButtonWithTitle:NSLocalizedString(@"Keep Encoding", @"Queue Stop Alert -> stop and remove first button")]; [alert addButtonWithTitle:NSLocalizedString(@"Stop Encoding and Delete", @"Queue Stop Alert -> stop and remove second button")]; -#if defined(NSAppKitVersionNumber10_15) - if (@available(macOS 10.16, *)) +#if defined(__MAC_11_0) + if (@available(macOS 11, *)) { alert.buttons.lastObject.hasDestructiveAction = true; } @@ -373,8 +388,8 @@ [alert setInformativeText:NSLocalizedString(@"Your movie will be lost if you don't continue encoding.", @"Queue Edit Alert -> stop and edit informative text")]; [alert addButtonWithTitle:NSLocalizedString(@"Keep Encoding", @"Queue Edit Alert -> stop and edit first button")]; [alert addButtonWithTitle:NSLocalizedString(@"Stop Encoding and Edit", @"Queue Edit Alert -> stop and edit second button")]; -#if defined(NSAppKitVersionNumber10_15) - if (@available(macOS 10.16, *)) +#if defined(__MAC_11_0) + if (@available(macOS 11, *)) { alert.buttons.lastObject.hasDestructiveAction = true; } @@ -654,8 +669,20 @@ NSString * const HBQueueItemNotificationPathKey = @"HBQueueItemNotificationPathK [alert setInformativeText:NSLocalizedString(@"Select Continue Encoding to dismiss this dialog without making changes.", @"Queue Alert -> cancel rip informative text")]; [alert addButtonWithTitle:NSLocalizedString(@"Continue Encoding", @"Queue Alert -> cancel rip first button")]; [alert addButtonWithTitle:NSLocalizedString(@"Skip Current Job", @"Queue Alert -> cancel rip second button")]; +#if defined(__MAC_11_0) + if (@available(macOS 11, *)) + { + alert.buttons.lastObject.hasDestructiveAction = true; + } +#endif [alert addButtonWithTitle:NSLocalizedString(@"Stop After Current Job", @"Queue Alert -> cancel rip third button")]; [alert addButtonWithTitle:NSLocalizedString(@"Stop All", @"Queue Alert -> cancel rip fourth button")]; +#if defined(__MAC_11_0) + if (@available(macOS 11, *)) + { + alert.buttons.lastObject.hasDestructiveAction = true; + } +#endif [alert setAlertStyle:NSAlertStyleCritical]; [alert beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) { -- cgit v1.2.3