Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

4.4 fixes

  • Loading branch information...
commit 0e33b265386a17b09abfc8f988173cf8cff78f63 1 parent 6764b99
tomcool420 authored

Showing 2 changed files with 65 additions and 62 deletions. Show diff stats Hide diff stats

  1. +1 1  SMFAssetPreviewController.h
  2. +64 61 SMFMoviePreviewController.m
2  SMFAssetPreviewController.h
@@ -7,7 +7,7 @@
7 7 //
8 8
9 9 #import "SMFMoviePreviewController.h"
10   -#import <BackRow/BackRow.h>
  10 +#import "Backrow/AppleTV.h"
11 11
12 12 @interface SMFAssetPreviewController : SMFMoviePreviewController {
13 13 BRBaseMediaAsset * asset;
125 SMFMoviePreviewController.m
@@ -13,17 +13,19 @@
13 13 #import "SMFDefines.h"
14 14 #import "SMFBaseAsset.h"
15 15 #import "SMFListDropShadowControl.h"
  16 +#import "SMFCompatibility.h"
  17 +#import "SMFMoviePreviewDelegateDatasource.h"
16 18 #define NOSHELF
17   -static NSString * const kSMFMovieTitle = @"title";
18   -static NSString * const kSMFMovieSubtitle = @"substitle";
19   -static NSString * const kSMFMovieSummary = @"summary";
20   -static NSString * const kSMFMoviePosterPath = @"posterPath";
21   -static NSString * const kSMFMoviePoster = @"poster";
22   -static NSString * const kSMFMovieHeaders = @"headers";
23   -static NSString * const kSMFMovieColumns = @"columns";
24   -static NSString * const kSMFMovieRating = @"rating";
25   -NSString * const kMoviePreviewControllerSelectionChanged = @"kMoviePreviewControllerSelectionChanged";
26   -NSString * const kMoviePreviewControllerNewSelectedControl = @"kMoviePreviewControllerNewSelectedControl";
  19 + NSString * const kSMFMoviePreviewTitle = @"title";
  20 + NSString * const kSMFMoviePreviewSubtitle = @"substitle";
  21 + NSString * const kSMFMoviePreviewSummary = @"summary";
  22 + NSString * const kSMFMoviePreviewPosterPath = @"posterPath";
  23 + NSString * const kSMFMoviePreviewPoster = @"poster";
  24 + NSString * const kSMFMoviePreviewHeaders = @"headers";
  25 + NSString * const kSMFMoviePreviewColumns = @"columns";
  26 + NSString * const kSMFMoviePreviewRating = @"rating";
  27 + NSString * const kMoviePreviewControllerSelectionChanged = @"kMoviePreviewControllerSelectionChanged";
  28 + NSString * const kMoviePreviewControllerNewSelectedControl = @"kMoviePreviewControllerNewSelectedControl";
27 29
28 30
29 31 @implementation SMFMoviePreviewController
@@ -58,39 +60,41 @@ -(id)getProviderForShelf
58 60 -(NSMutableDictionary *)getInformation
59 61 {
60 62 NSMutableDictionary *d = [[NSMutableDictionary alloc]initWithObjectsAndKeys:
61   - @"",kSMFMovieTitle,
62   - @"",kSMFMovieSubtitle,
63   - @"(no summary)",kSMFMovieSummary,
64   - [NSArray array],kSMFMovieHeaders,
65   - [NSArray array],kSMFMovieColumns,
66   - [BRImage imageWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"colorAppleTVNameImage" ofType:@"png"]],kSMFMoviePoster,
67   - @"",kSMFMoviePosterPath,
68   - @"pg",kSMFMovieRating,
  63 + @"",kSMFMoviePreviewTitle,
  64 + @"",kSMFMoviePreviewSubtitle,
  65 + @"(no summary)",kSMFMoviePreviewSummary,
  66 + [NSArray array],kSMFMoviePreviewHeaders,
  67 + [NSArray array],kSMFMoviePreviewColumns,
  68 + [BRImage imageWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"colorAppleTVNameImage" ofType:@"png"]],kSMFMoviePreviewPoster,
  69 + @"",kSMFMoviePreviewPosterPath,
  70 + @"pg",kSMFMoviePreviewRating,
69 71 nil];
70   - if (self.datasource!=nil && [self.datasource conformsToProtocol:@protocol(SMFMoviePreviewControllerDatasource)]) {
  72 + NSLog(@"get information %@",self.datasource);
  73 + if (self.datasource!=nil /*&& [self.datasource conformsToProtocol:@protocol(SMFMoviePreviewControllerDatasource)]*/) {
  74 + NSLog(@"conforms to protocol");
71 75 NSString *t = [self.datasource title];
72   - if (t!=nil) {[d setObject:t forKey:kSMFMovieTitle];}
  76 + if (t!=nil) {[d setObject:t forKey:kSMFMoviePreviewTitle];}
73 77 t = [self.datasource subtitle];
74   - if (t!=nil) {[d setObject:t forKey:kSMFMovieSubtitle];}
  78 + if (t!=nil) {[d setObject:t forKey:kSMFMoviePreviewSubtitle];}
75 79 t = [self.datasource summary];
76   - if (t!=nil) {[d setObject:t forKey:kSMFMovieSummary];}
  80 + if (t!=nil) {[d setObject:t forKey:kSMFMoviePreviewSummary];}
77 81 NSArray *a = [self.datasource headers];
78   - if (a!=nil) {[d setObject:a forKey:kSMFMovieHeaders];}
  82 + if (a!=nil) {[d setObject:a forKey:kSMFMoviePreviewHeaders];}
79 83 a = [self.datasource columns];
80   - if (a!=nil) {[d setObject:a forKey:kSMFMovieColumns];}
  84 + if (a!=nil) {[d setObject:a forKey:kSMFMoviePreviewColumns];}
81 85 if ([self.datasource respondsToSelector:@selector(coverArt)]) {
82 86 BRImage *i = [self.datasource coverArt];
83   - if (i!=nil) {[d setObject:i forKey:kSMFMoviePoster];}
  87 + if (i!=nil) {[d setObject:i forKey:kSMFMoviePreviewPoster];}
84 88 }
85 89 else if([self.datasource respondsToSelector:@selector(posterPath)])
86 90 {
87 91 t = [self.datasource posterPath];
88   - if (t!=nil) {[d setObject:t forKey:kSMFMoviePosterPath];}
  92 + if (t!=nil) {[d setObject:t forKey:kSMFMoviePreviewPosterPath];}
89 93 }
90 94
91 95
92 96 t = [self.datasource rating];
93   - if (t!=nil) {[d setObject:t forKey:kSMFMovieRating];}
  97 + if (t!=nil) {[d setObject:t forKey:kSMFMoviePreviewRating];}
94 98 }
95 99 return [d autorelease];
96 100
@@ -142,7 +146,7 @@ -(void)reload
142 146 _previewControl =[[BRCoverArtPreviewControl alloc]init];
143 147
144 148 SMFBaseAsset *a = [SMFBaseAsset asset];
145   - [a setCoverArt:[_info objectForKey:kSMFMoviePoster]];
  149 + [a setCoverArt:[_info objectForKey:kSMFMoviePreviewPoster]];
146 150 BRPhotoImageProxy *proxy = [[BRPhotoImageProxy alloc] initWithAsset:a];
147 151 [_previewControl setImageProxy:proxy];
148 152 [proxy release];
@@ -153,11 +157,12 @@ -(void)reload
153 157 /*
154 158 * The Title
155 159 */
  160 + NSLog(@"1");
156 161 checkNil(_metadataTitleControl);
157 162 _metadataTitleControl=[[BRMetadataTitleControl alloc]init];
158   - [_metadataTitleControl setTitle:[_info objectForKey:kSMFMovieTitle]];
159   - [_metadataTitleControl setTitleSubtext:[_info objectForKey:kSMFMovieSubtitle]];
160   - [_metadataTitleControl setRating:[_info objectForKey:kSMFMovieRating]];
  163 + [_metadataTitleControl setTitle:[_info objectForKey:kSMFMoviePreviewTitle]];
  164 + [_metadataTitleControl setTitleSubtext:[_info objectForKey:kSMFMoviePreviewSubtitle]];
  165 + [_metadataTitleControl setRating:[_info objectForKey:kSMFMoviePreviewRating]];
161 166 CGRect mtcf=CGRectMake(masterFrame.size.width*0.29766f,
162 167 masterFrame.size.height*0.875f,
163 168 masterFrame.size.width*0.648f,
@@ -200,7 +205,7 @@ -(void)reload
200 205 mtcf.size.width,//masterFrame.size.width*0.64f,
201 206 masterFrame.size.height*(94.f/720.f));//masterFrame.size.height*0.113f);
202 207 [_summaryControl setFrame:summaryFrame];
203   - [_summaryControl setText:[_info objectForKey:kSMFMovieSummary]
  208 + [_summaryControl setText:[_info objectForKey:kSMFMoviePreviewSummary]
204 209 withAttributes:[[BRThemeInfo sharedTheme]metadataSummaryFieldAttributes]];
205 210 //[_summaryControl setBackgroundColor:[[SMFThemeInfo sharedTheme]blackColor]];
206 211
@@ -219,16 +224,17 @@ -(void)reload
219 224 [_hideList addObject:div2];
220 225 [div2 release];
221 226
222   -
  227 + NSLog(@"2");
223 228
224 229 /*
225 230 * Headers for information
226 231 */
227   - NSArray *headers = [_info objectForKey:kSMFMovieHeaders];
  232 + NSArray *headers = [_info objectForKey:kSMFMoviePreviewHeaders];
228 233 float increment = (mtcf.size.width/masterFrame.size.width)/(float)[headers count];
229 234 //int counter=0;
230 235 float lastOriginY=0.0f;
231   - for(int counter=0;counter<4;counter++)
  236 + NSLog(@"obj: %@",headers);
  237 + for(int counter=0;counter<[headers count];counter++)
232 238 {
233 239 BRTextControl *head = [[BRTextControl alloc]init];
234 240 [head setText:[headers objectAtIndex:counter] withAttributes:[SMFMoviePreviewController columnHeaderAttributes] ];
@@ -247,7 +253,8 @@ -(void)reload
247 253 /*
248 254 * Main Information
249 255 */
250   - NSArray *objects = [_info objectForKey:kSMFMovieColumns];
  256 + NSLog(@"3");
  257 + NSArray *objects = [_info objectForKey:kSMFMoviePreviewColumns];
251 258 for (int counter=0; counter<[objects count]; counter++) {
252 259 NSArray *current = [objects objectAtIndex:counter];
253 260 int maxObj = [current count]>5?5:[current count];
@@ -366,30 +373,29 @@ -(void)reload
366 373
367 374 }
368 375 }
369   -
370   -
  376 + NSLog(@"buttons");
371 377 checkNil(_buttons);
372 378
373 379 _buttons=[[NSMutableArray alloc]init];
374   - NSArray *buttons=nil;//[NSArray array];
  380 + NSArray *tbuttons=nil;//[NSArray array];
375 381 if ([self.datasource respondsToSelector:@selector(buttons)]) {
376   - buttons = [self.datasource buttons];
  382 + tbuttons = [self.datasource buttons];
377 383 }
378 384 else {
379   - buttons=[[NSMutableArray alloc]init];
380   - [(NSMutableArray *)buttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]previewActionImage]
  385 + tbuttons=[[NSMutableArray alloc]init];
  386 + [(NSMutableArray *)tbuttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]previewActionImage]
381 387 subtitle:@"Preview"
382 388 badge:nil]];
383   - [(NSMutableArray *)buttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]playActionImage]
  389 + [(NSMutableArray *)tbuttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]playActionImage]
