Changeset 696
- Timestamp:
- 12/03/08 15:14:08 (1 month ago)
- Files:
-
- branches/CoreData/SapphireFrappliance/Browser/SapphireBrowser.m (modified) (6 diffs)
- branches/CoreData/SapphireFrappliance/Browser/SapphireMarkMenu.m (modified) (4 diffs)
- branches/CoreData/SapphireFrappliance/Browser/SapphireMediaPreview.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireAppliance.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireApplianceController.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireApplianceController.m (modified) (6 diffs)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireImportHelper.m (modified) (4 diffs)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireMetaDataUpgrading.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireMetaDataUpgrading.m (modified) (4 diffs)
- branches/CoreData/SapphireFrappliance/FRAppliance/main_helper.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.m (modified) (5 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireImporterDataMenu.h (modified) (3 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireImporterDataMenu.m (modified) (6 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieChooser.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieChooser.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.m (modified) (6 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireShowChooser.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireShowChooser.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireTVShowImporter.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireTVShowImporter.m (modified) (7 diffs)
- branches/CoreData/SapphireFrappliance/Players/SapphireMedia.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/Players/SapphireMedia.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/Players/SapphireVideoPlayer.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/Players/SapphireVideoPlayer.m (modified) (4 diffs)
- branches/CoreData/SapphireFrappliance/Players/SapphireVideoPlayerController.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/Players/SapphireVideoPlayerController.m (modified) (3 diffs)
- branches/CoreData/SapphireFrappliance/Sapphire.xcodeproj/project.pbxproj (modified) (25 diffs)
- branches/CoreData/SapphireFrappliance/Settings/SapphireCollectionSettings.m (modified) (3 diffs)
- branches/CoreData/SapphireFrappliance/Settings/SapphireSettings.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/CoreData/SapphireFrappliance/Browser/SapphireBrowser.m
r652 r696 195 195 } 196 196 197 - (void) willBePushed 198 { 199 // We're about to be placed on screen, but we're not yet there 200 201 // always call super 202 [super willBePushed]; 197 - (void) wasPushed 198 { 199 // We've just been put on screen, the user can see this controller's content now 203 200 /*Reload upon display*/ 204 201 @try { … … 208 205 @catch (NSException * e) { 209 206 [SapphireApplianceController logException:e]; 210 } 211 } 212 213 - (void) wasPushed 214 { 215 // We've just been put on screen, the user can see this controller's content now 216 207 } 217 208 // always call super 218 209 [super wasPushed]; … … 221 212 } 222 213 223 - (void) willBePopped 224 { 225 // The user pressed Menu, but we've not been removed from the screen yet 226 214 - (void) wasPopped 215 { 216 // The user pressed Menu, removing us from the screen 227 217 // always call super 228 [super willBePopped]; 218 219 [super wasPopped]; 229 220 /*Cancel everything we were doing*/ 230 221 [metaData cancelImport]; … … 233 224 } 234 225 235 - (void) wasPopped 236 { 237 // The user pressed Menu, removing us from the screen 238 // always call super 239 [super wasPopped]; 240 } 241 242 - (void) willBeBuried 243 { 244 // The user just chose an option, and we will be taken off the screen 245 226 - (void) wasBuriedByPushingController: (BRLayerController *) controller 227 { 228 // The user chose an option and this controller is no longer on screen 229 246 230 /*Cancel everything we were doing*/ 247 231 [metaData cancelImport]; 248 232 cancelScan = YES; 249 233 [metaData setDelegate:nil]; 250 // always call super 251 [super willBeBuried]; 252 } 253 254 - (void) wasBuriedByPushingController: (BRLayerController *) controller 255 { 256 // The user chose an option and this controller is no longer on screen 257 234 258 235 // always call super 259 236 [super wasBuriedByPushingController: controller]; 260 237 } 261 238 262 - (void) w illBeExhumed263 { 264 // the user pressed Menu, but we've not been revealed yet265 239 - (void) wasExhumedByPoppingController: (BRLayerController *) controller 240 { 241 // handle being revealed when the user presses Menu 242 266 243 /*Reload our display*/ 267 244 [metaData setDelegate:self]; 268 245 [self setNewPredicate:[SapphireApplianceController predicate]]; 269 // always call super 270 [super willBeExhumed]; 271 } 272 273 - (void) wasExhumedByPoppingController: (BRLayerController *) controller 274 { 275 // handle being revealed when the user presses Menu 276 246 277 247 // always call super 278 248 [super wasExhumedByPoppingController: controller]; … … 613 583 614 584 /*and go*/ 615 SapphireVideoPlayerController *controller = [[SapphireVideoPlayerController alloc] initWithScene:[self scene] ];585 SapphireVideoPlayerController *controller = [[SapphireVideoPlayerController alloc] initWithScene:[self scene] player:player]; 616 586 [controller setPlayFile:currentPlayFile]; 617 587 [controller setAllowsResume:YES]; 618 [controller setVideoPlayer:player];619 588 [[self stack] pushController:controller]; 620 589 … … 704 673 - (BOOL)brEventAction:(BREvent *)event 705 674 { 706 BREventPageUsageHash hashVal = [event pageUsageHash];675 BREventPageUsageHash hashVal = (uint32_t)([event page] << 16 | [event usage]); 707 676 if ([(BRControllerStack *)[self stack] peekController] != self) 708 677 hashVal = 0; branches/CoreData/SapphireFrappliance/Browser/SapphireMarkMenu.m
r670 r696 284 284 } 285 285 286 - (void) willBePushed287 {288 // We're about to be placed on screen, but we're not yet there289 290 // always call super291 [super willBePushed];292 }293 294 286 - (void) wasPushed 295 287 { … … 300 292 } 301 293 302 - (void) willBePopped303 {304 // The user pressed Menu, but we've not been removed from the screen yet305 306 // always call super307 [super willBePopped];308 }309 310 294 - (void) wasPopped 311 295 { … … 316 300 } 317 301 318 - (void) willBeBuried319 {320 // The user just chose an option, and we will be taken off the screen321 322 // always call super323 [super willBeBuried];324 }325 326 302 - (void) wasBuriedByPushingController: (BRLayerController *) controller 327 303 { … … 330 306 // always call super 331 307 [super wasBuriedByPushingController: controller]; 332 }333 334 - (void) willBeExhumed335 {336 // the user pressed Menu, but we've not been revealed yet337 338 // always call super339 [super willBeExhumed];340 308 } 341 309 branches/CoreData/SapphireFrappliance/Browser/SapphireMediaPreview.h
r592 r696 38 38 */ 39 39 @interface SapphireMediaPreview : BRMetadataPreviewController{ 40 int padding[ 16]; /*!< @brief The classes are of different sizes. This padding prevents a class compiled with one size to overlap when used with a class of a different size*/40 int padding[32]; /*!< @brief The classes are of different sizes. This padding prevents a class compiled with one size to overlap when used with a class of a different size*/ 41 41 id <SapphireMetaDataProtocol> meta; /*!< @brief The metadata to display in the preview*/ 42 42 id <SapphireDirectory> dirMeta; /*!< @brief The directory containing the metadata*/ branches/CoreData/SapphireFrappliance/FRAppliance/SapphireAppliance.m
r597 r696 60 60 return; 61 61 [[cls sharedInstance] enableFeatureNamed: [[NSBundle bundleForClass: self] bundleIdentifier]]; 62 [[SapphireFrontRowCompat sharedFrontRowPreferences] setBool:YES forKey:@"AllowAllVideoToPlay"]; //Workaround 2.2. 62 63 } 63 64 branches/CoreData/SapphireFrappliance/FRAppliance/SapphireApplianceController.h
r608 r696 20 20 21 21 #import <SapphireCompatClasses/SapphireMediaMenuController.h> 22 23 #define RESCAN_DIRECTORY_NOTIFICATION @"Rescan Directory Notification" 22 24 23 25 @class SapphireSettings, SapphireTheme, SapphireLeopardOnly, SapphireImporterDataMenu, SapphireBrowser; branches/CoreData/SapphireFrappliance/FRAppliance/SapphireApplianceController.m
r668 r696 228 228 [ret appendFormat:@"\n0x%X\t%@", [key pointerValue], [mapping objectForKey:key]]; 229 229 } 230 NSLog(@"%@", ret);230 SapphireLog(SAPPHIRE_LOG_GENERAL, SAPPHIRE_LOG_LEVEL_ERROR, @"%@", ret); 231 231 } 232 232 … … 288 288 mountsOnly = NO; 289 289 290 SapphireSetLogLevel(SAPPHIRE_LOG_ALL, SAPPHIRE_LOG_LEVEL_ERROR); 291 SapphireSetLogLevel(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG); 292 293 [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(distributedRescanDir:) name:RESCAN_DIRECTORY_NOTIFICATION object:nil]; 294 290 295 return self; 291 296 } … … 302 307 [settings release]; 303 308 [SapphireImportHelper relinquishHelper]; 309 [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; 304 310 [super dealloc]; 305 311 } … … 467 473 } 468 474 469 - (void) willBePushed 470 { 471 // We're about to be placed on screen, but we're not yet there 475 - (void)distributedRescanDir:(NSNotification *)note 476 { 477 id info = [note userInfo]; 478 if(![info isKindOfClass:[NSString class]]) 479 return; 480 NSString *dirPath = (NSString *)info; 481 if(![[NSFileManager defaultManager] isDirectory:dirPath]) 482 return; 483 484 SapphireDirectoryMetaData *dir = [SapphireDirectoryMetaData directoryWithPath:dirPath inContext:moc]; 485 [dir reloadDirectoryContents]; 486 [dir resumeImport]; 487 } 488 489 - (void) wasPushed 490 { 491 // We've just been put on screen, the user can see this controller's content now 472 492 [self recreateMenu]; 473 493 [[self list] reload]; 474 494 // always call super 475 [super willBePushed];476 }477 478 - (void) wasPushed479 {480 // We've just been put on screen, the user can see this controller's content now481 482 // always call super483 495 [super wasPushed]; 484 }485 486 - (void) willBePopped487 {488 // The user pressed Menu, but we've not been removed from the screen yet489 490 // always call super491 [super willBePopped];492 496 } 493 497 … … 500 504 } 501 505 502 - (void) willBeBuried503 {504 // The user just chose an option, and we will be taken off the screen505 506 // always call super507 [super willBeBuried];508 }509 510 506 - (void) wasBuriedByPushingController: (BRLayerController *) controller 511 507 { … … 516 512 } 517 513 518 - (void) w illBeExhumed519 { 520 // the user pressed Menu, but we've not been revealed yet514 - (void) wasExhumedByPoppingController: (BRLayerController *) controller 515 { 516 // handle being revealed when the user presses Menu 521 517 522 // always call super523 [super willBeExhumed];524 518 [self setMenuFromSettings]; 525 519 [[self list] reload]; 526 520 [SapphireFrontRowCompat renderScene:[self scene]]; 527 } 528 529 - (void) wasExhumedByPoppingController: (BRLayerController *) controller 530 { 531 // handle being revealed when the user presses Menu 532 521 533 522 // always call super 534 523 [super wasExhumedByPoppingController: controller]; branches/CoreData/SapphireFrappliance/FRAppliance/SapphireImportHelper.m
r692 r696 152 152 while((file = [server nextFile]) != nil) 153 153 { 154 if(![moc hasChanges]) 155 [moc reset]; 154 156 NSAutoreleasePool *singleImportPool = [[NSAutoreleasePool alloc] init]; 155 157 ImportType type = [file importType]; … … 162 164 else 163 165 ret = ([allImporter importMetaData:file] == IMPORT_STATE_UPDATED); 164 keepRunning &= [SapphireMetaDataSupport save:moc];166 keepRunning &= ([SapphireMetaDataSupport save:moc] || [SapphireMetaDataSupport wasLocked]); 165 167 [server importComplete:ret]; 166 168 [singleImportPool release]; … … 183 185 [serverConnection setRootObject:self]; 184 186 if([serverConnection registerName:CONNECTION_NAME] == NO) 185 NSLog(@"Register failed");187 SapphireLog(SAPPHIRE_LOG_GENERAL, SAPPHIRE_LOG_LEVEL_ERROR, @"Register failed"); 186 188 187 189 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(connectionDidDie:) name:NSConnectionDidDieNotification object:nil]; … … 275 277 } 276 278 @catch (NSException * e) { 277 NSLog(@"Could not launch helper because of exception %@ launching %@. Make this file executable", e, path);279 SapphireLog(SAPPHIRE_LOG_GENERAL, SAPPHIRE_LOG_LEVEL_ERROR, @"Could not launch helper because of exception %@ launching %@. Make this file executable", e, path); 278 280 } 279 281 } 280 282 else 281 NSLog(@"Could not correct helper permissions on %@. Make this file executable!", path);283 SapphireLog(SAPPHIRE_LOG_GENERAL, SAPPHIRE_LOG_LEVEL_ERROR, @"Could not correct helper permissions on %@. Make this file executable!", path); 282 284 } 283 285 branches/CoreData/SapphireFrappliance/FRAppliance/SapphireMetaDataUpgrading.h
r572 r696 20 20 21 21 #import <SapphireCompatClasses/SapphireCenteredMenuController.h> 22 #import <SapphireCompatClasses/SapphireLayoutManager.h> 22 23 23 @interface SapphireMetaDataUpgrading : SapphireCenteredMenuController {24 @interface SapphireMetaDataUpgrading : SapphireCenteredMenuController <SapphireLayoutDelegate> { 24 25 BRWaitSpinnerControl *spinner; /*!< @brief The spinner*/ 25 26 BRTextControl *status; /*!< @brief Status message*/ branches/CoreData/SapphireFrappliance/FRAppliance/SapphireMetaDataUpgrading.m
r578 r696 22 22 #import <SapphireCompatClasses/SapphireFrontRowCompat.h> 23 23 #import "SapphireMetaDataSupport.h" 24 25 @interface SapphireMetaDataUpgrading (private)26 - (void)layoutFrame;27 @end28 24 29 25 @implementation SapphireMetaDataUpgrading … … 63 59 } 64 60 65 [self layoutFrame];61 [self doMyLayout]; 66 62 67 63 [self addControl:status]; … … 70 66 else 71 67 [self addControl:spinner]; 68 69 [SapphireLayoutManager setCustomLayoutOnControl:self]; 72 70 73 71 return self; … … 75 73 } 76 74 77 - (void) layoutFrame75 - (void)doMyLayout 78 76 { 79 77 NSRect frame = [SapphireFrontRowCompat frameOfController:self]; branches/CoreData/SapphireFrappliance/FRAppliance/main_helper.m
r558 r696 50 50 NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] init]; 51 51 [moc setUndoManager:nil]; 52 [moc setMergePolicy:NSMergeByPropertyStoreTrumpMergePolicy]; 52 53 NSString *mopath = [bundle pathForResource:@"Sapphire" ofType:@"mom"]; 53 54 NSURL *mourl = [NSURL fileURLWithPath:mopath]; branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.m
r683 r696 204 204 return ret; 205 205 } 206 NSLog(@"Somehow couldn't get cache for %@ in %@", directory, self.path);206 SapphireLog(SAPPHIRE_LOG_GENERAL, SAPPHIRE_LOG_LEVEL_ERROR, @"Somehow couldn't get cache for %@ in %@", directory, self.path); 207 207 NSString *path = [self.path stringByAppendingPathComponent:directory]; 208 208 NSPredicate *pred = [NSPredicate predicateWithFormat:@"path == %@", path]; branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m
r670 r696 9 9 #import "SapphireMediaPreview.h" 10 10 #import "SapphireFileSymLink.h" 11 #import "SapphireSettings.h" 11 12 12 13 #import "SapphireTVShow.h" … … 475 476 { 476 477 if([lowerFileName hasPrefix:tran.name]) 478 { 479 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Deleting TV import translation for %@", tran.name); 477 480 [moc deleteObject:tran]; 481 } 478 482 } 479 483 } 480 SapphireMovieTranslation *movieTran = [SapphireMovieTranslation movieTranslationWithName:lowerFileName inContext:moc]; 484 NSString *lookupName; 485 if([[SapphireSettings sharedSettings] dirLookup]) 486 lookupName = [[[self.path stringByDeletingLastPathComponent] lastPathComponent] lowercaseString]; 487 else 488 lookupName = lowerFileName; 489 SapphireMovieTranslation *movieTran = [SapphireMovieTranslation movieTranslationWithName:[lookupName stringByDeletingPathExtension] inContext:moc]; 481 490 if(movieTran != nil) 491 { 492 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Deleting Movie import translation for %@", movieTran.name); 482 493 [moc deleteObject:movieTran]; 494 } 483 495 484 496 [self setToReimportFromMask:IMPORT_TYPE_ALL_MASK]; branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.h
r689 r696 31 31 NSTimer *writeTimer; /*!< @brief The timer to agregate writes*/ 32 32 NSTimeInterval interval; /*!< @brief The write interval*/ 33 BOOL locked; /*!< @brief Was the DB locked during the last save*/ 33 34 } 34 35 … … 40 41 */ 41 42 + (BOOL)save:(NSManagedObjectContext *)context; 43 44 /*! 45 * @brief Was the DB locked in last save? 46 * 47 * @return YES if it was locked, NO otherwise 48 */ 49 + (BOOL)wasLocked; 42 50 43 51 /*! branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.m
r689 r696 108 108 context = [timer userInfo]; 109 109 110 if(writeTimer != nil) 111 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Rescheduled write"); 110 112 [writeTimer invalidate]; 111 113 writeTimer = nil; 112 114 NSError *error = nil; 115 locked = NO; 113 116 BOOL success = NO; 114 117 @try { … … 116 119 } 117 120 @catch (NSException * e) { 118 NSLog(@"Could not save due to exception \"%@\" with reason\"%@\"", [e name], [e reason]);121 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Could not save due to exception \"%@\" with reason \"%@\"", [e name], [e reason]); 119 122 } 120 123 if(error != nil) 121 NSLog(@"Save error \"%@\"", error); 124 { 125 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Save error \"%@\"", error); 126 NSException *underlying = [[error userInfo] objectForKey:@"NSUnderlyingException"]; 127 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG, @"Underlying is %@ %@ %@ %@", underlying, [underlying name], [underlying reason], [underlying userInfo]); 128 if([[underlying reason] isEqualToString:@"database is locked"]) 129 { 130 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG, @"Detected locked"); 131 locked = YES; 132 } 133 } 122 134 if(success == NO) 123 135 { 136 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG, @"Inserted objects is %@", [context insertedObjects]); 137 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG, @"Updated objects is %@", [context updatedObjects]); 138 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG, @"Deleted objects is %@", [context deletedObjects]); 124 139 interval *= 2; 125 140 [writeTimer invalidate]; 141 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Rescheduling write to occurr in %f seconds", interval); 126 142 writeTimer = [NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(realWriteMetaData:) userInfo:context repeats:NO]; 127 143 } … … 133 149 { 134 150 interval = 1; 135 [self realWriteMetaData:(NSTimer *)context];151 [self performSelectorOnMainThread:@selector(realWriteMetaData:) withObject:context waitUntilDone:YES]; 136 152 return (writeTimer == nil); 137 153 } … … 146 162 147 163 return [[SapphireMetaDataSupport sharedInstance] save:context]; 164 } 165 166 - (BOOL)wasLocked 167 { 168 return locked; 169 } 170 171 + (BOOL)wasLocked 172 { 173 return [[SapphireMetaDataSupport sharedInstance] wasLocked]; 148 174 } 149 175 … … 268 294 { 269 295 if(![obj validateForUpdate:&error]) 270 NSLog(@"%@", error);296 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_INFO, @"%@", error); 271 297 } 272 298 [display setCurrentFile:BRLocalizedString(@"Upgrading Complete; Press Menu to Go Back", @"")]; branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireImporterDataMenu.h
r683 r696 21 21 #import "SapphireDirectory.h" 22 22 #import <SapphireCompatClasses/SapphireCenteredMenuController.h> 23 #import <SapphireCompatClasses/SapphireLayoutManager.h> 23 24 24 25 @class SapphireImporterDataMenu, SapphireFileMetaData; … … 108 109 * This class creates the importer UI. It handles all the user interaction and passes commands on to its subordinates. 109 110 */ 110 @interface SapphireImporterDataMenu : SapphireCenteredMenuController <SapphireMetaDataScannerDelegate, SapphireImporterBackgroundProtocol >111 @interface SapphireImporterDataMenu : SapphireCenteredMenuController <SapphireMetaDataScannerDelegate, SapphireImporterBackgroundProtocol, SapphireLayoutDelegate> 111 112 { 112 113 BRTextControl *text; /*!< @brief The informative text*/ … … 132 133 SEL action; /*!< @brief The action selector when the button is hit*/ 133 134 NSString *buttonTitle; /*!< @brief The fake button title*/ 135 BOOL layoutDone; /*!< @brief YES if layout already done, NO otherwise*/ 134 136 } 135 137 /*! branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireImporterDataMenu.m
r687 r696 72 72 [self addControl: currentFile] ; 73 73 [SapphireFrontRowCompat addSublayer:bar toControl:self]; 74 74 75 [SapphireLayoutManager setCustomLayoutOnControl:self]; 76 75 77 return ( self ); 76 78 } … … 237 239 return; 238 240 } 241 [SapphireMetaDataSupport save:moc]; 239 242 [allItems release]; 240 243 allItems = [importItems copy]; … … 284 287 case IMPORT_STATE_UPDATED: 285 288 ret = YES; 289 SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DETAIL, @"Updated %@", [file path]); 286 290 break; 287 291 case IMPORT_STATE_NEEDS_SUSPEND: … … 294 298 break; 295 299 } 296 [SapphireMetaDataSupport save:moc]; 300 if(ret) 301 [SapphireMetaDataSupport save:moc]; 297 302 } 298 303 @catch (NSException * e) { … … 461 466 } 462 467 468 - (void)doMyLayout 469 { 470 if(!layoutDone) 471 { 472 [self layoutFrame]; 473 [self resetUIElements]; 474 layoutDone = YES; 475 } 476 } 477 463 478 - (void)wasPushed 464 479 { … … 482 497 483 498 - (BOOL)brEventAction:(BREvent *)event{ 484 BREventPageUsageHash hashVal = [event pageUsageHash];499 BREventPageUsageHash hashVal = (uint32_t)([event page] << 16 | [event usage]); 485 500 486 501 if([(BRControllerStack *)[self stack] peekController] != self || action == NULL) branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieChooser.h
r541 r696 20 20 21 21 #import <SapphireCompatClasses/SapphireCenteredMenuController.h> 22 #import <SapphireCompatClasses/SapphireLayoutManager.h> 22 23 23 24 #define MOVIE_CHOOSE_CANCEL -2 … … 29 30 * This class presents the user with a list of possible movies to match a file and asks the user to choose its name. 30 31 */ 31 @interface SapphireMovieChooser : SapphireCenteredMenuController {32 @interface SapphireMovieChooser : SapphireCenteredMenuController <SapphireLayoutDelegate> { 32 33 NSArray *movies; /*!< @brief The list of possible movies*/ 33 34 NSString *fileName; /*!< @brief The filename of the current file*/ branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieChooser.m
r541 r696 43 43 [self addControl: fileNameText]; 44 44 [[self list] setDatasource:self]; 45 46 [SapphireLayoutManager setCustomLayoutOnControl:self]; 45 47 46 48 return self; … … 89 91 } 90 92 91 - (void)willBePushed92 {93 [super willBePushed];94 [(BRListControl *)[self list] setSelection:1];95 }96 97 93 - (void)wasPushed 98 94 { 95 [(BRListControl *)[self list] setSelection:1]; 99 96 [self doMyLayout]; 100 97 [super wasPushed]; branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.h
r557 r696 32 32 NSManagedObjectContext *moc; /*!< @brief The context of translations*/ 33 33 SapphirePosterChooser *posterChooser; /*!< @brief The poster chooser (if exists) (not retained)*/ 34 BRLayerController *childController; /*!< @brief The controller we push on top of us*/ 34 35 } 35 36 branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.m
r669 r696 166 166 { 167 167 [moc release]; 168 [childController release]; 168 169 [super dealloc]; 169 170 } … … 710 711 [chooser setListTitle:BRLocalizedString(@"Select Movie Title", @"Prompt the user for title of movie")]; 711 712 /*And display prompt*/ 713 childController = [chooser retain]; 712 714 [[dataMenu stack] pushController:chooser]; 713 715 [chooser release]; … … 763 765 [posterChooser setFile:(SapphireFileMetaData *)metaData]; 764 766 [posterChooser setListTitle:BRLocalizedString(@"Select Movie Poster", @"Prompt the user for poster selection")]; 767 childController = [posterChooser retain]; 765 768 [[dataMenu stack] pushController:posterChooser]; 766 769 [posterChooser release]; … … 875 878 { 876 879 /*See if it was a movie chooser*/ 877 if([c ontroller isKindOfClass:[SapphireMovieChooser class]])880 if([childController isKindOfClass:[SapphireMovieChooser class]]) 878 881 { 879 882 /*Get the user's selection*/ 880 SapphireMovieChooser *chooser = (SapphireMovieChooser *)c ontroller;883 SapphireMovieChooser *chooser = (SapphireMovieChooser *)childController; 881 884 int selection = [chooser selection]; 882 885 if(selection == MOVIE_CHOOSE_CANCEL) … … 905 908 [dataMenu resume]; 906 909 } 907 else if([c ontroller isKindOfClass:[SapphirePosterChooser class]])910 else if([childController isKindOfClass:[SapphirePosterChooser class]]) 908 911 { 909 912 int selectedPoster = [posterChooser selectedPoster]; … … 924 927 else 925 928 return; 929 930 [childController release]; 931 childController = nil; 926 932 } 927 933 branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.h
r541 r696 20 20 21 21 #import <SapphireCompatClasses/SapphireMediaMenuController.h> 22 #import <SapphireCompatClasses/SapphireLayoutManager.h> 22 23 23 24 #define POSTER_CHOOSE_CANCEL -1 … … 31 32 * This class provides a menu and maching icons to display posters for the user to choose. 32 33 */ 33 @interface SapphirePosterChooser : SapphireMediaMenuController <BRIconSourceProtocol, BRMenuListItemProvider > {34 @interface SapphirePosterChooser : SapphireMediaMenuController <BRIconSourceProtocol, BRMenuListItemProvider, SapphireLayoutDelegate> { 34 35 NSArray *posters; /*!< @brief The array of poster paths*/ 35 36 NSMutableArray *posterLayers; /*!< @brief The image layers of posters*/ branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.m
r554 r696 72 72 /* Setup posterMarch controls */ 73 73 posterMarch = [SapphireFrontRowCompat newMarchingIconLayerWithScene:scene]; 74 [SapphireLayoutManager setCustomLayoutOnControl:self]; 74 75 75 76 return self; … … 101 102 { 102 103 // We're about to be placed on screen, but we're not yet there 103 // add the icon march layer to the scene104 [self showIconMarch];105 104 106 105 // always call super branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireShowChooser.h
r541 r696 20 20 21 21 #import <SapphireCompatClasses/SapphireCenteredMenuController.h> 22 #import <SapphireCompatClasses/SapphireLayoutManager.h> 22 23
