Checking in MenuTunes changes and adding plugin loading for Kent. Also requires...
authorMatthew Judy <mjudy@ithinksw.com>
Wed, 5 Feb 2003 13:46:06 +0000 (13:46 +0000)
committerMatthew Judy <mjudy@ithinksw.com>
Wed, 5 Feb 2003 13:46:06 +0000 (13:46 +0000)
ITMTRemote.h
ITMTRemote.m
MenuTunes.h
MenuTunes.m
iTunesRemote.m

index 3e8c9bd..3d2015f 100755 (executable)
@@ -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.
index 9baf3f2..f232224 100755 (executable)
@@ -13,7 +13,7 @@
     return nil;
 }
 
-- (NSString *)description
+- (NSString *)information;
 {
     return nil;
 }
     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;
 }
index cde1eff..16e773e 100755 (executable)
@@ -15,6 +15,9 @@
 #import <Cocoa/Cocoa.h>
 #import <Carbon/Carbon.h>
 #import <ITKit/ITKit.h>
+#import <ITFoundation/ITFoundation.h>
+#import <ITMTRemote/ITMTRemote.h>
+
 
 //@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;
index aa4296c..e8736fa 100755 (executable)
@@ -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 -
index 2773358..36a38db 100755 (executable)
@@ -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