source: trunk/SapphireAppliance.m @ 252

Revision 252, 2.4 KB checked in by pmerrill, 6 years ago (diff)
  • Added a media preview for movie specific metadata.
  • Code cleanup.


Line 
1//
2//  SapphireAppliance.m
3//  Sapphire
4//
5//  Created by pnmerrill on 6/20/07.
6//  Copyright 2007 www.nanopi.net. All rights reserved.
7//
8
9
10#import "SapphireAppliance.h"
11#import "SapphireApplianceController.h"
12#import <BackRow/BackRow.h>
13#import <objc/objc-class.h>
14
15#import "BackRowUtils.h"
16
17@implementation SapphireAppliance
18
19+ (void) initialize
20{
21    Class cls = NSClassFromString( @"BRFeatureManager" );
22    if ( cls == Nil )
23        return;
24       
25    [[cls sharedInstance] enableFeatureNamed: [[NSBundle bundleForClass: self] bundleIdentifier]];
26}
27
28+ (NSString *) className
29{
30    // get around the whitelist
31   
32    // this function will get the real class name from the runtime, and
33    // will assuredly not recurse back to here
34    NSString * className = NSStringFromClass( self );
35   
36    // BackRow has its own exception class which provides backtrace
37    // helpers. It returns a parsed trace, with function names. We'll
38    // look for the name of the function which is known to call this
39    // function to check against the whitelist, and if we find it we'll
40    // lie about our name, purely to escape that check.
41    // Also, the backtracer method is a class routine, meaning that we
42    // don't have to even generate an exception - woohoo!
43    NSRange range = [[BRBacktracingException backtrace] rangeOfString: @"_loadApplianceInfoAtPath:"];
44    if ( range.location != NSNotFound )
45    {
46        // this is the whitelist check -- tell a Great Big Fib
47        BRLog( @"[%@ className] called for whitelist check; returning RUICalibrationAppliance instead",
48               className );
49        className = @"RUIMoviesAppliance";     // could be anything in the whitelist, really
50    }
51   
52    return ( className );
53}
54
55- (NSString *) moduleIconName
56{
57    // replace this with your own icon name
58    return ( @"SapphireIcon.png" );
59}
60
61- (NSString *) moduleName
62{
63    // this doesn't appear to be actually *used*, but even so:
64    return ( BRLocalizedString(@"Sapphire", @"Main Menu item name") );
65}
66
67+ (NSString *) moduleKey
68{
69    // change this to match your CFBundleIdentifier
70    return ( @"Nanopi.net.UCIJoker.Sapphire" );
71}
72
73- (NSString *) moduleKey
74{
75    return ( [SapphireAppliance moduleKey] );
76}
77
78- (BRLayerController *) applianceControllerWithScene: (BRRenderScene *) scene
79{
80    // this function is called when your item is selected on the main menu
81    return ( [[[SapphireApplianceController alloc] initWithScene: scene] autorelease] );
82}
83
84@end
Note: See TracBrowser for help on using the repository browser.