Explorar o código

Convert code to ARC

Felix Paul Kühne %!s(int64=12) %!d(string=hai) anos
pai
achega
561a759a7e

+ 2 - 0
AspenProject.xcodeproj/project.pbxproj

@@ -526,6 +526,7 @@
 		7D94FD0B16DE7D1100F2623B /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				DEAD_CODE_STRIPPING = NO;
 				GCC_C_LANGUAGE_STANDARD = c99;
@@ -554,6 +555,7 @@
 		7D94FD0C16DE7D1100F2623B /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_OBJC_ARC = YES;
 				COPY_PHASE_STRIP = NO;
 				DEAD_CODE_STRIPPING = NO;
 				GCC_C_LANGUAGE_STANDARD = c99;

+ 4 - 4
AspenProject/VLCAboutViewController.h

@@ -10,10 +10,10 @@
 
 @interface VLCAboutViewController : UIViewController
 
-@property (nonatomic, retain) IBOutlet UITextView *textContents;
-@property (nonatomic, retain) IBOutlet UILabel *aspenVersion;
-@property (nonatomic, retain) IBOutlet UILabel *vlckitVersion;
-@property (nonatomic, retain) IBOutlet UIBarButtonItem *dismissButton;
+@property (nonatomic, strong) IBOutlet UITextView *textContents;
+@property (nonatomic, strong) IBOutlet UILabel *aspenVersion;
+@property (nonatomic, strong) IBOutlet UILabel *vlckitVersion;
+@property (nonatomic, strong) IBOutlet UIBarButtonItem *dismissButton;
 
 - (IBAction)dismiss:(id)sender;
 

+ 0 - 8
AspenProject/VLCAboutViewController.m

@@ -20,14 +20,6 @@
     return self;
 }
 
-- (void)dealloc
-{
-    [_textContents release];
-    [_aspenVersion release];
-    [_vlckitVersion release];
-    [_dismissButton release];
-    [super dealloc];
-}
 
 - (void)viewDidLoad
 {

+ 2 - 2
AspenProject/VLCAppDelegate.h

@@ -14,8 +14,8 @@
     VLCPlaylistViewController *_playlistViewController;
 }
 
-@property (nonatomic, retain) UIWindow *window;
+@property (nonatomic, strong) UIWindow *window;
 
-@property (nonatomic, retain) UINavigationController *navigationController;
+@property (nonatomic, strong) UINavigationController *navigationController;
 
 @end

+ 2 - 9
AspenProject/VLCAppDelegate.m

@@ -14,21 +14,14 @@
 
 @implementation VLCAppDelegate
 
-- (void)dealloc
-{
-    [_playlistViewController release];
-    [_window release];
-    [_navigationController release];
-    [super dealloc];
-}
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
-    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
+    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 
     _playlistViewController = [[VLCPlaylistViewController alloc] initWithNibName:@"VLCPlaylistViewController" bundle:nil];
 
-    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:_playlistViewController] autorelease];
+    self.navigationController = [[UINavigationController alloc] initWithRootViewController:_playlistViewController];
     self.window.rootViewController = self.navigationController;
 
     self.navigationController.navigationBar.barStyle = UIBarStyleBlack;

+ 17 - 17
AspenProject/VLCMovieViewController.h

@@ -18,23 +18,23 @@
     UIActionSheet *_audiotrackActionSheet;
 }
 
-@property (nonatomic, retain) IBOutlet UIView *movieView;
-@property (nonatomic, retain) IBOutlet UIBarButtonItem *backButton;
-@property (nonatomic, retain) IBOutlet UISlider *positionSlider;
-@property (nonatomic, retain) IBOutlet UIBarButtonItem *timeDisplay;
-@property (nonatomic, retain) IBOutlet UIButton *playPauseButton;
-@property (nonatomic, retain) IBOutlet UIButton *bwdButton;
-@property (nonatomic, retain) IBOutlet UIButton *fwdButton;
-@property (nonatomic, retain) IBOutlet UIButton *subtitleSwitcherButton;
-@property (nonatomic, retain) IBOutlet UIButton *audioSwitcherButton;
-@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
-@property (nonatomic, retain) IBOutlet UIView *controllerPanel;
-
-@property (nonatomic, retain) IBOutlet UIView *playingExternallyView;
-@property (nonatomic, retain) IBOutlet UILabel *playingExternallyTitle;
-@property (nonatomic, retain) IBOutlet UILabel *playingExternallyDescription;
-
-@property (nonatomic, retain) MLFile *mediaItem;
+@property (nonatomic, strong) IBOutlet UIView *movieView;
+@property (nonatomic, strong) IBOutlet UIBarButtonItem *backButton;
+@property (nonatomic, strong) IBOutlet UISlider *positionSlider;
+@property (nonatomic, strong) IBOutlet UIBarButtonItem *timeDisplay;
+@property (nonatomic, strong) IBOutlet UIButton *playPauseButton;
+@property (nonatomic, strong) IBOutlet UIButton *bwdButton;
+@property (nonatomic, strong) IBOutlet UIButton *fwdButton;
+@property (nonatomic, strong) IBOutlet UIButton *subtitleSwitcherButton;
+@property (nonatomic, strong) IBOutlet UIButton *audioSwitcherButton;
+@property (nonatomic, strong) IBOutlet UIToolbar *toolbar;
+@property (nonatomic, strong) IBOutlet UIView *controllerPanel;
+
+@property (nonatomic, strong) IBOutlet UIView *playingExternallyView;
+@property (nonatomic, strong) IBOutlet UILabel *playingExternallyTitle;
+@property (nonatomic, strong) IBOutlet UILabel *playingExternallyDescription;
+
+@property (nonatomic, strong) MLFile *mediaItem;
 
 - (IBAction)closePlayback:(id)sender;
 - (IBAction)positionSliderAction:(id)sender;

