A couple more modifications, as well as some comments to ease others'
[MenuTunes.git] / MenuController.m
index 4317dec..6560821 100755 (executable)
@@ -7,8 +7,19 @@
 //
 
 #import "MenuController.h"
 //
 
 #import "MenuController.h"
-#import "NewMainController.h"
-#import "ITMTRemote.h"
+#import "MainController.h"
+#import <ITKit/ITHotKeyCenter.h>
+#import <ITKit/ITHotKey.h>
+#import <ITKit/ITKeyCombo.h>
+
+@interface MenuController (SubmenuMethods)
+- (NSMenu *)ratingMenu;
+- (NSMenu *)upcomingSongsMenu;
+- (NSMenu *)playlistsMenu;
+- (NSMenu *)eqMenu;
+- (void)setKeyEquivalentForCode:(short)code andModifiers:(long)modifiers
+        onItem:(NSMenuItem *)item;
+@end
 
 @implementation MenuController
 
 
 @implementation MenuController
 
 - (NSMenu *)menu
 {
     NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
 - (NSMenu *)menu
 {
     NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
-    NSArray *menuArray = [[NSUserDefaults standardUserDefaults] arrayForKey:@"menu"];
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    NSArray *menuArray = [defaults arrayForKey:@"menu"];
     NSEnumerator *enumerator = [menuArray objectEnumerator];
     NSString *nextObject;
     NSEnumerator *enumerator = [menuArray objectEnumerator];
     NSString *nextObject;
-    ITMTRemote *currentRemote = [[MainController sharedController] currentRemote];
     NSMenuItem *tempItem;
     NSMenuItem *tempItem;
+    NSEnumerator *itemEnum;
+    ITHotKey *hotKey;
+    NSArray *hotKeys = [[ITHotKeyCenter sharedCenter] allHotKeys];
+    
+    //Get the information
+    _currentPlaylist = [currentRemote currentPlaylistIndex];
+    _playingRadio = ([currentRemote currentPlaylistClass] == ITMTRemotePlayerRadioPlaylist);
+    
+    //Kill the old submenu items
+    if ( (tempItem = [_currentMenu itemWithTag:1]) ) {
+        [tempItem setSubmenu:nil];
+    }
     
     
-    //Get the current playlist, track index, etc.
-    int playlistIndex = [currentRemote currentPlaylistIndex];
-    //int trackIndex = [currentRemote currentSongIndex];
+    if ( (tempItem = [_currentMenu itemWithTag:2]) ) {
+        [tempItem setSubmenu:nil];
+    }
+    
+    if ( (tempItem = [_currentMenu itemWithTag:3]) ) {
+        [tempItem setSubmenu:nil];
+    }
+    
+    if ( (tempItem = [_currentMenu itemWithTag:4]) ) {
+        [tempItem setSubmenu:nil];
+    }
     
     //create our menu
     while ( (nextObject = [enumerator nextObject]) ) {
         //Main menu items
     
     //create our menu
     while ( (nextObject = [enumerator nextObject]) ) {
         //Main menu items
-        if ([nextObject isEqualToString:@"Play/Pause"]) {
-            tempItem = [menu addItemWithTitle:@"Play"
+        if ([nextObject isEqualToString:@"playPause"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"play", @"Play")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuPlayPauseItem];
             [tempItem setTarget:self];
             
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuPlayPauseItem];
             [tempItem setTarget:self];
             
+            itemEnum = [hotKeys objectEnumerator];
+            while ( (hotKey = [itemEnum nextObject]) ) {
+                if ([[hotKey name] isEqualToString:@"PlayPause"]) {
+                    ITKeyCombo *combo = [hotKey keyCombo];
+                    [self setKeyEquivalentForCode:[combo keyCode]
+                          andModifiers:[combo modifiers]
+                          onItem:tempItem];
+                }
+            }
+            
             switch ([currentRemote playerPlayingState]) {
                 case ITMTRemotePlayerPlaying:
             switch ([currentRemote playerPlayingState]) {
                 case ITMTRemotePlayerPlaying:
-                    [tempItem setTitle:@"Pause"];
+                    [tempItem setTitle:NSLocalizedString(@"pause", @"Pause")];
                 break;
                 case ITMTRemotePlayerRewinding:
                 case ITMTRemotePlayerForwarding:
                 break;
                 case ITMTRemotePlayerRewinding:
                 case ITMTRemotePlayerForwarding:
-                    [tempItem setTitle:@"Resume"];
+                    [tempItem setTitle:NSLocalizedString(@"resume", @"Resume")];
                 break;
                 default:
                 break;
             }
                 break;
                 default:
                 break;
             }
-        } else if ([nextObject isEqualToString:@"Next Track"]) {
-            tempItem = [menu addItemWithTitle:@"Next Track"
+        } else if ([nextObject isEqualToString:@"nextTrack"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"nextTrack", @"Next Track")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
-            if (playlistIndex) {
+            
+            itemEnum = [hotKeys objectEnumerator];
+            while ( (hotKey = [itemEnum nextObject]) ) {
+                if ([[hotKey name] isEqualToString:@"NextTrack"]) {
+                    ITKeyCombo *combo = [hotKey keyCombo];
+                    [self setKeyEquivalentForCode:[combo keyCode]
+                          andModifiers:[combo modifiers]
+                          onItem:tempItem];
+                }
+            }
+            
+            if (_currentPlaylist) {
                 [tempItem setTag:MTMenuNextTrackItem];
                 [tempItem setTarget:self];
             }
                 [tempItem setTag:MTMenuNextTrackItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Previous Track"]) {
-            tempItem = [menu addItemWithTitle:@"Previous Track"
+        } else if ([nextObject isEqualToString:@"prevTrack"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"prevTrack", @"Previous Track")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
-            if (playlistIndex) {
+            
+            itemEnum = [hotKeys objectEnumerator];
+            while ( (hotKey = [itemEnum nextObject]) ) {
+                if ([[hotKey name] isEqualToString:@"PrevTrack"]) {
+                    ITKeyCombo *combo = [hotKey keyCombo];
+                    [self setKeyEquivalentForCode:[combo keyCode]
+                          andModifiers:[combo modifiers]
+                          onItem:tempItem];
+                }
+            }
+            
+            if (_currentPlaylist) {
                 [tempItem setTag:MTMenuPreviousTrackItem];
                 [tempItem setTarget:self];
             }
                 [tempItem setTag:MTMenuPreviousTrackItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Fast Forward"]) {
-            tempItem = [menu addItemWithTitle:@"Fast Forward"
+        } else if ([nextObject isEqualToString:@"fastForward"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"fastForward", @"Fast Forward")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
-            if (playlistIndex) {
+            if (_currentPlaylist) {
                 [tempItem setTag:MTMenuFastForwardItem];
                 [tempItem setTarget:self];
             }
                 [tempItem setTag:MTMenuFastForwardItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Rewind"]) {
-            tempItem = [menu addItemWithTitle:@"Rewind"
+        } else if ([nextObject isEqualToString:@"rewind"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"rewind", @"Rewind")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
-            if (playlistIndex) {
+            if (_currentPlaylist) {
                 [tempItem setTag:MTMenuRewindItem];
                 [tempItem setTarget:self];
             }
                 [tempItem setTag:MTMenuRewindItem];
                 [tempItem setTarget:self];
             }
-        } else if ([nextObject isEqualToString:@"Preferences"]) {
-            tempItem = [menu addItemWithTitle:@"Preferences..."
+        } else if ([nextObject isEqualToString:@"showPlayer"]) {
+            tempItem = [menu addItemWithTitle:[NSString stringWithFormat:@"%@ %@",
+                            NSLocalizedString(@"show", @"Show"),
+                            [[[MainController sharedController] currentRemote] playerSimpleName]]
+                    action:@selector(performMainMenuAction:)
+                    keyEquivalent:@""];
+            
+            itemEnum = [hotKeys objectEnumerator];
+            while ( (hotKey = [itemEnum nextObject]) ) {
+                if ([[hotKey name] isEqualToString:@"ShowPlayer"]) {
+                    ITKeyCombo *combo = [hotKey keyCombo];
+                    [self setKeyEquivalentForCode:[combo keyCode]
+                          andModifiers:[combo modifiers]
+                          onItem:tempItem];
+                }
+            }
+            
+            [tempItem setTarget:self];
+            [tempItem setTag:MTMenuShowPlayerItem];
+        } else if ([nextObject isEqualToString:@"preferences"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"preferences", @"Preferences...")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuPreferencesItem];
             [tempItem setTarget:self];
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuPreferencesItem];
             [tempItem setTarget:self];
-        } else if ([nextObject isEqualToString:@"Quit"]) {
-            tempItem = [menu addItemWithTitle:@"Quit"
+        } else if ([nextObject isEqualToString:@"quit"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"quit", @"Quit")
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuQuitItem];
             [tempItem setTarget:self];
                     action:@selector(performMainMenuAction:)
                     keyEquivalent:@""];
             [tempItem setTag:MTMenuQuitItem];
             [tempItem setTarget:self];
-        } else if ([nextObject isEqualToString:@"Current Track Info"]) {
-            if (playlistIndex) {
+        } else if ([nextObject isEqualToString:@"trackInfo"]) {
+            //Handle playing radio too
+            if (_currentPlaylist) {
                 NSString *title = [currentRemote currentSongTitle];
                 
                 NSString *title = [currentRemote currentSongTitle];
                 
-                [menu addItemWithTitle:@"Now Playing" action:NULL keyEquivalent:@""];
+                [menu addItemWithTitle:NSLocalizedString(@"nowPlaying", @"Now Playing") action:NULL keyEquivalent:@""];
                 
                 if ([title length] > 0) {
                 
                 if ([title length] > 0) {
-                    [menu addItemWithTitle:[NSString stringWithFormat:@"        %@", title] action:nil keyEquivalent:@""];
+                    [menu addItemWithTitle:[NSString stringWithFormat:@"        %@", title]
+                            action:nil
+                            keyEquivalent:@""];
+                }
+                
+                if ([defaults boolForKey:@"showAlbum"]) {
+                    NSString *curAlbum = [currentRemote currentSongAlbum];
+                    if ([curAlbum length]) {
+                        [menu addItemWithTitle:[NSString stringWithFormat:@"    %@", curAlbum]
+                                action:nil
+                                keyEquivalent:@""];
+                    }
+                }
+                
+                if ([defaults boolForKey:@"showArtist"]) {
+                    NSString *curArtist = [currentRemote currentSongArtist];
+                    if ([curArtist length]) {
+                        [menu addItemWithTitle:[NSString stringWithFormat:@"    %@", curArtist]
+                                action:nil
+                                keyEquivalent:@""];
+                    }
+                }
+                
+                if ([defaults boolForKey:@"showTrackNumber"]) {
+                    int track = [currentRemote currentSongTrack];
+                    if (track) {
+                        [menu addItemWithTitle:[NSString stringWithFormat:@"    %@ %i", NSLocalizedString(@"track", @"Track"), track]
+                            action:nil
+                            keyEquivalent:@""];
+                    }
+                }
+                
+                if ([defaults boolForKey:@"showTime"]) {
+                    int left = [[currentRemote currentSongRemaining] intValue];
+                    NSString *remaining = [NSString stringWithFormat:@"%i:%02i", left / 60, left % 60];
+                    [menu addItemWithTitle:[NSString stringWithFormat:@"        %@/%@", remaining, [currentRemote currentSongLength]]
+                            action:nil
+                            keyEquivalent:@""];
                 }
             } else {
                 }
             } else {
-                [menu addItemWithTitle:@"No Song" action:NULL keyEquivalent:@""];
+                [menu addItemWithTitle:NSLocalizedString(@"noSong", @"No Song") action:NULL keyEquivalent:@""];
             }
             }
-        } else if ([nextObject isEqualToString:@"<separator>"]) {
+        } else if ([nextObject isEqualToString:@"separator"]) {
             [menu addItem:[NSMenuItem separatorItem]];
         //Submenu items
             [menu addItem:[NSMenuItem separatorItem]];
         //Submenu items
-        } else if ([nextObject isEqualToString:@"Song Rating"]) {
-            tempItem = [menu addItemWithTitle:@"Song Rating"
+        } else if ([nextObject isEqualToString:@"songRating"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"songRating", @"Song Rating")
                     action:nil
                     keyEquivalent:@""];
                     action:nil
                     keyEquivalent:@""];
-            //[tempItem setSubmenu:[self ratingMenu]];
-        } else if ([nextObject isEqualToString:@"Upcoming Songs"]) {
-            tempItem = [menu addItemWithTitle:@"Upcoming Songs"
+            [tempItem setSubmenu:_ratingMenu];
+            [tempItem setTag:1];
+            if (_playingRadio || !_currentPlaylist) {
+                [tempItem setEnabled:NO];
+            }
+            
+            itemEnum = [[_ratingMenu itemArray] objectEnumerator];
+            while ( (tempItem = [itemEnum nextObject]) ) {
+                [tempItem setState:NSOffState];
+            }
+            
+            [[_ratingMenu itemAtIndex:([currentRemote currentSongRating] * 5)] setState:NSOnState];
+        } else if ([nextObject isEqualToString:@"upcomingSongs"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"upcomingSongs", @"Upcoming Songs")
                     action:nil
                     keyEquivalent:@""];
                     action:nil
                     keyEquivalent:@""];
-            //[tempItem setSubmenu:[self upcomingSongsMenu]];
-        } else if ([nextObject isEqualToString:@"Playlists"]) {
-            tempItem = [menu addItemWithTitle:@"Playlists"
+            [tempItem setSubmenu:_upcomingSongsMenu];
+            [tempItem setTag:2];
+            if (_playingRadio || !_currentPlaylist) {
+                [tempItem setEnabled:NO];
+            }
+        } else if ([nextObject isEqualToString:@"playlists"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"playlists", @"Playlists")
                     action:nil
                     keyEquivalent:@""];
                     action:nil
                     keyEquivalent:@""];
-            //[tempItem setSubmenu:[self playlistsMenu]];
-        } else if ([nextObject isEqualToString:@"EQ Presets"]) {
-            tempItem = [menu addItemWithTitle:@"EQ Presets"
+            [tempItem setSubmenu:_playlistsMenu];
+            [tempItem setTag:3];
+        } else if ([nextObject isEqualToString:@"eqPresets"]) {
+            tempItem = [menu addItemWithTitle:NSLocalizedString(@"eqPresets", @"EQ Presets")
                     action:nil
                     keyEquivalent:@""];
                     action:nil
                     keyEquivalent:@""];
-            //[tempItem setSubmenu:[self eqMenu]];
+            [tempItem setSubmenu:_eqMenu];
+            [tempItem setTag:4];
+            
+            itemEnum = [[_eqMenu itemArray] objectEnumerator];
+            while ( (tempItem = [itemEnum nextObject]) ) {
+                [tempItem setState:NSOffState];
+            }
+            [[_eqMenu itemAtIndex:([currentRemote currentEQPresetIndex] - 1)] setState:NSOnState];
         }
     }
         }
     }
-    
     [_currentMenu release];
     _currentMenu = menu;
     return _currentMenu;
     [_currentMenu release];
     _currentMenu = menu;
     return _currentMenu;
 {
     NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
     NSMenuItem *tempItem;
 {
     NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
     NSMenuItem *tempItem;
-    [menu addItemWithTitle:[NSString stringWithFormat:@"Open %@", [[[MainController sharedController] currentRemote] playerSimpleName]] action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    tempItem = [menu addItemWithTitle:[NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"open", @"Open"), [[[MainController sharedController] currentRemote] playerSimpleName]] action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    [tempItem setTag:MTMenuShowPlayerItem];
+    [tempItem setTarget:self];
     [menu addItem:[NSMenuItem separatorItem]];
     [menu addItem:[NSMenuItem separatorItem]];
-    tempItem = [menu addItemWithTitle:@"Preferences" action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    tempItem = [menu addItemWithTitle:NSLocalizedString(@"preferences", @"Preferences...") action:@selector(performMainMenuAction:) keyEquivalent:@""];
     [tempItem setTag:MTMenuPreferencesItem];
     [tempItem setTarget:self];
     [tempItem setTag:MTMenuPreferencesItem];
     [tempItem setTarget:self];
-    tempItem = [menu addItemWithTitle:@"Quit" action:@selector(performMainMenuAction:) keyEquivalent:@""];
+    tempItem = [menu addItemWithTitle:NSLocalizedString(@"quit", @"Quit") action:@selector(performMainMenuAction:) keyEquivalent:@""];
     [tempItem setTag:MTMenuQuitItem];
     [tempItem setTarget:self];
     return [menu autorelease];
 }
 
     [tempItem setTag:MTMenuQuitItem];
     [tempItem setTarget:self];
     return [menu autorelease];
 }
 
+- (void)rebuildSubmenus
+{
+    currentRemote = [[MainController sharedController] currentRemote];
+    _currentPlaylist = [currentRemote currentPlaylistIndex];
+    _currentTrack = [currentRemote currentSongIndex];
+    _playingRadio = ([currentRemote currentPlaylistClass] == ITMTRemotePlayerRadioPlaylist);
+    
+    [_ratingMenu release];
+    [_upcomingSongsMenu release];
+    [_playlistsMenu release];
+    [_eqMenu release];
+    _ratingMenu = [self ratingMenu];
+    _upcomingSongsMenu = [self upcomingSongsMenu];
+    _playlistsMenu = [self playlistsMenu];
+    _eqMenu = [self eqMenu];
+}
+
+- (NSMenu *)ratingMenu
+{
+    NSMenu *ratingMenu = [[NSMenu alloc] initWithTitle:@""];
+    NSEnumerator *itemEnum;
+    id  anItem;
+    int itemTag = 0;
+    SEL itemSelector = @selector(performRatingMenuAction:);
+    
+    [ratingMenu addItemWithTitle:[NSString stringWithUTF8String:"☆☆☆☆☆"] action:nil keyEquivalent:@""];
+    [ratingMenu addItemWithTitle:[NSString stringWithUTF8String:"★☆☆☆☆"] action:nil keyEquivalent:@""];
+    [ratingMenu addItemWithTitle:[NSString stringWithUTF8String:"★★☆☆☆"] action:nil keyEquivalent:@""];
+    [ratingMenu addItemWithTitle:[NSString stringWithUTF8String:"★★★☆☆"] action:nil keyEquivalent:@""];
+    [ratingMenu addItemWithTitle:[NSString stringWithUTF8String:"★★★★☆"] action:nil keyEquivalent:@""];
+    [ratingMenu addItemWithTitle:[NSString stringWithUTF8String:"★★★★★"] action:nil keyEquivalent:@""];
+    
+    itemEnum = [[ratingMenu itemArray] objectEnumerator];
+    while ( (anItem = [itemEnum nextObject]) ) {
+        [anItem setAction:itemSelector];
+        [anItem setTarget:self];
+        [anItem setTag:itemTag];
+        itemTag += 20;
+    }
+    return ratingMenu;
+}
+
+- (NSMenu *)upcomingSongsMenu
+{
+    NSMenu *upcomingSongsMenu = [[NSMenu alloc] initWithTitle:@""];
+    int numSongs = [currentRemote numberOfSongsInPlaylistAtIndex:_currentPlaylist];
+    int numSongsInAdvance = [[NSUserDefaults standardUserDefaults] integerForKey:@"SongsInAdvance"];
+    
+    if (_currentPlaylist && !_playingRadio) {
+        if (numSongs > 0) {
+            int i;
+            
+            for (i = _currentTrack + 1; i <= _currentTrack + numSongsInAdvance; i++) {
+                if (i <= numSongs) {
+                    NSString *curSong = [currentRemote songTitleAtIndex:i];
+                    NSMenuItem *songItem;
+                    songItem = [upcomingSongsMenu addItemWithTitle:curSong action:@selector(performUpcomingSongsMenuAction:) keyEquivalent:@""];
+                    [songItem setTag:i];
+                    [songItem setTarget:self];
+                } else {
+                    break;
+                }
+            }
+        }
+    }
+    return upcomingSongsMenu;
+}
+
+- (NSMenu *)playlistsMenu
+{
+    NSMenu *playlistsMenu = [[NSMenu alloc] initWithTitle:@""];
+    NSArray *playlists = [currentRemote playlists];
+    NSMenuItem *tempItem;
+    int i;
+    
+    for (i = 0; i < [playlists count]; i++) {
+        tempItem = [playlistsMenu addItemWithTitle:[playlists objectAtIndex:i] action:@selector(performPlaylistMenuAction:) keyEquivalent:@""];
+        [tempItem setTag:i + 1];
+        [tempItem setTarget:self];
+    }
+    
+    if (!_playingRadio && _currentPlaylist) {
+        [[playlistsMenu itemAtIndex:_currentPlaylist - 1] setState:NSOnState];
+    }
+    return playlistsMenu;
+}
+
+- (NSMenu *)eqMenu
+{
+    NSMenu *eqMenu = [[NSMenu alloc] initWithTitle:@""];
+    NSArray *eqPresets = [currentRemote eqPresets];
+    NSMenuItem *tempItem;
+    int i;
+    
+    for (i = 0; i < [eqPresets count]; i++) {
+        NSString *name;
+       if ( ( name = [eqPresets objectAtIndex:i] ) ) {
+            tempItem = [eqMenu addItemWithTitle:name action:@selector(performEqualizerMenuAction:) keyEquivalent:@""];
+            [tempItem setTag:i];
+            [tempItem setTarget:self];
+       }
+    }
+    return eqMenu;
+}
+
 - (void)performMainMenuAction:(id)sender
 {
     switch ( [sender tag] )
 - (void)performMainMenuAction:(id)sender
 {
     switch ( [sender tag] )
         case MTMenuPlayPauseItem:
             NSLog(@"MenuController: Play/Pause");
             [[MainController sharedController] playPause];
         case MTMenuPlayPauseItem:
             NSLog(@"MenuController: Play/Pause");
             [[MainController sharedController] playPause];
-            //We're gonna have to change the Play menu item to Pause here too.
             break;
         case MTMenuFastForwardItem:
             NSLog(@"MenuController: Fast Forward");
             [[MainController sharedController] fastForward];
             break;
         case MTMenuFastForwardItem:
             NSLog(@"MenuController: Fast Forward");
             [[MainController sharedController] fastForward];
-            //make sure play/pause item says sane through this
             break;
         case MTMenuRewindItem:
             NSLog(@"MenuController: Rewind");
             [[MainController sharedController] rewind];
             break;
         case MTMenuRewindItem:
             NSLog(@"MenuController: Rewind");
             [[MainController sharedController] rewind];
-            //make sure play/pause item says sane through this
             break;
         case MTMenuPreviousTrackItem:
             NSLog(@"MenuController: Previous Track");
             break;
         case MTMenuPreviousTrackItem:
             NSLog(@"MenuController: Previous Track");
             NSLog(@"MenuController: Next Track");
             [[MainController sharedController] nextSong];
             break;
             NSLog(@"MenuController: Next Track");
             [[MainController sharedController] nextSong];
             break;
+        case MTMenuShowPlayerItem:
+            NSLog(@"MainController: Show Main Interface");
+            [[MainController sharedController] showPlayer];
+            break;
         case MTMenuPreferencesItem:
             NSLog(@"MenuController: Preferences...");
             [[MainController sharedController] showPreferences];
         case MTMenuPreferencesItem:
             NSLog(@"MenuController: Preferences...");
             [[MainController sharedController] showPreferences];
     }
 }
 
     }
 }
 
-@end
+@end
\ No newline at end of file