]> granicus.if.org Git - handbrake/commitdiff
MacGui: fix another round of deprecation warnings. Remove drawer code.
authorDamiano Galassi <damiog@gmail.com>
Sun, 10 Jun 2018 07:12:18 +0000 (09:12 +0200)
committerDamiano Galassi <damiog@gmail.com>
Sun, 10 Jun 2018 07:12:18 +0000 (09:12 +0200)
16 files changed:
macosx/DockTextField.m
macosx/HBAdvancedController.m
macosx/HBAppDelegate.m
macosx/HBChapterTitlesController.m
macosx/HBController.m
macosx/HBImageAndTextCell.m
macosx/HBOutputPanelController.m
macosx/HBPlayerHUDController.m
macosx/HBPreferencesController.m
macosx/HBPresetsViewController.m
macosx/HBPreviewController.m
macosx/HBQueueController.m
macosx/HBSubtitlesController.m
macosx/HBToolbarBadgedItem.m
macosx/HandBrake.xcodeproj/project.pbxproj
macosx/HandBrakeKit/HandBrakeKit.h

index bf6bc544412207c3a73374dcd4d8240fc7a879e2..04f39b8ce6baad864205009ef4db68d295905dd8 100644 (file)
@@ -24,7 +24,7 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        [[self cell] setBezelStyle:NSRoundedBezelStyle];
+        [[self cell] setBezelStyle:NSBezelStyleRounded];
         _textToDisplay = @"";
         _textAttributes = [self textAttributesWithFontSize:DOCK_TEXTFIELD_FONTSIZE];
         _smallTextAttributes = [self textAttributesWithFontSize:DOCK_TEXTFIELD_FONTSIZE - 2];
index 49af2baf504175728b2e0f3293eccc532e865e99..e4fbb775cabc9f9389a6e3a394197e5124454a42 100644 (file)
     /* Adaptive Quantization Strength fX264opAqSlider */
     [fX264optAqSlider setMinValue:0.0];
     [fX264optAqSlider setMaxValue:2.0];
-    [fX264optAqSlider setTickMarkPosition:NSTickMarkBelow];
+    [fX264optAqSlider setTickMarkPosition:NSTickMarkPositionBelow];
     [fX264optAqSlider setNumberOfTickMarks:21];
     [fX264optAqSlider setAllowsTickMarkValuesOnly:YES];
     [fX264optAqSlider setFloatValue:1.0];
     /* PsyRDO fX264optPsyRDSlider */
     [fX264optPsyRDSlider setMinValue:0.0];
     [fX264optPsyRDSlider setMaxValue:2.0];
-    [fX264optPsyRDSlider setTickMarkPosition:NSTickMarkBelow];
+    [fX264optPsyRDSlider setTickMarkPosition:NSTickMarkPositionBelow];
     [fX264optPsyRDSlider setNumberOfTickMarks:21];
     [fX264optPsyRDSlider setAllowsTickMarkValuesOnly:YES];
     [fX264optPsyRDSlider setFloatValue:1.0];
     /* PsyTrellis fX264optPsyRDSlider */
     [fX264optPsyTrellisSlider setMinValue:0.0];
     [fX264optPsyTrellisSlider setMaxValue:1.0];
-    [fX264optPsyTrellisSlider setTickMarkPosition:NSTickMarkBelow];
+    [fX264optPsyTrellisSlider setTickMarkPosition:NSTickMarkPositionBelow];
     [fX264optPsyTrellisSlider setNumberOfTickMarks:21];
     [fX264optPsyTrellisSlider setAllowsTickMarkValuesOnly:YES];
     [fX264optPsyTrellisSlider setFloatValue:0.0];
