]> granicus.if.org Git - handbrake/commitdiff
MacGui: remove a bunch of unneeded compatibility code.
authorDamiano Galassi <damiog@gmail.com>
Tue, 10 Jul 2018 18:06:09 +0000 (20:06 +0200)
committerDamiano Galassi <damiog@gmail.com>
Tue, 10 Jul 2018 18:06:09 +0000 (20:06 +0200)
14 files changed:
macosx/Base.lproj/OutputPanel.xib
macosx/HBAdvancedController.m
macosx/HBChapterTitlesController.m
macosx/HBController.m
macosx/HBDistributedArray.m
macosx/HBEncodingProgressHUDController.m
macosx/HBPictureHUDController.m
macosx/HBPlayerHUDController.m
macosx/HBPreferencesController.m
macosx/HBPresetsViewController.m
macosx/HBPreviewView.m
macosx/HBPreviewViewController.m
macosx/HBSummaryViewController.m
macosx/HBToolbarBadgedItem.m

index cfde9616a5fe40c88ccbf9a7abf82cd04aecac1a..c4b46fac8ee42d8eb6adae0c87fd369494835e10 100644 (file)
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14295.6" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment identifier="macosx"/>
-        <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+        <development version="8000" identifier="xcode"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14295.6"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="HBOutputPanelController">
                     <scrollView horizontalLineScroll="0.0" horizontalPageScroll="0.0" verticalLineScroll="0.0" verticalPageScroll="0.0" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="19">
                         <rect key="frame" x="-1" y="-1" width="380" height="441"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <clipView key="contentView" id="mnc-sf-Cwe">
-                            <rect key="frame" x="1" y="1" width="363" height="439"/>
+                        <clipView key="contentView" drawsBackground="NO" id="mnc-sf-Cwe">
+                            <rect key="frame" x="1" y="1" width="378" height="439"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textView editable="NO" importsGraphics="NO" richText="NO" findStyle="bar" incrementalSearchingEnabled="YES" id="20">
+                                <textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" findStyle="bar" incrementalSearchingEnabled="YES" allowsNonContiguousLayout="YES" id="20">
                                     <rect key="frame" x="0.0" y="0.0" width="378" height="439"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                    <size key="minSize" width="363" height="439"/>
+                                    <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    <size key="minSize" width="378" height="439"/>
                                     <size key="maxSize" width="743" height="10000000"/>
-                                    <color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+                                    <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
                                     <connections>
                                         <outlet property="delegate" destination="-2" id="21"/>
                                         <outlet property="menu" destination="11" id="22"/>
                                     </connections>
                                 </textView>
                             </subviews>
-                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         </clipView>
                         <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="40">
                             <rect key="frame" x="-100" y="-100" width="87" height="18"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
                         <scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="39">
-                            <rect key="frame" x="364" y="1" width="15" height="439"/>
+                            <rect key="frame" x="363" y="1" width="16" height="439"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
                     </scrollView>
index e4fbb775cabc9f9389a6e3a394197e5124454a42..2bd81b1982a67181c93c94ba7438055f2f636b56 100644 (file)
@@ -86,9 +86,9 @@
     return self;
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
+    [super viewDidLoad];
     [self setHidden:NO];
 }
 
index 5154f0af28e238adc98ee6fbf820d74444667ba4..5993fdac2ad01020019c9fbb43103984503227e4 100644 (file)
     self.chapterTitles = job.chapterTitles;
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
+    [super viewDidLoad];
     self.table.doubleAction = @selector(doubleClickAction:);
 }
 
index 4e38c5852a96e5686a8ad682c15167101e659233..16c48d5c22b71e1bda5330373711c3f7c3bd2b09 100644 (file)
 
 @property (nonatomic, weak) IBOutlet HBToolbarBadgedItem *showQueueToolbarItem;
 
-@property (nonatomic, unsafe_unretained) IBOutlet NSView *openTitleView;
+@property (nonatomic, weak) IBOutlet NSView *openTitleView;
 @property (nonatomic, readwrite) BOOL scanSpecificTitle;
 @property (nonatomic, readwrite) NSInteger scanSpecificTitleIdx;
 
index 26638216692b63643a6cacd32a0be3868b452610..f92abfdf59e160616aac27f1f61d959a69930afc 100644 (file)
@@ -60,7 +60,6 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
 @property (nonatomic, readwrite) NSTimeInterval modifiedTime;
 
 @property (nonatomic, readonly) NSSet *objectClasses;
-@property (nonatomic, readonly) BOOL requiresSecureCoding;
 
 @property (nonatomic, readonly) sem_t *mutex;
 @property (nonatomic, readwrite) uint32_t mutexCount;
