From: Matthew Judy Date: Wed, 5 Feb 2003 13:46:06 +0000 (+0000) Subject: Checking in MenuTunes changes and adding plugin loading for Kent. Also requires... X-Git-Tag: v1.0~245 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/31ab86a87f78edfdd32810db1ff708ca8f5eaaca Checking in MenuTunes changes and adding plugin loading for Kent. Also requires changes made to the ITKit and ITFoundation frameworks. Be sure to update those as well before attempting to build. --- diff --git a/ITMTRemote.h b/ITMTRemote.h index 3e8c9bd..3d2015f 100755 --- a/ITMTRemote.h +++ b/ITMTRemote.h @@ -32,8 +32,9 @@ * @abstract Declares what a MenuTunes Remote must be able to do. * @discussion A MenuTunes Remote must be able to return and change state information. */ - @protocol ITMTRemote + + /*! @method remote * @abstract Returns an autoreleased instance of the remote. * @discussion Should be very quick and compact. @@ -56,7 +57,7 @@ * @abstract Returns a description of the remote. * @result An NSString containing the description. */ -- (NSString *)description; +- (NSString *)information; /*! @method icon: * @abstract Returns a icon for the remote. diff --git a/ITMTRemote.m b/ITMTRemote.m index 9baf3f2..f232224 100755 --- a/ITMTRemote.m +++ b/ITMTRemote.m @@ -13,7 +13,7 @@ return nil; } -- (NSString *)description +- (NSString *)information; { return nil; } @@ -23,18 +23,42 @@ return nil; } +- (BOOL)begin +{ + return NO; +} + +- (BOOL)halt +{ + return NO; +} + - (NSArray *)sources { return nil; } +- (int)currentSourceIndex +{ + return nil; +} + - (NSArray *)playlistsForCurrentSource { return nil; } +- (int)currentPlaylistIndex +{ + return nil; +} + +- (NSString *)songTitleAtIndex +{ + return nil; +} -- (NSArray *)songsForCurrentPlaylist +- (int)currentSongIndex { return nil; } diff --git a/MenuTunes.h b/MenuTunes.h index cde1eff..16e773e 100755 --- a/MenuTunes.h +++ b/MenuTunes.h @@ -15,6 +15,9 @@ #import #import #import +#import +#import + //@class MenuTunesView; @class PreferencesController, StatusWindowController; @@ -24,6 +27,8 @@ ITStatusItem *statusItem; NSMenu *menu; ComponentInstance asComponent; + ITMTRemote *currentRemote; + NSMutableArray *remoteArray; //Used in updating the menu automatically NSTimer *refreshTimer; diff --git a/MenuTunes.m b/MenuTunes.m index aa4296c..e8736fa 100755 --- a/MenuTunes.m +++ b/MenuTunes.m @@ -13,6 +13,7 @@ Things to do: #import "StatusWindowController.h" @interface MenuTunes(Private) +- (ITMTRemote *)loadRemote; - (void)updateMenu; - (void)rebuildUpcomingSongsMenu; - (void)rebuildPlaylistMenu; @@ -33,8 +34,17 @@ Things to do: #pragma mark INITIALIZATION METHODS /*************************************************************************/ +- (id)init +{ + if ( ( self = [super init] ) ) { + remoteArray = [[NSMutableArray alloc] initWithCapacity:1]; + } + return self; +} + - (void)applicationDidFinishLaunching:(NSNotification *)note { + currentRemote = [self loadRemote]; asComponent = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype); [self registerDefaultsIfNeeded]; @@ -71,6 +81,41 @@ Things to do: // [statusItem setToolTip:@[NSString stringWithFormat:@"This Nontransferable Beta (Built on %s) of iThink Software's MenuTunes is Registered to: Beta Tester (betatester@somedomain.com).",__DATE__]]; } +- (ITMTRemote *)loadRemote +{ + NSString *folderPath = [[NSBundle mainBundle] builtInPlugInsPath]; + + if (folderPath) { + NSArray *bundlePathList = [NSBundle pathsForResourcesOfType:@"remote" inDirectory:folderPath]; + NSEnumerator *enumerator = [bundlePathList objectEnumerator]; + NSString *bundlePath; + + while ( (bundlePath = [enumerator nextObject]) ) { + NSBundle* remoteBundle = [NSBundle bundleWithPath:bundlePath]; + + if (remoteBundle) { + Class remoteClass = [remoteBundle principalClass]; + + if ([remoteClass conformsToProtocol:@protocol(ITMTRemote)] && + [remoteClass isKindOfClass:[NSObject class]]) { + + id remote = [remoteClass remote]; + [remoteArray addObject:remote]; + } + } + } + +// if ( [remoteArray count] > 0 ) { +// if ( [remoteArray count] > 1 ) { +// [remoteArray sortUsingSelector:@selector(sortAlpha:)]; +// } +// [self loadModuleAccessUI]; //Comment out this line to disable remote visibility +// } + } + NSLog(@"%@", [remoteArray objectAtIndex:0]); + return [remoteArray objectAtIndex:0]; +} + /*************************************************************************/ #pragma mark - diff --git a/iTunesRemote.m b/iTunesRemote.m index 2773358..36a38db 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -3,5 +3,149 @@ @implementation iTunesRemote ++ (id)remote +{ + return [[[iTunesRemote alloc] init] autorelease]; +} + +- (NSString *)title +{ + return nil; +} + +- (NSString *)information; +{ + return nil; +} + +- (NSImage *)icon +{ + return nil; +} + +- (BOOL)begin +{ + return NO; +} + +- (BOOL)halt +{ + return NO; +} + +- (NSArray *)sources +{ + return nil; +} + +- (int)currentSourceIndex +{ + return nil; +} + +- (NSArray *)playlistsForCurrentSource +{ + return nil; +} + +- (int)currentPlaylistIndex +{ + return nil; +} + +- (NSString *)songTitleAtIndex +{ + return nil; +} + +- (int)currentSongIndex +{ + return nil; +} + +- (NSString *)currentSongTitle +{ + return nil; +} + +- (NSString *)currentSongArtist +{ + return nil; +} + +- (NSString *)currentSongAlbum +{ + return nil; +} + +- (NSString *)currentSongGenre +{ + return nil; +} + +- (NSString *)currentSongLength +{ + return nil; +} + +- (NSString *)currentSongRemaining +{ + return nil; +} + +- (NSArray *)eqPresets; +{ + return nil; +} + +- (BOOL)play +{ + return NO; +} + +- (BOOL)pause +{ + return NO; +} + +- (BOOL)goToNextSong +{ + return NO; +} + +- (BOOL)goToPreviousSong +{ + return NO; +} + +- (BOOL)goToNextPlaylist +{ + return NO; +} + +- (BOOL)goToPreviousPlaylist +{ + return NO; +} + +- (BOOL)switchToSourceAtIndex:(int)index +{ + return NO; +} + +- (BOOL)switchToPlaylistAtIndex:(int)index +{ + return NO; +} + +- (BOOL)switchToSongAtIndex:(int)index +{ + return NO; +} + +- (BOOL)switchToEQAtIndex:(int)index +{ + return NO; +} @end