Changeset 470

Show
Ignore:
Timestamp:
01/29/08 17:00:49 (1 year ago)
Author:
pmerrill
Message:
  • Implemented a method for displaying descriptions for utilities.
  • Added descriptions to the settings menu.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/SapphireFrappliance/SapphireMediaPreview.h

    r461 r470  
    4242 */ 
    4343- (void)setMetaData:(SapphireMetaData *)newMeta inMetaData:(SapphireDirectoryMetaData *)dir; 
     44- (void)setUtilityData:(NSMutableDictionary *)newMeta; 
    4445 
    4546@end 
  • trunk/SapphireFrappliance/SapphireMediaPreview.m

    r469 r470  
    9797} 
    9898 
     99- (void)setUtilityData:(NSMutableDictionary *)newMeta 
     100{ 
     101        [meta release]; 
     102        meta=[newMeta retain]; 
     103        SapphireMedia *asset  =[SapphireMedia alloc]; 
     104        [asset setImagePath:[[NSBundle bundleForClass:[self class]] pathForResource:@"DefaultPreview" ofType:@"png"]]; 
     105        [self setAsset:asset]; 
     106 
     107} 
     108 
    99109- (void)setMetaData:(SapphireMetaData *)newMeta inMetaData:(SapphireDirectoryMetaData *)dir 
    100110{ 
     
    327337 
    328338/*! 
     339 * @brief populate utility data 
     340 */ 
     341- (void)populateUtilityDataWith:(NSMutableDictionary *)allMeta 
     342{ 
     343        BRMetadataLayer *metaLayer = [self gimmieMetadataLayer]; 
     344        /* Get the setting name */ 
     345        NSString *value = [allMeta objectForKey:META_TITLE_KEY]; 
     346        if(value != nil) 
     347                [metaLayer setTitle:value]; 
     348        /*Get the setting description*/ 
     349        value = [allMeta objectForKey:META_DESCRIPTION_KEY]; 
     350        if(value != nil) 
     351                        [metaLayer setSummary:value]; 
     352} 
     353 
     354/*! 
    329355 * @brief populate generic file data 
    330356 */ 
     
    451477        /*Get our data then*/ 
    452478        NSArray *order = nil; 
    453         NSMutableDictionary *allMeta = [meta getDisplayedMetaDataInOrder:&order]; 
    454          
     479        NSMutableDictionary *allMeta = nil; 
    455480        FileClass fileClass=FILE_CLASS_UNKNOWN ; 
    456         if([meta isKindOfClass:[SapphireDirectoryMetaData class]]) 
    457                 fileClass=FILE_CLASS_NOT_FILE; 
    458         else 
    459                 fileClass=(FileClass)[(SapphireFileMetaData *) meta fileClass]; 
     481        if([meta respondsToSelector:@selector(getDisplayedMetaDataInOrder:)]) 
     482        { 
     483                allMeta=[meta getDisplayedMetaDataInOrder:&order]; 
     484                if([meta isKindOfClass:[SapphireDirectoryMetaData class]]) 
     485                        fileClass=FILE_CLASS_NOT_FILE; 
     486                else 
     487                        fileClass=(FileClass)[(SapphireFileMetaData *) meta fileClass]; 
     488        } 
     489        if(!allMeta) 
     490                fileClass=FILE_CLASS_UTILITY; 
    460491                 
    461          
    462492        BRMetadataLayer *metaLayer = [self gimmieMetadataLayer]; 
    463493        /* TV Show Preview Handeling */ 
     
    470500        { 
    471501                [self populateMovieMetadataWith:allMeta]; 
     502        } 
     503        /* Utility Preview Handeling */ 
     504        else if(fileClass == FILE_CLASS_UTILITY) 
     505        { 
     506                [self populateUtilityDataWith:(NSMutableDictionary *)meta]; 
    472507        } 
    473508        else if(fileClass != FILE_CLASS_NOT_FILE) 
  • trunk/SapphireFrappliance/SapphireMetaData.h

    r461 r470  
    8888#define FILE_CONTAINER_TYPE_KEY                 @"File Container Type" 
    8989typedef enum { 
     90        FILE_CLASS_UTILITY= -2, 
    9091        FILE_CLASS_NOT_FILE= -1, 
    9192        FILE_CLASS_UNKNOWN = 0, 
  • trunk/SapphireFrappliance/SapphireSettings.h

    r461 r470  
    3030@interface SapphireSettings : SapphireMediaMenuController 
    3131{ 
    32         NSArray                                         *names;                         /*!< @brief The menu names in order*/ 
    33         NSArray                                         *keys;                          /*!< @brief The setting keys, in order*/ 
    34         NSArray                                         *gems;                          /*!< @brief The left icons, in order*/ 
    35         NSMutableDictionary                     *options;                       /*!< @brief The settings, in order*/ 
    36         NSString                                        *path;                          /*!< @brief The persistent store path*/ 
    37         NSDictionary                            *defaults;                      /*!< @brief The default settings, in order*/ 
    38         SapphireMetaDataCollection      *metaCollection;        /*!< @brief The collection*/ 
     32        NSArray                                         *names;                                 /*!< @brief The menu names in order*/ 
     33        NSArray                                         *settingDescriptions;   /*!< @brief The menu names in order*/ 
     34        NSArray                                         *keys;                                  /*!< @brief The setting keys, in order*/ 
     35        NSArray                                         *gems;                                  /*!< @brief The left icons, in order*/ 
     36        NSMutableDictionary                     *options;                               /*!< @brief The settings, in order*/ 
     37        NSString                                        *path;                                  /*!< @brief The persistent store path*/ 
     38        NSDictionary                            *defaults;                              /*!< @brief The default settings, in order*/ 
     39        SapphireMetaDataCollection      *metaCollection;                /*!< @brief The collection*/ 
    3940} 
    4041 
  • trunk/SapphireFrappliance/SapphireSettings.m

    r461 r470  
    2424#import "SapphireSettings.h" 
    2525#import "SapphireTheme.h" 
     26#import "SapphireMediaPreview.h" 
    2627#import "SapphireAllFileDataImporter.h" 
    2728#import "SapphireTVShowImporter.h" 
     
    9192                                                                                                BRLocalizedString(@"  Disable Anonymous Reporting", @"Disable the anonymous reporting for aid in future features"), nil]; 
    9293         
     94        settingDescriptions=[[NSArray alloc] initWithObjects: 
     95                                                                                                BRLocalizedString(@"tells Sapphire to examine all files, and remember the file size, length and other information that can be gathered from the file itself.", @"Populate File Data description"), 
     96                                                                                                BRLocalizedString(@"tells Sapphire that for every TV episode, gather more information about this episode from the internet.", @"Fetch TV Show Data description"), 
     97                                                                                                BRLocalizedString(@"tells Sapphire that for every Movie, gather more information from the internet.", @"Fetch Movie Data description"), 
     98/*                                                                                              BRLocalizedString(@"Choose Movie Posters", @"Start Poster Chooser description"),*/ 
     99                                                                                                BRLocalizedString(@"allows the user to specify which collections should be hidden from Sapphire's main menu.", @"Hide Collections description"), 
     100                                                                                                BRLocalizedString(@"allows to user to specify which collections should be skipped when importing meta data.", @"Don't Import Collections description"), 
     101                                                                                                BRLocalizedString(@"tells Sapphire that when changing filter settings, skip over the favorite shows filter.", @"Skip Favorite shows description"), 
     102/*                                                                                              BRLocalizedString(@"Skip \"Top Shows\" filter", @"Skip Top shows description"),*/ 
     103                                                                                                BRLocalizedString(@"tells Sapphire that when changing filter settings, skip over the unwatched shows filter.", @"Skip Unwatched shows description"),  
     104                                                                                                BRLocalizedString(@"tells Sapphire to disable the display of the show's synopsis.", @"Hide show summarys description"), 
     105                                                                                                BRLocalizedString(@"tells Sapphire to disable the display of audio codec and sample rate information.", @"Hide perian audio info description"), 
     106                                                                                                BRLocalizedString(@"tells Sapphire to disable the display of video codec, resolution, and color depth information.", @"Hide perian video info description"), 
     107                                                                                                BRLocalizedString(@"tells Sapphire to automatically choose posters for movies instead of asking the user to choose one.", @"Hide poster chooser description"), 
     108                                                                                                BRLocalizedString(@"tells Sapphire to hide the main menu element forcing frontrow to quit.", @"Hide the ui quitter description"), 
     109                                                                                                BRLocalizedString(@"tells Sapphire that when using a filter, use the cached data to setup directories rather than scanning the directories themselves for new files.", @"Fast Directory Switching description"), 
     110                                                                                                BRLocalizedString(@"tells Sapphire that you have an AC3 decoder and to enable passthrough of the full audio information to the decoder. This is how you get 5.1 output.", @"Enable AC3 Passthrough description"), 
     111                                                                                                BRLocalizedString(@"tells Sapphire to not report any anonymous information on how you use Sapphire. Anonymous reporting enables us to improve the plugin for future use.", @"Disable the anonymous reporting description"), nil]; 
     112                 
    93113        keys = [[NSArray alloc] initWithObjects:                @"", 
    94114                                                                                                        @"", 
     
    479499    // If subclassing BRMediaMenuController, this function is called when the selection cursor 
    480500    // passes over an item. 
     501        if(item >= [names count]) 
     502                return nil; 
     503        else 
     504        { 
     505                /* Get setting name & kill the gem cushion  */ 
     506                NSString *settingName = [[names objectAtIndex:item]substringFromIndex:2]; 
     507                NSString *settingDescription=[settingDescriptions objectAtIndex:item]; 
     508                /* Construct a gerneric metadata asset for display */ 
     509                NSMutableDictionary *settingMeta=[[NSMutableDictionary alloc] init]; 
     510                [settingMeta setObject:settingName forKey:META_TITLE_KEY]; 
     511                [settingMeta setObject:[NSNumber numberWithInt:FILE_CLASS_UTILITY] forKey:FILE_CLASS_KEY]; 
     512                [settingMeta setObject:settingDescription forKey:META_DESCRIPTION_KEY]; 
     513                SapphireMediaPreview *preview = [[SapphireMediaPreview alloc] initWithScene:[self scene]]; 
     514                [preview setUtilityData:settingMeta]; 
     515                [preview setShowsMetadataImmediately:YES]; 
     516                /*And go*/ 
     517                return [preview autorelease]; 
     518        } 
     519         
    481520    return ( nil ); 
    482521}