Plugin API changes
authorJoseph Spiros <joseph.spiros@ithinksw.com>
Tue, 11 Mar 2003 00:24:43 +0000 (00:24 +0000)
committerJoseph Spiros <joseph.spiros@ithinksw.com>
Tue, 11 Mar 2003 00:24:43 +0000 (00:24 +0000)
ITMTRemote.h
ITMTRemote.m
MenuTunes.h
MenuTunes.m
iTunesRemote.m

index 693d908..dd6ca6b 100755 (executable)
 #import <Cocoa/Cocoa.h>
 
 typedef enum {
-    stopped = -1,
-    paused,
-    playing,
-    rewinding,
-    forwarding
+    ITMTRemotePlayerNotRunning = -1,
+    ITMTRemotePlayerLaunching,
+    ITMTRemotePlayerRunning
+} ITMTRemotePlayerRunningStatus;
+
+typedef enum {
+    ITMTRemotePlayerStopped = -1,
+    ITMTRemotePlayerPaused,
+    ITMTRemotePlayerPlaying,
+    ITMTRemotePlayerRewinding,
+    ITMTRemotePlayerForwarding
 } ITMTRemotePlayerState;
 
 /*! @protocol ITMTRemote
@@ -55,23 +61,23 @@ typedef enum {
  */
 + (id)remote;
 
-/*! @method title:
+/*! @method pluginTitle:
  *  @abstract Returns the title of the plugin, which should be player name.
  *  @result An NSString containing the title.
  */
-- (NSString *)title;
+- (NSString *)pluginTitle;
 
-/*! @method description:
+/*! @method pluginInformation:
  *  @abstract Returns a description of the remote.
  *  @result An NSString containing the description.
  */
-- (NSString *)information;
+- (NSString *)pluginInformation;
 
-/*! @method icon:
+/*! @method pluginIcon:
  *  @abstract Returns a icon for the remote.
  *  @result An NSImage containing the icon.
  */
-- (NSImage *)icon;
+- (NSImage *)pluginIcon;
 
 /*! @method begin:
  *  @abstract Sent when the plugin should begin operation.
@@ -85,11 +91,15 @@ typedef enum {
  */
 - (BOOL)halt;
 
-/*! @method isAppRunning:
+- (NSString *)playerFullName;
+
+- (NSString *)playerSimpleName;
+
+/*! @method playerRunningStatus:
  *  @abstract Returns controlled application's running status (is or isn't running).
  *  @result BOOL of the controlled application's running status.
  */
-- (BOOL)isAppRunning;
+- (ITMTRemotePlayerRunningStatus)playerRunningStatus;
 
 /*! @method playerState:
  *  @abstract Returns controlled application's playing state.
@@ -125,7 +135,7 @@ typedef enum {
 - (BOOL)pause;
 - (BOOL)goToNextSong;
 - (BOOL)goToPreviousSong;
-- (BOOL)fastForward;
+- (BOOL)forward;
 - (BOOL)rewind;
 
 - (BOOL)switchToPlaylistAtIndex:(int)index;
index 78922f4..c003989 100755 (executable)
     return NO;
 }
 
-- (BOOL)isAppRunning
+- (ITMTRemotePlayerRunningStatus)playerRunningStatus
 {
-    return NO;
+    return ITMTRemotePlayerNotRunning;
 }
 
 - (ITMTRemotePlayerState)playerState
 {
-    return stopped;
+    return ITMTRemotePlayerStopped;
 }
 
 - (NSArray *)playlists
index 92aade2..69791b9 100755 (executable)
@@ -36,7 +36,7 @@
     int      lastPlaylistIndex;
     BOOL     isPlayingRadio;
     
-    BOOL isAppRunning;
+    ITMTRemotePlayerRunningStatus isAppRunning;
     BOOL didHaveAlbumName;
     BOOL didHaveArtistName; //Helper variable for creating the menu
     
index 2f3b083..9115c10 100755 (executable)
@@ -44,7 +44,7 @@
     
     menu = [[NSMenu alloc] initWithTitle:@""];
     
-    if ([currentRemote isAppRunning]) {
+    if ( ( [currentRemote remotePlayerStatus] == ITMTRemotePlayerRunning ) ) {
         [self remotePlayerLaunched:nil];
     } else {
         [self remotePlayerTerminated:nil];
     NSMenuItem *menuItem;
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     
-    if (!isAppRunning) {
+    if ( ( isAppRunning = ITMTRemotePlayerNotRunning ) ) {
         return;
     }
     
 
 - (void)remotePlayerLaunched:(NSNotification *)note
 {
-    isAppRunning = YES;
+    isAppRunning = ITMTRemotePlayerRunning;
     
     //Restart the timer
     refreshTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES]; 
 
 - (void)remotePlayerTerminated:(NSNotification *)note
 {
-    isAppRunning = NO;
+    isAppRunning = ITMTRemotePlayerNotRunning;
     
     [menu release];
     menu = [[NSMenu alloc] initWithTitle:@""];
 
 - (void)closePreferences
 {
-    if (isAppRunning) {
+    if ( ( isAppRunning == ITMTRemotePlayerRunning) ) {
         [self setupHotKeys];
     }
     [prefsController release];
index e479c63..d50d55d 100755 (executable)
@@ -43,7 +43,7 @@
     return YES;
 }
 
-- (BOOL)isAppRunning
+- (ITMTRemotePlayerRunningStatus)playerRunningStatus
 {
     NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];
     int i;
     for (i = 0; i < count; i++) {
         if ([[[apps objectAtIndex:i] objectForKey:@"NSApplicationName"]
                 isEqualToString:@"iTunes"]) {
-            return YES;
+            return ITMTRemotePlayerRunning;
         }
     }
-    return NO;
+    return ITMTRemotePlayerNotRunning;
 }
 
 - (ITMTRemotePlayerState)playerState
     {
         default:
         case 'kPSS':
-            return stopped;
+            return ITMTRemotePlayerStopped;
         case 'kPSP':
-            return playing;
+            return ITMTRemotePlayerPlaying;
         case 'kPSp':
-            return paused;
+            return ITMTRemotePlayerPaused;
         case 'kPSR':
-            return rewinding;
+            return ITMTRemotePlayerRewinding;
         case 'kPSF':
-            return forwarding;
+            return ITMTRemotePlayerForwarding;
     }
     
     return stopped;