@@ -78,12 +77,6 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
         _array = [[NSMutableArray alloc] init];
         _objectClasses = [NSSet setWithObjects:[NSMutableArray class], objectClass, nil];
 
-        // Enable secure coding only on 10.9 and later
-        if ([NSURL instancesRespondToSelector:@selector(fileSystemRepresentation)])
-        {
-            _requiresSecureCoding = YES;
-        }
-
         NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
         NSArray *runningInstances = [NSRunningApplication runningApplicationsWithBundleIdentifier:identifier];
         const char *name = [NSString stringWithFormat:@"%@/%@", identifier, _fileURL.lastPathComponent.stringByDeletingPathExtension].UTF8String;
@@ -204,18 +197,11 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
     NSMutableArray *jobsArray = nil;
     @try
     {
-        if (self.requiresSecureCoding)
-        {
-            NSData *queue = [NSData dataWithContentsOfURL:self.fileURL];
-            NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:queue];
-            unarchiver.requiresSecureCoding = YES;
-            jobsArray = [unarchiver decodeObjectOfClasses:self.objectClasses forKey:NSKeyedArchiveRootObjectKey];
-            [unarchiver finishDecoding];
-        }
-        else
-        {
-            jobsArray = [NSKeyedUnarchiver unarchiveObjectWithFile:self.fileURL.path];
-        }
+        NSData *queue = [NSData dataWithContentsOfURL:self.fileURL];
+        NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:queue];
+        unarchiver.requiresSecureCoding = YES;
+        jobsArray = [unarchiver decodeObjectOfClasses:self.objectClasses forKey:NSKeyedArchiveRootObjectKey];
+        [unarchiver finishDecoding];
     }
     @catch (NSException *exception)
     {
index 4ac16e1eaa3a3ccbbd701aadd77bf990b513e3d2..da417bf029b7ec8b66f01e90c439f68bd9938867 100644 (file)
     return @"HBEncodingProgressHUDController";
 }
 
-- (void)loadView
-{
-    [super loadView];
-
-    if (NSClassFromString(@"NSVisualEffectView") == NO)
-    {
-        self.infoLabel.textColor = [NSColor whiteColor];
-    }
-}
-
 - (BOOL)canBeHidden
 {
     return NO;
index 1312e1a5d98775473ff1fc1a69e3289c473f3c42..8db23767b63f352112d4ef82086ccb6a56ce0691 100644 (file)
     return @"HBPictureHUDController";
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
-
-    if (NSClassFromString(@"NSVisualEffectView") == NO)
-    {
-        self.scaleLabel.textColor = [NSColor whiteColor];
-        self.infoLabel.textColor = [NSColor whiteColor];
-        self.durationLabel.textColor = [NSColor whiteColor];
-        self.durationUnitLabel.textColor = [NSColor whiteColor];
-    }
+    [super viewDidLoad];
 
     // we set the preview length popup in seconds
     [self.durationPopUp removeAllItems];
index 82b68b494aa0c65b89e112616b84d3a363e50d1f..311a2b0d54a3f14ecb94d4be571ad1f12fdc7836 100644 (file)
@@ -32,9 +32,9 @@
     return @"HBPlayerHUDController";
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
+    [super viewDidLoad];
 
     if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
         _monospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular]};
     {
         [self _buildTracksMenu];
 
-        // 10.7 does not supports weak NSViewController,
-        // so use self and disable the warning for now.
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warc-retain-cycles"
+        __weak HBPlayerHUDController *weakSelf = self;
 
         self.periodicObserver = [self.player addPeriodicTimeObserverUsingBlock:^(NSTimeInterval time) {
-            [self _refreshUI];
+            [weakSelf _refreshUI];
         }];
 
         self.rateObserver = [self.player addRateObserverUsingBlock:^{
-            if (self.player.rate != 0.0)
+            if (weakSelf.player.rate != 0.0)
             {
-                self.playButton.image = [NSImage imageNamed:@"PauseTemplate"];
+                weakSelf.playButton.image = [NSImage imageNamed:@"PauseTemplate"];
             }
             else
             {
-                self.playButton.image = [NSImage imageNamed:@"PlayTemplate"];
+                weakSelf.playButton.image = [NSImage imageNamed:@"PlayTemplate"];
             }
         }];
 
index 753f371fbd6329382795ebe13440abf01fa086ad..aa02821f6ecc26552da5d8b5deff2b2dbf4c2dff 100644 (file)
 }
 
 /**
- * -[HBPreferencesController awakeFromNib]
  *
  * Called after all the outlets in the nib file have been attached. Sets up the
  * toolbar and shows the "General" pane.
  *
  */
