X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/51ec73665b7584cffb4d6facde1b872efc283b23..61040496e5014fab9562288d4ac0b13120b4d5ef:/MenuController.m?ds=sidebyside diff --git a/MenuController.m b/MenuController.m index 86a65ec..4b56594 100755 --- a/MenuController.m +++ b/MenuController.m @@ -224,7 +224,7 @@ if ([defaults boolForKey:@"showAlbum"]) { NSString *curAlbum = [currentRemote currentSongAlbum]; ITDebugLog(@"Add Track Album (\"%@\") menu item.", curAlbum); - if ([curAlbum length]) { + if ( curAlbum ) { [menu indentItem: [menu addItemWithTitle:curAlbum action:nil keyEquivalent:@""]]; } @@ -233,7 +233,7 @@ if ([defaults boolForKey:@"showArtist"]) { NSString *curArtist = [currentRemote currentSongArtist]; ITDebugLog(@"Add Track Artist (\"%@\") menu item.", curArtist); - if ([curArtist length]) { + if ( curArtist ) { [menu indentItem: [menu addItemWithTitle:curArtist action:nil keyEquivalent:@""]]; } @@ -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;