diff options
author | Damiano Galassi <[email protected]> | 2018-06-08 16:59:25 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2018-06-08 16:59:25 +0200 |
commit | c762b2c0ec5b6fb58d1fd453e2b5aed526c6d693 (patch) | |
tree | e0ab43c5ddd28ed876158b689be0c93c2380d970 | |
parent | de7355d5ad5257c4cce5e0a99fffb3ee58264ba0 (diff) |
MacGui: set the minimum deployment target to 10.10. Remove Growl and use macOS standard notifications. Remove deprecated API usage and code that doesn't compile anymore (QTKit).
50 files changed, 289 insertions, 2119 deletions
diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib index 6cc1caf51..dccbacc02 100644 --- a/macosx/English.lproj/PictureSettings.xib +++ b/macosx/English.lproj/PictureSettings.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13168.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment identifier="macosx"/> <development version="8000" identifier="xcode"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13168.3"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/> <capability name="box content view" minToolsVersion="7.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -287,7 +287,7 @@ <button id="45"> <rect key="frame" x="73" y="57" width="125" height="18"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> - <buttonCell key="cell" type="check" title="Keep Aspect Ratio" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="170" customClass="HBHUDButtonCell"> + <buttonCell key="cell" type="check" title="Keep Aspect Ratio" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="170"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="smallSystem"/> </buttonCell> @@ -344,13 +344,13 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxTopCrop" id="Kft-ci-UbK"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="Vp0-sU-c5s"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> <binding destination="-2" name="value" keyPath="self.picture.cropTop" previousBinding="Kft-ci-UbK" id="Zqw-Pu-qi1"/> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxTopCrop" id="Kft-ci-UbK"/> </connections> </stepper> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="15"> @@ -360,13 +360,13 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxRightCrop" id="Fyc-RI-h9A"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="5QD-Dh-bzl"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> <binding destination="-2" name="value" keyPath="self.picture.cropRight" previousBinding="Fyc-RI-h9A" id="L3c-i2-kQY"/> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxRightCrop" id="Fyc-RI-h9A"/> </connections> </stepper> <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autosizesCells="NO" id="16"> @@ -375,17 +375,17 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> <size key="cellSize" width="90" height="20"/> <size key="intercellSpacing" width="2" height="3"/> - <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="small" inset="2" id="178" customClass="HBHUDButtonCell"> + <buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" controlSize="small" inset="2" id="178"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="smallSystem"/> </buttonCell> <cells> <column> - <buttonCell type="radio" title="Automatic" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="17" customClass="HBHUDButtonCell"> + <buttonCell type="radio" title="Automatic" imagePosition="left" alignment="left" controlSize="small" state="on" inset="2" id="17"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="smallSystem"/> </buttonCell> - <buttonCell type="radio" title="Custom:" imagePosition="left" alignment="left" controlSize="small" inset="2" id="18" customClass="HBHUDButtonCell"> + <buttonCell type="radio" title="Custom:" imagePosition="left" alignment="left" controlSize="small" inset="2" id="18"> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <font key="font" metaFont="smallSystem"/> </buttonCell> @@ -450,13 +450,13 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxLeftCrop" id="CcF-LX-2Wg"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="WmV-2A-EDo"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> <binding destination="-2" name="value" keyPath="self.picture.cropLeft" previousBinding="CcF-LX-2Wg" id="VtG-0s-YHK"/> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxLeftCrop" id="CcF-LX-2Wg"/> </connections> </stepper> <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="11"> @@ -488,13 +488,13 @@ <font key="font" metaFont="smallSystem"/> </stepperCell> <connections> - <binding destination="-2" name="maxValue" keyPath="self.picture.maxBottomCrop" id="YKW-no-4sN"/> <binding destination="-2" name="enabled" keyPath="self.picture.autocrop" id="soK-UE-pde"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> <binding destination="-2" name="value" keyPath="self.picture.cropBottom" previousBinding="YKW-no-4sN" id="4AO-dA-bmi"/> + <binding destination="-2" name="maxValue" keyPath="self.picture.maxBottomCrop" id="YKW-no-4sN"/> </connections> </stepper> <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="382"> diff --git a/macosx/Growl.framework/Growl b/macosx/Growl.framework/Growl deleted file mode 120000 index 85956e2d2..000000000 --- a/macosx/Growl.framework/Growl +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Growl
\ No newline at end of file diff --git a/macosx/Growl.framework/Headers b/macosx/Growl.framework/Headers deleted file mode 120000 index a177d2a6b..000000000 --- a/macosx/Growl.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers
\ No newline at end of file diff --git a/macosx/Growl.framework/Resources b/macosx/Growl.framework/Resources deleted file mode 120000 index 953ee36f3..000000000 --- a/macosx/Growl.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources
\ No newline at end of file diff --git a/macosx/Growl.framework/Versions/A/Growl b/macosx/Growl.framework/Versions/A/Growl Binary files differdeleted file mode 100755 index 395dd2b69..000000000 --- a/macosx/Growl.framework/Versions/A/Growl +++ /dev/null diff --git a/macosx/Growl.framework/Versions/A/Headers/Growl.h b/macosx/Growl.framework/Versions/A/Headers/Growl.h deleted file mode 100644 index 7b1a3247d..000000000 --- a/macosx/Growl.framework/Versions/A/Headers/Growl.h +++ /dev/null @@ -1,5 +0,0 @@ -#include <Growl/GrowlDefines.h> - -#ifdef __OBJC__ -# include <Growl/GrowlApplicationBridge.h> -#endif diff --git a/macosx/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h b/macosx/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h deleted file mode 100644 index 0bf3583e5..000000000 --- a/macosx/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h +++ /dev/null @@ -1,567 +0,0 @@ -// -// GrowlApplicationBridge.h -// Growl -// -// Created by Evan Schoenberg on Wed Jun 16 2004. -// Copyright 2004-2006 The Growl Project. All rights reserved. -// - -/*! - * @header GrowlApplicationBridge.h - * @abstract Defines the GrowlApplicationBridge class. - * @discussion This header defines the GrowlApplicationBridge class as well as - * the GROWL_PREFPANE_BUNDLE_IDENTIFIER constant. - */ - -#ifndef __GrowlApplicationBridge_h__ -#define __GrowlApplicationBridge_h__ - -#import <Foundation/Foundation.h> -#import <AppKit/AppKit.h> -#import <Growl/GrowlDefines.h> - -//Forward declarations -@protocol GrowlApplicationBridgeDelegate; - -//------------------------------------------------------------------------------ -#pragma mark - - -/*! - * @class GrowlApplicationBridge - * @abstract A class used to interface with Growl. - * @discussion This class provides a means to interface with Growl. - * - * Currently it provides a way to detect if Growl is installed and launch the - * GrowlHelperApp if it's not already running. - */ -@interface GrowlApplicationBridge : NSObject { - -} - -/*! - * @method isGrowlInstalled - * @abstract Detects whether Growl is installed. - * @discussion Determines if the Growl prefpane and its helper app are installed. - * @result this method will forever return YES. - */ -+ (BOOL) isGrowlInstalled __attribute__((deprecated)); - -/*! - * @method isGrowlRunning - * @abstract Detects whether GrowlHelperApp is currently running. - * @discussion Cycles through the process list to find whether GrowlHelperApp is running and returns its findings. - * @result Returns YES if GrowlHelperApp is running, NO otherwise. - */ -+ (BOOL) isGrowlRunning; - - -/*! - * @method isMistEnabled - * @abstract Gives the caller a fairly good indication of whether or not built-in notifications(Mist) will be used. - * @discussion since this call makes use of isGrowlRunning it is entirely possible for this value to change between call and - * executing a notification dispatch - * @result Returns YES if Growl isn't reachable and the developer has not opted-out of - * Mist and the user hasn't set the global mist enable key to false. - */ -+ (BOOL)isMistEnabled; - -/*! - * @method setShouldUseBuiltInNotifications - * @abstract opt-out mechanism for the mist notification style in the event growl can't be reached. - * @discussion if growl is unavailable due to not being installed or as a result of being turned off then - * this option can enable/disable a built-in fire and forget display style - * @param should Specifies whether or not the developer wants to opt-in (default) or opt out - * of the built-in Mist style in the event Growl is unreachable. - */ -+ (void)setShouldUseBuiltInNotifications:(BOOL)should; - -/*! - * @method shouldUseBuiltInNotifications - * @abstract returns the current opt-in state of the framework's use of the Mist display style. - * @result Returns NO if the developer opt-ed out of Mist, the default value is YES. - */ -+ (BOOL)shouldUseBuiltInNotifications; - -#pragma mark - - -/*! - * @method setGrowlDelegate: - * @abstract Set the object which will be responsible for providing and receiving Growl information. - * @discussion This must be called before using GrowlApplicationBridge. - * - * The methods in the GrowlApplicationBridgeDelegate protocol are required - * and return the basic information needed to register with Growl. - * - * The methods in the GrowlApplicationBridgeDelegate_InformalProtocol - * informal protocol are individually optional. They provide a greater - * degree of interaction between the application and growl such as informing - * the application when one of its Growl notifications is clicked by the user. - * - * The methods in the GrowlApplicationBridgeDelegate_Installation_InformalProtocol - * informal protocol are individually optional and are only applicable when - * using the Growl-WithInstaller.framework which allows for automated Growl - * installation. - * - * When this method is called, data will be collected from inDelegate, Growl - * will be launched if it is not already running, and the application will be - * registered with Growl. - * - * If using the Growl-WithInstaller framework, if Growl is already installed - * but this copy of the framework has an updated version of Growl, the user - * will be prompted to update automatically. - * - * @param inDelegate The delegate for the GrowlApplicationBridge. It must conform to the GrowlApplicationBridgeDelegate protocol. - */ -+ (void) setGrowlDelegate:(id<GrowlApplicationBridgeDelegate>)inDelegate; - -/*! - * @method growlDelegate - * @abstract Return the object responsible for providing and receiving Growl information. - * @discussion See setGrowlDelegate: for details. - * @result The Growl delegate. - */ -+ (id<GrowlApplicationBridgeDelegate>) growlDelegate; - -#pragma mark - - -/*! - * @method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext: - * @abstract Send a Growl notification. - * @discussion This is the preferred means for sending a Growl notification. - * The notification name and at least one of the title and description are - * required (all three are preferred). All other parameters may be - * <code>nil</code> (or 0 or NO as appropriate) to accept default values. - * - * If using the Growl-WithInstaller framework, if Growl is not installed the - * user will be prompted to install Growl. If the user cancels, this method - * will have no effect until the next application session, at which time when - * it is called the user will be prompted again. The user is also given the - * option to not be prompted again. If the user does choose to install Growl, - * the requested notification will be displayed once Growl is installed and - * running. - * - * @param title The title of the notification displayed to the user. - * @param description The full description of the notification displayed to the user. - * @param notifName The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane. - * @param iconData <code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead. - * @param priority The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority. - * @param isSticky If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications. - * @param clickContext A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types). - */ -+ (void) notifyWithTitle:(NSString *)title - description:(NSString *)description - notificationName:(NSString *)notifName - iconData:(NSData *)iconData - priority:(signed int)priority - isSticky:(BOOL)isSticky - clickContext:(id)clickContext; - -/*! - * @method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:identifier: - * @abstract Send a Growl notification. - * @discussion This is the preferred means for sending a Growl notification. - * The notification name and at least one of the title and description are - * required (all three are preferred). All other parameters may be - * <code>nil</code> (or 0 or NO as appropriate) to accept default values. - * - * If using the Growl-WithInstaller framework, if Growl is not installed the - * user will be prompted to install Growl. If the user cancels, this method - * will have no effect until the next application session, at which time when - * it is called the user will be prompted again. The user is also given the - * option to not be prompted again. If the user does choose to install Growl, - * the requested notification will be displayed once Growl is installed and - * running. - * - * @param title The title of the notification displayed to the user. - * @param description The full description of the notification displayed to the user. - * @param notifName The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane. - * @param iconData <code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead. - * @param priority The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority. - * @param isSticky If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications. - * @param clickContext A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types). - * @param identifier An identifier for this notification. Notifications with equal identifiers are coalesced. - */ -+ (void) notifyWithTitle:(NSString *)title - description:(NSString *)description - notificationName:(NSString *)notifName - iconData:(NSData *)iconData - priority:(signed int)priority - isSticky:(BOOL)isSticky - clickContext:(id)clickContext - identifier:(NSString *)identifier; - -/*! @method notifyWithDictionary: - * @abstract Notifies using a userInfo dictionary suitable for passing to - * <code>NSDistributedNotificationCenter</code>. - * @param userInfo The dictionary to notify with. - * @discussion Before Growl 0.6, your application would have posted - * notifications using <code>NSDistributedNotificationCenter</code> by - * creating a userInfo dictionary with the notification data. This had the - * advantage of allowing you to add other data to the dictionary for programs - * besides Growl that might be listening. - * - * This method allows you to use such dictionaries without being restricted - * to using <code>NSDistributedNotificationCenter</code>. The keys for this dictionary - * can be found in GrowlDefines.h. - */ -+ (void) notifyWithDictionary:(NSDictionary *)userInfo; - -#pragma mark - - -/*! @method registerWithDictionary: - * @abstract Register your application with Growl without setting a delegate. - * @discussion When you call this method with a dictionary, - * GrowlApplicationBridge registers your application using that dictionary. - * If you pass <code>nil</code>, GrowlApplicationBridge will ask the delegate - * (if there is one) for a dictionary, and if that doesn't work, it will look - * in your application's bundle for an auto-discoverable plist. - * (XXX refer to more information on that) - * - * If you pass a dictionary to this method, it must include the - * <code>GROWL_APP_NAME</code> key, unless a delegate is set. - * - * This method is mainly an alternative to the delegate system introduced - * with Growl 0.6. Without a delegate, you cannot receive callbacks such as - * <code>-growlIsReady</code> (since they are sent to the delegate). You can, - * however, set a delegate after registering without one. - * - * This method was introduced in Growl.framework 0.7. - */ -+ (BOOL) registerWithDictionary:(NSDictionary *)regDict; - -/*! @method reregisterGrowlNotifications - * @abstract Reregister the notifications for this application. - * @discussion This method does not normally need to be called. If your - * application changes what notifications it is registering with Growl, call - * this method to have the Growl delegate's - * <code>-registrationDictionaryForGrowl</code> method called again and the - * Growl registration information updated. - * - * This method is now implemented using <code>-registerWithDictionary:</code>. - */ -+ (void) reregisterGrowlNotifications; - -#pragma mark - - -/*! @method setWillRegisterWhenGrowlIsReady: - * @abstract Tells GrowlApplicationBridge to register with Growl when Growl - * launches (or not). - * @discussion When Growl has started listening for notifications, it posts a - * <code>GROWL_IS_READY</code> notification on the Distributed Notification - * Center. GrowlApplicationBridge listens for this notification, using it to - * perform various tasks (such as calling your delegate's - * <code>-growlIsReady</code> method, if it has one). If this method is - * called with <code>YES</code>, one of those tasks will be to reregister - * with Growl (in the manner of <code>-reregisterGrowlNotifications</code>). - * - * This attribute is automatically set back to <code>NO</code> (the default) - * after every <code>GROWL_IS_READY</code> notification. - * @param flag <code>YES</code> if you want GrowlApplicationBridge to register with - * Growl when next it is ready; <code>NO</code> if not. - */ -+ (void) setWillRegisterWhenGrowlIsReady:(BOOL)flag; - -/*! @method willRegisterWhenGrowlIsReady - * @abstract Reports whether GrowlApplicationBridge will register with Growl - * when Growl next launches. - * @result <code>YES</code> if GrowlApplicationBridge will register with Growl - * when next it posts GROWL_IS_READY; <code>NO</code> if not. - */ -+ (BOOL) willRegisterWhenGrowlIsReady; - -#pragma mark - - -/*! @method registrationDictionaryFromDelegate - * @abstract Asks the delegate for a registration dictionary. - * @discussion If no delegate is set, or if the delegate's - * <code>-registrationDictionaryForGrowl</code> method returns - * <code>nil</code>, this method returns <code>nil</code>. - * - * This method does not attempt to clean up the dictionary in any way - for - * example, if it is missing the <code>GROWL_APP_NAME</code> key, the result - * will be missing it too. Use <code>+[GrowlApplicationBridge - * registrationDictionaryByFillingInDictionary:]</code> or - * <code>+[GrowlApplicationBridge - * registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try - * to fill in missing keys. - * - * This method was introduced in Growl.framework 0.7. - * @result A registration dictionary. - */ -+ (NSDictionary *) registrationDictionaryFromDelegate; - -/*! @method registrationDictionaryFromBundle: - * @abstract Looks in a bundle for a registration dictionary. - * @discussion This method looks in a bundle for an auto-discoverable - * registration dictionary file using <code>-[NSBundle - * pathForResource:ofType:]</code>. If it finds one, it loads the file using - * <code>+[NSDictionary dictionaryWithContentsOfFile:]</code> and returns the - * result. - * - * If you pass <code>nil</code> as the bundle, the main bundle is examined. - * - * This method does not attempt to clean up the dictionary in any way - for - * example, if it is missing the <code>GROWL_APP_NAME</code> key, the result - * will be missing it too. Use <code>+[GrowlApplicationBridge - * registrationDictionaryByFillingInDictionary:]</code> or - * <code>+[GrowlApplicationBridge - * registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try - * to fill in missing keys. - * - * This method was introduced in Growl.framework 0.7. - * @result A registration dictionary. - */ -+ (NSDictionary *) registrationDictionaryFromBundle:(NSBundle *)bundle; - -/*! @method bestRegistrationDictionary - * @abstract Obtains a registration dictionary, filled out to the best of - * GrowlApplicationBridge's knowledge. - * @discussion This method creates a registration dictionary as best - * GrowlApplicationBridge knows how. - * - * First, GrowlApplicationBridge contacts the Growl delegate (if there is - * one) and gets the registration dictionary from that. If no such dictionary - * was obtained, GrowlApplicationBridge looks in your application's main - * bundle for an auto-discoverable registration dictionary file. If that - * doesn't exist either, this method returns <code>nil</code>. - * - * Second, GrowlApplicationBridge calls - * <code>+registrationDictionaryByFillingInDictionary:</code> with whatever - * dictionary was obtained. The result of that method is the result of this - * method. - * - * GrowlApplicationBridge uses this method when you call - * <code>+setGrowlDelegate:</code>, or when you call - * <code>+registerWithDictionary:</code> with <code>nil</code>. - * - * This method was introduced in Growl.framework 0.7. - * @result A registration dictionary. - */ -+ (NSDictionary *) bestRegistrationDictionary; - -#pragma mark - - -/*! @method registrationDictionaryByFillingInDictionary: - * @abstract Tries to fill in missing keys in a registration dictionary. - * @discussion This method examines the passed-in dictionary for missing keys, - * and tries to work out correct values for them. As of 0.7, it uses: - * - * Key Value - * --- ----- - * <code>GROWL_APP_NAME</code> <code>CFBundleExecutableName</code> - * <code>GROWL_APP_ICON_DATA</code> The data of the icon of the application. - * <code>GROWL_APP_LOCATION</code> The location of the application. - * <code>GROWL_NOTIFICATIONS_DEFAULT</code> <code>GROWL_NOTIFICATIONS_ALL</code> - * - * Keys are only filled in if missing; if a key is present in the dictionary, - * its value will not be changed. - * - * This method was introduced in Growl.framework 0.7. - * @param regDict The dictionary to fill in. - * @result The dictionary with the keys filled in. This is an autoreleased - * copy of <code>regDict</code>. - */ -+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict; - -/*! @method registrationDictionaryByFillingInDictionary:restrictToKeys: - * @abstract Tries to fill in missing keys in a registration dictionary. - * @discussion This method examines the passed-in dictionary for missing keys, - * and tries to work out correct values for them. As of 0.7, it uses: - * - * Key Value - * --- ----- - * <code>GROWL_APP_NAME</code> <code>CFBundleExecutableName</code> - * <code>GROWL_APP_ICON_DATA</code> The data of the icon of the application. - * <code>GROWL_APP_LOCATION</code> The location of the application. - * <code>GROWL_NOTIFICATIONS_DEFAULT</code> <code>GROWL_NOTIFICATIONS_ALL</code> - * - * Only those keys that are listed in <code>keys</code> will be filled in. - * Other missing keys are ignored. Also, keys are only filled in if missing; - * if a key is present in the dictionary, its value will not be changed. - * - * This method was introduced in Growl.framework 0.7. - * @param regDict The dictionary to fill in. - * @param keys The keys to fill in. If <code>nil</code>, any missing keys are filled in. - * @result The dictionary with the keys filled in. This is an autoreleased - * copy of <code>regDict</code>. - */ -+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys; - -/*! @brief Tries to fill in missing keys in a notification dictionary. - * @param notifDict The dictionary to fill in. - * @return The dictionary with the keys filled in. This will be a separate instance from \a notifDict. - * @discussion This function examines the \a notifDict for missing keys, and - * tries to get them from the last known registration dictionary. As of 1.1, - * the keys that it will look for are: - * - * \li <code>GROWL_APP_NAME</code> - * \li <code>GROWL_APP_ICON_DATA</code> - * - * @since Growl.framework 1.1 - */ -+ (NSDictionary *) notificationDictionaryByFillingInDictionary:(NSDictionary *)regDict; - -+ (NSDictionary *) frameworkInfoDictionary; - -#pragma mark - - -/*! - *@method growlURLSchemeAvailable - *@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this - *@return Returns whether growl:// is registered on the system - *@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function - * Further, this method can provide a check on whether Growl is installed, - * however, the framework will not be relying on this method for choosing when/how to notify, - * and it is not recommended that the app rely on it for other than whether to use growl:// methods - *@since Growl.framework 1.4 - */ -+ (BOOL) isGrowlURLSchemeAvailable; - -/*! - * @method openGrowlPreferences: - * @abstract Open Growl preferences, optionally to this app's settings, growl:// method - * @param showApp Whether to show the application's settings, otherwise just opens to the last position - * @return Returns whether opening the URL was successful or not. - * @discussion Will launch if Growl is installed, but not running, and open the preferences window - * Uses growl:// URL scheme - * @since Growl.framework 1.4 - */ -+ (BOOL) openGrowlPreferences:(BOOL)showApp; - -@end - -//------------------------------------------------------------------------------ -#pragma mark - - -/*! - * @protocol GrowlApplicationBridgeDelegate - * @abstract Required protocol for the Growl delegate. - * @discussion The methods in this protocol are optional and are called - * automatically as needed by GrowlApplicationBridge. See - * <code>+[GrowlApplicationBridge setGrowlDelegate:]</code>. - * See also <code>GrowlApplicationBridgeDelegate_InformalProtocol</code>. - */ - -@protocol GrowlApplicationBridgeDelegate <NSObject> - -@optional - -/*! - * @method registrationDictionaryForGrowl - * @abstract Return the dictionary used to register this application with Growl. - * @discussion The returned dictionary gives Growl the complete list of - * notifications this application will ever send, and it also specifies which - * notifications should be enabled by default. Each is specified by an array - * of <code>NSString</code> objects. - * - * For most applications, these two arrays can be the same (if all sent - * notifications should be displayed by default). - * - * The <code>NSString</code> objects of these arrays will correspond to the - * <code>notificationName:</code> parameter passed in - * <code>+[GrowlApplicationBridge - * notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:]</code> calls. - * - * The dictionary should have the required key object pairs: - * key: GROWL_NOTIFICATIONS_ALL object: <code>NSArray</code> of <code>NSString</code> objects - * key: GROWL_NOTIFICATIONS_DEFAULT object: <code>NSArray</code> of <code>NSString</code> objects - * - * The dictionary may have the following key object pairs: - * key: GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES object: <code>NSDictionary</code> of key: notification name object: human-readable notification name - * - * You do not need to implement this method if you have an auto-discoverable - * plist file in your app bundle. (XXX refer to more information on that) - * - * @result The <code>NSDictionary</code> to use for registration. - */ -- (NSDictionary *) registrationDictionaryForGrowl; - -/*! - * @method applicationNameForGrowl - * @abstract Return the name of this application which will be used for Growl bookkeeping. - * @discussion This name is used both internally and in the Growl preferences. - * - * This should remain stable between different versions and incarnations of - * your application. - * For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and - * "SurfWriter Lite" are not. - * - * You do not need to implement this method if you are providing the - * application name elsewhere, meaning in an auto-discoverable plist file in - * your app bundle (XXX refer to more information on that) or in the result - * of -registrationDictionaryForGrowl. - * - * @result The name of the application using Growl. - */ -- (NSString *) applicationNameForGrowl; - -/*! - * @method applicationIconForGrowl - * @abstract Return the <code>NSImage</code> to treat as the application icon. - * @discussion The delegate may optionally return an <code>NSImage</code> - * object to use as the application icon. If this method is not implemented, - * {{{-applicationIconDataForGrowl}}} is tried. If that method is not - * implemented, the application's own icon is used. Neither method is - * generally needed. - * @result The <code>NSImage</code> to treat as the application icon. - */ -- (NSImage *) applicationIconForGrowl; - -/*! - * @method applicationIconDataForGrowl - * @abstract Return the <code>NSData</code> to treat as the application icon. - * @discussion The delegate may optionally return an <code>NSData</code> - * object to use as the application icon; if this is not implemented, the - * application's own icon is used. This is not generally needed. - * @result The <code>NSData</code> to treat as the application icon. - * @deprecated In version 1.1, in favor of {{{-applicationIconForGrowl}}}. - */ -- (NSData *) applicationIconDataForGrowl; - -/*! - * @method growlIsReady - * @abstract Informs the delegate that Growl has launched. - * @discussion Informs the delegate that Growl (specifically, the - * GrowlHelperApp) was launched successfully. The application can take actions - * with the knowledge that Growl is installed and functional. - */ -- (void) growlIsReady; - -/*! - * @method growlNotificationWasClicked: - * @abstract Informs the delegate that a Growl notification was clicked. - * @discussion Informs the delegate that a Growl notification was clicked. It - * is only sent for notifications sent with a non-<code>nil</code> - * clickContext, so if you want to receive a message when a notification is - * clicked, clickContext must not be <code>nil</code> when calling - * <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>. - * @param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:]. - */ -- (void) growlNotificationWasClicked:(id)clickContext; - -/*! - * @method growlNotificationTimedOut: - * @abstract Informs the delegate that a Growl notification timed out. - * @discussion Informs the delegate that a Growl notification timed out. It - * is only sent for notifications sent with a non-<code>nil</code> - * clickContext, so if you want to receive a message when a notification is - * clicked, clickContext must not be <code>nil</code> when calling - * <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>. - * @param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:]. - */ -- (void) growlNotificationTimedOut:(id)clickContext; - - -/*! - * @method hasNetworkClientEntitlement - * @abstract Used only in sandboxed situations since we don't know whether the app has com.apple.security.network.client entitlement - * @discussion GrowlDelegate calls to find out if we have the com.apple.security.network.client entitlement, - * since we can't find this out without hitting the sandbox. We only call it if we detect that the application is sandboxed. - */ -- (BOOL) hasNetworkClientEntitlement; - -@end - -#pragma mark - - -#endif /* __GrowlApplicationBridge_h__ */ diff --git a/macosx/Growl.framework/Versions/A/Headers/GrowlDefines.h b/macosx/Growl.framework/Versions/A/Headers/GrowlDefines.h deleted file mode 100644 index 0a196f1e3..000000000 --- a/macosx/Growl.framework/Versions/A/Headers/GrowlDefines.h +++ /dev/null @@ -1,386 +0,0 @@ -// -// GrowlDefines.h -// - -#ifndef _GROWLDEFINES_H -#define _GROWLDEFINES_H - -#ifdef __OBJC__ -#define XSTR(x) (@x) -#else -#define XSTR CFSTR -#endif - -/*! @header GrowlDefines.h - * @abstract Defines all the notification keys. - * @discussion Defines all the keys used for registration with Growl and for - * Growl notifications. - * - * Most applications should use the functions or methods of Growl.framework - * instead of posting notifications such as those described here. - * @updated 2004-01-25 - */ - -// UserInfo Keys for Registration -#pragma mark UserInfo Keys for Registration - -/*! @group Registration userInfo keys */ -/* @abstract Keys for the userInfo dictionary of a GROWL_APP_REGISTRATION distributed notification. - * @discussion The values of these keys describe the application and the - * notifications it may post. - * - * Your application must register with Growl before it can post Growl - * notifications (and have them not be ignored). However, as of Growl 0.6, - * posting GROWL_APP_REGISTRATION notifications directly is no longer the - * preferred way to register your application. Your application should instead - * use Growl.framework's delegate system. - * See +[GrowlApplicationBridge setGrowlDelegate:] or Growl_SetDelegate for - * more information. - */ - -/*! @defined GROWL_APP_NAME - * @abstract The name of your application. - * @discussion The name of your application. This should remain stable between - * different versions and incarnations of your application. - * For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and - * "SurfWriter Lite" are not. - */ -#define GROWL_APP_NAME XSTR("ApplicationName") -/*! @defined GROWL_APP_ID - * @abstract The bundle identifier of your application. - * @discussion The bundle identifier of your application. This key should - * be unique for your application while there may be several applications - * with the same GROWL_APP_NAME. - * This key is optional. - */ -#define GROWL_APP_ID XSTR("ApplicationId") -/*! @defined GROWL_APP_ICON_DATA - * @abstract The image data for your application's icon. - * @discussion Image data representing your application's icon. This may be - * superimposed on a notification icon as a badge, used as the notification - * icon when a notification-specific icon is not supplied, or ignored - * altogether, depending on the display. Must be in a format supported by - * NSImage, such as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_APP_ICON_DATA XSTR("ApplicationIcon") -/*! @defined GROWL_NOTIFICATIONS_DEFAULT - * @abstract The array of notifications to turn on by default. - * @discussion These are the names of the notifications that should be enabled - * by default when your application registers for the first time. If your - * application reregisters, Growl will look here for any new notification - * names found in GROWL_NOTIFICATIONS_ALL, but ignore any others. - */ -#define GROWL_NOTIFICATIONS_DEFAULT XSTR("DefaultNotifications") -/*! @defined GROWL_NOTIFICATIONS_ALL - * @abstract The array of all notifications your application can send. - * @discussion These are the names of all of the notifications that your - * application may post. See GROWL_NOTIFICATION_NAME for a discussion of good - * notification names. - */ -#define GROWL_NOTIFICATIONS_ALL XSTR("AllNotifications") -/*! @defined GROWL_NOTIFICATIONS_HUMAN_READABLE_DESCRIPTIONS - * @abstract A dictionary of human-readable names for your notifications. - * @discussion By default, the Growl UI will display notifications by the names given in GROWL_NOTIFICATIONS_ALL - * which correspond to the GROWL_NOTIFICATION_NAME. This dictionary specifies the human-readable name to display. - * The keys of the dictionary are GROWL_NOTIFICATION_NAME strings; the objects are the human-readable versions. - * For any GROWL_NOTIFICATION_NAME not specific in this dictionary, the GROWL_NOTIFICATION_NAME will be displayed. - * - * This key is optional. - */ -#define GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES XSTR("HumanReadableNames") -/*! @defined GROWL_NOTIFICATIONS_DESCRIPTIONS -* @abstract A dictionary of descriptions of _when_ each notification occurs -* @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are -* descriptions of _when_ each notification occurs, such as "You received a new mail message" or -* "A file finished downloading". -* -* This key is optional. -*/ -#define GROWL_NOTIFICATIONS_DESCRIPTIONS XSTR("NotificationDescriptions") -/*! @defined GROWL_NOTIFICATIONS_ICONS - * @abstract A dictionary of icons for each notification - * @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are - * icons for each notification, for GNTP spec - * - * This key is optional. - */ -#define GROWL_NOTIFICATIONS_ICONS XSTR("NotificationIcons") - -/*! @defined GROWL_TICKET_VERSION - * @abstract The version of your registration ticket. - * @discussion Include this key in a ticket plist file that you put in your - * application bundle for auto-discovery. The current ticket version is 1. - */ -#define GROWL_TICKET_VERSION XSTR("TicketVersion") -// UserInfo Keys for Notifications -#pragma mark UserInfo Keys for Notifications - -/*! @group Notification userInfo keys */ -/* @abstract Keys for the userInfo dictionary of a GROWL_NOTIFICATION distributed notification. - * @discussion The values of these keys describe the content of a Growl - * notification. - * - * Not all of these keys are supported by all displays. Only the name, title, - * and description of a notification are universal. Most of the built-in - * displays do support all of these keys, and most other visual displays - * probably will also. But, as of 0.6, the Log, MailMe, and Speech displays - * support only textual data. - */ - -/*! @defined GROWL_NOTIFICATION_NAME - * @abstract The name of the notification. - * @discussion The name of the notification. Note that if you do not define - * GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES when registering your ticket originally this name - * will the one displayed within the Growl preference pane and should be human-readable. - */ -#define GROWL_NOTIFICATION_NAME XSTR("NotificationName") -/*! @defined GROWL_NOTIFICATION_TITLE - * @abstract The title to display in the notification. - * @discussion The title of the notification. Should be very brief. - * The title usually says what happened, e.g. "Download complete". - */ -#define GROWL_NOTIFICATION_TITLE XSTR("NotificationTitle") -/*! @defined GROWL_NOTIFICATION_DESCRIPTION - * @abstract The description to display in the notification. - * @discussion The description should be longer and more verbose than the title. - * The description usually tells the subject of the action, - * e.g. "Growl-0.6.dmg downloaded in 5.02 minutes". - */ -#define GROWL_NOTIFICATION_DESCRIPTION XSTR("NotificationDescription") -/*! @defined GROWL_NOTIFICATION_ICON - * @discussion Image data for the notification icon. Image data must be in a format - * supported by NSImage, such as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_ICON_DATA XSTR("NotificationIcon") -/*! @defined GROWL_NOTIFICATION_APP_ICON - * @discussion Image data for the application icon, in case GROWL_APP_ICON does - * not apply for some reason. Image data be in a format supported by NSImage, such - * as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_APP_ICON_DATA XSTR("NotificationAppIcon") -/*! @defined GROWL_NOTIFICATION_PRIORITY - * @discussion The priority of the notification as an integer number from - * -2 to +2 (+2 being highest). - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_PRIORITY XSTR("NotificationPriority") -/*! @defined GROWL_NOTIFICATION_STICKY - * @discussion A Boolean number controlling whether the notification is sticky. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_STICKY XSTR("NotificationSticky") -/*! @defined GROWL_NOTIFICATION_CLICK_CONTEXT - * @abstract Identifies which notification was clicked. - * @discussion An identifier for the notification for clicking purposes. - * - * This will be passed back to the application when the notification is - * clicked. It must be plist-encodable (a data, dictionary, array, number, or - * string object), and it should be unique for each notification you post. - * A good click context would be a UUID string returned by NSProcessInfo or - * CFUUID. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_CLICK_CONTEXT XSTR("NotificationClickContext") - -/*! @defined GROWL_NOTIFICATION_IDENTIFIER - * @abstract An identifier for the notification for coalescing purposes. - * Notifications with the same identifier fall into the same class; only - * the last notification of a class is displayed on the screen. If a - * notification of the same class is currently being displayed, it is - * replaced by this notification. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_IDENTIFIER XSTR("GrowlNotificationIdentifier") - -/*! @defined GROWL_APP_PID - * @abstract The process identifier of the process which sends this - * notification. If this field is set, the application will only receive - * clicked and timed out notifications which originate from this process. - * - * Optional. - */ -#define GROWL_APP_PID XSTR("ApplicationPID") - -/*! @defined GROWL_NOTIFICATION_PROGRESS -* @abstract If this key is set, it should contain a double value wrapped -* in a NSNumber which describes some sort of progress (from 0.0 to 100.0). -* If this is key is not set, no progress bar is shown. -* -* Optional. Not supported by all display plugins. -*/ -#define GROWL_NOTIFICATION_PROGRESS XSTR("NotificationProgress") - -/*! @defined GROWL_NOTIFICATION_ALREADY_SHOWN - * @abstract If this key is set, it should contain a bool value wrapped - * in a NSNumber which describes whether the notification has - * already been displayed, for instance by built in Notification - * Center support. This value can be used to allow display - * plugins to skip a notification, while still allowing Growl - * actions to run on them. - * - * Optional. Not supported by all display plugins. - */ -#define GROWL_NOTIFICATION_ALREADY_SHOWN XSTR("AlreadyShown") - - -// Notifications -#pragma mark Notifications - -/*! @group Notification names */ -/* @abstract Names of distributed notifications used by Growl. - * @discussion These are notifications used by applications (directly or - * indirectly) to interact with Growl, and by Growl for interaction between - * its components. - * - * Most of these should no longer be used in Growl 0.6 and later, in favor of - * Growl.framework's GrowlApplicationBridge APIs. - */ - -/*! @defined GROWL_APP_REGISTRATION - * @abstract The distributed notification for registering your application. - * @discussion This is the name of the distributed notification that can be - * used to register applications with Growl. - * - * The userInfo dictionary for this notification can contain these keys: - * <ul> - * <li>GROWL_APP_NAME</li> - * <li>GROWL_APP_ICON_DATA</li> - * <li>GROWL_NOTIFICATIONS_ALL</li> - * <li>GROWL_NOTIFICATIONS_DEFAULT</li> - * </ul> - * - * No longer recommended as of Growl 0.6. An alternate method of registering - * is to use Growl.framework's delegate system. - * See +[GrowlApplicationBridge setGrowlDelegate:] or Growl_SetDelegate for - * more information. - */ -#define GROWL_APP_REGISTRATION XSTR("GrowlApplicationRegistrationNotification") -/*! @defined GROWL_APP_REGISTRATION_CONF - * @abstract The distributed notification for confirming registration. - * @discussion The name of the distributed notification sent to confirm the - * registration. Used by the Growl preference pane. Your application probably - * does not need to use this notification. - */ -#define GROWL_APP_REGISTRATION_CONF XSTR("GrowlApplicationRegistrationConfirmationNotification") -/*! @defined GROWL_NOTIFICATION - * @abstract The distributed notification for Growl notifications. - * @discussion This is what it all comes down to. This is the name of the - * distributed notification that your application posts to actually send a - * Growl notification. - * - * The userInfo dictionary for this notification can contain these keys: - * <ul> - * <li>GROWL_NOTIFICATION_NAME (required)</li> - * <li>GROWL_NOTIFICATION_TITLE (required)</li> - * <li>GROWL_NOTIFICATION_DESCRIPTION (required)</li> - * <li>GROWL_NOTIFICATION_ICON</li> - * <li>GROWL_NOTIFICATION_APP_ICON</li> - * <li>GROWL_NOTIFICATION_PRIORITY</li> - * <li>GROWL_NOTIFICATION_STICKY</li> - * <li>GROWL_NOTIFICATION_CLICK_CONTEXT</li> - * <li>GROWL_APP_NAME (required)</li> - * </ul> - * - * No longer recommended as of Growl 0.6. Three alternate methods of posting - * notifications are +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:], - * Growl_NotifyWithTitleDescriptionNameIconPriorityStickyClickContext, and - * Growl_PostNotification. - */ -#define GROWL_NOTIFICATION XSTR("GrowlNotification") -/*! @defined GROWL_PING - * @abstract A distributed notification to check whether Growl is running. - * @discussion This is used by the Growl preference pane. If it receives a - * GROWL_PONG, the preference pane takes this to mean that Growl is running. - */ -#define GROWL_PING XSTR("Honey, Mind Taking Out The Trash") -/*! @defined GROWL_PONG - * @abstract The distributed notification sent in reply to GROWL_PING. - * @discussion GrowlHelperApp posts this in reply to GROWL_PING. - */ -#define GROWL_PONG XSTR("What Do You Want From Me, Woman") -/*! @defined GROWL_IS_READY - * @abstract The distributed notification sent when Growl starts up. - * @discussion GrowlHelperApp posts this when it has begin listening on all of - * its sources for new notifications. GrowlApplicationBridge (in - * Growl.framework), upon receiving this notification, reregisters using the - * registration dictionary supplied by its delegate. - */ -#define GROWL_IS_READY XSTR("Lend Me Some Sugar; I Am Your Neighbor!") - - -/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX - * @abstract Part of the name of the distributed notification sent when a supported notification is clicked. - * @discussion When a Growl notification with a click context is clicked on by - * the user, Growl posts a distributed notification whose name is in the format: - * [NSString stringWithFormat:@"%@-%d-%@", appName, pid, GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX] - * The GrowlApplicationBridge responds to this notification by calling a callback in its delegate. - */ -#define GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX XSTR("GrowlClicked!") - -/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX - * @abstract Part of the name of the distributed notification sent when a supported notification times out without being clicked. - * @discussion When a Growl notification with a click context times out, Growl posts a distributed notification - * whose name is in the format: - * [NSString stringWithFormat:@"%@-%d-%@", appName, pid, GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX] - * The GrowlApplicationBridge responds to this notification by calling a callback in its delegate. - * NOTE: The user may have actually clicked the 'close' button; this triggers an *immediate* time-out of the notification. - */ -#define GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX XSTR("GrowlTimedOut!") - -/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON - * @abstract The distributed notification sent when the Notification Center support is toggled on in Growl 2.0 - * @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent - * to inform all running apps that they should now speak to Notification Center directly. - */ -#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON XSTR("GrowlNotificationCenterOn!") - -/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF - * @abstract The distributed notification sent when the Notification Center support is toggled off in Growl 2.0 - * @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent - * to inform all running apps that they should no longer speak to Notification Center directly. - */ -#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF XSTR("GrowlNotificationCenterOff!") - -/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY - * @abstract The distributed notification sent by an application to query Growl 2.0's notification center support. - * @discussion When an app starts up, it will send this query to get Growl 2.0 to spit out whether notification - * center support is on or off. - */ -#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY XSTR("GrowlNotificationCenterYN?") - - -/*! @group Other symbols */ -/* Symbols which don't fit into any of the other categories. */ - -/*! @defined GROWL_KEY_CLICKED_CONTEXT - * @abstract Used internally as the key for the clickedContext passed over DNC. - * @discussion This key is used in GROWL_NOTIFICATION_CLICKED, and contains the - * click context that was supplied in the original notification. - */ -#define GROWL_KEY_CLICKED_CONTEXT XSTR("ClickedContext") -/*! @defined GROWL_REG_DICT_EXTENSION - * @abstract The filename extension for registration dictionaries. - * @discussion The GrowlApplicationBridge in Growl.framework registers with - * Growl by creating a file with the extension of .(GROWL_REG_DICT_EXTENSION) - * and opening it in the GrowlHelperApp. This happens whether or not Growl is - * running; if it was stopped, it quits immediately without listening for - * notifications. - */ -#define GROWL_REG_DICT_EXTENSION XSTR("growlRegDict") - - -#define GROWL_POSITION_PREFERENCE_KEY @"GrowlSelectedPosition" - -#define GROWL_PLUGIN_CONFIG_ID XSTR("GrowlPluginConfigurationID") - -#endif //ndef _GROWLDEFINES_H diff --git a/macosx/Growl.framework/Versions/A/Resources/Info.plist b/macosx/Growl.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index 6a90f41b9..000000000 --- a/macosx/Growl.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildMachineOSBuild</key> - <string>12C60</string> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>Growl</string> - <key>CFBundleIdentifier</key> - <string>com.growl.growlframework</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundlePackageType</key> - <string>FMWK</string> - <key>CFBundleShortVersionString</key> - <string>2.0.1</string> - <key>CFBundleSignature</key> - <string>GRRR</string> - <key>CFBundleVersion</key> - <string>2.0.1</string> - <key>DTCompiler</key> - <string>com.apple.compilers.llvm.clang.1_0</string> - <key>DTPlatformBuild</key> - <string>4G2008a</string> - <key>DTPlatformVersion</key> - <string>GM</string> - <key>DTSDKBuild</key> - <string>12C37</string> - <key>DTSDKName</key> - <string>macosx10.8</string> - <key>DTXcode</key> - <string>0452</string> - <key>DTXcodeBuild</key> - <string>4G2008a</string> - <key>NSPrincipalClass</key> - <string>GrowlApplicationBridge</string> -</dict> -</plist> diff --git a/macosx/Growl.framework/Versions/Current b/macosx/Growl.framework/Versions/Current deleted file mode 120000 index 8c7e5a667..000000000 --- a/macosx/Growl.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A
\ No newline at end of file diff --git a/macosx/HBAVPlayer.m b/macosx/HBAVPlayer.m index d0b064a61..833c0643a 100644 --- a/macosx/HBAVPlayer.m +++ b/macosx/HBAVPlayer.m @@ -69,7 +69,7 @@ typedef void (^HBPlayableObverser)(void); // The asset invokes its completion handler on an arbitrary queue when loading is complete. // Because we want to access our AVPlayer in our ensuing set-up, we must dispatch our handler to the main queue. dispatch_async(dispatch_get_main_queue(), ^(void) { - [self _setUpPlaybackOfAsset:_movie withKeys:assetKeysToLoadAndTest]; + [self _setUpPlaybackOfAsset:self->_movie withKeys:assetKeysToLoadAndTest]; }); }]; diff --git a/macosx/HBAddCategoryController.m b/macosx/HBAddCategoryController.m index 41de50330..dd85ea4d7 100644 --- a/macosx/HBAddCategoryController.m +++ b/macosx/HBAddCategoryController.m @@ -52,8 +52,7 @@ - (IBAction)dismiss:(id)sender { - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseCancel]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel]; } - (IBAction)create:(id)sender @@ -61,8 +60,7 @@ self.category = [[HBPreset alloc] initWithCategoryName:self.name.stringValue builtIn:NO]; [self.manager addPreset:self.category]; - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseOK]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK]; } diff --git a/macosx/HBAddPresetController.m b/macosx/HBAddPresetController.m index 7fc0af0a5..d100a330e 100644 --- a/macosx/HBAddPresetController.m +++ b/macosx/HBAddPresetController.m @@ -142,21 +142,16 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) { { HBAddCategoryController *addCategoryController = [[HBAddCategoryController alloc] initWithPresetManager:self.manager]; - [NSApp beginSheet:addCategoryController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(categorySheetDidEnd:returnCode:contextInfo:) contextInfo:(void *)CFBridgingRetain(addCategoryController)]; -} - -- (void)categorySheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - HBAddCategoryController *addCategoryController = (HBAddCategoryController *)CFBridgingRelease(contextInfo); - - if (returnCode == NSModalResponseOK) - { - NSMenuItem *item = [self buildMenuItemWithCategory:addCategoryController.category]; - [self.categories.menu insertItem:item atIndex:2]; - } + [self.window beginSheet:addCategoryController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + NSMenuItem *item = [self buildMenuItemWithCategory:addCategoryController.category]; + [self.categories.menu insertItem:item atIndex:2]; + } - [self.categories selectItemWithTag:2]; - [self selectCategoryFromMenu:self.categories.selectedItem]; + [self.categories selectItemWithTag:2]; + [self selectCategoryFromMenu:self.categories.selectedItem]; + }]; } - (IBAction)selectCategoryFromMenu:(NSMenuItem *)sender @@ -183,11 +178,13 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) { self.defaultsController = [[HBAudioDefaultsController alloc] initWithSettings:defaults]; - [NSApp beginSheet:self.defaultsController.window - modalForWindow:self.window - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:(void *)CFBridgingRetain(defaults)]; + [self.window beginSheet:self.defaultsController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + [defaults writeToPreset:self.mutablePreset]; + } + self.defaultsController = nil; + }]; } - (IBAction)showSubtitlesSettingsSheet:(id)sender @@ -197,22 +194,13 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) { self.defaultsController = [[HBSubtitlesDefaultsController alloc] initWithSettings:defaults]; - [NSApp beginSheet:self.defaultsController.window - modalForWindow:self.window - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:(void *)CFBridgingRetain(defaults)]; -} - -- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - id defaults = (id)CFBridgingRelease(contextInfo); - - if (returnCode == NSModalResponseOK) - { - [defaults writeToPreset:self.mutablePreset]; - } - self.defaultsController = nil; + [self.window beginSheet:self.defaultsController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + [defaults writeToPreset:self.mutablePreset]; + } + self.defaultsController = nil; + }]; } - (IBAction)add:(id)sender @@ -254,15 +242,13 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) { self.preset = [newPreset copy]; [self.selectedCategory insertObject:self.preset inChildrenAtIndex:self.selectedCategory.countOfChildren]; - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseContinue]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK]; } } - (IBAction)cancel:(id)sender { - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseAbort]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel]; } - (IBAction)openUserGuide:(id)sender diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m index ad93c1cc7..b8072ca78 100644 --- a/macosx/HBAppDelegate.m +++ b/macosx/HBAppDelegate.m @@ -62,9 +62,6 @@ _queueController = [[HBQueueController alloc] initWithURL:[appSupportURL URLByAppendingPathComponent:QUEUE_FILE]]; _queueController.delegate = self; _mainController = [[HBController alloc] initWithQueue:_queueController presetsManager:_presetsManager]; - - // Set the Growl Delegate - [GrowlApplicationBridge setGrowlDelegate:_queueController]; } return self; } diff --git a/macosx/HBApplication.m b/macosx/HBApplication.m index 1223621b4..dcd934030 100644 --- a/macosx/HBApplication.m +++ b/macosx/HBApplication.m @@ -7,7 +7,7 @@ #import "HBApplication.h" #import "HBExceptionAlertController.h" -@import HandBrakeKit.HBUtilities; +@import HandBrakeKit; @implementation HBApplication diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m index 9432e943e..66a8d2a8a 100644 --- a/macosx/HBAudioController.m +++ b/macosx/HBAudioController.m @@ -7,8 +7,7 @@ #import "HBAudioController.h" #import "HBAudioDefaultsController.h" -@import HandBrakeKit.HBAudio; -@import HandBrakeKit.HBAudioDefaults; +@import HandBrakeKit; @interface HBAudioController () @@ -46,22 +45,13 @@ HBAudioDefaults *defaults = [self.audio.defaults copy]; self.defaultsController = [[HBAudioDefaultsController alloc] initWithSettings:defaults]; - [NSApp beginSheet:self.defaultsController.window - modalForWindow:self.view.window - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:(void *)CFBridgingRetain(defaults)]; -} - -- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - HBAudioDefaults *defaults = (HBAudioDefaults *)CFBridgingRelease(contextInfo); - - if (returnCode == NSModalResponseOK) - { - self.audio.defaults = defaults; - } - self.defaultsController = nil; + [self.view.window beginSheet:self.defaultsController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + self.audio.defaults = defaults; + } + self.defaultsController = nil; + }]; } - (IBAction)reloadDefaults:(id)sender diff --git a/macosx/HBAudioDefaultsController.m b/macosx/HBAudioDefaultsController.m index 023030ecf..88788e63b 100644 --- a/macosx/HBAudioDefaultsController.m +++ b/macosx/HBAudioDefaultsController.m @@ -7,7 +7,7 @@ #import "HBAudioDefaultsController.h" #import "HBLanguagesSelection.h" -@import HandBrakeKit.HBAudioDefaults; +@import HandBrakeKit; static void *HBAudioDefaultsContext = &HBAudioDefaultsContext; @@ -87,14 +87,12 @@ static void *HBAudioDefaultsContext = &HBAudioDefaultsContext; - (IBAction)ok:(id)sender { self.settings.trackSelectionLanguages = [self.languagesList.selectedLanguages mutableCopy]; - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseOK]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK]; } - (IBAction)cancel:(id)sender { - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseCancel]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel]; } - (IBAction)openUserGuide:(id)sender diff --git a/macosx/HBCodingUtilities.h b/macosx/HBCodingUtilities.h index c880e08aa..8635720ea 100644 --- a/macosx/HBCodingUtilities.h +++ b/macosx/HBCodingUtilities.h @@ -17,40 +17,13 @@ #define decodeInteger(x) x = [decoder decodeIntegerForKey:OBJC_STRINGIFY(x)] #define decodeBool(x) x = [decoder decodeBoolForKey:OBJC_STRINGIFY(x)] #define decodeDouble(x) x = [decoder decodeDoubleForKey:OBJC_STRINGIFY(x)] -#define decodeObject(x, cl) x = [HBCodingUtilities decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x) decoder:decoder]; +#define decodeObject(x, cl) x = [decoder decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x)]; -#define decodeCollectionOfObjects(x, cl, objectcl) x = [HBCodingUtilities decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], nil] forKey:OBJC_STRINGIFY(x) decoder:decoder]; +#define decodeCollectionOfObjects(x, cl, objectcl) x = [decoder decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], nil] forKey:OBJC_STRINGIFY(x)]; -#define decodeCollectionOfObjects2(x, cl, objectcl, objectcl2) x = [HBCodingUtilities decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], [objectcl2 class], nil] forKey:OBJC_STRINGIFY(x) decoder:decoder]; +#define decodeCollectionOfObjects2(x, cl, objectcl, objectcl2) x = [decoder decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], [objectcl2 class], nil] forKey:OBJC_STRINGIFY(x)]; -#define decodeCollectionOfObjects3(x, cl, objectcl, objectcl2, objectcl3) x = [HBCodingUtilities decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], [objectcl2 class], [objectcl3 class], nil] forKey:OBJC_STRINGIFY(x) decoder:decoder]; +#define decodeCollectionOfObjects3(x, cl, objectcl, objectcl2, objectcl3) x = [decoder decodeObjectOfClasses:[NSSet setWithObjects:[cl class], [objectcl class], [objectcl2 class], [objectcl3 class], nil] forKey:OBJC_STRINGIFY(x)]; -#define decodeObjectOrFail(x, cl) x = [HBCodingUtilities decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x) decoder:decoder]; if (x == nil) {NSLog(@"Failed to decode: %@", OBJC_STRINGIFY(x)); goto fail;} - -NS_ASSUME_NONNULL_BEGIN - -@interface HBCodingUtilities : NSObject - -/** - * Specify what the expected class of the allocated object is. If the coder responds YES to -requiresSecureCoding, - * then an exception will be thrown if the class to be decoded does not implement NSSecureCoding or is not isKindOfClass: of the argument. - * If the coder responds NO to -requiresSecureCoding, then the class argument is ignored - * and no check of the class of the decoded object is performed, exactly as if decodeObjectForKey: had been called. - * - * if NSSecureCoding is not available on the system it check the class after loading the object. - * - * @param aClass The expect class type. - * @param key The coder key. - * @param decoder The NSCoder. - * - * @return the decoder object. - */ -+ (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder; - - -+ (nullable id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key decoder:(NSCoder *)decoder; - -@end - -NS_ASSUME_NONNULL_END +#define decodeObjectOrFail(x, cl) x = [decoder decodeObjectOfClass:[cl class] forKey:OBJC_STRINGIFY(x)]; if (x == nil) {NSLog(@"Failed to decode: %@", OBJC_STRINGIFY(x)); goto fail;} diff --git a/macosx/HBCodingUtilities.m b/macosx/HBCodingUtilities.m deleted file mode 100644 index 80e245a7b..000000000 --- a/macosx/HBCodingUtilities.m +++ /dev/null @@ -1,58 +0,0 @@ -// -// HBCodingUtilities.m -// HandBrake -// -// Created by Damiano Galassi on 22/04/15. -// -// - -#import "HBCodingUtilities.h" - -static BOOL useSecureCoding; - -@implementation HBCodingUtilities - -+ (void)initialize -{ - static BOOL initialized = NO; - - if (!initialized && self == [HBCodingUtilities class]) - { - useSecureCoding = [NSCoder instancesRespondToSelector:@selector(decodeObjectOfClass:forKey:)] ? YES : NO; - } -} - -+ (id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder -{ - if (useSecureCoding) - { - return [decoder decodeObjectOfClass:aClass forKey:key]; - } - else - { - id obj = [decoder decodeObjectForKey:key]; - if (![obj isKindOfClass:aClass]) - { - return nil; - } - else - { - return obj; - } - } -} - -+ (id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key decoder:(NSCoder *)decoder -{ - if (useSecureCoding) - { - return [decoder decodeObjectOfClasses:classes forKey:key]; - } - else - { - id obj = [decoder decodeObjectForKey:key]; - return obj; - } -} - -@end diff --git a/macosx/HBController.h b/macosx/HBController.h index f650a5bf0..c3a1eba68 100644 --- a/macosx/HBController.h +++ b/macosx/HBController.h @@ -41,7 +41,6 @@ - (IBAction)showRenamePresetPanel:(id)sender; - (IBAction)selectDefaultPreset:(id)sender; -- (IBAction)renamePreset:(id)sender; - (IBAction)deletePreset:(id)sender; - (IBAction)reloadPreset:(id)sender; diff --git a/macosx/HBController.m b/macosx/HBController.m index 15ea6bd07..12eb06d7b 100644 --- a/macosx/HBController.m +++ b/macosx/HBController.m @@ -164,10 +164,6 @@ // Progress _progressInfo = @""; - if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) - { - _visible = YES; - } // Check to see if the last destination has been set, use if so, if not, use Movies #ifdef __SANDBOX_ENABLED__ @@ -214,49 +210,21 @@ fPresetsView = [[HBPresetsViewController alloc] initWithPresetManager:presetManager]; fPresetsView.delegate = self; - if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) - { - self.presetsDrawer = [[NSDrawer alloc] initWithContentSize:NSMakeSize(240, 550) preferredEdge:NSRectEdgeMaxX]; - self.presetsDrawer.parentWindow = self.window; - self.presetsDrawer.delegate = self; - self.presetsDrawer.preferredEdge = NSRectEdgeMaxX; - - // Set up the preset drawer - self.presetsDrawer.contentView = fPresetsView.view; - self.presetsDrawer.contentView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - - NSSize drawerSize = NSSizeFromString([[NSUserDefaults standardUserDefaults] - stringForKey:@"HBDrawerSize"]); - if (drawerSize.width > 0) - { - self.presetsDrawer.contentSize = drawerSize; - } - - // Show/Hide the Presets drawer upon launch based - // on user preference DefaultPresetsDrawerShow - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBDefaultPresetsDrawerShow"]) - { - [self.presetsDrawer open:self]; - } - } - else - { - fPresetsView.showHeader = YES; + fPresetsView.showHeader = YES; - // Set up the presets popover - self.presetsPopover = [[NSPopover alloc] init]; + // Set up the presets popover + self.presetsPopover = [[NSPopover alloc] init]; - self.presetsPopover.contentViewController = fPresetsView; - self.presetsPopover.contentSize = NSMakeSize(280, 580); - self.presetsPopover.animates = YES; + self.presetsPopover.contentViewController = fPresetsView; + self.presetsPopover.contentSize = NSMakeSize(280, 580); + self.presetsPopover.animates = YES; - // AppKit will close the popover when the user interacts with a user interface element outside the popover. - // note that interacting with menus or panels that become key only when needed will not cause a transient popover to close. - self.presetsPopover.behavior = NSPopoverBehaviorSemitransient; - self.presetsPopover.delegate = self; + // AppKit will close the popover when the user interacts with a user interface element outside the popover. + // note that interacting with menus or panels that become key only when needed will not cause a transient popover to close. + self.presetsPopover.behavior = NSPopoverBehaviorSemitransient; + self.presetsPopover.delegate = self; - [fPresetsView loadView]; - } + [fPresetsView loadView]; // Set up the summary view self.summaryController = [[HBSummaryViewController alloc] init]; @@ -557,8 +525,7 @@ { return self.job != nil; } - if (action == @selector(renamePreset:) || - action == @selector(deletePreset:) || + if (action == @selector(deletePreset:) || action == @selector(setDefaultPreset:)) { return self.job != nil && self.edited == NO;//fixme @@ -646,23 +613,23 @@ previews:hb_num_previews minDuration:min_title_duration_seconds progressHandler:^(HBState state, HBProgress progress, NSString *info) { - fSrcDVD2Field.stringValue = info; - fScanIndicator.hidden = NO; - fScanHorizontalLine.hidden = YES; - fScanIndicator.doubleValue = progress.percent; + self->fSrcDVD2Field.stringValue = info; + self->fScanIndicator.hidden = NO; + self->fScanHorizontalLine.hidden = YES; + self->fScanIndicator.doubleValue = progress.percent; } completionHandler:^(HBCoreResult result) { - fScanHorizontalLine.hidden = NO; - fScanIndicator.hidden = YES; - fScanIndicator.indeterminate = NO; - fScanIndicator.doubleValue = 0.0; + self->fScanHorizontalLine.hidden = NO; + self->fScanIndicator.hidden = YES; + self->fScanIndicator.indeterminate = NO; + self->fScanIndicator.doubleValue = 0.0; if (result == HBCoreResultDone) { for (HBTitle *title in self.core.titles) { - [fSrcTitlePopUp addItemWithTitle:title.description]; + [self->fSrcTitlePopUp addItemWithTitle:title.description]; } self.window.representedURL = mediaURL; self.window.title = mediaURL.lastPathComponent; @@ -670,7 +637,7 @@ else { // We display a message if a valid source was not chosen - fSrcDVD2Field.stringValue = NSLocalizedString(@"No Valid Source Found", @""); + self->fSrcDVD2Field.stringValue = NSLocalizedString(@"No Valid Source Found", @""); } // Set the last searched source directory in the prefs here @@ -1102,27 +1069,25 @@ /** Check if the job destination if a valid one, - if so, call the didEndSelector - Note: rework this to use a block in the future - + if so, call the handler @param job the job - @param didEndSelector the selector to call if the check is successful + @param completionHandler the block to call if the check is successful */ -- (void)runDestinationAlerts:(HBJob *)job didEndSelector:(SEL)didEndSelector +- (void)runDestinationAlerts:(HBJob *)job completionHandler:(void (^ __nullable)(NSModalResponse returnCode))handler { if ([[NSFileManager defaultManager] fileExistsAtPath:job.outputURL.path] == 0) { NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:NSLocalizedString(@"Warning!", @"")]; [alert setInformativeText:NSLocalizedString(@"This is not a valid destination directory!", @"")]; - [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:didEndSelector contextInfo:NULL]; + [alert beginSheetModalForWindow:self.window completionHandler:handler]; } else if ([job.fileURL isEqual:job.completeOutputURL]) { NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:NSLocalizedString(@"A file already exists at the selected destination.", @"")]; [alert setInformativeText:NSLocalizedString(@"The destination is the same as the source, you can not overwrite your source file!", @"")]; - [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:didEndSelector contextInfo:NULL]; + [alert beginSheetModalForWindow:self.window completionHandler:handler]; } else if ([[NSFileManager defaultManager] fileExistsAtPath:job.completeOutputURL.path]) { @@ -1133,7 +1098,7 @@ [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"")]; [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:didEndSelector contextInfo:NULL]; + [alert beginSheetModalForWindow:self.window completionHandler:handler]; } else if ([fQueueController jobExistAtURL:job.completeOutputURL]) { @@ -1144,17 +1109,11 @@ [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", @"")]; [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:didEndSelector contextInfo:NULL]; + [alert beginSheetModalForWindow:self.window completionHandler:handler]; } else { - NSInteger returnCode = NSAlertSecondButtonReturn; - NSMethodSignature *methodSignature = [self methodSignatureForSelector:didEndSelector]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; - [invocation setTarget:self]; - [invocation setSelector:didEndSelector]; - [invocation setArgument:&returnCode atIndex:3]; - [invocation invoke]; + handler(NSAlertSecondButtonReturn); } } @@ -1173,22 +1132,12 @@ { if ([self.window HB_endEditing]) { - [self runDestinationAlerts:self.job - didEndSelector:@selector(overwriteAddToQueueAlertDone:returnCode:contextInfo:)]; - } -} - -/** - * Called from the alert posted by addToQueue - * that asks the user if they want to overwrite an exiting movie file. - */ -- (void)overwriteAddToQueueAlertDone:(NSAlert *)alert - returnCode:(NSInteger)returnCode - contextInfo:(void *)contextInfo -{ - if (returnCode == NSAlertSecondButtonReturn) - { - [self doAddToQueue]; + [self runDestinationAlerts:self.job completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSAlertSecondButtonReturn) + { + [self doAddToQueue]; + } + }]; } } @@ -1224,26 +1173,16 @@ { if ([self.window HB_endEditing]) { - [self runDestinationAlerts:self.job - didEndSelector:@selector(overWriteAlertDone:returnCode:contextInfo:)]; + [self runDestinationAlerts:self.job completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSAlertSecondButtonReturn) + { + [self doRip]; + } + }]; } } } -/** - * overWriteAlertDone: called from the alert posted by Rip: that asks the user if they - * want to overwrite an exiting movie file. - */ -- (void)overWriteAlertDone:(NSAlert *)alert - returnCode:(NSInteger)returnCode - contextInfo:(void *)contextInfo -{ - if (returnCode == NSAlertSecondButtonReturn) - { - [self doRip]; - } -} - - (IBAction)pause:(id)sender { [fQueueController togglePauseResume:sender]; @@ -1260,17 +1199,12 @@ presetName:self.job.presetName delegate:self]; - [NSApp beginSheet:self.titlesSelectionController.window - modalForWindow:self.window - modalDelegate:nil - didEndSelector:NULL - contextInfo:NULL]; + [self.window beginSheet:self.titlesSelectionController.window completionHandler:nil]; } - (void)didSelectTitles:(NSArray<HBTitle *> *)titles { - [self.titlesSelectionController.window orderOut:nil]; - [NSApp endSheet:self.titlesSelectionController.window]; + [self.window endSheet:self.titlesSelectionController.window]; [self doAddTitlesToQueue:titles]; } @@ -1326,7 +1260,7 @@ NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:NSLocalizedString(@"A file already exists at the selected destination.", @"")]; [alert setInformativeText:NSLocalizedString(@"The destination is the same as the source, you can not overwrite your source file!", @"")]; - [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(overwriteAddTitlesToQueueAlertDone:returnCode:contextInfo:) contextInfo:NULL]; + [alert beginSheetModalForWindow:self.window completionHandler:nil]; } else if (fileExists) { @@ -1338,7 +1272,12 @@ [alert addButtonWithTitle:NSLocalizedString(@"Overwrite", nil)]; [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:self.window modalDelegate:self didEndSelector:@selector(overwriteAddTitlesToQueueAlertDone:returnCode:contextInfo:) contextInfo:(void *)CFBridgingRetain(jobs)]; + [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSAlertSecondButtonReturn) + { + [self->fQueueController addJobsFromArray:jobs]; + } + }]; } else { @@ -1346,17 +1285,6 @@ } } -- (void)overwriteAddTitlesToQueueAlertDone:(NSAlert *)alert - returnCode:(NSInteger)returnCode - contextInfo:(void *)contextInfo -{ - if (returnCode == NSAlertSecondButtonReturn) - { - NSArray *jobs = CFBridgingRelease(contextInfo); - [fQueueController addJobsFromArray:jobs]; - } -} - - (IBAction)addAllTitlesToQueue:(id)sender { [self doAddTitlesToQueue:self.core.titles]; @@ -1493,19 +1421,14 @@ customHeight:self.job.picture.height defaultToCustom:defaultToCustom]; - [NSApp beginSheet:addPresetController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:(void *)CFBridgingRetain(addPresetController)]; -} - -- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - __unused HBAddPresetController *addPresetController = (HBAddPresetController *)CFBridgingRelease(contextInfo); - - if (returnCode == NSModalResponseContinue) - { - fPresetsView.selectedPreset = addPresetController.preset; - [self applyPreset:fPresetsView.selectedPreset]; - [[NSNotificationCenter defaultCenter] postNotificationName:HBPresetsChangedNotification object:nil]; - } + [self.window beginSheet:addPresetController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + self->fPresetsView.selectedPreset = addPresetController.preset; + [self applyPreset:self->fPresetsView.selectedPreset]; + [[NSNotificationCenter defaultCenter] postNotificationName:HBPresetsChangedNotification object:nil]; + } + }]; } - (HBPreset *)createPresetFromCurrentSettings @@ -1526,21 +1449,16 @@ [self.window HB_endEditing]; fPresetsView.selectedPreset = _currentPreset; - HBRenamePresetController *renamePresetController = [[HBRenamePresetController alloc] initWithPreset:self.currentPreset + __block HBRenamePresetController *renamePresetController = [[HBRenamePresetController alloc] initWithPreset:self.currentPreset presetManager:presetManager]; - - [NSApp beginSheet:renamePresetController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(renamePresetSheetDidEnd:returnCode:contextInfo:) contextInfo:(void *)CFBridgingRetain(renamePresetController)]; -} - -- (void)renamePresetSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - __unused HBRenamePresetController *renamePresetController = (HBRenamePresetController *)CFBridgingRelease(contextInfo); - - if (returnCode == NSModalResponseContinue) - { - [self applyPreset:fPresetsView.selectedPreset]; - [[NSNotificationCenter defaultCenter] postNotificationName:HBPresetsChangedNotification object:nil]; - } + [self.window beginSheet:renamePresetController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + [self applyPreset:self->fPresetsView.selectedPreset]; + [[NSNotificationCenter defaultCenter] postNotificationName:HBPresetsChangedNotification object:nil]; + } + renamePresetController = nil; + }]; } #pragma mark - diff --git a/macosx/HBCore.m b/macosx/HBCore.m index 160975ada..6c259e25a 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -274,7 +274,7 @@ typedef void (^HBCoreCleanupHandler)(void); [self preventAutoSleep]; - hb_scan(_hb_handle, url.path.fileSystemRepresentation, + hb_scan(_hb_handle, url.fileSystemRepresentation, (int)index, (int)previewsNum, 1, min_title_duration_ticks); @@ -422,7 +422,7 @@ typedef void (^HBCoreCleanupHandler)(void); // Add the job to libhb hb_job_t *hb_job = job.hb_job; - hb_job_set_file(hb_job, job.completeOutputURL.path.fileSystemRepresentation); + hb_job_set_file(hb_job, job.completeOutputURL.fileSystemRepresentation); hb_add(_hb_handle, hb_job); // Free the job @@ -526,7 +526,6 @@ typedef void (^HBCoreCleanupHandler)(void); if (self.updateTimer) { dispatch_source_cancel(self.updateTimer); - dispatch_release(self.updateTimer); self.updateTimer = NULL; } } diff --git a/macosx/HBFiltersViewController.m b/macosx/HBFiltersViewController.m index 77139d6ec..83b960b97 100644 --- a/macosx/HBFiltersViewController.m +++ b/macosx/HBFiltersViewController.m @@ -6,7 +6,7 @@ #import "HBFiltersViewController.h" -@import HandBrakeKit.HBFilters; +@import HandBrakeKit; @interface HBFiltersViewController () diff --git a/macosx/HBHUDButtonCell.h b/macosx/HBHUDButtonCell.h deleted file mode 100644 index 3f0c6e564..000000000 --- a/macosx/HBHUDButtonCell.h +++ /dev/null @@ -1,15 +0,0 @@ -/* HBHUDButtonCell.h $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License. */ - -#import <Cocoa/Cocoa.h> - -/** - * A subclass of NSButtonCell that draws the cell title - * in white. - */ -@interface HBHUDButtonCell : NSButtonCell - -@end diff --git a/macosx/HBHUDButtonCell.m b/macosx/HBHUDButtonCell.m deleted file mode 100644 index a5e4119ec..000000000 --- a/macosx/HBHUDButtonCell.m +++ /dev/null @@ -1,25 +0,0 @@ -/* HBHUDButtonCell.m $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License. */ - -#import "HBHUDButtonCell.h" - -@implementation HBHUDButtonCell - -- (NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView -{ - NSAttributedString *attrLabel = title; - - if (!NSClassFromString(@"NSVisualEffectView")) - { - attrLabel = [[NSAttributedString alloc] initWithString:[title string] - attributes:@{ NSFontAttributeName:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:self.controlSize]], - NSForegroundColorAttributeName: [NSColor whiteColor]}]; - } - - return [super drawTitle:attrLabel withFrame:frame inView:controlView]; -} - -@end diff --git a/macosx/HBHUDView.h b/macosx/HBHUDView.h index 0ea5f3112..b453ae374 100644 --- a/macosx/HBHUDView.h +++ b/macosx/HBHUDView.h @@ -9,5 +9,5 @@ /** * The HBHUDView class implements simple views that can draw the background in the HUD style. */ -@interface HBHUDView : NSView +@interface HBHUDView : NSVisualEffectView @end diff --git a/macosx/HBHUDView.m b/macosx/HBHUDView.m index 1d6079d96..a03eb427a 100644 --- a/macosx/HBHUDView.m +++ b/macosx/HBHUDView.m @@ -6,10 +6,7 @@ #import "HBHUDView.h" -@interface HBHUDVisualEffectsView : NSVisualEffectView -@end - -@implementation HBHUDVisualEffectsView +@implementation HBHUDView - (instancetype)initWithFrame:(NSRect)frame { @@ -35,46 +32,3 @@ } @end - -@implementation HBHUDView - -- (instancetype)initWithFrame:(NSRect)frame -{ - if (NSClassFromString(@"NSVisualEffectView")) - { - // If NSVisualEffectView class is loaded - // release ourself and return a NSVisualEffectView instance instead. - self = (HBHUDView *)[[HBHUDVisualEffectsView alloc] initWithFrame:frame]; - } - else - { - self = [super initWithFrame:frame]; - } - - return self; -} - -- (BOOL)acceptsFirstResponder -{ - return YES; -} - -- (void)drawRect:(NSRect)dirtyRect -{ - NSGraphicsContext *theContext = [NSGraphicsContext currentContext]; - [theContext saveGraphicsState]; - - NSRect rect = NSMakeRect(0.0, 0.0, self.frame.size.width, self.frame.size.height); - - // Draw a standard HUD with black transparent background and white border. - [[NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.0 alpha:0.6] setFill]; - [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, 1, 1) xRadius:14.0 yRadius:14.0] fill]; - - [[NSColor whiteColor] setStroke]; - [NSBezierPath setDefaultLineWidth:2.0]; - [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, 1, 1) xRadius:14.0 yRadius:14.0] stroke]; - - [theContext restoreGraphicsState]; -} - -@end
\ No newline at end of file diff --git a/macosx/HBJob+HBJobConversion.m b/macosx/HBJob+HBJobConversion.m index 9895a3adc..ecef901e0 100644 --- a/macosx/HBJob+HBJobConversion.m +++ b/macosx/HBJob+HBJobConversion.m @@ -39,7 +39,7 @@ hb_title_t *title = self.title.hb_title; hb_job_t *job = hb_job_init(title); - hb_job_set_file(job, self.completeOutputURL.path.fileSystemRepresentation); + hb_job_set_file(job, self.completeOutputURL.fileSystemRepresentation); // Title Angle for dvdnav job->angle = self.angle; @@ -271,7 +271,7 @@ sub_config.offset = subTrack.offset; // we need to strncpy file name and codeset - strncpy(sub_config.src_filename, subTrack.fileURL.path.fileSystemRepresentation, 255); + strncpy(sub_config.src_filename, subTrack.fileURL.fileSystemRepresentation, 255); sub_config.src_filename[255] = 0; strncpy(sub_config.src_codeset, subTrack.charCode.UTF8String, 39); sub_config.src_codeset[39] = 0; diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 1644a7fcf..09193a847 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -426,7 +426,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; decodeObjectOrFail(_uuid, NSString); #ifdef __SANDBOX_ENABLED__ - _fileURLBookmark = [HBCodingUtilities decodeObjectOfClass:[NSData class] forKey:@"_fileURLBookmark" decoder:decoder]; + _fileURLBookmark = [decoder decodeObjectOfClass:[NSData class] forKey:@"_fileURLBookmark"]; if (_fileURLBookmark) { @@ -438,7 +438,7 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; decodeObjectOrFail(_fileURL, NSURL); } - _outputURLFolderBookmark = [HBCodingUtilities decodeObjectOfClass:[NSData class] forKey:@"_outputURLFolderBookmark" decoder:decoder]; + _outputURLFolderBookmark = [decoder decodeObjectOfClass:[NSData class] forKey:@"_outputURLFolderBookmark"]; if (_outputURLFolderBookmark) { diff --git a/macosx/HBOutputFileWriter.m b/macosx/HBOutputFileWriter.m index fffe9478b..cbd4e9977 100644 --- a/macosx/HBOutputFileWriter.m +++ b/macosx/HBOutputFileWriter.m @@ -10,6 +10,7 @@ @implementation HBOutputFileWriter { FILE *f; + NSDateFormatter *_formatter; } - (nullable instancetype)initWithFileURL:(NSURL *)url; @@ -31,7 +32,7 @@ _url = [url copy]; - f = fopen(url.path.fileSystemRepresentation, "w"); + f = fopen(url.fileSystemRepresentation, "w"); if (!f) { return nil; @@ -43,6 +44,11 @@ return nil; } + _formatter = [[NSDateFormatter alloc] init]; + _formatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; + _formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ssZZZZZ"; + _formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; + [self writeHeaderForReason:@"Session"]; } @@ -58,7 +64,7 @@ { [self write:[NSString stringWithFormat:@"HandBrake Activity Log for %@: %@\n%@\n", reason, - [[NSDate date] descriptionWithCalendarFormat:nil timeZone:nil locale:nil], + [_formatter stringFromDate:[NSDate date]], [HBUtilities handBrakeVersion]]]; } diff --git a/macosx/HBPictureController.m b/macosx/HBPictureController.m index 0014f687a..fc0eb195a 100644 --- a/macosx/HBPictureController.m +++ b/macosx/HBPictureController.m @@ -6,8 +6,7 @@ #import "HBPictureController.h" -@import HandBrakeKit.HBFilters; -@import HandBrakeKit.HBPicture; +@import HandBrakeKit; static void *HBPictureControllerContext = &HBPictureControllerContext; diff --git a/macosx/HBPictureViewController.m b/macosx/HBPictureViewController.m index d7a686a7b..52beb8013 100644 --- a/macosx/HBPictureViewController.m +++ b/macosx/HBPictureViewController.m @@ -6,7 +6,7 @@ #import "HBPictureViewController.h" -@import HandBrakeKit.HBPicture; +@import HandBrakeKit; static void *HBPictureViewControllerContext = &HBPictureViewControllerContext; diff --git a/macosx/HBPlayerHUDController.m b/macosx/HBPlayerHUDController.m index 3524f79e3..98ab96fa5 100644 --- a/macosx/HBPlayerHUDController.m +++ b/macosx/HBPlayerHUDController.m @@ -36,12 +36,6 @@ { [super loadView]; - if (NSClassFromString(@"NSVisualEffectView") == NO) - { - self.currentTimeLabel.textColor = [NSColor whiteColor]; - self.remaingTimeLabel.textColor = [NSColor whiteColor]; - } - if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { _monospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular]}; } diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m index 18bb86257..2141b0f54 100644 --- a/macosx/HBPreferencesController.m +++ b/macosx/HBPreferencesController.m @@ -191,7 +191,7 @@ [panel setDirectoryURL:[NSURL fileURLWithPath:sendToAppDirectory]]; [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { - if (result == NSOKButton) + if (result == NSModalResponseOK) { NSURL *sendToAppURL = [panel URL]; NSURL *sendToAppDirectoryURL = [sendToAppURL URLByDeletingLastPathComponent]; @@ -199,9 +199,9 @@ // We set the name of the app to send to in the display field NSString *sendToAppName = [[sendToAppURL lastPathComponent] stringByDeletingPathExtension]; - [fSendEncodeToAppField setStringValue:sendToAppName]; + [self->fSendEncodeToAppField setStringValue:sendToAppName]; - [[NSUserDefaults standardUserDefaults] setObject:[fSendEncodeToAppField stringValue] forKey:@"HBSendToApp"]; + [[NSUserDefaults standardUserDefaults] setObject:self->fSendEncodeToAppField.stringValue forKey:@"HBSendToApp"]; } }]; } diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m index 95688424f..0c1a8abe7 100644 --- a/macosx/HBPresetsViewController.m +++ b/macosx/HBPresetsViewController.m @@ -224,21 +224,7 @@ static void *HBPresetsViewControllerContext = &HBPresetsViewControllerContext; _showHeader = showHeader; self.headerLabel.hidden = !showHeader; - if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) - { - if (showHeader) - { - [self.view addConstraint:self.headerBottomConstraint]; - } - else - { - [self.view removeConstraint:self.headerBottomConstraint]; - } - } - else - { - self.headerBottomConstraint.active = showHeader; - } + self.headerBottomConstraint.active = showHeader; } - (IBAction)clicked:(id)sender @@ -270,17 +256,17 @@ static void *HBPresetsViewControllerContext = &HBPresetsViewControllerContext; { if ([self.treeController canRemove]) { - /* Alert user before deleting preset */ - NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Are you sure you want to permanently delete the selected preset?", nil) - defaultButton:NSLocalizedString(@"Delete Preset", nil) - alternateButton:NSLocalizedString(@"Cancel", nil) - otherButton:nil - informativeTextWithFormat:NSLocalizedString(@"You can't undo this action.", nil)]; - [alert setAlertStyle:NSCriticalAlertStyle]; + // Alert user before deleting preset + NSAlert *alert = [NSAlert init]; + alert.messageText = NSLocalizedString(@"Are you sure you want to permanently delete the selected preset?", nil); + alert.informativeText = NSLocalizedString(@"You can't undo this action.", nil); + [alert addButtonWithTitle:NSLocalizedString(@"Delete Preset", nil)]; + [alert addButtonWithTitle:NSLocalizedString(@"Cancel", nil)]; + alert.alertStyle = NSCriticalAlertStyle; NSInteger status = [alert runModal]; - if (status == NSAlertDefaultReturn) + if (status == NSAlertFirstButtonReturn) { [self.presets deletePresetAtIndexPath:[self.treeController selectionIndexPath]]; [self setSelection:self.presets.defaultPreset]; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index d85cdc4d9..fb0105f23 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -12,7 +12,6 @@ #import "HBPreviewView.h" #import "HBPlayer.h" -#import "HBQTKitPlayer.h" #import "HBAVPlayer.h" #import "HBPictureHUDController.h" @@ -548,11 +547,7 @@ - (void)setUpPlaybackOfURL:(NSURL *)fileURL playerClass:(Class)class; { -#if __HB_QTKIT_PLAYER_AVAILABLE - NSArray<Class> *availablePlayerClasses = @[[HBAVPlayer class], [HBQTKitPlayer class]]; -#else NSArray<Class> *availablePlayerClasses = @[[HBAVPlayer class]]; -#endif self.player = [[class alloc] initWithURL:fileURL]; diff --git a/macosx/HBQTKitPlayer.h b/macosx/HBQTKitPlayer.h deleted file mode 100644 index d87473683..000000000 --- a/macosx/HBQTKitPlayer.h +++ /dev/null @@ -1,32 +0,0 @@ -/* HBQTKitPlayer.h $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License. */ - -#import <Foundation/Foundation.h> -#import <QuartzCore/QuartzCore.h> - -#import "HBPlayer.h" - -#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200 - #define __HB_QTKIT_PLAYER_AVAILABLE 1 -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface HBQTKitPlayer : NSObject <HBPlayer> - -@property (nonatomic, readonly) CALayer *layer; - -@property (nonatomic, readonly) NSTimeInterval duration; -@property (nonatomic) NSTimeInterval currentTime; - -@property (nonatomic) float rate; -@property (nonatomic) float volume; - -@property (nonatomic, readonly, getter=isPlayable) BOOL playable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/macosx/HBQTKitPlayer.m b/macosx/HBQTKitPlayer.m deleted file mode 100644 index 6c464426b..000000000 --- a/macosx/HBQTKitPlayer.m +++ /dev/null @@ -1,402 +0,0 @@ -/* HBQTKitPlayer.m $ - - This file is part of the HandBrake source code. - Homepage: <http://handbrake.fr/>. - It may be used under the terms of the GNU General Public License. */ - -#import "HBQTKitPlayer.h" - -#if __HB_QTKIT_PLAYER_AVAILABLE - -#import <QTKit/QTKit.h> - -@import HandBrakeKit; - -@interface QTTrack (HBAdditions) -- (id)isoLanguageCodeAsString; -@end - -typedef void (^HBPeriodicObverser)(NSTimeInterval time); -typedef void (^HBRateObverser)(void); -typedef void (^HBPlayableObverser)(void); - -@interface HBQTKitPlayerPeriodicObserver : NSObject - -@property (nonatomic, copy) HBPeriodicObverser block; - -- (void)postNotification:(NSTimeInterval)time; - -@end - -@implementation HBQTKitPlayerPeriodicObserver - -- (void)postNotification:(NSTimeInterval)time -{ - self.block(time); -} - -@end - -@interface HBQTKitPlayerRateObserver : NSObject - -@property (nonatomic, copy) HBRateObverser block; - -- (void)postNotification; - -@end - -@implementation HBQTKitPlayerRateObserver - -- (void)postNotification; -{ - self.block(); -} - -@end - -@interface HBQTKitPlayer () - -@property (nonatomic, strong) QTMovie *movie; -@property (nonatomic, strong) NSTimer *timer; - -@property (nonatomic, readwrite, getter=isPlayable) BOOL playable; -@property (nonatomic, readwrite, getter=isLoaded) BOOL loaded; - -@property (nonatomic, strong) NSMutableSet<HBQTKitPlayerPeriodicObserver *> *periodicObservers; -@property (nonatomic, strong) NSMutableSet<HBQTKitPlayerRateObserver *> *rateObservers; - -@property (nonatomic, strong) NSMutableSet<HBPlayableObverser> *playableObservers; - -@end - -@implementation HBQTKitPlayer - -- (instancetype)initWithURL:(NSURL *)url -{ - self = [super init]; - - if (self) - { - NSError *outError; - NSDictionary *attributes = @{ QTMovieURLAttribute: url, - QTMovieAskUnresolvedDataRefsAttribute: @NO, - QTMovieOpenForPlaybackAttribute: @YES, - QTMovieIsSteppableAttribute: @YES, - QTMovieOpenAsyncRequiredAttribute: @NO, - QTMovieOpenAsyncOKAttribute: @NO, - QTMovieApertureModeAttribute: QTMovieApertureModeClean }; - - _movie = [[QTMovie alloc] initWithAttributes:attributes error:&outError]; - - if (_movie) - { - _movie.delegate = self; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_movieRateDidChange:) - name:QTMovieRateDidChangeNotification - object:_movie]; - - _layer = [QTMovieLayer layerWithMovie:_movie]; - } - - _periodicObservers = [NSMutableSet set]; - _rateObservers = [NSMutableSet set]; - _playableObservers = [NSMutableSet set]; - - // Can't open things async - // because of 23414 QTKit bugs. - if (_movie && _layer) - { - self.playable = YES; - [self _enableSubtitles]; - } - else - { - self.playable = NO; - } - - self.loaded = YES; - } - - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [self _stopMovieTimer]; -} - -- (void)setLoaded:(BOOL)loaded -{ - _loaded = loaded; - - for (HBPlayableObverser block in self.playableObservers) - { - block(); - } - [self.playableObservers removeAllObjects]; -} - -- (void)_movieRateDidChange:(NSNotification *)notification -{ - for (HBQTKitPlayerRateObserver *observer in self.rateObservers) - { - [observer postNotification]; - } -} - -- (void)_enableSubtitles -{ - // Get and enable subtitles - NSArray<QTTrack *> *subtitlesArray = [self.movie tracksOfMediaType:QTMediaTypeSubtitle]; - if (subtitlesArray.count) - { - // enable the first tx3g subtitle track - [subtitlesArray.firstObject setEnabled:YES]; - } - else - { - // Perian subtitles - subtitlesArray = [self.movie tracksOfMediaType:QTMediaTypeVideo]; - if (subtitlesArray.count >= 2) - { - // track 0 should be video, other video tracks should - // be subtitles; force-enable the first subs track - [subtitlesArray[1] setEnabled:YES]; - } - } -} - -- (void)_startMovieTimer -{ - if (!self.timer) - { - self.timer = [NSTimer scheduledTimerWithTimeInterval:0.09 target:self - selector:@selector(_timerFired:) - userInfo:nil repeats:YES]; - } -} - -- (void)_stopMovieTimer -{ - [self.timer invalidate]; - self.timer = nil; -} - -- (void)_timerFired:(NSTimer *)timer -{ - for (HBQTKitPlayerPeriodicObserver *observer in self.periodicObservers) - { - [observer postNotification:self.currentTime]; - } -} - -#pragma mark Public properties - -- (NSArray<HBPlayerTrack *> *)tracksWithMediaType:(NSString *)mediaType -{ - NSMutableArray *result = [NSMutableArray array]; - NSArray<QTTrack *> *tracks = [self.movie tracksOfMediaType:mediaType]; - for (QTTrack *track in tracks) - { - NSNumber *trackID = [track attributeForKey:QTTrackIDAttribute]; - NSString *name = NSLocalizedString(@"Unknown", nil); - - if ([track respondsToSelector:@selector(isoLanguageCodeAsString)]) - { - NSString *language = [track isoLanguageCodeAsString]; - name = [HBUtilities languageCodeForIso6392Code:language]; - } - BOOL enabled = [[track attributeForKey:QTTrackEnabledAttribute] boolValue]; - - HBPlayerTrack *playerTrack = [[HBPlayerTrack alloc] initWithTrackName:name object:trackID enabled:enabled]; - - [result addObject:playerTrack]; - } - return result; -} - -@synthesize audioTracks = _audioTracks; - -- (NSArray<HBPlayerTrack *> *)audioTracks -{ - if (_audioTracks == nil) - { - _audioTracks = [self tracksWithMediaType:QTMediaTypeSound]; - } - return _audioTracks; -} - -@synthesize subtitlesTracks = _subtitlesTracks; - -- (NSArray<HBPlayerTrack *> *)subtitlesTracks -{ - if (_subtitlesTracks == nil) - { - _subtitlesTracks = [self tracksWithMediaType:QTMediaTypeSubtitle]; - } - return _subtitlesTracks; -} - -- (void)_enableTrack:(HBPlayerTrack *)playerTrack mediaType:(NSString *)mediaType -{ - NSArray<QTTrack *> *tracks = [self.movie tracksOfMediaType:mediaType]; - for (QTTrack *track in tracks) - { - NSNumber *trackID = [track attributeForKey:QTTrackIDAttribute]; - - if ([trackID isEqualTo:playerTrack.representedObject]) - { - [track setEnabled:YES]; - } - else - { - [track setEnabled:NO]; - } - } -} - -- (void)enableAudioTrack:(HBPlayerTrack *)playerTrack -{ - for (HBPlayerTrack *track in self.audioTracks) - { - track.enabled = NO; - } - playerTrack.enabled = YES; - [self _enableTrack:playerTrack mediaType:QTMediaTypeSound]; -} - -- (void)enableSubtitlesTrack:(HBPlayerTrack *)playerTrack -{ - for (HBPlayerTrack *track in self.subtitlesTracks) - { - track.enabled = NO; - } - playerTrack.enabled = YES; - [self _enableTrack:playerTrack mediaType:QTMediaTypeSubtitle]; -} - -- (NSTimeInterval)duration -{ - QTTime duration = [self.movie duration]; - return (double)duration.timeValue / (double)duration.timeScale;; -} - -- (NSTimeInterval)currentTime -{ - QTTime time = [self.movie currentTime]; - return (double)time.timeValue / (double)time.timeScale;; -} - -- (void)setCurrentTime:(NSTimeInterval)value -{ - long timeScale = [[self.movie attributeForKey:QTMovieTimeScaleAttribute] longValue]; - [self.movie setCurrentTime:QTMakeTime((long long)value * timeScale, timeScale)]; - [self _timerFired:nil]; -} - -- (void)setRate:(float)rate -{ - self.movie.rate = rate; -} - -- (float)rate -{ - return self.movie.rate; -} - -- (float)volume -{ - return self.movie.volume; -} - -- (void)setVolume:(float)volume -{ - self.movie.volume = volume; -} - -#pragma mark public methods - -- (void)loadPlayableValueAsynchronouslyWithCompletionHandler:(nullable void (^)(void))handler; -{ - if (self.isLoaded) - { - handler(); - } - else - { - [self.playableObservers addObject:handler]; - } -} - -- (id)addPeriodicTimeObserverUsingBlock:(void (^)(NSTimeInterval time))block -{ - HBQTKitPlayerPeriodicObserver *observer = [[HBQTKitPlayerPeriodicObserver alloc] init]; - observer.block = block; - [self.periodicObservers addObject:observer]; - - [self _startMovieTimer]; - - return observer; -} - -- (void)removeTimeObserver:(id)observer -{ - [self.periodicObservers removeObject:observer]; -} - -- (id)addRateObserverUsingBlock:(void (^)(void))block -{ - HBQTKitPlayerRateObserver *observer = [[HBQTKitPlayerRateObserver alloc] init]; - observer.block = block; - [self.rateObservers addObject:observer]; - - return observer; -} - -- (void)removeRateObserver:(id)observer -{ - [self.rateObservers removeObject:observer]; -} - -- (void)play -{ - [self.movie play]; - [self _startMovieTimer]; -} - -- (void)pause -{ - [self.movie stop]; - [self _stopMovieTimer]; -} - -- (void)gotoBeginning -{ - [self.movie gotoBeginning]; - [self _timerFired:nil]; -} - -- (void)gotoEnd -{ - [self.movie gotoEnd]; - [self _timerFired:nil]; -} - -- (void)stepForward -{ - [self.movie stepForward]; - [self _timerFired:nil]; -} - -- (void)stepBackward -{ - [self.movie stepBackward]; - [self _timerFired:nil]; -} - -@end - -#endif diff --git a/macosx/HBQueueController.h b/macosx/HBQueueController.h index 3584f7737..597b68a1d 100644 --- a/macosx/HBQueueController.h +++ b/macosx/HBQueueController.h @@ -5,7 +5,6 @@ It may be used under the terms of the GNU General Public License. */ #import <Cocoa/Cocoa.h> -#import <Growl/Growl.h> NS_ASSUME_NONNULL_BEGIN @@ -15,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN @class HBCore; @class HBJob; -@interface HBQueueController : NSWindowController <NSToolbarDelegate, NSWindowDelegate, GrowlApplicationBridgeDelegate> +@interface HBQueueController : NSWindowController <NSToolbarDelegate, NSWindowDelegate> - (instancetype)initWithURL:(NSURL *)queueURL; diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index d2506ef01..b67c85063 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -28,7 +28,7 @@ // DockTile update frequency in total percent increment #define dockTileUpdateFrequency 0.1f -@interface HBQueueController () <NSOutlineViewDataSource, HBQueueOutlineViewDelegate> +@interface HBQueueController () <NSOutlineViewDataSource, HBQueueOutlineViewDelegate, NSUserNotificationCenterDelegate> /// Whether the window is visible or occluded, /// useful to avoid updating the UI needlessly @@ -82,14 +82,12 @@ // Progress _progressInfo = @""; - if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10) - { - _visible = YES; - } // Load the queue from disk. _jobs = [[HBDistributedArray alloc] initWithURL:queueURL class:[HBJob class]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadQueue) name:HBDistributedArrayChanged object:_jobs]; + + [NSUserNotificationCenter defaultUserNotificationCenter].delegate = self; } return self; @@ -882,39 +880,29 @@ #pragma mark - Encode Done Actions -#define SERVICE_NAME @"Encode Done" - -/** - * Register a test notification and make - * it enabled by default - */ -- (NSDictionary *)registrationDictionaryForGrowl -{ - return @{GROWL_NOTIFICATIONS_ALL: @[SERVICE_NAME], - GROWL_NOTIFICATIONS_DEFAULT: @[SERVICE_NAME]}; -} - -- (void)showNotificationWithTitle:(NSString *)title description:(NSString *)description url:(NSURL *)fileURL -{ - [GrowlApplicationBridge notifyWithTitle:title - description:description - notificationName:SERVICE_NAME - iconData:nil - priority:0 - isSticky:YES - clickContext:fileURL.path]; -} - -- (void)growlNotificationWasClicked:(id)clickContext +- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { // Show the file in Finder when a done notification was clicked. - if ([clickContext isKindOfClass:[NSString class]] && [clickContext length]) + NSString *path = notification.userInfo[@"Path"]; + if ([path isKindOfClass:[NSString class]] && path.length) { - NSURL *fileURL = [NSURL fileURLWithPath:clickContext]; + NSURL *fileURL = [NSURL fileURLWithPath:path]; [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[fileURL]]; } } +- (void)showNotificationWithTitle:(NSString *)title description:(NSString *)description url:(NSURL *)fileURL +{ + NSUserNotification *notification = [[NSUserNotification alloc] init]; + notification.title = title; + notification.informativeText = description; + notification.soundName = NSUserNotificationDefaultSoundName; + notification.hasActionButton = YES; + notification.actionButtonTitle = NSLocalizedString(@"Show", @"Notification -> Show in Finder"); + notification.userInfo = @{ @"Path": fileURL.path }; + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; +} + /** * Sends the URL to the external app * selected in the preferences. @@ -1098,10 +1086,18 @@ [alert addButtonWithTitle:NSLocalizedString(@"Stop Encoding and Delete", nil)]; [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:targetWindow - modalDelegate:self - didEndSelector:@selector(didDimissCancelCurrentJob:returnCode:contextInfo:) - contextInfo:NULL]; + [alert beginSheetModalForWindow:targetWindow completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSAlertSecondButtonReturn) + { + [self.jobs beginTransaction]; + + NSInteger index = [self.jobs indexOfObject:self.currentJob]; + [self cancelCurrentJobAndContinue]; + + [self removeQueueItemAtIndex:index]; + [self.jobs commit]; + } + }]; } } @@ -1111,22 +1107,6 @@ [self.jobs commit]; } -- (void)didDimissCancelCurrentJob:(NSAlert *)alert - returnCode:(NSInteger)returnCode - contextInfo:(void *)contextInfo -{ - if (returnCode == NSAlertSecondButtonReturn) - { - [self.jobs beginTransaction]; - - NSInteger index = [self.jobs indexOfObject:self.currentJob]; - [self cancelCurrentJobAndContinue]; - - [self removeQueueItemAtIndex:index]; - [self.jobs commit]; - } -} - /** * Show the finished encode in the finder */ @@ -1230,28 +1210,20 @@ [alert addButtonWithTitle:NSLocalizedString(@"Finish Current and Stop", nil)]; [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:window - modalDelegate:self - didEndSelector:@selector(didDimissCancel:returnCode:contextInfo:) - contextInfo:nil]; -} - -- (void)didDimissCancel:(NSAlert *)alert - returnCode:(NSInteger)returnCode - contextInfo:(void *)contextInfo -{ - if (returnCode == NSAlertSecondButtonReturn) - { - [self cancelCurrentJobAndStop]; - } - else if (returnCode == NSAlertThirdButtonReturn) - { - [self cancelCurrentJobAndContinue]; - } - else if (returnCode == NSAlertThirdButtonReturn + 1) - { - [self finishCurrentAndStop]; - } + [alert beginSheetModalForWindow:window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSAlertSecondButtonReturn) + { + [self cancelCurrentJobAndStop]; + } + else if (returnCode == NSAlertThirdButtonReturn) + { + [self cancelCurrentJobAndContinue]; + } + else if (returnCode == NSAlertThirdButtonReturn + 1) + { + [self finishCurrentAndStop]; + } + }]; } /** @@ -1389,10 +1361,12 @@ [alert addButtonWithTitle:NSLocalizedString(@"Stop Encoding and Edit", nil)]; [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:docWindow - modalDelegate:self - didEndSelector:@selector(didDimissEditCurrentJob:returnCode:contextInfo:) - contextInfo:(__bridge void *)(job)]; + [alert beginSheetModalForWindow:docWindow completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSAlertSecondButtonReturn) + { + [self editQueueItem:job]; + } + }]; } else if (job.state != HBJobStateWorking) { @@ -1403,17 +1377,6 @@ [self.jobs commit]; } -- (void)didDimissEditCurrentJob:(NSAlert *)alert - returnCode:(NSInteger)returnCode - contextInfo:(void *)contextInfo -{ - if (returnCode == NSAlertSecondButtonReturn) - { - HBJob *job = (__bridge HBJob *)contextInfo; - [self editQueueItem:job]; - } -} - - (IBAction)clearAll:(id)sender { [self.jobs beginTransaction]; diff --git a/macosx/HBRenamePresetController.m b/macosx/HBRenamePresetController.m index 2b788da32..baeee738e 100644 --- a/macosx/HBRenamePresetController.m +++ b/macosx/HBRenamePresetController.m @@ -41,10 +41,7 @@ { [super windowDidLoad]; - if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_9) - { - self.name.placeholderString = self.preset.name; - } + self.name.placeholderString = self.preset.name; self.name.stringValue = self.preset.name; [[NSNotificationCenter defaultCenter] addObserver:self @@ -63,8 +60,7 @@ - (IBAction)dismiss:(id)sender { - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseCancel]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel]; } - (IBAction)rename:(id)sender @@ -79,9 +75,7 @@ else { [self.preset setName:self.name.stringValue]; - - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseContinue]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK]; } } diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m index 4576c6601..fd44ef59d 100644 --- a/macosx/HBSubtitlesController.m +++ b/macosx/HBSubtitlesController.m @@ -7,8 +7,7 @@ #import "HBSubtitlesController.h" #import "HBSubtitlesDefaultsController.h" -@import HandBrakeKit.HBSubtitles; -@import HandBrakeKit.HBSubtitlesDefaults; +@import HandBrakeKit; @interface HBSubtitlesController () @@ -62,22 +61,13 @@ HBSubtitlesDefaults *defaults = [self.subtitles.defaults copy]; self.defaultsController = [[HBSubtitlesDefaultsController alloc] initWithSettings:defaults]; - [NSApp beginSheet:self.defaultsController.window - modalForWindow:self.view.window - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:(void *)CFBridgingRetain(defaults)]; -} - -- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - HBSubtitlesDefaults *defaults = (HBSubtitlesDefaults *)CFBridgingRelease(contextInfo); - - if (returnCode == NSModalResponseOK) - { - self.subtitles.defaults = defaults; - } - self.defaultsController = nil; + [self.view.window beginSheet:self.defaultsController.window completionHandler:^(NSModalResponse returnCode) { + if (returnCode == NSModalResponseOK) + { + self.subtitles.defaults = defaults; + } + self.defaultsController = nil; + }]; } #pragma mark - Srt import diff --git a/macosx/HBSubtitlesDefaultsController.m b/macosx/HBSubtitlesDefaultsController.m index 1acac3c69..47f650dfa 100644 --- a/macosx/HBSubtitlesDefaultsController.m +++ b/macosx/HBSubtitlesDefaultsController.m @@ -7,7 +7,7 @@ #import "HBSubtitlesDefaultsController.h" #import "HBLanguagesSelection.h" -@import HandBrakeKit.HBSubtitlesDefaults; +@import HandBrakeKit; static void *HBSubtitlesDefaultsContext = &HBSubtitlesDefaultsContext; @@ -68,14 +68,12 @@ static void *HBSubtitlesDefaultsContext = &HBSubtitlesDefaultsContext; - (IBAction)ok:(id)sender { self.settings.trackSelectionLanguages = [self.languagesList.selectedLanguages mutableCopy]; - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseOK]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK]; } - (IBAction)cancel:(id)sender { - [self.window orderOut:nil]; - [NSApp endSheet:self.window returnCode:NSModalResponseCancel]; + [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel]; } - (IBAction)openUserGuide:(id)sender diff --git a/macosx/HBTitleSelectionController.m b/macosx/HBTitleSelectionController.m index b0f3e088a..05d44354f 100644 --- a/macosx/HBTitleSelectionController.m +++ b/macosx/HBTitleSelectionController.m @@ -6,7 +6,7 @@ #import "HBTitleSelectionController.h" -@import HandBrakeKit.HBTitle; +@import HandBrakeKit; @interface HBTitleSelection : NSObject @property (nonatomic, readonly) HBTitle *title; diff --git a/macosx/HBVideo+UIAdditions.h b/macosx/HBVideo+UIAdditions.h index beb0584b5..5ce7648a7 100644 --- a/macosx/HBVideo+UIAdditions.h +++ b/macosx/HBVideo+UIAdditions.h @@ -50,3 +50,13 @@ @interface HBQualityTransformer : NSValueTransformer - (instancetype)initWithReversedDirection:(BOOL)reverse min:(double)min max:(double)max NS_DESIGNATED_INITIALIZER; @end + +@interface HBVideo (EncoderAdditions) + +- (BOOL)isUnparsedSupported:(int)encoder; +- (BOOL)isPresetSystemSupported:(int)encoder; +- (BOOL)isSimpleOptionsPanelSupported:(int)encoder; +- (BOOL)isOldAdvancedPanelSupported:(int)encoder; +- (void)qualityLimitsForEncoder:(int)encoder low:(float *)low high:(float *)high granularity:(float *)granularity direction:(int *)direction; + +@end diff --git a/macosx/HBVideo+UIAdditions.m b/macosx/HBVideo+UIAdditions.m index 1a07bb810..0c0410b3a 100644 --- a/macosx/HBVideo+UIAdditions.m +++ b/macosx/HBVideo+UIAdditions.m @@ -413,3 +413,31 @@ } @end + +@implementation HBVideo (EncoderAdditions) + +- (BOOL)isUnparsedSupported:(int)encoder +{ + return encoder & HB_VCODEC_X264_MASK; +} +- (BOOL)isPresetSystemSupported:(int)encoder +{ + return hb_video_encoder_get_presets(encoder) != NULL; +} + +- (BOOL)isSimpleOptionsPanelSupported:(int)encoder +{ + return encoder & HB_VCODEC_FFMPEG_MASK; +} + +- (BOOL)isOldAdvancedPanelSupported:(int)encoder +{ + return encoder & HB_VCODEC_X264_MASK; +} + +- (void)qualityLimitsForEncoder:(int)encoder low:(float *)low high:(float *)high granularity:(float *)granularity direction:(int *)direction +{ + hb_video_quality_get_limits(encoder, low, high, granularity, direction); +} + +@end diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index 355f24ad9..a08d87bcc 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -9,8 +9,6 @@ @import HandBrakeKit; -#include "hb.h" - static void *HBVideoControllerContext = &HBVideoControllerContext; @interface HBVideoController () { @@ -130,21 +128,15 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; } else if ([keyPath isEqualToString:@"video.quality"]) { - if ([fVidQualitySlider respondsToSelector:@selector(setAccessibilityValueDescription:)]) - { - fVidQualitySlider.accessibilityValueDescription = [NSString stringWithFormat:@"%@ %.2f", self.video.constantQualityLabel, self.video.quality];; - } + fVidQualitySlider.accessibilityValueDescription = [NSString stringWithFormat:@"%@ %.2f", self.video.constantQualityLabel, self.video.quality];; } else if ([keyPath isEqualToString:@"video.preset"]) { - if ([fPresetsSlider respondsToSelector:@selector(setAccessibilityValueDescription:)]) - { - fPresetsSlider.accessibilityValueDescription = self.video.preset; - } + fPresetsSlider.accessibilityValueDescription = self.video.preset; } else if ([keyPath isEqualToString:@"video.unparseOptions"]) { - if (self.video.encoder & HB_VCODEC_X264_MASK) + if ([self.video isUnparsedSupported:self.video.encoder]) { fDisplayX264PresetsUnparseTextField.stringValue = [NSString stringWithFormat:@"x264 Unparse: %@", self.video.unparseOptions]; } @@ -195,8 +187,8 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; { int direction; float minValue, maxValue, granularity; - hb_video_quality_get_limits(self.video.encoder, - &minValue, &maxValue, &granularity, &direction); + [self.video qualityLimitsForEncoder:self.video.encoder low:&minValue high:&maxValue granularity:&granularity direction:&direction]; + if (granularity < 1.0f) { // Encoders that allow fractional CQ values often have a low granularity @@ -225,19 +217,19 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; { self.advancedController.hidden = YES; - if (hb_video_encoder_get_presets(self.video.encoder) != NULL) + if ([self.video isPresetSystemSupported:self.video.encoder]) { [self toggleAdvancedOptionsCheckBoxForEncoder:self.video.encoder]; fPresetsBox.contentView = fPresetView; [self setupPresetsSlider]; - if (self.video.encoder & HB_VCODEC_X264_MASK) + if ([self.video isOldAdvancedPanelSupported:self.video.encoder]) { self.advancedController.hidden = NO; } } - else if (self.video.encoder & HB_VCODEC_FFMPEG_MASK) + else if ([self.video isSimpleOptionsPanelSupported:self.video.encoder]) { fPresetsBox.contentView = fSimplePresetView; } @@ -268,7 +260,7 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; */ - (void)toggleAdvancedOptionsCheckBoxForEncoder:(int)encoder { - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"] && (encoder & HB_VCODEC_X264_MASK)) + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"] && [self.video isOldAdvancedPanelSupported:self.video.encoder]) { fX264UseAdvancedOptionsCheck.hidden = NO; fDividerLine.hidden = YES; diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index b4cbea8ad..19283ff9f 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -40,8 +40,6 @@ 273F20B514ADBE670021BE6D /* HBPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A014ADBE670021BE6D /* HBPreferencesController.m */; }; 273F20B714ADBE670021BE6D /* HBPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20A414ADBE670021BE6D /* HBPreviewController.m */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; }; 273F20BA14ADBE670021BE6D /* HBPictureController.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F20AA14ADBE670021BE6D /* HBPictureController.m */; }; - 273F20C814ADC4FF0021BE6D /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F20C714ADC4FF0021BE6D /* QTKit.framework */; }; - 273F20CB14ADC89A0021BE6D /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 273F20BF14ADC1250021BE6D /* Growl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 273F20CC14ADC8A10021BE6D /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 273F20C014ADC1250021BE6D /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 273F218A14ADDDA10021BE6D /* AdvancedView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 273F217A14ADDDA10021BE6D /* AdvancedView.xib */; }; 273F218B14ADDDA10021BE6D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 273F217C14ADDDA10021BE6D /* InfoPlist.strings */; }; @@ -51,7 +49,6 @@ 273F218F14ADDDA10021BE6D /* PictureSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 273F218414ADDDA10021BE6D /* PictureSettings.xib */; }; 273F219014ADDDA10021BE6D /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 273F218614ADDDA10021BE6D /* Preferences.xib */; }; 273F219114ADDDA10021BE6D /* Queue.xib in Resources */ = {isa = PBXBuildFile; fileRef = 273F218814ADDDA10021BE6D /* Queue.xib */; }; - 273F21C114ADE7A20021BE6D /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F20BF14ADC1250021BE6D /* Growl.framework */; }; 273F21C214ADE7BC0021BE6D /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F20C014ADC1250021BE6D /* Sparkle.framework */; }; 27D6C72614B1019100B785E4 /* libhandbrake.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72414B1019100B785E4 /* libhandbrake.a */; }; 27D6C74414B102DA00B785E4 /* libass.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72814B102DA00B785E4 /* libass.a */; }; @@ -93,7 +90,6 @@ A916C9971C8449CA00C7B560 /* HBAudioDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A932E26E198833920047D13E /* HBAudioDefaultsController.m */; }; A916C9981C8449DB00C7B560 /* HBTitleSelectionController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C183941A716B8F00C897C2 /* HBTitleSelectionController.m */; }; A916C9991C8449E200C7B560 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 273F20BD14ADC09F0021BE6D /* main.mm */; }; - A916C99A1C8449FB00C7B560 /* HBHUDView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C9F88819A733FE00DC8923 /* HBHUDView.m */; }; A916C99B1C844A0800C7B560 /* HBQueueOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EA43671A2210C400785E95 /* HBQueueOutlineView.m */; }; A919430D1FB5E2FE001E9BB0 /* HBSummaryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A919430B1FB5E2FE001E9BB0 /* HBSummaryViewController.m */; }; A91943111FB5E39E001E9BB0 /* HBSummaryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A919430F1FB5E39E001E9BB0 /* HBSummaryViewController.xib */; }; @@ -123,7 +119,6 @@ A91CE2A41C7DA7320068F46F /* HBPicture+UIAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A9537BF51A48AB6300141102 /* HBPicture+UIAdditions.m */; }; A91CE2A61C7DA7320068F46F /* HBFilters+UIAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A9537BF81A48AC9000141102 /* HBFilters+UIAdditions.m */; }; A91CE2A81C7DA7320068F46F /* HBDVDDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 273F209814ADBE670021BE6D /* HBDVDDetector.m */; }; - A91CE2AA1C7DA7320068F46F /* HBCodingUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9160A341AE7A165009A7818 /* HBCodingUtilities.m */; }; A91CE2AD1C7DA7320068F46F /* HBStateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = A975C08D1AE8C5270061870D /* HBStateFormatter.m */; }; A91CE2B01C7DA9FB0068F46F /* HBUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AA44791970664A00D7DEFC /* HBUtilities.m */; }; A91CE2B11C7DAA530068F46F /* libhandbrake.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D6C72414B1019100B785E4 /* libhandbrake.a */; }; @@ -193,9 +188,9 @@ A92268781A6E555500A8D5C5 /* HBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A92268771A6E555500A8D5C5 /* HBAppDelegate.m */; }; A922687B1A6E569B00A8D5C5 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A92268791A6E569B00A8D5C5 /* MainWindow.xib */; }; A9294CC91DC4BBF7004D3415 /* HBJob+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A9294CC71DC4BBF7004D3415 /* HBJob+Private.h */; }; + A92B148220CA9F7700146FD8 /* HBHUDView.m in Sources */ = {isa = PBXBuildFile; fileRef = A92B148120CA9F7600146FD8 /* HBHUDView.m */; }; A92EC6EA1FE40FD90013511E /* HBPreviewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A92EC6E81FE40FD90013511E /* HBPreviewViewController.xib */; }; A932E26C1988334B0047D13E /* AudioDefaults.xib in Resources */ = {isa = PBXBuildFile; fileRef = A932E26A1988334B0047D13E /* AudioDefaults.xib */; }; - A9350F501CCA7F490089F970 /* HBQTKitPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = A9350F4E1CCA7C3B0089F970 /* HBQTKitPlayer.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 */; }; A93B49221DA3AA6900DD70A3 /* HBToolbarBadgedItem.m in Sources */ = {isa = PBXBuildFile; fileRef = A93B49211DA3AA6900DD70A3 /* HBToolbarBadgedItem.m */; }; @@ -234,7 +229,6 @@ A9ABD1A71E2A0F7500EC8B65 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9ABD1A51E2A0F0700EC8B65 /* CoreText.framework */; }; A9ABD1A91E2A0F8200EC8B65 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9ABD1A81E2A0F8200EC8B65 /* CoreGraphics.framework */; }; A9ABD1AA1E2A0F8F00EC8B65 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9ABD1A81E2A0F8200EC8B65 /* CoreGraphics.framework */; }; - A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A9BB0F2619A0ECE40079F1C1 /* HBHUDButtonCell.m */; }; A9BC24C91A69293E007DC41A /* HBAttributedStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A9BC24C81A69293E007DC41A /* HBAttributedStringAdditions.m */; }; A9C0DB85197E7B0000DF55B3 /* SubtitlesDefaults.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C0DB83197E7B0000DF55B3 /* SubtitlesDefaults.xib */; }; A9C1839D1A716BCC00C897C2 /* HBTitleSelection.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C1839B1A716BCC00C897C2 /* HBTitleSelection.xib */; }; @@ -316,7 +310,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 273F20CB14ADC89A0021BE6D /* Growl.framework in CopyFiles */, 273F20CC14ADC8A10021BE6D /* Sparkle.framework in CopyFiles */, A9736F181C7DA5FE008F1D18 /* HandBrakeKit.framework in CopyFiles */, ); @@ -379,9 +372,7 @@ 273F20A914ADBE670021BE6D /* HBPictureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPictureController.h; sourceTree = "<group>"; }; 273F20AA14ADBE670021BE6D /* HBPictureController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPictureController.m; sourceTree = "<group>"; }; 273F20BD14ADC09F0021BE6D /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; }; - 273F20BF14ADC1250021BE6D /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = "<group>"; }; 273F20C014ADC1250021BE6D /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; }; - 273F20C714ADC4FF0021BE6D /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; }; 273F217B14ADDDA10021BE6D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AdvancedView.xib; sourceTree = "<group>"; }; 273F217D14ADDDA10021BE6D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = InfoPlist.strings; sourceTree = "<group>"; }; 273F217F14ADDDA10021BE6D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = MainMenu.xib; sourceTree = "<group>"; }; @@ -435,7 +426,6 @@ A914BCB11BC441C700157917 /* HBPreviewView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPreviewView.h; sourceTree = "<group>"; }; A914BCB21BC441C700157917 /* HBPreviewView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPreviewView.m; sourceTree = "<group>"; }; A9160A331AE7A165009A7818 /* HBCodingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBCodingUtilities.h; sourceTree = "<group>"; }; - A9160A341AE7A165009A7818 /* HBCodingUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBCodingUtilities.m; sourceTree = "<group>"; }; A91726E5197291BC00D1AFEF /* HBChapterTitlesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBChapterTitlesController.h; sourceTree = "<group>"; }; A91726E6197291BC00D1AFEF /* HBChapterTitlesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBChapterTitlesController.m; sourceTree = "<group>"; }; A918066F1A4807B000FC9BED /* HBRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBRange.h; sourceTree = "<group>"; }; @@ -465,14 +455,14 @@ A92268771A6E555500A8D5C5 /* HBAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAppDelegate.m; sourceTree = "<group>"; }; A922687A1A6E569B00A8D5C5 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = MainWindow.xib; sourceTree = "<group>"; }; A9294CC71DC4BBF7004D3415 /* HBJob+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HBJob+Private.h"; sourceTree = "<group>"; }; + A92B148020CA9F7600146FD8 /* HBHUDView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBHUDView.h; sourceTree = "<group>"; }; + A92B148120CA9F7600146FD8 /* HBHUDView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBHUDView.m; sourceTree = "<group>"; }; A92EC6E91FE40FD90013511E /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/HBPreviewViewController.xib; sourceTree = "<group>"; }; A932E26B1988334B0047D13E /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AudioDefaults.xib; sourceTree = "<group>"; }; A932E26D198833920047D13E /* HBAudioDefaultsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAudioDefaultsController.h; sourceTree = "<group>"; }; A932E26E198833920047D13E /* HBAudioDefaultsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAudioDefaultsController.m; sourceTree = "<group>"; }; A932E271198834130047D13E /* HBAudioDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAudioDefaults.h; sourceTree = "<group>"; }; A932E272198834130047D13E /* HBAudioDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAudioDefaults.m; sourceTree = "<group>"; }; - A9350F4D1CCA7C3B0089F970 /* HBQTKitPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBQTKitPlayer.h; sourceTree = "<group>"; }; - A9350F4E1CCA7C3B0089F970 /* HBQTKitPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBQTKitPlayer.m; sourceTree = "<group>"; }; A937EECA1C6C7C0300EEAE6D /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; }; A939DD891FC8826A00135F2A /* HBPresetsMenuBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBPresetsMenuBuilder.h; sourceTree = "<group>"; }; A939DD8A1FC8826A00135F2A /* HBPresetsMenuBuilder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HBPresetsMenuBuilder.m; sourceTree = "<group>"; }; @@ -560,16 +550,12 @@ A9ABD1A51E2A0F0700EC8B65 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; A9ABD1A81E2A0F8200EC8B65 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; A9B34D74197696FE00871B7D /* DiskArbitration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DiskArbitration.framework; path = System/Library/Frameworks/DiskArbitration.framework; sourceTree = SDKROOT; }; - A9BB0F2519A0ECE40079F1C1 /* HBHUDButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBHUDButtonCell.h; sourceTree = "<group>"; }; - A9BB0F2619A0ECE40079F1C1 /* HBHUDButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBHUDButtonCell.m; sourceTree = "<group>"; }; A9BC24C71A69293E007DC41A /* HBAttributedStringAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAttributedStringAdditions.h; sourceTree = "<group>"; }; A9BC24C81A69293E007DC41A /* HBAttributedStringAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAttributedStringAdditions.m; sourceTree = "<group>"; }; A9C0DB84197E7B0000DF55B3 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = SubtitlesDefaults.xib; sourceTree = "<group>"; }; A9C183931A716B8F00C897C2 /* HBTitleSelectionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBTitleSelectionController.h; sourceTree = "<group>"; }; A9C183941A716B8F00C897C2 /* HBTitleSelectionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBTitleSelectionController.m; sourceTree = "<group>"; }; A9C1839C1A716BCC00C897C2 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = HBTitleSelection.xib; sourceTree = "<group>"; }; - A9C9F88719A733FE00DC8923 /* HBHUDView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBHUDView.h; sourceTree = "<group>"; }; - A9C9F88819A733FE00DC8923 /* HBHUDView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBHUDView.m; sourceTree = "<group>"; }; A9CAC26E1CCB6B0F00A39E72 /* HBPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPlayer.h; sourceTree = "<group>"; }; A9CE0A911F57EC3400724577 /* HBImageUtilities.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HBImageUtilities.m; sourceTree = "<group>"; }; A9CE0A931F57EC4600724577 /* HBImageUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBImageUtilities.h; sourceTree = "<group>"; }; @@ -674,8 +660,6 @@ buildActionMask = 2147483647; files = ( 273F203C14ADBC210021BE6D /* Cocoa.framework in Frameworks */, - 273F21C114ADE7A20021BE6D /* Growl.framework in Frameworks */, - 273F20C814ADC4FF0021BE6D /* QTKit.framework in Frameworks */, A9E1467B16BC2ABD00C307BC /* QuartzCore.framework in Frameworks */, 273F21C214ADE7BC0021BE6D /* Sparkle.framework in Frameworks */, A9736F171C7DA5FE008F1D18 /* HandBrakeKit.framework in Frameworks */, @@ -837,7 +821,6 @@ 273F203B14ADBC210021BE6D /* Cocoa.framework */, 273F203214ADB9F00021BE6D /* CoreServices.framework */, 273F202214ADB8650021BE6D /* IOKit.framework */, - 273F20C714ADC4FF0021BE6D /* QTKit.framework */, A9E1467A16BC2ABD00C307BC /* QuartzCore.framework */, 273F203D14ADBC210021BE6D /* Other Frameworks */, 273F202714ADB8BE0021BE6D /* libbz2.dylib */, @@ -886,7 +869,6 @@ 273F20CE14ADC9210021BE6D /* Bundled */ = { isa = PBXGroup; children = ( - 273F20BF14ADC1250021BE6D /* Growl.framework */, 273F20C014ADC1250021BE6D /* Sparkle.framework */, ); name = Bundled; @@ -1019,7 +1001,6 @@ A9CE0A931F57EC4600724577 /* HBImageUtilities.h */, A9CE0A911F57EC3400724577 /* HBImageUtilities.m */, A9160A331AE7A165009A7818 /* HBCodingUtilities.h */, - A9160A341AE7A165009A7818 /* HBCodingUtilities.m */, A997D8EB1A4ABB0900E19B6F /* HBPresetCoding.h */, A975C08C1AE8C5270061870D /* HBStateFormatter.h */, A975C08D1AE8C5270061870D /* HBStateFormatter.m */, @@ -1075,8 +1056,6 @@ A9CAC26E1CCB6B0F00A39E72 /* HBPlayer.h */, A9A0CBE51CCEA1D10045B3DF /* HBPlayerTrack.h */, A9A0CBE61CCEA1D10045B3DF /* HBPlayerTrack.m */, - A9350F4D1CCA7C3B0089F970 /* HBQTKitPlayer.h */, - A9350F4E1CCA7C3B0089F970 /* HBQTKitPlayer.m */, A98036CB1CCA91DD007661AA /* HBAVPlayer.h */, A98036CC1CCA91DD007661AA /* HBAVPlayer.m */, ); @@ -1292,10 +1271,8 @@ isa = PBXGroup; children = ( A941ACB91CD75B4E0029D06A /* HBHUD.h */, - A9BB0F2519A0ECE40079F1C1 /* HBHUDButtonCell.h */, - A9BB0F2619A0ECE40079F1C1 /* HBHUDButtonCell.m */, - A9C9F88719A733FE00DC8923 /* HBHUDView.h */, - A9C9F88819A733FE00DC8923 /* HBHUDView.m */, + A92B148020CA9F7600146FD8 /* HBHUDView.h */, + A92B148120CA9F7600146FD8 /* HBHUDView.m */, A96664B21CCE48F700DA4A57 /* HBPictureHUDController.h */, A96664B31CCE48F700DA4A57 /* HBPictureHUDController.m */, A96664B41CCE48F700DA4A57 /* HBPictureHUDController.xib */, @@ -1587,8 +1564,6 @@ buildActionMask = 2147483647; files = ( A916C99B1C844A0800C7B560 /* HBQueueOutlineView.m in Sources */, - A916C99A1C8449FB00C7B560 /* HBHUDView.m in Sources */, - A9350F501CCA7F490089F970 /* HBQTKitPlayer.m in Sources */, A916C9991C8449E200C7B560 /* main.mm in Sources */, A916C9981C8449DB00C7B560 /* HBTitleSelectionController.m in Sources */, A903C5601CCE78060026B0ED /* NSWindow+HBAdditions.m in Sources */, @@ -1616,7 +1591,6 @@ A96664BA1CCE493D00DA4A57 /* HBEncodingProgressHUDController.m in Sources */, A9A7E27C1FE2A0B5006BE79F /* HBPreviewViewController.m in Sources */, A919430D1FB5E2FE001E9BB0 /* HBSummaryViewController.m in Sources */, - A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */, A9706CB71AC1437800BAEAA8 /* HBExceptionAlertController.m in Sources */, A93B49221DA3AA6900DD70A3 /* HBToolbarBadgedItem.m in Sources */, A91AD3401FB5D2FC00AEA822 /* HBAddCategoryController.m in Sources */, @@ -1632,6 +1606,7 @@ A91AFD0C1A948827009BECED /* HBOutputFileWriter.m in Sources */, A95121E61B5F7BE700FD773D /* NSArray+HBAdditions.m in Sources */, A96664B51CCE48F700DA4A57 /* HBPictureHUDController.m in Sources */, + A92B148220CA9F7700146FD8 /* HBHUDView.m in Sources */, A914BCB31BC441C700157917 /* HBPreviewView.m in Sources */, 273F20B714ADBE670021BE6D /* HBPreviewController.m in Sources */, A9D1E41718262364002F6424 /* HBPreviewGenerator.m in Sources */, @@ -1678,7 +1653,6 @@ A91119A61C7DD64A001C463C /* HBDistributedArray.m in Sources */, A91CE2A61C7DA7320068F46F /* HBFilters+UIAdditions.m in Sources */, A91CE2A81C7DA7320068F46F /* HBDVDDetector.m in Sources */, - A91CE2AA1C7DA7320068F46F /* HBCodingUtilities.m in Sources */, A91CE2AD1C7DA7320068F46F /* HBStateFormatter.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1949,7 +1923,6 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = NO; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -1981,7 +1954,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_LDFLAGS = ( "-filelist", "$(EXTERNAL_BUILD)/macosx/osl.filelist.txt", @@ -2014,7 +1987,6 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = NO; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2042,7 +2014,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_LDFLAGS = ( "-filelist", "$(EXTERNAL_BUILD)/macosx/osl.filelist.txt", @@ -2130,7 +2102,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -2160,7 +2131,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -2237,7 +2207,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKit; @@ -2296,7 +2265,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKit; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2349,7 +2317,6 @@ ); INFOPLIST_FILE = HandBrakeKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKitTests; @@ -2395,7 +2362,6 @@ ); INFOPLIST_FILE = HandBrakeKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2425,7 +2391,6 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = NO; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2459,7 +2424,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_LDFLAGS = ( "-filelist", "$(EXTERNAL_BUILD)/macosx/osl.filelist.txt", @@ -2559,7 +2524,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKit; @@ -2613,7 +2577,6 @@ ); INFOPLIST_FILE = HandBrakeKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKitTests; @@ -2649,7 +2612,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -2676,7 +2638,6 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2706,7 +2667,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_LDFLAGS = ( "-filelist", "$(EXTERNAL_BUILD)/macosx/osl.filelist.txt", @@ -2800,7 +2761,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKit; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2847,7 +2807,6 @@ ); INFOPLIST_FILE = HandBrakeKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = fr.handbrake.HandBrakeKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2882,7 +2841,6 @@ "\"$(EXTERNAL_BUILD)/libhb\"", "\"$(EXTERNAL_BUILD)/contrib/lib\"", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/macosx/Info.plist.m4 b/macosx/Info.plist.m4 index 8b511b40b..96c7a98de 100644 --- a/macosx/Info.plist.m4 +++ b/macosx/Info.plist.m4 @@ -70,5 +70,7 @@ GPLv2 license.</string> <string>dsa_pub.pem</string> <key>SUAllowsAutomaticUpdates</key> <false/> + <key>NSUserNotificationAlertStyle</key> + <string>alert</string> </dict> </plist> diff --git a/test/test.c b/test/test.c index 1e5ad2e47..0cfa90432 100644 --- a/test/test.c +++ b/test/test.c @@ -43,6 +43,7 @@ #include <IOKit/IOKitLib.h> #include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IODVDMedia.h> +#include <sys/mount.h> #endif #define LAPSHARP_DEFAULT_PRESET "medium" @@ -4888,46 +4889,23 @@ static void print_string_list(FILE *out, const char* const *list, const char *pr ****************************************************************************/ static char* bsd_name_for_path(char *path) { - OSStatus err; - FSRef ref; - err = FSPathMakeRef( (const UInt8 *) input, &ref, NULL ); - if( err != noErr ) - { - return NULL; - } + const char *prefix = "/dev/"; + struct statfs s; - // Get the volume reference number. - FSCatalogInfo catalogInfo; - err = FSGetCatalogInfo( &ref, kFSCatInfoVolume, &catalogInfo, NULL, NULL, - NULL); - if( err != noErr ) + if (statfs(path, &s) == -1) { return NULL; } - FSVolumeRefNum volRefNum = catalogInfo.volume; - // Now let's get the device name - GetVolParmsInfoBuffer volumeParms; - err = FSGetVolumeParms( volRefNum, &volumeParms, sizeof( volumeParms ) ); - if( err != noErr ) - { - return NULL; - } + size_t lenpre = strlen(prefix), + lenstr = strlen(s.f_mntfromname); - // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field. - // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h. - if( volumeParms.vMVersion < 4 ) + if (lenstr > lenpre && strncmp(prefix, s.f_mntfromname, lenpre) == 0) { - return NULL; - } - - // vMDeviceID might be zero as is reported with experimental ZFS (zfs-119) support in Leopard. - if( !volumeParms.vMDeviceID ) - { - return NULL; + return strdup(s.f_mntfromname + lenpre); } - return strdup( volumeParms.vMDeviceID ); + return strdup(s.f_mntfromname); } /**************************************************************************** |