-- (void) awakeFromNib
+- (void)windowDidLoad
 {
-    NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"];
+    NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"];
     [toolbar setDelegate: self];
     [toolbar setAllowsUserCustomization: NO];
     [toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel];
             view.hidden = YES;
 
             [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
-                if ([context respondsToSelector:@selector(setAllowsImplicitAnimation:)] && NSClassFromString(@"NSVisualEffectView"))
+                if ([context respondsToSelector:@selector(setAllowsImplicitAnimation:)])
                 {
                     context.allowsImplicitAnimation = YES;
                 }
index 17e174f56055892be76123ece53606871e0e98e5..b2888d30fe78e8be80c4347dd864f3ba032f388d 100644 (file)
@@ -83,9 +83,9 @@ static void *HBPresetsViewControllerContext = &HBPresetsViewControllerContext;
     return self;
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
+    [super viewDidLoad];
 
     if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_10)
     {
index ff97ad2746d374dd328716235f9f8d99f00f8e58..3f10b7c10756537ef91f86802c047d262475fc71 100644 (file)
@@ -57,9 +57,7 @@
 
     _backLayer = [CALayer layer];
     [_backLayer setBounds:CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height)];
-    CGColorRef white = CGColorCreateGenericRGB(1.0, 1.0, 1.0, 1.0);
-    [_backLayer setBackgroundColor: white];
-    CFRelease(white);
+    [_backLayer setBackgroundColor: NSColor.whiteColor.CGColor];
     [_backLayer setShadowOpacity:0.5f];
     [_backLayer setShadowOffset:CGSizeMake(0, 0)];
     [_backLayer setAnchorPoint:CGPointMake(0, 0)];
index a9e275e28bc0b95541e205563d8f7b85781362ab..ca63d424a5c06d51a1c735f538e30291ba0f9b36 100644 (file)
@@ -38,9 +38,9 @@
     return self;
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
+    [super viewDidLoad];
     self.visible = YES;
     self.previewView.showShadow = NO;
 
index 453f313521de71b4f812a6b0b75c68c487a36c7e..4437677257a580eeb6797ac25f9e02584197be22 100644 (file)
@@ -52,9 +52,9 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo
     return self;
 }
 
-- (void)loadView
+- (void)viewDidLoad
 {
-    [super loadView];
+    [super viewDidLoad];
     self.previewViewController.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     self.previewViewController.view.frame = NSMakeRect(0, 0, self.previewView.frame.size.width, self.previewView.frame.size.height);
     [self.previewView addSubview:self.previewViewController.view];
@@ -117,16 +117,13 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo
     }
     else if (context == HBSummaryViewControllerContainerContext)
     {
-        if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_10 && change[NSKeyValueChangeNewKey])
+        if ([change[NSKeyValueChangeNewKey] integerValue] & 0x030000)
         {
-            if ([change[NSKeyValueChangeNewKey] integerValue] & 0x030000)
-            {
-                self.bottomOptionsConstrain.active = YES;
-            }
-            else
-            {
-                self.bottomOptionsConstrain.active = NO;
-            }
+            self.bottomOptionsConstrain.active = YES;
+        }
+        else
+        {
+            self.bottomOptionsConstrain.active = NO;
         }
         [self updateTracks:nil];
     }
index dfce12f5b975a16cfc754d8613124e40ca464d9f..bae3ab1339ffe7f197e6c72f8cb2a5983646fb9a 100644 (file)
 
 #pragma mark -- Private Methods
 
-- (CGColorRef)copyNSColorToCGColor:(NSColor *)color
-{
-    // CGColor property of NSColor has been added only in 10.8,
-    // we need to support 10.7 too.
-    NSInteger numberOfComponents = [color numberOfComponents];
-    CGFloat components[numberOfComponents];
-    CGColorSpaceRef colorSpace = [[color colorSpace] CGColorSpace];
-    [color getComponents:(CGFloat *)&components];
-    CGColorRef cgColor = CGColorCreate(colorSpace, components);
-
-    return cgColor;
-}
-
 - (void)HB_refreshBadge
 {
     if (_badgeValue.length)
         CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, radius);
         CGContextAddArcToPoint(context, minx, maxy, minx, midy, radius);
         CGContextClosePath(context);
-        CGColorRef fillColor = [self copyNSColorToCGColor:_badgeFillColor];
+        CGColorRef fillColor = _badgeFillColor.CGColor;
         CGContextSetFillColorWithColor(context,fillColor);
-        CFRelease(fillColor);
         CGContextDrawPath(context, kCGPathFill);
 
         // Draw the text