* @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.
* @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.
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;
}
#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;
ITStatusItem *statusItem;
NSMenu *menu;
ComponentInstance asComponent;
+ ITMTRemote *currentRemote;
+ NSMutableArray *remoteArray;
//Used in updating the menu automatically
NSTimer *refreshTimer;
#import "StatusWindowController.h"
@interface MenuTunes(Private)
+- (ITMTRemote *)loadRemote;
- (void)updateMenu;
- (void)rebuildUpcomingSongsMenu;
- (void)rebuildPlaylistMenu;
#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];
// [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 -
@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