Commit f592e7cd authored by Felix Paul Kühne's avatar Felix Paul Kühne

AspenProject: refactor code

In our context, a detail view is a movie view and a detail item is a media item
parent c58ebdcb
......@@ -17,11 +17,11 @@
7D94FCF316DE7D1000F2623B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FCF216DE7D1000F2623B /* Default@2x.png */; };
7D94FCF516DE7D1100F2623B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FCF416DE7D1100F2623B /* Default-568h@2x.png */; };
7D94FCF816DE7D1100F2623B /* VLCPlaylistViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D94FCF716DE7D1100F2623B /* VLCPlaylistViewController.m */; };
7D94FCFB16DE7D1100F2623B /* VLCDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D94FCFA16DE7D1100F2623B /* VLCDetailViewController.m */; };
7D94FCFB16DE7D1100F2623B /* VLCMovieViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D94FCFA16DE7D1100F2623B /* VLCMovieViewController.m */; };
7D94FCFE16DE7D1100F2623B /* VLCPlaylistViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FCFC16DE7D1100F2623B /* VLCPlaylistViewController_iPhone.xib */; };
7D94FD0116DE7D1100F2623B /* VLCPlaylistViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FCFF16DE7D1100F2623B /* VLCPlaylistViewController_iPad.xib */; };
7D94FD0416DE7D1100F2623B /* VLCDetailViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FD0216DE7D1100F2623B /* VLCDetailViewController_iPhone.xib */; };
7D94FD0716DE7D1100F2623B /* VLCDetailViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FD0516DE7D1100F2623B /* VLCDetailViewController_iPad.xib */; };
7D94FD0416DE7D1100F2623B /* VLCMovieViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FD0216DE7D1100F2623B /* VLCMovieViewController_iPhone.xib */; };
7D94FD0716DE7D1100F2623B /* VLCMovieViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D94FD0516DE7D1100F2623B /* VLCMovieViewController_iPad.xib */; };
CC1BBC3F1704934300A20CBF /* libMobileVLCKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1BBC3E1704934200A20CBF /* libMobileVLCKit.a */; };
CC1BBC411704934D00A20CBF /* libMobileMediaLibraryKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1BBC401704934C00A20CBF /* libMobileMediaLibraryKit.a */; };
CC1BBC431704935E00A20CBF /* MediaLibrary.mom in Resources */ = {isa = PBXBuildFile; fileRef = CC1BBC421704935E00A20CBF /* MediaLibrary.mom */; };
......@@ -53,12 +53,12 @@
7D94FCF416DE7D1100F2623B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
7D94FCF616DE7D1100F2623B /* VLCPlaylistViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistViewController.h; sourceTree = "<group>"; };
7D94FCF716DE7D1100F2623B /* VLCPlaylistViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistViewController.m; sourceTree = "<group>"; };
7D94FCF916DE7D1100F2623B /* VLCDetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCDetailViewController.h; sourceTree = "<group>"; };
7D94FCFA16DE7D1100F2623B /* VLCDetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDetailViewController.m; sourceTree = "<group>"; };
7D94FCF916DE7D1100F2623B /* VLCMovieViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMovieViewController.h; sourceTree = "<group>"; };
7D94FCFA16DE7D1100F2623B /* VLCMovieViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMovieViewController.m; sourceTree = "<group>"; };
7D94FCFD16DE7D1100F2623B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VLCPlaylistViewController_iPhone.xib; sourceTree = "<group>"; };
7D94FD0016DE7D1100F2623B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VLCPlaylistViewController_iPad.xib; sourceTree = "<group>"; };
7D94FD0316DE7D1100F2623B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VLCDetailViewController_iPhone.xib; sourceTree = "<group>"; };
7D94FD0616DE7D1100F2623B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VLCDetailViewController_iPad.xib; sourceTree = "<group>"; };
7D94FD0316DE7D1100F2623B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VLCMovieViewController_iPhone.xib; sourceTree = "<group>"; };
7D94FD0616DE7D1100F2623B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VLCMovieViewController_iPad.xib; sourceTree = "<group>"; };
CC1BBC3E1704934200A20CBF /* libMobileVLCKit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMobileVLCKit.a; path = "ImportedSources/VLCKit/build/Release-iphonesimulator/libMobileVLCKit.a"; sourceTree = "<group>"; };
CC1BBC401704934C00A20CBF /* libMobileMediaLibraryKit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMobileMediaLibraryKit.a; path = "ImportedSources/MediaLibraryKit/build/Release-iphonesimulator/libMobileMediaLibraryKit.a"; sourceTree = "<group>"; };
CC1BBC421704935E00A20CBF /* MediaLibrary.mom */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = MediaLibrary.mom; path = "ImportedSources/MediaLibraryKit/build/Release-iphonesimulator/MediaLibrary.mom"; sourceTree = "<group>"; };
......@@ -145,12 +145,12 @@
7D94FCEE16DE7D1000F2623B /* VLCAppDelegate.m */,
7D94FCF616DE7D1100F2623B /* VLCPlaylistViewController.h */,
7D94FCF716DE7D1100F2623B /* VLCPlaylistViewController.m */,
7D94FCF916DE7D1100F2623B /* VLCDetailViewController.h */,
7D94FCFA16DE7D1100F2623B /* VLCDetailViewController.m */,
7D94FCF916DE7D1100F2623B /* VLCMovieViewController.h */,
7D94FCFA16DE7D1100F2623B /* VLCMovieViewController.m */,
7D94FCFC16DE7D1100F2623B /* VLCPlaylistViewController_iPhone.xib */,
7D94FCFF16DE7D1100F2623B /* VLCPlaylistViewController_iPad.xib */,
7D94FD0216DE7D1100F2623B /* VLCDetailViewController_iPhone.xib */,
7D94FD0516DE7D1100F2623B /* VLCDetailViewController_iPad.xib */,
7D94FD0216DE7D1100F2623B /* VLCMovieViewController_iPhone.xib */,
7D94FD0516DE7D1100F2623B /* VLCMovieViewController_iPad.xib */,
7D94FCE516DE7D1000F2623B /* Supporting Files */,
);
path = AspenProject;
......@@ -239,8 +239,8 @@
7D94FCF516DE7D1100F2623B /* Default-568h@2x.png in Resources */,
7D94FCFE16DE7D1100F2623B /* VLCPlaylistViewController_iPhone.xib in Resources */,
7D94FD0116DE7D1100F2623B /* VLCPlaylistViewController_iPad.xib in Resources */,
7D94FD0416DE7D1100F2623B /* VLCDetailViewController_iPhone.xib in Resources */,
7D94FD0716DE7D1100F2623B /* VLCDetailViewController_iPad.xib in Resources */,
7D94FD0416DE7D1100F2623B /* VLCMovieViewController_iPhone.xib in Resources */,
7D94FD0716DE7D1100F2623B /* VLCMovieViewController_iPad.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -254,7 +254,7 @@
7D94FCEB16DE7D1000F2623B /* main.m in Sources */,
7D94FCEF16DE7D1000F2623B /* VLCAppDelegate.m in Sources */,
7D94FCF816DE7D1100F2623B /* VLCPlaylistViewController.m in Sources */,
7D94FCFB16DE7D1100F2623B /* VLCDetailViewController.m in Sources */,
7D94FCFB16DE7D1100F2623B /* VLCMovieViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -285,20 +285,20 @@
name = VLCPlaylistViewController_iPad.xib;
sourceTree = "<group>";
};
7D94FD0216DE7D1100F2623B /* VLCDetailViewController_iPhone.xib */ = {
7D94FD0216DE7D1100F2623B /* VLCMovieViewController_iPhone.xib */ = {
isa = PBXVariantGroup;
children = (
7D94FD0316DE7D1100F2623B /* en */,
);
name = VLCDetailViewController_iPhone.xib;
name = VLCMovieViewController_iPhone.xib;
sourceTree = "<group>";
};
7D94FD0516DE7D1100F2623B /* VLCDetailViewController_iPad.xib */ = {
7D94FD0516DE7D1100F2623B /* VLCMovieViewController_iPad.xib */ = {
isa = PBXVariantGroup;
children = (
7D94FD0616DE7D1100F2623B /* en */,
);
name = VLCDetailViewController_iPad.xib;
name = VLCMovieViewController_iPad.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
......
......@@ -12,7 +12,7 @@
#import "VLCPlaylistViewController.h"
#import "VLCDetailViewController.h"
#import "VLCMovieViewController.h"
@implementation VLCAppDelegate
......@@ -37,14 +37,14 @@
_playlistViewController = [[VLCPlaylistViewController alloc] initWithNibName:@"VLCPlaylistViewController_iPad" bundle:nil];
UINavigationController *masterNavigationController = [[[UINavigationController alloc] initWithRootViewController:_playlistViewController] autorelease];
VLCDetailViewController *detailViewController = [[[VLCDetailViewController alloc] initWithNibName:@"VLCDetailViewController_iPad" bundle:nil] autorelease];
UINavigationController *detailNavigationController = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
VLCMovieViewController *movieViewController = [[[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController_iPad" bundle:nil] autorelease];
UINavigationController *movieNavigationController = [[[UINavigationController alloc] initWithRootViewController:movieViewController] autorelease];
_playlistViewController.detailViewController = detailViewController;
_playlistViewController.movieViewController = movieViewController;
self.splitViewController = [[[UISplitViewController alloc] init] autorelease];
self.splitViewController.delegate = detailViewController;
self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController];
self.splitViewController.delegate = movieViewController;
self.splitViewController.viewControllers = @[masterNavigationController, movieNavigationController];
self.window.rootViewController = self.splitViewController;
}
......
......@@ -7,10 +7,11 @@
//
#import <UIKit/UIKit.h>
#import <MediaLibraryKit/MLFile.h>
@interface VLCDetailViewController : UIViewController <UISplitViewControllerDelegate>
@interface VLCMovieViewController : UIViewController <UISplitViewControllerDelegate>
@property (strong, nonatomic) id detailItem;
@property (strong, nonatomic) MLFile *mediaItem;
@property (strong, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
......
//
// VLCDetailViewController.m
// VLCMovieViewController.m
// AspenProject
//
// Created by Felix Paul Kühne on 27.02.13.
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
#import "VLCDetailViewController.h"
#import "VLCMovieViewController.h"
@interface VLCDetailViewController ()
@interface VLCMovieViewController ()
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
- (void)configureView;
@end
@implementation VLCDetailViewController
@implementation VLCMovieViewController
- (void)dealloc
{
[_detailItem release];
[_mediaItem release];
[_detailDescriptionLabel release];
[_masterPopoverController release];
[super dealloc];
}
#pragma mark - Managing the detail item
#pragma mark - Managing the media item
- (void)setDetailItem:(id)newDetailItem
- (void)setMediaItem:(id)newMediaItem
{
if (_detailItem != newDetailItem) {
[_detailItem release];
_detailItem = [newDetailItem retain];
if (_mediaItem != newMediaItem) {
[_mediaItem release];
_mediaItem = [newMediaItem retain];
// Update the view.
[self configureView];
......@@ -42,17 +42,18 @@
- (void)configureView
{
// Update the user interface for the detail item.
// Update the user interface for the media item.
if (self.detailItem) {
self.detailDescriptionLabel.text = [self.detailItem description];
if (self.mediaItem) {
self.detailDescriptionLabel.text = [self.mediaItem title];
self.title = [self.mediaItem title];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
}
......@@ -66,7 +67,7 @@
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Detail", @"Detail");
self.title = @"Video Playback";
}
return self;
}
......
......@@ -8,11 +8,11 @@
#import <UIKit/UIKit.h>
@class VLCDetailViewController;
@class VLCMovieViewController;
@interface VLCPlaylistViewController : UITableViewController
@property (strong, nonatomic) VLCDetailViewController *detailViewController;
@property (strong, nonatomic) VLCMovieViewController *movieViewController;
- (void)updateViewContents;
......
......@@ -11,7 +11,7 @@
#import "VLCPlaylistViewController.h"
#import "VLCDetailViewController.h"
#import "VLCMovieViewController.h"
@interface VLCPlaylistViewController () {
NSMutableArray *_foundMedia;
......@@ -35,7 +35,7 @@
- (void)dealloc
{
[_detailViewController release];
[_movieViewController release];
[_foundMedia release];
[super dealloc];
}
......@@ -80,7 +80,6 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
APLog(@"found %u media", _foundMedia.count);
return _foundMedia.count;
}
......@@ -99,7 +98,6 @@
MLFile *object = _foundMedia[indexPath.row];
cell.textLabel.text = object.title;
APLog(@"returning cell with title %@", object.title);
return cell;
}
......@@ -137,16 +135,15 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MLFile *object = _foundMedia[indexPath.row];
MLFile *mediaObject = _foundMedia[indexPath.row];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if (!self.detailViewController) {
self.detailViewController = [[[VLCDetailViewController alloc] initWithNibName:@"VLCDetailViewController_iPhone" bundle:nil] autorelease];
}
self.detailViewController.detailItem = object;
[self.navigationController pushViewController:self.detailViewController animated:YES];
} else {
self.detailViewController.detailItem = object;
}
if (!self.movieViewController) {
self.movieViewController = [[[VLCMovieViewController alloc] initWithNibName:@"VLCMovieViewController_iPhone" bundle:nil] autorelease];
}
self.movieViewController.mediaItem = mediaObject;
[self.navigationController pushViewController:self.movieViewController animated:YES];
} else
self.movieViewController.mediaItem = mediaObject;
}
#pragma mark - UI implementation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment