X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/f16e2f1f2b4778b4bc890162fa9cd31d7dd79b54..081a5fa6db149252a499575da751c45f340312bd:/MenuController.m?ds=sidebyside diff --git a/MenuController.m b/MenuController.m index 7c0f307..6560821 100755 --- a/MenuController.m +++ b/MenuController.m @@ -9,6 +9,7 @@ #import "MenuController.h" #import "MainController.h" #import +#import #import @interface MenuController (SubmenuMethods) @@ -39,7 +40,8 @@ NSString *nextObject; NSMenuItem *tempItem; NSEnumerator *itemEnum; - ITKeyCombo *keyCombo; + ITHotKey *hotKey; + NSArray *hotKeys = [[ITHotKeyCenter sharedCenter] allHotKeys]; //Get the information _currentPlaylist = [currentRemote currentPlaylistIndex]; @@ -72,11 +74,15 @@ [tempItem setTag:MTMenuPlayPauseItem]; [tempItem setTarget:self]; - /*if ( (keyCombo = [[ITHotKeyCenter sharedCenter] keyComboForName:@"PlayPause"]) ) { - [self setKeyEquivalentForCode:[keyCombo keyCode] - andModifiers:[keyCombo modifiers] - onItem:tempItem]; - }*/ // FIX ME! + 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: @@ -94,11 +100,15 @@ action:@selector(performMainMenuAction:) keyEquivalent:@""]; - /*if ( (keyCombo = [[ITHotKeyCenter sharedCenter] keyComboForName:@"NextTrack"]) ) { - [self setKeyEquivalentForCode:[keyCombo keyCode] - andModifiers:[keyCombo modifiers] - onItem:tempItem]; - }*/ // FIX ME! + 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]; @@ -109,11 +119,15 @@ action:@selector(performMainMenuAction:) keyEquivalent:@""]; - /*if ( (keyCombo = [[ITHotKeyCenter sharedCenter] keyComboForName:@"PrevTrack"]) ) { - [self setKeyEquivalentForCode:[keyCombo keyCode] - andModifiers:[keyCombo modifiers] - onItem:tempItem]; - }*/ // FIX ME! + 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]; @@ -142,11 +156,15 @@ action:@selector(performMainMenuAction:) keyEquivalent:@""]; - /*if ( (keyCombo = [[ITHotKeyCenter sharedCenter] keyComboForName:@"ShowPlayer"]) ) { - [self setKeyEquivalentForCode:[keyCombo keyCode] - andModifiers:[keyCombo modifiers] - onItem:tempItem]; - }*/ // FIX ME! + 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];