diff options
author | Damiano Galassi <[email protected]> | 2018-10-10 19:58:21 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2018-10-10 19:58:21 +0200 |
commit | 2264d25308238210892840d7de3fa1edf9de105e (patch) | |
tree | 0285fd80ba9717f50219a45b8891d072f030c77f /macosx/HBEncodingProgressHUDController.m | |
parent | 210164589bd29a2b21cfd58a928aa11e603782eb (diff) |
MacGui: add touch bars in the preview window, improve touch bars in the main and queue windows.
Diffstat (limited to 'macosx/HBEncodingProgressHUDController.m')
-rw-r--r-- | macosx/HBEncodingProgressHUDController.m | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/macosx/HBEncodingProgressHUDController.m b/macosx/HBEncodingProgressHUDController.m index da417bf02..a78ed85a1 100644 --- a/macosx/HBEncodingProgressHUDController.m +++ b/macosx/HBEncodingProgressHUDController.m @@ -51,3 +51,41 @@ } @end + +@interface HBEncodingProgressHUDController (TouchBar) <NSTouchBarProvider, NSTouchBarDelegate> +@end + +@implementation HBEncodingProgressHUDController (TouchBar) + +@dynamic touchBar; + +static NSTouchBarItemIdentifier HBTouchBarCancelEncoding = @"fr.handbrake.cancelEncoding"; + +- (NSTouchBar *)makeTouchBar +{ + NSTouchBar *bar = [[NSTouchBar alloc] init]; + bar.delegate = self; + + bar.escapeKeyReplacementItemIdentifier = HBTouchBarCancelEncoding; + + return bar; +} + +- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier +{ + if ([identifier isEqualTo:HBTouchBarCancelEncoding]) + { + NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]; + item.customizationLabel = NSLocalizedString(@"Cancel Encoding", @"Touch bar"); + + NSButton *button = [NSButton buttonWithTitle:NSLocalizedString(@"Cancel", @"Touch bar") target:self action:@selector(cancelEncoding:)]; + button.bezelColor = NSColor.systemRedColor; + + item.view = button; + return item; + } + + return nil; +} + +@end |