diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/English.lproj/PicturePreview.xib | 8 | ||||
-rw-r--r-- | macosx/English.lproj/PictureSettings.xib | 32 | ||||
-rw-r--r-- | macosx/HBAppDelegate.m | 19 | ||||
-rw-r--r-- | macosx/HBController.m | 27 | ||||
-rw-r--r-- | macosx/HBOutputPanelController.m | 18 | ||||
-rw-r--r-- | macosx/HBPictureController.h | 10 | ||||
-rw-r--r-- | macosx/HBPictureController.m | 18 | ||||
-rw-r--r-- | macosx/HBPreviewController.h | 9 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 26 | ||||
-rw-r--r-- | macosx/HBQueueController.m | 18 |
10 files changed, 79 insertions, 106 deletions
diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib index 604172292..f2c07fb41 100644 --- a/macosx/English.lproj/PicturePreview.xib +++ b/macosx/English.lproj/PicturePreview.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14C68k" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7528.3" systemVersion="14D113c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" identifier="macosx"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/> - <plugIn identifier="com.apple.QTKitIBPlugin" version="6250"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7528.3"/> + <plugIn identifier="com.apple.QTKitIBPlugin" version="7528.3"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBPreviewController"> @@ -27,7 +27,7 @@ </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/> - <window title="HandBrake Preview" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="PreviewPanel"> + <window title="Preview" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="PreviewPanel"> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <rect key="contentRect" x="221" y="837" width="490" height="360"/> diff --git a/macosx/English.lproj/PictureSettings.xib b/macosx/English.lproj/PictureSettings.xib index dcfa5fc66..1a9a51b61 100644 --- a/macosx/English.lproj/PictureSettings.xib +++ b/macosx/English.lproj/PictureSettings.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C81f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7528.3" systemVersion="14D113c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" identifier="macosx"/> <development version="5100" identifier="xcode"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7528.3"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBPictureController"> @@ -995,6 +995,11 @@ </tabViewItem> </tabViewItems> <connections> + <binding destination="-2" name="hidden" keyPath="self.picture" id="W8S-DU-3XL"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNil</string> + </dictionary> + </binding> <outlet property="delegate" destination="-2" id="420"/> </connections> </tabView> @@ -1007,14 +1012,35 @@ </buttonCell> <connections> <action selector="showPreviewWindow:" target="-2" id="273"/> + <binding destination="-2" name="hidden" keyPath="self.picture" id="zTd-kj-P5U"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNil</string> + </dictionary> + </binding> </connections> </button> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="XmO-LR-1DQ"> + <rect key="frame" x="258" y="122" width="118" height="17"/> + <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Nothing to inspect" id="buq-K6-Wvy"> + <font key="font" metaFont="system"/> + <color key="textColor" name="highlightColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + <connections> + <binding destination="-2" name="hidden" keyPath="self.picture" id="00s-D3-JmF"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> + </connections> + </textField> </subviews> </view> <connections> <outlet property="delegate" destination="-2" id="hby-dR-NFK"/> </connections> - <point key="canvasLocation" x="-1.5" y="238"/> + <point key="canvasLocation" x="-807.5" y="98"/> </window> <userDefaultsController representsSharedInstance="YES" id="vUw-ux-GVV"/> </objects> diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m index 872d61c3e..87bf0f45d 100644 --- a/macosx/HBAppDelegate.m +++ b/macosx/HBAppDelegate.m @@ -84,6 +84,14 @@ // Get the number of HandBrake instances currently running NSUInteger instances = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]].count; + // Open debug output window now if it was visible when HB was closed + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OutputPanelIsOpen"]) + [self showOutputPanel:nil]; + + // Open queue window now if it was visible when HB was closed + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"]) + [self showQueueWindow:nil]; + [self showMainWindow:self]; // Now we re-check the queue array to see if there are @@ -165,14 +173,6 @@ [self.mainController launchAction]; } - // Open debug output window now if it was visible when HB was closed - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OutputPanelIsOpen"]) - [self showOutputPanel:nil]; - - // Open queue window now if it was visible when HB was closed - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"]) - [self showQueueWindow:nil]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ // Remove encodes logs older than a month if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBClearOldLogs"]) @@ -242,6 +242,9 @@ { [self.presetsManager savePresets]; + [[NSUserDefaults standardUserDefaults] setBool:_queueController.window.isVisible forKey:@"QueueWindowIsOpen"]; + [[NSUserDefaults standardUserDefaults] setBool:_outputPanel.window.isVisible forKey:@"OutputPanelIsOpen"]; + _mainController = nil; _queueController = nil; diff --git a/macosx/HBController.m b/macosx/HBController.m index 29b69da18..9379abf43 100644 --- a/macosx/HBController.m +++ b/macosx/HBController.m @@ -29,7 +29,7 @@ #import "HBCore.h" #import "HBJob.h" -@interface HBController () <HBPresetsViewControllerDelegate, HBPreviewControllerDelegate, HBPictureControllerDelegate, HBTitleSelectionDelegate> +@interface HBController () <HBPresetsViewControllerDelegate, HBTitleSelectionDelegate> @property (unsafe_unretained) IBOutlet NSView *openTitleView; @property (nonatomic, readwrite) BOOL scanSpecificTitle; @@ -73,10 +73,10 @@ _core.name = @"ScanCore"; // Inits the controllers + fPreviewController = [[HBPreviewController alloc] init]; fPictureController = [[HBPictureController alloc] init]; - [fPictureController setDelegate:self]; - - fPreviewController = [[HBPreviewController alloc] initWithDelegate:self]; + fPictureController.previewWindow = fPreviewController; + fPreviewController.pictureSettingsWindow = fPictureController; fQueueController = queueController; fQueueController.controller = self; @@ -346,9 +346,7 @@ } } - if (action == @selector(showPicturePanel:) || - action == @selector(showPreviewWindow:) || - action == @selector(addToQueue:)) + if (action == @selector(addToQueue:)) { return (self.job != nil); } @@ -360,9 +358,8 @@ { SEL action = [menuItem action]; - if (action == @selector(addToQueue:) || action == @selector(addAllTitlesToQueue:) || action == @selector(addTitlesToQueue:) || - action == @selector(showPicturePanel:) || action == @selector(showAddPresetPanel:) || - action == @selector(showPreviewWindow:)) + if (action == @selector(addToQueue:) || action == @selector(addAllTitlesToQueue:) || + action == @selector(addTitlesToQueue:) || action == @selector(showAddPresetPanel:)) { return self.job && self.window.attachedSheet == nil; } @@ -751,14 +748,6 @@ [self titlePopUpChanged:nil]; - // Open preview window now if it was visible when HB was closed - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PreviewWindowIsOpen"]) - [self showPreviewWindow:nil]; - - // Open picture sizing window now if it was visible when HB was closed - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PictureSizeWindowIsOpen"]) - [self showPicturePanel:nil]; - if (self.jobFromQueue) { [fPresetsView deselect]; @@ -1273,7 +1262,7 @@ */ - (IBAction)showPicturePanel:(id)sender { - [fPictureController showPictureWindow]; + [fPictureController showWindow:sender]; } - (IBAction)showPreviewWindow:(id)sender diff --git a/macosx/HBOutputPanelController.m b/macosx/HBOutputPanelController.m index 2fc5f3032..7555afe77 100644 --- a/macosx/HBOutputPanelController.m +++ b/macosx/HBOutputPanelController.m @@ -94,17 +94,8 @@ */ - (IBAction)showWindow:(id)sender { - if ([[self window] isVisible]) - { - [[self window] close]; - } - else - { - [textView scrollToEndOfDocument:self]; - [super showWindow:sender]; - - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"OutputPanelIsOpen"]; - } + [textView scrollToEndOfDocument:self]; + [super showWindow:sender]; } /** @@ -183,9 +174,4 @@ [self.outputFile clear]; } -- (void)windowWillClose:(NSNotification *)aNotification -{ - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"OutputPanelIsOpen"]; -} - @end diff --git a/macosx/HBPictureController.h b/macosx/HBPictureController.h index 6efbcbe5b..1460fa9e2 100644 --- a/macosx/HBPictureController.h +++ b/macosx/HBPictureController.h @@ -9,19 +9,11 @@ @class HBFilters; @class HBPicture; -@protocol HBPictureControllerDelegate <NSObject> - -- (IBAction)showPreviewWindow:(id)sender; - -@end - @interface HBPictureController : NSWindowController <NSWindowDelegate> @property (nonatomic, readwrite, strong) HBFilters *filters; @property (nonatomic, readwrite, strong) HBPicture *picture; -@property (nonatomic, readwrite, unsafe_unretained) id <HBPictureControllerDelegate> delegate; - -- (void)showPictureWindow; +@property (nonatomic, readwrite, unsafe_unretained) NSWindowController *previewWindow; @end diff --git a/macosx/HBPictureController.m b/macosx/HBPictureController.m index 73c09f1e2..ba6dc9a24 100644 --- a/macosx/HBPictureController.m +++ b/macosx/HBPictureController.m @@ -315,30 +315,24 @@ static void *HBPictureControllerContext = &HBPictureControllerContext; /** * Displays and brings the picture window to the front */ -- (void)showPictureWindow +- (void)showWindow:(id)sender { - if ([[self window] isVisible]) + if (self.window.isVisible) { - [[self window] close]; + [self.window close]; } else { - [self showWindow:self]; - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PictureSizeWindowIsOpen"]; + [super showWindow:self]; } [self resizeInspectorForTab:nil]; [self adjustSizingDisplay:nil]; } -- (IBAction) showPreviewWindow: (id) sender +- (IBAction)showPreviewWindow:(id)sender { - [self.delegate showPreviewWindow:sender]; -} - -- (void) windowWillClose: (NSNotification *)aNotification -{ - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PictureSizeWindowIsOpen"]; + [self.previewWindow showWindow:sender]; } @end diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index 9dd2ccf7f..866c2a45d 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -8,16 +8,9 @@ @class HBPreviewGenerator; -@protocol HBPreviewControllerDelegate <NSObject> - -- (IBAction)showPicturePanel:(id)sender; - -@end - @interface HBPreviewController : NSWindowController <NSWindowDelegate> -- (id)initWithDelegate:(id <HBPreviewControllerDelegate>)delegate; - @property (nonatomic, strong) HBPreviewGenerator *generator; +@property (nonatomic, readwrite, unsafe_unretained) NSWindowController *pictureSettingsWindow; @end diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 4196819e7..92e779685 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -93,8 +93,6 @@ typedef enum ViewMode : NSUInteger { IBOutlet NSPopUpButton * fPreviewMovieLengthPopUp; } -@property (nonatomic, unsafe_unretained) id <HBPreviewControllerDelegate> delegate; - @property (nonatomic, strong) CALayer *backLayer; @property (nonatomic, strong) CALayer *pictureLayer; @@ -130,12 +128,9 @@ typedef enum ViewMode : NSUInteger { @implementation HBPreviewController -- (id)initWithDelegate:(id <HBPreviewControllerDelegate>)delegate +- (instancetype)init { - if (self = [super initWithWindowNibName:@"PicturePreview"]) - { - _delegate = delegate; - } + self = [super initWithWindowNibName:@"PicturePreview"]; return self; } @@ -211,6 +206,8 @@ typedef enum ViewMode : NSUInteger { [fEncodingControlBox setFrameOrigin:hudControlBoxOrigin]; [fMoviePlaybackControlBox setFrameOrigin:hudControlBoxOrigin]; + [self hideHud]; + /* set the current scale factor */ if( [[self window] respondsToSelector:@selector( backingScaleFactor )] ) self.backingScaleFactor = [[self window] backingScaleFactor]; @@ -239,6 +236,11 @@ typedef enum ViewMode : NSUInteger { [self switchViewToMode:ViewModePicturePreview]; [self displayPreview]; } + else + { + [self.pictureLayer setContents:nil]; + self.window.title = NSLocalizedString(@"Preview", nil); + } } - (void) reloadPreviews @@ -280,7 +282,6 @@ typedef enum ViewMode : NSUInteger { } [self.generator purgeImageCache]; - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PreviewWindowIsOpen"]; } - (void) windowDidChangeBackingProperties: (NSNotification *) notification @@ -613,6 +614,13 @@ typedef enum ViewMode : NSUInteger { } } +- (void)hideHud +{ + [fPictureControlBox setHidden:YES]; + [fMoviePlaybackControlBox setHidden:YES]; + [fEncodingControlBox setHidden:YES]; +} + - (void) startHudTimer { if (self.hudTimer) @@ -795,7 +803,7 @@ typedef enum ViewMode : NSUInteger { - (IBAction) showPictureSettings: (id) sender { - [self.delegate showPicturePanel:self]; + [self.pictureSettingsWindow showWindow:self]; } #pragma mark - diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index c52dd3b68..4d0905dc1 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -88,10 +88,6 @@ - (void)dealloc { - // clear the delegate so that windowWillClose is not attempted - if ([[self window] delegate] == self) - [[self window] setDelegate:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; } @@ -107,20 +103,6 @@ [self.outlineView setAutoresizesOutlineColumn: NO]; } -- (void)windowWillClose:(NSNotification *)aNotification -{ - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"QueueWindowIsOpen"]; -} - -/** - * Displays and brings the queue window to the front - */ -- (IBAction)showWindow:(id)sender -{ - [super showWindow:sender]; - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"QueueWindowIsOpen"]; -} - #pragma mark Toolbar - (BOOL)validateMenuItem:(NSMenuItem *)menuItem |