From: Kent Sutherland Date: Wed, 1 Oct 2003 18:20:33 +0000 (+0000) Subject: Fixed the hotkeys so they don't run even when they shouldn't (player no running,... X-Git-Tag: v1.0~21 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/ceb65233f7ffd73c2fd3b471d7e15ab7abefb553 Fixed the hotkeys so they don't run even when they shouldn't (player no running, rating not changable) --- diff --git a/MainController.m b/MainController.m index e6d338b..36212c4 100755 --- a/MainController.m +++ b/MainController.m @@ -371,6 +371,11 @@ static MainController *sharedController; { ITHotKey *hotKey; ITDebugLog(@"Setting up hot keys."); + + if (playerRunningState == ITMTRemotePlayerNotRunning) { + return; + } + if ([df objectForKey:@"PlayPause"] != nil) { ITDebugLog(@"Setting up play pause hot key."); hotKey = [[ITHotKey alloc] init]; @@ -620,6 +625,12 @@ static MainController *sharedController; { float rating = [currentRemote currentSongRating]; ITDebugLog(@"Incrementing rating."); + + if ([currentRemote currentPlaylistIndex] == 0) { + ITDebugLog(@"No song playing, rating change aborted."); + return; + } + rating += 0.2; if (rating > 1.0) { rating = 1.0; @@ -635,6 +646,12 @@ static MainController *sharedController; { float rating = [currentRemote currentSongRating]; ITDebugLog(@"Decrementing rating."); + + if ([currentRemote currentPlaylistIndex] == 0) { + ITDebugLog(@"No song playing, rating change aborted."); + return; + } + rating -= 0.2; if (rating < 0.0) { rating = 0.0; diff --git a/MenuController.m b/MenuController.m index c157903..0d6fc63 100755 --- a/MenuController.m +++ b/MenuController.m @@ -220,6 +220,7 @@ [menu addItemWithTitle:title action:nil keyEquivalent:@""]]; } + if (!_playingRadio) { if ([defaults boolForKey:@"showAlbum"]) { NSString *curAlbum = [currentRemote currentSongAlbum]; ITDebugLog(@"Add Track Album (\"%@\") menu item.", curAlbum); @@ -277,7 +278,7 @@ ITDebugLog(@"Add Track Rating (\"%@\") menu item.", string); [menu indentItem:[menu addItemWithTitle:string action:nil keyEquivalent:@""]]; } - + } } else { ITDebugLog(@"No Track is Playing, Add \"No Song\" menu item."); [menu addItemWithTitle:NSLocalizedString(@"noSong", @"No Song") action:NULL keyEquivalent:@""]; diff --git a/libValidate.a b/libValidate.a index f06af69..ac5a536 100755 Binary files a/libValidate.a and b/libValidate.a differ