index 53b89417c8d01b84ffca597c5a20cc3e22aafabd..72e3f36567b1ef9f3cf0703caac3fdd8b978cf40 100644 (file)
         [alert addButtonWithTitle:NSLocalizedString(@"Quit", @"Quit Alert -> first button")];
         [alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", @"Quit Alert -> second button")];
         [alert.buttons[1] setKeyEquivalent:@"\E"];
-        [alert setAlertStyle:NSCriticalAlertStyle];
+        [alert setAlertStyle:NSAlertStyleCritical];
 
         NSInteger result = [alert runModal];
 
index 5cc567f9182b49bdeebec3726269fa2a208b475c..5154f0af28e238adc98ee6fbf820d74444667ba4 100644 (file)
 
     [panel beginSheetModalForWindow:self.view.window completionHandler:^(NSInteger result)
     {
-        if (result == NSFileHandlingPanelOKButton)
+        if (result == NSModalResponseOK)
         {
             NSError *error;
             if ([self importChaptersFromURL:panel.URL error:&error] == NO)
 
     [panel beginSheetModalForWindow:self.view.window completionHandler:^(NSInteger result)
     {
-        if (result == NSFileHandlingPanelOKButton)
+        if (result == NSModalResponseOK)
         {
             NSError *saveError;
             NSMutableString *csv = [NSMutableString string];
index 3c4d60c38b9d98f7f1a2eeeb679ec5c91cfe57f8..4e38c5852a96e5686a8ad682c15167101e659233 100644 (file)
@@ -34,7 +34,7 @@
 
 @import HandBrakeKit;
 
-@interface HBController () <HBPresetsViewControllerDelegate, HBTitleSelectionDelegate, NSDrawerDelegate, NSDraggingDestination, NSPopoverDelegate>
+@interface HBController () <HBPresetsViewControllerDelegate, HBTitleSelectionDelegate, NSDraggingDestination, NSPopoverDelegate>
 {
     IBOutlet NSTabView *fMainTabView;
 
@@ -93,7 +93,6 @@
 
 @property (nonatomic, strong) HBPresetsMenuBuilder *presetsMenuBuilder;
 @property (nonatomic, strong) IBOutlet NSPopUpButton *presetsPopup;
-@property (nonatomic, strong) IBOutlet NSDrawer *presetsDrawer;
 
 @property (nonatomic, strong) IBOutlet NSToolbarItem *presetsItem;
 @property (nonatomic, strong) NSPopover *presetsPopover;
     fPresetsView.enabled = enabled;
 }
 
-- (NSSize)drawerWillResizeContents:(NSDrawer *) drawer toSize:(NSSize)contentSize {
-    [[NSUserDefaults standardUserDefaults] setObject:NSStringFromSize(contentSize) forKey:@"HBDrawerSize"];
-    return contentSize;
-}
-
 - (void)setNilValueForKey:(NSString *)key
 {
     if ([key isEqualToString:@"scanSpecificTitleIdx"])
 
     [panel beginSheetModalForWindow:self.window completionHandler: ^(NSInteger result)
     {
-         if (result == NSFileHandlingPanelOKButton)
+        if (result == NSModalResponseOK)
          {
              NSInteger titleIdx = self.scanSpecificTitle ? self.scanSpecificTitleIdx : 0;
              [self openURL:panel.URL titleIndex:titleIdx];
 
     [panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
      {
-         if (result == NSFileHandlingPanelOKButton)
+         if (result == NSModalResponseOK)
          {
              self.job.outputURL = panel.URL;
              self.currentDestination = panel.URL;
         [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Do you want to overwrite %@?", @"File already exists alert -> informative text"), job.completeOutputURL.path]];
         [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"File already exists alert -> first button")];
         [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"File already exists alert -> second button")];
-        [alert setAlertStyle:NSCriticalAlertStyle];
+        [alert setAlertStyle:NSAlertStyleCritical];
 
         [alert beginSheetModalForWindow:self.window completionHandler:handler];
     }
         [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Do you want to overwrite %@?", @"File already exists in queue alert -> informative text"), job.completeOutputURL.path]];
         [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"File already exists in queue alert -> first button")];
         [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"File already exists in queue alert -> second button")];
-        [alert setAlertStyle:NSCriticalAlertStyle];
+        [alert setAlertStyle:NSAlertStyleCritical];
 
         [alert beginSheetModalForWindow:self.window completionHandler:handler];
     }
         [alert setInformativeText:NSLocalizedString(@"One or more file already exists. Do you want to overwrite?", @"File already exists alert -> informative text")];
         [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"File already exists alert -> first button")];
         [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"File already exists alert -> second button")];
-        [alert setAlertStyle:NSCriticalAlertStyle];
+        [alert setAlertStyle:NSAlertStyleCritical];
 
         [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
             if (returnCode == NSAlertSecondButtonReturn)
             [self.presetsPopover close];
         }
     }
-    else
-    {
-        if (self.presetsDrawer.state == NSDrawerClosedState)
-        {
-            [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HBDefaultPresetsDrawerShow"];
-        }
-        else
-        {
-            [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"HBDefaultPresetsDrawerShow"];
-        }
-
-        [self.presetsDrawer toggle:self];
-    }
 }
 
 - (void)setCurrentPreset:(HBPreset *)currentPreset
index b0c400edbd8699557ebc468774957018c75c2a28..5aebf9cf7a8f7d160215859e13c922d1cad91259 100644 (file)
@@ -194,7 +194,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
           
         }
 
-        [image drawAtPoint:imageFrame.origin fromRect:imageFrame operation:NSCompositeSourceOver fraction:1.0];
+        [image drawAtPoint:imageFrame.origin fromRect:imageFrame operation:NSCompositingOperationSourceOver fraction:1.0];
     }
 
     [super drawWithFrame:cellFrame inView:controlView];
index 1150e193947cc42f28b5769b7f47aab9287d5a70..5da8ebaf9d227a3fb9e294f0580e1096849936d2 100644 (file)
 - (IBAction)copyAllOutputToPasteboard:(id)sender
 {
        NSPasteboard *pboard = [NSPasteboard generalPasteboard];
-       [pboard declareTypes:@[NSStringPboardType] owner:nil];
-       [pboard setString:[outputTextStorage string] forType:NSStringPboardType];
+    [pboard declareTypes:@[NSPasteboardTypeString] owner:nil];
+    [pboard setString:[outputTextStorage string] forType:NSPasteboardTypeString];
 }
 
 /**
index b3b391cbdc6c130cbc16aadf2b79d8a2e9983de1..82b68b494aa0c65b89e112616b84d3a363e50d1f 100644 (file)
             [self.player play];
             self.player.rate = rate;
         }
-        else if (event.modifierFlags & NSAlternateKeyMask && key == NSLeftArrowFunctionKey)
+        else if (event.modifierFlags & NSEventModifierFlagOption && key == NSLeftArrowFunctionKey)
         {
             [self.player gotoBeginning];
         }
-        else if (event.modifierFlags & NSAlternateKeyMask && key == NSRightArrowFunctionKey)
+        else if (event.modifierFlags & NSEventModifierFlagOption && key == NSRightArrowFunctionKey)
         {
             [self.player gotoEnd];
         }
index 57bf60627f895d241a108849e53f29689943e69e..753f371fbd6329382795ebe13440abf01fa086ad 100644 (file)
@@ -57,7 +57,6 @@
         @"HBShowOpenPanelAtLaunch":         @YES,
         @"DefaultMpegExtension":            @"Auto",
         @"UseDvdNav":                       @"YES",
-        @"HBDefaultPresetsDrawerShow":      @YES,
         // Archive the URL because they aren't supported in plist.
         @"HBLastDestinationDirectory":      [NSKeyedArchiver archivedDataWithRootObject:desktopURL],
         @"HBLastSourceDirectory":           [NSKeyedArchiver archivedDataWithRootObject:desktopURL],
@@ -72,7 +71,6 @@
         @"x264CqSliderFractional":          @"0.50",
         @"HBShowAdvancedTab":               @NO,
         @"HBAutoNamingFormat":              @[@"{Source}", @" ", @"{Title}"],
-        @"HBDrawerSize":                    NSStringFromSize(NSMakeSize(184, 591)),
         @"HBQueuePauseIfLowSpace":          @YES,
         @"HBQueueMinFreeSpace":             @"2"
         }];
 {
     if ([representedObject rangeOfString: @"{"].location == 0)
     {
-        return NSRoundedTokenStyle;
+        return NSTokenStyleRounded;
     }
     else
     {
-        return NSPlainTextTokenStyle;
+        return NSTokenStyleNone;
     }
 }
 
index d2a22b378a54ec8c949c47ea62cb747d4a354f21..17e174f56055892be76123ece53606871e0e98e5 100644 (file)
@@ -164,7 +164,7 @@ static void *HBPresetsViewControllerContext = &HBPresetsViewControllerContext;
 
     [panel beginWithCompletionHandler:^(NSInteger result)
      {
-         if (result == NSFileHandlingPanelOKButton)
+         if (result == NSModalResponseOK)
          {
              NSURL *presetExportDirectory = [panel.URL URLByDeletingLastPathComponent];
              [[NSUserDefaults standardUserDefaults] setURL:presetExportDirectory forKey:@"LastPresetExportDirectoryURL"];
@@ -196,7 +196,7 @@ static void *HBPresetsViewControllerContext = &HBPresetsViewControllerContext;
      {
          [[NSUserDefaults standardUserDefaults] setURL:panel.directoryURL forKey:@"LastPresetImportDirectoryURL"];
 
-         if (result == NSFileHandlingPanelOKButton)
+         if (result == NSModalResponseOK)
          {
              for (NSURL *url in panel.URLs)
              {
@@ -262,7 +262,7 @@ static void *HBPresetsViewControllerContext = &HBPresetsViewControllerContext;
         alert.informativeText = NSLocalizedString(@"You can't undo this action.", @"Delete preset alert -> informative text");
         [alert addButtonWithTitle:NSLocalizedString(@"Delete Preset", @"Delete preset alert -> first button")];
         [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Delete preset alert -> second button")];
-        alert.alertStyle = NSCriticalAlertStyle;
+        alert.alertStyle = NSAlertStyleCritical;
 
         NSInteger status = [alert runModal];
 
index f5c572cfd33725fbd4a8cb0886d0d7a6339df374..cd30f8161e4837156d9ba22bdcf77050db6708e8 100644 (file)
         CFRelease(fPreviewImage);
     }
 
-    if (self.previewView.fitToView == NO && !(self.window.styleMask & NSFullScreenWindowMask))
+    if (self.previewView.fitToView == NO && !(self.window.styleMask & NSWindowStyleMaskFullScreen))
     {
         // Get the optimal view size for the image
         NSSize imageScaledSize = [self.generator imageSize];
     else
     {
         self.previewView.fitToView = YES;
-        if (!(self.window.styleMask & NSFullScreenWindowMask))
+        if (!(self.window.styleMask & NSWindowStyleMaskFullScreen))
         {
             [self.window setFrame:self.window.screen.visibleFrame display:YES animate:YES];
         }
index fae219c20ca48e3cd4c75d375025743a1a9803cb..0c7ad25e36cff35c41e3986a83433773253c8c50 100644 (file)
                 [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")];
-                [alert setAlertStyle:NSCriticalAlertStyle];
+                [alert setAlertStyle:NSAlertStyleCritical];
 
                 [alert beginSheetModalForWindow:targetWindow completionHandler:^(NSModalResponse returnCode) {
                     if (returnCode == NSAlertSecondButtonReturn)
     [alert addButtonWithTitle:NSLocalizedString(@"Cancel Current and Stop", @"Queue Alert -> cancel rip second button")];
     [alert addButtonWithTitle:NSLocalizedString(@"Cancel Current and Continue", @"Queue Alert -> cancel rip third button")];
     [alert addButtonWithTitle:NSLocalizedString(@"Finish Current and Stop", @"Queue Alert -> cancel rip fourth button")];
-    [alert setAlertStyle:NSCriticalAlertStyle];
+    [alert setAlertStyle:NSAlertStyleCritical];
 
     [alert beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) {
         if (returnCode == NSAlertSecondButtonReturn)
             [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")];
-            [alert setAlertStyle:NSCriticalAlertStyle];
+            [alert setAlertStyle:NSAlertStyleCritical];
 
             [alert beginSheetModalForWindow:docWindow completionHandler:^(NSModalResponse returnCode) {
                 if (returnCode == NSAlertSecondButtonReturn)
index fd44ef59dfadb868e62c0c994cf7e5720d13395e..623f3053ae0f3fd7f7d5c39bfe48388a38d9af55 100644 (file)
@@ -99,7 +99,7 @@
 
     [panel beginSheetModalForWindow:self.view.window completionHandler:^(NSInteger result)
     {
-        if (result == NSFileHandlingPanelOKButton)
+        if (result == NSModalResponseOK)
         {
             NSURL *importSrtFileURL = panel.URL;
             NSURL *importSrtDirectory = importSrtFileURL.URLByDeletingLastPathComponent;
index 35fdf680885dccae44ba498ddaf3ccfedf89f766..dfce12f5b975a16cfc754d8613124e40ca464d9f 100644 (file)
         [NSGraphicsContext saveGraphicsState];
         [NSGraphicsContext setCurrentContext:ctx];
 
-        CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        CGContextRef context = [[NSGraphicsContext currentContext] CGContext];
         CGContextSaveGState(context);
 
         NSRect imageRect = NSMakeRect(0, 0, size.width, size.height);
index 9141ccd8c616615b783b24373621857e0785dbe3..f22445fdab3316b2f282ca7f7f8899f1424a9c1c 100644 (file)
                A91CE2FC1C7DB99D0068F46F /* HBPreset.h in Headers */ = {isa = PBXBuildFile; fileRef = A9CF25F21990D64E0023F727 /* HBPreset.h */; settings = {ATTRIBUTES = (Public, ); }; };
                A91CE2FD1C7DB99D0068F46F /* HBMutablePreset.h in Headers */ = {isa = PBXBuildFile; fileRef = A96CD1741BCC5F9100F372F1 /* HBMutablePreset.h */; settings = {ATTRIBUTES = (Public, ); }; };
                A91CE2FE1C7DB99D0068F46F /* HBTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D488A31996270300E9B1BA /* HBTreeNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               A91D54871E378ABD006D0997 /* HBSecurityAccessToken.h in Headers */ = {isa = PBXBuildFile; fileRef = A91D54851E378ABD006D0997 /* HBSecurityAccessToken.h */; settings = {ATTRIBUTES = (Public, ); }; };
+               A91D54871E378ABD006D0997 /* HBSecurityAccessToken.h in Headers */ = {isa = PBXBuildFile; fileRef = A91D54851E378ABD006D0997 /* HBSecurityAccessToken.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A91D54881E378ABD006D0997 /* HBSecurityAccessToken.m in Sources */ = {isa = PBXBuildFile; fileRef = A91D54861E378ABD006D0997 /* HBSecurityAccessToken.m */; };
                A91F97351D7B2A4E00D82DCE /* HBAudioTransformers.h in Headers */ = {isa = PBXBuildFile; fileRef = A91F97331D7B2A4E00D82DCE /* HBAudioTransformers.h */; settings = {ATTRIBUTES = (Public, ); }; };
                A91F97361D7B2A4E00D82DCE /* HBAudioTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = A91F97341D7B2A4E00D82DCE /* HBAudioTransformers.m */; };
                A92268781A6E555500A8D5C5 /* HBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A92268771A6E555500A8D5C5 /* HBAppDelegate.m */; };
-               A9294CC91DC4BBF7004D3415 /* HBJob+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A9294CC71DC4BBF7004D3415 /* HBJob+Private.h */; };
+               A9294CC91DC4BBF7004D3415 /* HBJob+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A9294CC71DC4BBF7004D3415 /* HBJob+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A92B148220CA9F7700146FD8 /* HBHUDView.m in Sources */ = {isa = PBXBuildFile; fileRef = A92B148120CA9F7600146FD8 /* HBHUDView.m */; };
                A937EECB1C6C7C0300EEAE6D /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = A937EECA1C6C7C0300EEAE6D /* dsa_pub.pem */; };
                A939DD8B1FC8826A00135F2A /* HBPresetsMenuBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = A939DD8A1FC8826A00135F2A /* HBPresetsMenuBuilder.m */; };
                                A91CE2EC1C7DAEEE0068F46F /* HBStateFormatter.h in Headers */,
                                A91CE2ED1C7DAEEE0068F46F /* HBUtilities.h in Headers */,
                                A91CE2FB1C7DB99D0068F46F /* HBPresetsManager.h in Headers */,
-                               A9294CC91DC4BBF7004D3415 /* HBJob+Private.h in Headers */,
                                A91CE2FC1C7DB99D0068F46F /* HBPreset.h in Headers */,
                                A91CE2FD1C7DB99D0068F46F /* HBMutablePreset.h in Headers */,
-                               A91D54871E378ABD006D0997 /* HBSecurityAccessToken.h in Headers */,
                                A91F97351D7B2A4E00D82DCE /* HBAudioTransformers.h in Headers */,
                                A98B8E241C7DD2A200B810C9 /* HBPresetCoding.h in Headers */,
+                               A9294CC91DC4BBF7004D3415 /* HBJob+Private.h in Headers */,
                                A91CE2FE1C7DB99D0068F46F /* HBTreeNode.h in Headers */,
+                               A91D54871E378ABD006D0997 /* HBSecurityAccessToken.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 40d756e854b909632ab395c02045e27d78377995..de6e1dfa0de2a29e324147c90496bc6f472f01ae 100644 (file)
@@ -49,3 +49,5 @@ FOUNDATION_EXPORT const unsigned char HandBrakeKitVersionString[];
 #import <HandBrakeKit/HBVideo+UIAdditions.h>
 #import <HandBrakeKit/HBPicture+UIAdditions.h>
 #import <HandBrakeKit/HBFilters+UIAdditions.h>
+#import <HandBrakeKit/HBAudioTransformers.h>
+