Changeset 648
- Timestamp:
- 07/30/08 17:26:17 (4 months ago)
- Files:
-
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireCollectionDirectory.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireCollectionDirectory.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/Settings/SapphireCollectionSettings.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/Settings/SapphireSettings.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/Settings/SapphireSettings.m (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireCollectionDirectory.h
r611 r648 1 1 #import "_SapphireCollectionDirectory.h" 2 2 3 @interface SapphireCollectionDirectory : _SapphireCollectionDirectory {} 3 @interface SapphireCollectionDirectory : _SapphireCollectionDirectory { 4 BOOL toDelete; 5 } 4 6 + (SapphireCollectionDirectory *)collectionAtPath:(NSString *)path mount:(BOOL)isMount skip:(BOOL)skip hidden:(BOOL)hidden manual:(BOOL)manual inContext:(NSManagedObjectContext *)moc; 5 7 + (SapphireCollectionDirectory *)collectionAtPath:(NSString *)path inContext:(NSManagedObjectContext *)moc; 6 8 + (NSArray *)availableCollectionDirectoriesInContext:(NSManagedObjectContext *)moc; 7 9 + (NSArray *)skippedCollectionDirectoriesInContext:(NSManagedObjectContext *)moc; 10 + (NSArray *)allCollectionsInContext:(NSManagedObjectContext *)moc; 11 12 - (BOOL)deleteValue; 13 - (void)setDeleteValue:(BOOL)del; 8 14 @end branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireCollectionDirectory.m
r611 r648 82 82 return ret; 83 83 } 84 85 + (NSArray *)allCollectionsInContext:(NSManagedObjectContext *)moc 86 { 87 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(manualCollection == YES) OR (isMount == YES)"]; 88 NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"directory.path" ascending:YES]; 89 NSArray *ret = doSortedFetchRequest(MY_NAME, moc, predicate, sort); 90 91 [sort release]; 92 return ret; 93 } 94 95 - (BOOL)deleteValue 96 { 97 return toDelete; 98 } 99 100 - (void)setDeleteValue:(BOOL)del 101 { 102 toDelete = del; 103 } 84 104 @end branches/CoreData/SapphireFrappliance/Settings/SapphireCollectionSettings.m
r560 r648 36 36 37 37 moc = [context retain]; 38 collections = [[SapphireCollectionDirectory availableCollectionDirectoriesInContext:moc] retain]; 38 //Scan collections 39 [SapphireCollectionDirectory availableCollectionDirectoriesInContext:moc]; 40 collections = [[SapphireCollectionDirectory allCollectionsInContext:moc] retain]; 41 39 42 [[self list] setDatasource:self]; 40 43 branches/CoreData/SapphireFrappliance/Settings/SapphireSettings.h
r541 r648 36 36 NSDictionary *defaults; /*!< @brief The default settings, in order*/ 37 37 NSManagedObjectContext *moc; /*!< @brief The context*/ 38 int lastCommand; /*!< @brief The last command issued*/ 38 39 } 39 40 branches/CoreData/SapphireFrappliance/Settings/SapphireSettings.m
r560 r648 31 31 #import "SapphireCollectionSettings.h" 32 32 #import "SapphireFileMetaData.h" 33 #import "SapphireCollectionDirectory.h" 34 #import "SapphireDirectoryMetaData.h" 35 #import "SapphireMetaDataSupport.h" 33 36 #import <SapphireCompatClasses/SapphireFrontRowCompat.h> 34 37 #import "NSString-Extensions.h" 38 #import "NSFileManager-Extensions.h" 35 39 36 40 static SapphireSettings *sharedInstance = nil; … … 57 61 #define LAST_PREDICATE @"LastPredicate" 58 62 63 typedef enum { 64 COMMAND_OTHER, 65 COMMAND_DELETE_COLLECTION, 66 } SettingsCommand; 67 59 68 + (SapphireSettings *)sharedSettings 60 69 { … … 75 84 self = [super initWithScene:scene]; 76 85 86 lastCommand = COMMAND_OTHER; 77 87 /*Setup display*/ 78 88 moc = [context retain]; … … 83 93 BRLocalizedString(@" Hide Collections", @"Hide Collections menu item"), 84 94 BRLocalizedString(@" Don't Import Collections", @"Don't Import Collections menu item"), 95 BRLocalizedString(@" Delete Collections", @"Delete Collections menu item"), 85 96 BRLocalizedString(@" Skip \"Favorite Shows\" filter", @"Skip Favorite shows menu item"), 86 97 /* BRLocalizedString(@" Skip \"Top Shows\" filter", @"Skip Top shows menu item"),*/ … … 103 114 BRLocalizedString(@"Allows the user to specify which collections should be hidden from Sapphire's main menu.", @"Hide Collections description"), 104 115 BRLocalizedString(@"Allows the user to specify which collections should be skipped when importing meta data.", @"Don't Import Collections description"), 116 BRLocalizedString(@"Allows the user to specify which collections should be delete along with its data. Use this for collections which will never be used again.", @"Delete Collections description"), 105 117 BRLocalizedString(@"Tells Sapphire that when changing filter settings, skip over the favorite shows filter.", @"Skip Favorite shows description"), 106 118 /* BRLocalizedString(@"Skip \"Top Shows\" filter", @"Skip Top shows description"),*/ … … 120 132 @"", 121 133 /* @"",*/ 134 @"", 122 135 @"", 123 136 @"", … … 141 154 [theme gem:FILE_GEM_KEY], 142 155 [theme gem:FILE_GEM_KEY], 156 [theme gem:FILE_GEM_KEY], 143 157 [theme gem:YELLOW_GEM_KEY], 144 158 /*[theme gem:GREEN_GEM_KEY],*/ … … 178 192 BRListControl *list = [self list]; 179 193 [list setDatasource:self]; 180 [SapphireFrontRowCompat addDividerAtIndex: 5toList:list];194 [SapphireFrontRowCompat addDividerAtIndex:6 toList:list]; 181 195 /*Save our instance*/ 182 196 sharedInstance = [self retain]; … … 369 383 { 370 384 // handle being revealed when the user presses Menu 385 386 if(lastCommand == COMMAND_DELETE_COLLECTION) 387 { 388 NSArray *collections = [SapphireCollectionDirectory allCollectionsInContext:moc]; 389 NSEnumerator *colEnum = [collections objectEnumerator]; 390 SapphireCollectionDirectory *collection; 391 BOOL change = NO; 392 while((collection = [colEnum nextObject]) != nil) 393 { 394 if([collection deleteValue]) 395 { 396 change = YES; 397 SapphireDirectoryMetaData *dir = [collection directory]; 398 if([[NSFileManager defaultManager] isDirectory:[dir path]]) 399 [moc deleteObject:collection]; 400 else 401 [moc deleteObject:dir]; 402 } 403 } 404 if(change) 405 [SapphireMetaDataSupport save:moc]; 406 } 371 407 372 408 // always call super … … 438 474 // This is called when the user changed a setting 439 475 476 lastCommand = COMMAND_OTHER; 440 477 /*Check for populate show data*/ 441 478 if(row==0) … … 489 526 [colSettings setSettingSelector:@selector(setSkipValue:)]; 490 527 [colSettings setListTitle:BRLocalizedString(@"Skip Collections", @"Skip Collections Menu Title")] ; 528 [[self stack] pushController:colSettings]; 529 [colSettings release]; 530 } 531 else if(row == 5) 532 { 533 SapphireCollectionSettings *colSettings = [[SapphireCollectionSettings alloc] initWithScene:[self scene] context:moc]; 534 [colSettings setGettingSelector:@selector(deleteValue)]; 535 [colSettings setSettingSelector:@selector(setDeleteValue:)]; 536 [colSettings setListTitle:BRLocalizedString(@"Delete Collections", @"Delete Collections Menu Title")]; 537 lastCommand = COMMAND_DELETE_COLLECTION; 491 538 [[self stack] pushController:colSettings]; 492 539 [colSettings release];
