X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/3a1a21d1ea3e060f88ca1d24ea881f3ccb97640c..61040496e5014fab9562288d4ac0b13120b4d5ef:/MenuController.m?ds=inline diff --git a/MenuController.m b/MenuController.m index 632d45d..4b56594 100755 --- a/MenuController.m +++ b/MenuController.m @@ -242,20 +242,18 @@ if ([defaults boolForKey:@"showTrackNumber"]) { int track = [currentRemote currentSongTrack]; ITDebugLog(@"Add Track Number (\"Track %i\") menu item.", track); - if ( track ) { + if ( track > 0 ) { [menu indentItem: [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]; - ITDebugLog(@"Add Track Remaining (\"%@/%@\") menu item.", remaining, [currentRemote currentSongLength]); - [menu indentItem:[menu addItemWithTitle:[NSString stringWithFormat:@"%@/%@", remaining, [currentRemote currentSongLength]] action:nil keyEquivalent:@""]]; + if ([defaults boolForKey:@"showTime"] && ( ([currentRemote currentSongElapsed] != nil) || ([currentRemote currentSongLength] != nil) )) { + ITDebugLog(@"Add Track Elapsed (\"%@/%@\") menu item.", [currentRemote currentSongElapsed], [currentRemote currentSongLength]); + [menu indentItem:[menu addItemWithTitle:[NSString stringWithFormat:@"%@/%@", [currentRemote currentSongElapsed], [currentRemote currentSongLength]] action:nil keyEquivalent:@""]]; } - if ([defaults boolForKey:@"showTrackRating"]) { + if ([defaults boolForKey:@"showTrackRating"] && ( [currentRemote currentSongRating] != -1.0 )) { NSString *string = nil; switch ((int)([currentRemote currentSongRating] * 5)) { case 0: @@ -309,10 +307,7 @@ [tempItem setState:NSOffState]; } [[_eqMenu itemAtIndex:([currentRemote currentEQPresetIndex] - 1)] setState:NSOnState]; - } - - if (!_playingRadio) { - if ([nextObject isEqualToString:@"songRating"]) { + } else if ([nextObject isEqualToString:@"songRating"] && ( [currentRemote currentSongRating] != -1 )) { ITDebugLog(@"Add \"Song Rating\" submenu."); tempItem = [menu addItemWithTitle:NSLocalizedString(@"songRating", @"Song Rating") action:nil @@ -341,7 +336,6 @@ } } } - } ITDebugLog(@"Finished building menu."); [_currentMenu release]; _currentMenu = menu; @@ -660,7 +654,7 @@ SetMenuItemKeyGlyph(menuRef, 0, kMenuBlankGlyph); charcode = 'b';*/ unichar buffer; - [[NSString stringWithString:@"_"] getCharacters:&buffer]; // this will have to do for now :( + [[NSString stringWithString:@" "] getCharacters:&buffer]; // this will have to do for now :( charcode = buffer; } break;