From 021d0f58a6bf5904964202c67cd9adbe6b60fc9f Mon Sep 17 00:00:00 2001 From: dynaflash Date: Wed, 4 Aug 2010 17:11:02 +0000 Subject: MacGui: Add separate method for cancelling a Live Preview encode. - Also replace deprecated removeFileAtPath:handler: with removeItemAtPath:error: in HBPreviewController git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3469 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/English.lproj/PicturePreview.xib | 385 ++++++++++++++++++++++++++++++-- macosx/HBPreviewController.h | 1 + macosx/HBPreviewController.m | 37 ++- 3 files changed, 403 insertions(+), 20 deletions(-) diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib index a068db4a5..030fa9e7e 100644 --- a/macosx/English.lproj/PicturePreview.xib +++ b/macosx/English.lproj/PicturePreview.xib @@ -2,10 +2,10 @@ 1050 - 10D573 - 740 + 10F569 + 788 1038.29 - 460.00 + 461.00 YES @@ -15,13 +15,13 @@ YES - 740 - 1729 + 788 + 1742 YES - + YES @@ -968,14 +968,6 @@ 263 - - - createMoviePreview: - - - - 264 - fPictureSettingsToggleButton @@ -1112,6 +1104,14 @@ 384 + + + cancelCreateMoviePreview: + + + + 395 + @@ -1792,7 +1792,7 @@ - 394 + 395 @@ -1828,6 +1828,7 @@ YES SettingsChanged: + cancelCreateMoviePreview: createMoviePreview: goWindowedScreen: moviePlaybackGoBackwardOneFrame: @@ -1855,6 +1856,7 @@ id id id + id NSString id id @@ -1862,6 +1864,95 @@ id + + YES + + YES + SettingsChanged: + cancelCreateMoviePreview: + createMoviePreview: + goWindowedScreen: + moviePlaybackGoBackwardOneFrame: + moviePlaybackGoForwardOneFrame: + moviePlaybackGoToBeginning: + moviePlaybackGoToEnd: + pictureSliderChanged: + previewDurationPopUpChanged: + previewScrubberChanged: + showMoviePreview: + showPictureSettings: + showPreviewWindow: + toggleMoviePreviewPlayPause: + toggleScaleToScreen: + + + YES + + SettingsChanged: + id + + + cancelCreateMoviePreview: + id + + + createMoviePreview: + id + + + goWindowedScreen: + id + + + moviePlaybackGoBackwardOneFrame: + id + + + moviePlaybackGoForwardOneFrame: + id + + + moviePlaybackGoToBeginning: + id + + + moviePlaybackGoToEnd: + id + + + pictureSliderChanged: + id + + + previewDurationPopUpChanged: + id + + + previewScrubberChanged: + id + + + showMoviePreview: + NSString + + + showPictureSettings: + id + + + showPreviewWindow: + id + + + toggleMoviePreviewPlayPause: + id + + + toggleScaleToScreen: + id + + + YES @@ -1923,6 +2014,145 @@ NSTextField + + YES + + YES + fCancelPreviewMovieButton + fCreatePreviewMovieButton + fEncodingControlBox + fGoBackwardOneFrameButton + fGoForwardOneFrameButton + fGoToBeginningButton + fGoToEndButton + fGoToStillPreviewButton + fInfoField + fMovieCreationProgressIndicator + fMovieInfoField + fMoviePlaybackControlBox + fMovieScrubberSlider + fMovieView + fPictureControlBox + fPictureSettingsToggleButton + fPictureSlider + fPictureView + fPictureViewArea + fPlayPauseButton + fPreviewMovieLengthPopUp + fPreviewMovieStatusField + fPreviewWindow + fScaleToScreenToggleButton + fShowPreviewMovieButton + fscaleInfoField + + + YES + + fCancelPreviewMovieButton + NSButton + + + fCreatePreviewMovieButton + NSButton + + + fEncodingControlBox + NSBox + + + fGoBackwardOneFrameButton + NSButton + + + fGoForwardOneFrameButton + NSButton + + + fGoToBeginningButton + NSButton + + + fGoToEndButton + NSButton + + + fGoToStillPreviewButton + NSButton + + + fInfoField + NSTextField + + + fMovieCreationProgressIndicator + NSProgressIndicator + + + fMovieInfoField + NSTextField + + + fMoviePlaybackControlBox + NSBox + + + fMovieScrubberSlider + NSSlider + + + fMovieView + QTMovieView + + + fPictureControlBox + NSBox + + + fPictureSettingsToggleButton + NSButton + + + fPictureSlider + NSSlider + + + fPictureView + NSImageView + + + fPictureViewArea + NSBox + + + fPlayPauseButton + NSButton + + + fPreviewMovieLengthPopUp + NSPopUpButton + + + fPreviewMovieStatusField + NSTextField + + + fPreviewWindow + NSWindow + + + fScaleToScreenToggleButton + NSButton + + + fShowPreviewMovieButton + NSButton + + + fscaleInfoField + NSTextField + + + IBProjectSource HBPreviewController.h @@ -2608,6 +2838,13 @@ showWindow: id + + showWindow: + + showWindow: + id + + IBFrameworkSource AppKit.framework/Headers/NSWindowController.h @@ -2663,11 +2900,116 @@ id + + YES + + YES + add: + addScaled: + copy: + cut: + delete: + gotoBeginning: + gotoEnd: + gotoNextSelectionPoint: + gotoPosterFrame: + gotoPreviousSelectionPoint: + paste: + pause: + play: + replace: + selectAll: + selectNone: + stepBackward: + stepForward: + trim: + + + YES + + add: + id + + + addScaled: + id + + + copy: + id + + + cut: + id + + + delete: + id + + + gotoBeginning: + id + + + gotoEnd: + id + + + gotoNextSelectionPoint: + id + + + gotoPosterFrame: + id + + + gotoPreviousSelectionPoint: + id + + + paste: + id + + + pause: + id + + + play: + id + + + replace: + id + + + selectAll: + id + + + selectNone: + id + + + stepBackward: + id + + + stepForward: + id + + + trim: + id + + + 0 + IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.macosx @@ -2679,5 +3021,18 @@ YES ../HandBrake.xcodeproj 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {9, 8} + {7, 2} + + diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index c8dc6d023..3d26e6927 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -107,6 +107,7 @@ - (void) installMovieCallbacks; - (void)removeMovieCallbacks; +- (IBAction) cancelCreateMoviePreview: (id) sender; - (IBAction) createMoviePreview: (id) sender; - (void) libhbStateChanged: (hb_state_t ) state; - (IBAction) showMoviePreview: (NSString *) path; diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 4b60d7e4a..2f6e98191 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -137,6 +137,7 @@ [fMovieTimer release]; [fMovieView setHidden:YES]; [fMovieView setMovie:nil]; + [self pictureSliderChanged:nil]; hudTimerSeconds = 0; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PreviewWindowIsOpen"]; @@ -152,7 +153,7 @@ hb_stop(fPreviewLibhb); if (fPreviewMoviePath) { - [[NSFileManager defaultManager] removeFileAtPath:fPreviewMoviePath handler:nil]; + [[NSFileManager defaultManager] removeItemAtPath:fPreviewMoviePath error:nil]; [fPreviewMoviePath release]; } @@ -243,7 +244,10 @@ [fMovieCreationProgressIndicator stopAnimation: nil]; [fMovieCreationProgressIndicator setHidden: YES]; [fMoviePlaybackControlBox setHidden: YES]; - [self stopMovieTimer]; + if( fMovieTimer ) + { + [self stopMovieTimer]; + } [fPictureControlBox setHidden: NO]; [fPictureView setHidden:NO]; @@ -745,6 +749,30 @@ #pragma mark Movie Preview + +- (IBAction) cancelCreateMoviePreview: (id) sender +{ + + hb_state_t s; + hb_get_state2( fPreviewLibhb, &s ); + + if(isEncoding && (s.state == HB_STATE_WORKING || s.state == HB_STATE_PAUSED)) + { + hb_stop( fPreviewLibhb ); + [fPictureView setHidden:NO]; + [fMovieView pause:nil]; + [fMovieView setHidden:YES]; + [fMovieView setMovie:nil]; + [fPictureSlider setHidden:NO]; + isEncoding = NO; + + [self pictureSliderChanged:nil]; + + return; + } + +} + - (IBAction) createMoviePreview: (id) sender { @@ -758,7 +786,7 @@ hb_get_state2( fPreviewLibhb, &s ); if(sender == fCancelPreviewMovieButton && (s.state == HB_STATE_WORKING || s.state == HB_STATE_PAUSED)) - { + { hb_stop( fPreviewLibhb ); [fPictureView setHidden:NO]; [fMovieView pause:nil]; @@ -808,8 +836,7 @@ /* See if there is an existing preview file, if so, delete it */ if( ![[NSFileManager defaultManager] fileExistsAtPath:fPreviewMoviePath] ) { - [[NSFileManager defaultManager] removeFileAtPath:fPreviewMoviePath - handler:nil]; + [[NSFileManager defaultManager] removeItemAtPath:fPreviewMoviePath error:nil]; } /* We now direct our preview encode to fPreviewMoviePath */ -- cgit v1.2.3