+ 4 - 28
AspenProject/VLCMovieViewController.m

@@ -10,36 +10,17 @@
 #import "VLCExternalDisplayController.h"
 
 @interface VLCMovieViewController () <UIGestureRecognizerDelegate>
-@property (nonatomic, retain) UIPopoverController *masterPopoverController;
-@property (nonatomic, retain) UIWindow *externalWindow;
+@property (nonatomic, strong) UIPopoverController *masterPopoverController;
+@property (nonatomic, strong) UIWindow *externalWindow;
 @end
 
 @implementation VLCMovieViewController
 
 - (void)dealloc
 {
-    [_mediaItem release];
-    [_masterPopoverController release];
-    [_externalWindow release];
-    [_toolbar release];
-    [_movieView release];
-    [_backButton release];
-    [_positionSlider release];
-    [_timeDisplay release];
-    [_playPauseButton release];
-    [_bwdButton release];
-    [_fwdButton release];
-    [_subtitleActionSheet release];
-    [_audioSwitcherButton release];
-    [_controllerPanel release];
-    [_playingExternallyView release];
-    [_playingExternallyTitle release];
-    [_playingExternallyDescription release];
 
     [_mediaPlayer stop];
-    [_mediaPlayer release];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [super dealloc];
 }
 
 #pragma mark - Managing the media item
@@ -47,8 +28,7 @@
 - (void)setMediaItem:(id)newMediaItem
 {
     if (_mediaItem != newMediaItem) {
-        [_mediaItem release];
-        _mediaItem = [newMediaItem retain];
+        _mediaItem = newMediaItem;
     }
 
     if (self.masterPopoverController != nil)
@@ -81,7 +61,6 @@
     UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toogleControlsVisible)];
     recognizer.delegate = self;
     [self.view addGestureRecognizer:recognizer];
-    [recognizer release];
 }
 
 - (void)viewWillAppear:(BOOL)animated
@@ -241,7 +220,6 @@
             indexArray = _mediaPlayer.videoSubTitlesIndexes;
             _mediaPlayer.currentVideoSubTitleIndex = [[indexArray objectAtIndex:arrayIndex] intValue];
         }
-        [_subtitleActionSheet release];
     } else {
         namesArray = _mediaPlayer.audioTrackNames;
         arrayIndex = [namesArray indexOfObject:[actionSheet buttonTitleAtIndex:buttonIndex]];
@@ -249,7 +227,6 @@
             indexArray = _mediaPlayer.audioTrackIndexes;
             _mediaPlayer.currentAudioTrackIndex = [[indexArray objectAtIndex:arrayIndex] intValue];
         }
-        [_audiotrackActionSheet release];
     }
 }
 
@@ -272,14 +249,13 @@
     UIScreen *screen = [[UIScreen screens] objectAtIndex:1];
     screen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
 
-    self.externalWindow = [[[UIWindow alloc] initWithFrame:screen.bounds] autorelease];
+    self.externalWindow = [[UIWindow alloc] initWithFrame:screen.bounds];
 
     UIViewController *controller = [[VLCExternalDisplayController alloc] init];
     self.externalWindow.rootViewController = controller;
     [controller.view addSubview:_movieView];
     controller.view.frame = screen.bounds;
     _movieView.frame = screen.bounds;
-    [controller release];
 
     self.playingExternallyView.hidden = NO;
     self.externalWindow.screen = screen;

+ 0 - 7
AspenProject/VLCPlaylistGridViewCell.m

@@ -14,13 +14,6 @@
 
 @implementation VLCPlaylistGridViewCell
 