384 390 subtitle:@"Play"
385 391 badge:nil]];
386   - [(NSMutableArray *)buttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]queueActionImage]
  392 + [(NSMutableArray *)tbuttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]queueActionImage]
387 393 subtitle:@"Queue"
388 394 badge:nil]];
389   - [(NSMutableArray *)buttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]rateActionImage]
  395 + [(NSMutableArray *)tbuttons addObject:[BRButtonControl actionButtonWithImage:[[BRThemeInfo sharedTheme]rateActionImage]
390 396 subtitle:@"More"
391 397 badge:nil]];
392   - [buttons autorelease];
  398 + [tbuttons autorelease];
393 399
394 400 }
395 401
@@ -401,9 +407,9 @@ -(void)reload
401 407 CGRect firstButtonFrame = CGRectZero;
402 408 CGRect lastButtonFrame = CGRectZero;
403 409 int button=0;
404   - for(int i=0;i<[buttons count];i++)
  410 + for(int i=0;i<[tbuttons count];i++)
405 411 {
406   - id b = [buttons objectAtIndex:i];
  412 + id b = [tbuttons objectAtIndex:i];
407 413 if([b isKindOfClass:[BRButtonControl class]])
408 414 {
409 415 CGRect f = previewFrame;
@@ -415,7 +421,7 @@ -(void)reload
415 421
416 422 if (i == 0) {
417 423 firstButtonFrame = f;
418   - } else if (i == [buttons count]-1) {
  424 + } else if (i == [tbuttons count]-1) {
419 425 lastButtonFrame = f;
420 426 }
421 427
@@ -429,7 +435,7 @@ -(void)reload
429 435 checkNil(_nextArrowImageControl);
430 436
431 437 float arrowImageControlMargin = 20.0f;
432   - if ([buttons count] > 0) { //if there are no buttons, we cannot go next/previous
  438 + if ([tbuttons count] > 0) { //if there are no buttons, we cannot go next/previous
433 439 //next/previous arrows
434 440 if ([self.delegate respondsToSelector:@selector(controllerCanSwitchToPrevious:)]) {
435 441 //does respond
@@ -478,7 +484,7 @@ -(void)reload
478 484 }
479 485 }
480 486 }
481   -
  487 + NSLog(@"end buttons");
482 488
483 489 BRTextControl *moviesControl =[[BRTextControl alloc] init];
484 490 NSString *title=@"";
@@ -524,7 +530,7 @@ -(void)reloadShelf
524 530
525 531 CGRect masterFrame=[BRWindow interfaceFrame];
526 532
527   - if(!_usingShelfView)
  533 + if(![SMF_COMPAT usingFourPointFourPlus])
528 534 {
529 535 _shelfControl = [[NSClassFromString(@"BRMediaShelfControl") alloc] init];
530 536 [_shelfControl setProvider:[self getProviderForShelf]];
@@ -541,18 +547,18 @@ -(void)reloadShelf
541 547 _provider=nil;
542 548 }
543 549 _provider=[[self getProviderForShelf] retain];
544   - BRProviderDataSourceAdapter * adap = [[NSClassFromString(@"BRProviderDataSourceAdapter") alloc] init];
545   - [adap setProviders:[NSArray arrayWithObject:_provider]];
  550 + _adap = [[NSClassFromString(@"BRProviderDataSourceAdapter") alloc] init];
  551 + [_adap setProviders:[NSArray arrayWithObject:_provider]];
546 552 NSLog(@"Provider: %@ %@",_provider,_provider.controlFactory);
547 553 [_provider.controlFactory setDefaultImage:[[BRThemeInfo sharedTheme]appleTVIcon]];
548   - [adap setGridColumnCount:8];
  554 + [_adap setGridColumnCount:8];
549 555 if ([_shelfControl respondsToSelector:@selector(setColumnCount:)]) {
550 556 [_shelfControl setColumnCount:8];
551 557 }
552 558
553 559 [_shelfControl setCentered:NO];
554   - [_shelfControl setDataSource:adap];
555   - [_shelfControl setDelegate:adap];
  560 + [_shelfControl setDataSource:_adap];
  561 + [_shelfControl setDelegate:_adap];
556 562 //[adap autorelease];
557 563 [_shelfControl reloadData];
558 564
@@ -663,10 +669,6 @@ -(BOOL)brEventAction:(BREvent *)action
663 669 // _shelfControl.dataSource=self;
664 670 BRControl *c = [self focusedControl];
665 671 long shelfIndex=1;
666   -// if(!_usingShelfView)
667   -// {
668   -// long shelfIndex=[_shelfControl focusedIndex];
669   -// }
670 672 if ([[self stack] peekController]!=self)
671 673 return [super brEventAction:action];
672 674 int remoteAction = [action remoteAction];
@@ -752,6 +754,7 @@ -(void)dealloc
752 754 [_shelfControl release];
753 755
754 756 [_buttons release];
  757 + checkNil(_adap);
755 758 checkNil(_previousArrowImageControl);
756 759 checkNil(_nextArrowImageControl);
757 760 checkNil(_info);

0 comments on commit 0e33b26

Please sign in to comment.
Something went wrong with that request. Please try again.