summaryrefslogtreecommitdiffstats
path: root/macosx/HBPreviewController.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2015-03-17 13:56:21 +0000
committerritsuka <[email protected]>2015-03-17 13:56:21 +0000
commit48a9e546878ae074202e0301f428193b7915d68f (patch)
treecf3f0f270fc8c7430dec870e954c826926c02a60 /macosx/HBPreviewController.m
parent220bd888e05696acbe1dd47f96ded78c389fc27f (diff)
MacGui: convert the mac gui to Objective-C ARC.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6996 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPreviewController.m')
-rw-r--r--macosx/HBPreviewController.m46
1 files changed, 14 insertions, 32 deletions
diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m
index bbe9ba537..0996122eb 100644
--- a/macosx/HBPreviewController.m
+++ b/macosx/HBPreviewController.m
@@ -93,22 +93,22 @@ typedef enum ViewMode : NSUInteger {
IBOutlet NSPopUpButton * fPreviewMovieLengthPopUp;
}
-@property (nonatomic, assign) id <HBPreviewControllerDelegate> delegate;
+@property (nonatomic, unsafe_unretained) id <HBPreviewControllerDelegate> delegate;
-@property (nonatomic) CALayer *backLayer;
-@property (nonatomic) CALayer *pictureLayer;
+@property (nonatomic, strong) CALayer *backLayer;
+@property (nonatomic, strong) CALayer *pictureLayer;
@property (nonatomic) CGFloat backingScaleFactor;
@property (nonatomic) ViewMode currentViewMode;
@property (nonatomic) BOOL scaleToScreen;
-@property (nonatomic, retain) NSTimer *hudTimer;
+@property (nonatomic, strong) NSTimer *hudTimer;
@property (nonatomic) NSUInteger pictureIndex;
-@property (nonatomic, retain) QTMovie *movie;
-@property (nonatomic, retain) NSTimer *movieTimer;
+@property (nonatomic, strong) QTMovie *movie;
+@property (nonatomic, strong) NSTimer *movieTimer;
/* Pictures HUD actions */
- (IBAction) previewDurationPopUpChanged: (id) sender;
@@ -134,22 +134,12 @@ typedef enum ViewMode : NSUInteger {
{
if (self = [super initWithWindowNibName:@"PicturePreview"])
{
- // NSWindowController likes to lazily load its window. However since
- // this controller tries to set all sorts of outlets before the window
- // is displayed, we need it to load immediately. The correct way to do
- // this, according to the documentation, is simply to invoke the window
- // getter once.
- //
- // If/when we switch a lot of this stuff to bindings, this can probably
- // go away.
- [self window];
_delegate = delegate;
-
}
return self;
}
-- (void) awakeFromNib
+- (void)windowDidLoad
{
[[self window] setDelegate:self];
@@ -234,10 +224,9 @@ typedef enum ViewMode : NSUInteger {
{
_generator.delegate = nil;
[_generator cancel];
- [_generator autorelease];
}
- _generator = [generator retain];
+ _generator = generator;
if (generator)
{
@@ -248,7 +237,6 @@ typedef enum ViewMode : NSUInteger {
[fPictureSlider setNumberOfTickMarks: generator.imagesCount];
[self switchViewToMode:ViewModePicturePreview];
- [self displayPreview];
}
}
@@ -529,18 +517,11 @@ typedef enum ViewMode : NSUInteger {
- (void) dealloc
{
- [_hudTimer invalidate];
- [_hudTimer release];
+ [self removeMovieObservers];
+ [_hudTimer invalidate];
[_movieTimer invalidate];
- [_movieTimer release];
-
[_generator cancel];
- [_generator release];
-
- [self removeMovieObservers];
-
- [super dealloc];
}
#pragma mark -
@@ -675,8 +656,9 @@ typedef enum ViewMode : NSUInteger {
if (self.window.isVisible)
{
- fPreviewImage = [self.generator imageAtIndex:self.pictureIndex shouldCache:YES];
- [self.pictureLayer setContents:(id)fPreviewImage];
+ fPreviewImage = [self.generator copyImageAtIndex:self.pictureIndex shouldCache:YES];
+ [self.pictureLayer setContents:(__bridge id)(fPreviewImage)];
+ CFRelease(fPreviewImage);
}
else
{
@@ -848,7 +830,7 @@ typedef enum ViewMode : NSUInteger {
@"QTMovieIsSteppableAttribute": @(YES),
QTMovieApertureModeAttribute: QTMovieApertureModeClean};
- QTMovie *movie = [[[QTMovie alloc] initWithAttributes:movieAttributes error:&outError] autorelease];
+ QTMovie *movie = [[QTMovie alloc] initWithAttributes:movieAttributes error:&outError];
if (!movie)
{