-- (void)dealloc
-{
-    [_thumbnailView release];
-    [_titleLabel release];
-    [_subtitleLabel release];
-    [super dealloc];
-}
 
 - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
 {

+ 3 - 3
AspenProject/VLCPlaylistTableViewCell.h

@@ -10,9 +10,9 @@
 
 @interface VLCPlaylistTableViewCell : UITableViewCell
 
-@property (nonatomic, retain) IBOutlet UILabel *titleLabel;
-@property (nonatomic, retain) IBOutlet UILabel *subtitleLabel;
-@property (nonatomic, retain) IBOutlet UIImageView *thumbnailView;
+@property (nonatomic, strong) IBOutlet UILabel *titleLabel;
+@property (nonatomic, strong) IBOutlet UILabel *subtitleLabel;
+@property (nonatomic, strong) IBOutlet UIImageView *thumbnailView;
 
 + (VLCPlaylistTableViewCell *)cellWithReuseIdentifier:(NSString *)ident;
 + (CGFloat)heightOfCell;

+ 0 - 2
AspenProject/VLCPlaylistTableViewCell.m

@@ -20,11 +20,9 @@
     UIView *background = [[UIView alloc] initWithFrame:frame];
     background.backgroundColor = [UIColor colorWithWhite:.05 alpha:1.];
     cell.backgroundView = background;
-    [background autorelease];
     UIView *highlightedBackground = [[UIView alloc] initWithFrame:frame];
     highlightedBackground.backgroundColor = [UIColor colorWithWhite:.2 alpha:1.];
     cell.selectedBackgroundView = highlightedBackground;
-    [highlightedBackground autorelease];
 
     return cell;
 }

+ 4 - 4
AspenProject/VLCPlaylistViewController.h

@@ -15,11 +15,11 @@
 @interface VLCPlaylistViewController : UIViewController <AQGridViewDataSource, AQGridViewDelegate, UITableViewDataSource, UITableViewDelegate>
 
 
-@property (nonatomic, retain) VLCMovieViewController *movieViewController;
-@property (nonatomic, retain) VLCAboutViewController *aboutViewController;
+@property (nonatomic, strong) VLCMovieViewController *movieViewController;
+@property (nonatomic, strong) VLCAboutViewController *aboutViewController;
 
-@property (nonatomic, retain) IBOutlet UITableView *tableView;
-@property (nonatomic, retain) IBOutlet AQGridView *gridView;
+@property (nonatomic, strong) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) IBOutlet AQGridView *gridView;
 
 - (void)updateViewContents;
 

+ 5 - 16
AspenProject/VLCPlaylistViewController.m

@@ -28,15 +28,6 @@
     return self;
 }
 
-- (void)dealloc
-{
-    [_tableView release];
-    [_gridView release];
-    [_aboutViewController release];
-    [_movieViewController release];
-    [_foundMedia release];
-    [super dealloc];
-}
 
 - (void)viewDidLoad
 {
@@ -44,7 +35,7 @@
     self.tableView.separatorColor = [UIColor colorWithWhite:.2 alpha:1.];
     [super viewDidLoad];
 
-    UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStyleBordered target:self action:@selector(showAboutView:)] autorelease];
+    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStyleBordered target:self action:@selector(showAboutView:)];
     self.navigationItem.leftBarButtonItem = addButton;
 
     self.navigationItem.rightBarButtonItem = self.editButtonItem;
@@ -65,10 +56,8 @@
 {
     [[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
 
-    if (_foundMedia)
-        [_foundMedia release];
 
-    _foundMedia = [[NSMutableArray arrayWithArray:[MLFile allFiles]] retain];
+    _foundMedia = [NSMutableArray arrayWithArray:[MLFile allFiles]];
 
     if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
         [self.tableView reloadData];
@@ -121,7 +110,7 @@
 {
     MLFile *mediaObject = _foundMedia[indexPath.row];
     if (!self.movieViewController) {
-        self.movieViewController = [[[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController" bundle:nil] autorelease];
+        self.movieViewController = [[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController" bundle:nil];
     }
     self.movieViewController.mediaItem = mediaObject;
     [self.navigationController pushViewController:self.movieViewController animated:YES];
@@ -161,7 +150,7 @@
 {
     MLFile *mediaObject = _foundMedia[index];
     if (!self.movieViewController) {
-        self.movieViewController = [[[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController" bundle:nil] autorelease];
+        self.movieViewController = [[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController" bundle:nil];
     }
     self.movieViewController.mediaItem = mediaObject;
     [self.navigationController pushViewController:self.movieViewController animated:YES];
@@ -172,7 +161,7 @@
 {
     if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
         if (!self.aboutViewController) {
-            self.aboutViewController = [[[VLCAboutViewController alloc] initWithNibName:@"VLCAboutViewController" bundle:nil] autorelease];
+            self.aboutViewController = [[VLCAboutViewController alloc] initWithNibName:@"VLCAboutViewController" bundle:nil];
         }
         [self.navigationController pushViewController:self.aboutViewController animated:YES];
     } else