Changeset 1175
- Timestamp:
- 02/25/2010 09:45:06 AM (2 years ago)
- Location:
- branches/PlayerFramework/SapphireFrappliance/MetaDataImporting
- Files:
-
- 2 modified
-
SapphirePosterChooser.h (modified) (1 diff)
-
SapphirePosterChooser.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/PlayerFramework/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.h
r1017 r1175 31 31 */ 32 32 @interface SapphirePosterChooser : SapphireMediaMenuController <BRIconSourceProtocol, BRMenuListItemProvider, SapphireLayoutDelegate, SapphireChooser> { 33 BOOL displayed; /*!< @brief YES if currently displayed, NO otherwise*/ 33 34 NSMutableArray *posters; /*!< @brief The array of poster urls and after loaded, the NSImages*/ 34 35 NSMutableArray *posterLayers; /*!< @brief The image layers of posters*/ 36 NSMutableArray *posterData; /*!< @brief The data for the poster images*/ 35 37 NSString *fileName; /*!< @brief The movie filename*/ 36 38 NSString *movieTitle; /*!< @brief The title of the movie*/ -
branches/PlayerFramework/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.m
r1038 r1175 42 42 - (BRBlurryImageLayer *)getPosterLayerForData:(NSData *)thePosterData; 43 43 - (void)loadPoster:(int)index; 44 - (void)reloadPosterWithData:(NSData *)data atIndex:(int)intIndex; 44 45 @end 45 46 … … 93 94 [posters release]; 94 95 [posterLayers release]; 96 [posterData release]; 95 97 [fileName release]; 96 98 [movieTitle release]; … … 187 189 int i, count = [posters count]; 188 190 posterLayers = [posters mutableCopy]; 191 posterData = [[NSMutableArray alloc] initWithCapacity:[posters count]]; 192 NSNull *nsnull = [NSNull null]; 193 for(i=0; i<count; i++) 194 [posterData addObject:nsnull]; 189 195 for(i=0; i<count; i++) 190 196 [self loadPoster:i]; … … 202 208 NSString *posterURL = [posters objectAtIndex:index]; 203 209 [posterLayers replaceObjectAtIndex:index withObject:[self getPosterLayerForData:nil]]; 204 [[SapphireApplianceController urlLoader] loadDataURL:posterURL withTarget:self selector:@selector(reloadPosterWithData:atIndex:) object:[NSNumber numberWithInt:index] withPriority:YES]; 205 } 206 207 - (void)reloadPosterWithData:(NSData *)data atIndex:(NSNumber *)index; 208 { 209 int intIndex = [index intValue]; 210 [[SapphireApplianceController urlLoader] loadDataURL:posterURL withTarget:self selector:@selector(gotPosterData:atIndex:) object:[NSNumber numberWithInt:index] withPriority:YES]; 211 } 212 213 - (void)gotPosterData:(NSData *)data atIndex:(NSNumber *)index; 214 { 215 if(displayed) 216 [self reloadPosterWithData:data atIndex:[index intValue]]; 217 else 218 [posterData replaceObjectAtIndex:[index intValue] withObject:data]; 219 } 220 221 - (void)reloadPosterWithData:(NSData *)data atIndex:(int)intIndex; 222 { 210 223 [posterLayers replaceObjectAtIndex:intIndex withObject:[self getPosterLayerForData:data]]; 211 224 NSImage *image = [[NSImage alloc] initWithData:data]; … … 539 552 [[self list] reload]; 540 553 [super wasPushed]; 554 displayed = YES; 555 int i, count = [posterData count]; 556 for(i=0; i<count; i++) 557 { 558 id obj = [posterData objectAtIndex:i]; 559 if([obj isKindOfClass:[NSData class]]) 560 [self reloadPosterWithData:obj atIndex:i]; 561 } 541 562 } 542 563
