- if (eqItem) {
- [self rebuildEQPresetsMenu];
- }
- if (trackInfoIndex > -1) {
- NSString *curSongName, *curAlbumName = @"", *curArtistName = @"";
- curSongName = [currentRemote currentSongTitle];
-
- if ([defaults boolForKey:@"showAlbum"]) {
- curAlbumName = [currentRemote currentSongAlbum];
- }
-
- if ([defaults boolForKey:@"showArtist"]) {
- curArtistName = [currentRemote currentSongArtist];
- }
-
- if ([curSongName length] > 0) {
- int index = [menu indexOfItemWithTitle:@"Now Playing"];
- if (index > -1) {
- if ([defaults boolForKey:@"showName"]) {
- [menu removeItemAtIndex:index + 1];
- }
- if (didHaveAlbumName && [defaults boolForKey:@"showAlbum"]) {
- [menu removeItemAtIndex:index + 1];
- }
- if (didHaveArtistName && [defaults boolForKey:@"showArtist"]) {
- [menu removeItemAtIndex:index + 1];
- }
- if ([defaults boolForKey:@"showTime"]) {
- [menu removeItemAtIndex:index + 1];
- }
- }
-
- if (!isPlayingRadio) {
- if ([defaults boolForKey:@"showTime"]) {
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", [currentRemote currentSongLength]]
- action:nil
- keyEquivalent:@""];
- [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
- [menuItem release];
- }
-
- if ([curArtistName length] > 0) {
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curArtistName]
- action:nil
- keyEquivalent:@""];
- [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
- [menuItem release];
- }
-
- if ([curAlbumName length] > 0) {
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curAlbumName]
- action:nil
- keyEquivalent:@""];
- [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
- [menuItem release];
- }
-
- if (songRatingMenuItem) {
- int rating = (int)[currentRemote currentSongRating] * 10;
- int i;
- for (i = 0; i < 5; i++) {
- [[ratingMenu itemAtIndex:i] setState:NSOffState];
- [[ratingMenu itemAtIndex:i] setTarget:self];
- }
- [[ratingMenu itemAtIndex:rating / 2] setState:NSOnState];
- }
- }
-
- if ([defaults boolForKey:@"showName"]) {
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", curSongName]
- action:nil
- keyEquivalent:@""];
- [menu insertItem:menuItem atIndex:trackInfoIndex + 1];
- [menuItem release];
- }
-
- if (index == -1) {
- menuItem = [[NSMenuItem alloc] initWithTitle:@"Now Playing" action:nil keyEquivalent:@""];
- [menu removeItemAtIndex:[menu indexOfItemWithTitle:@"No Song"]];
- [menu insertItem:menuItem atIndex:trackInfoIndex];
- [menuItem release];
-
- [songRatingMenuItem setSubmenu:ratingMenu];
- [songRatingMenuItem setEnabled:YES];
- }
- } else if ([menu indexOfItemWithTitle:@"No Song"] == -1) {
- [menu removeItemAtIndex:trackInfoIndex];
-
- if ([defaults boolForKey:@"showName"] == YES) {
- [menu removeItemAtIndex:trackInfoIndex];
- }
-
- if ([defaults boolForKey:@"showTime"] == YES) {
- [menu removeItemAtIndex:trackInfoIndex];
- }
-
- if (didHaveArtistName && [defaults boolForKey:@"showArtist"]) {
- [menu removeItemAtIndex:trackInfoIndex];
- }
-
- if (didHaveAlbumName && [defaults boolForKey:@"showAlbum"]) {
- [menu removeItemAtIndex:trackInfoIndex];
- }
-
- menuItem = [[NSMenuItem alloc] initWithTitle:@"No Song" action:nil keyEquivalent:@""];
- [menu insertItem:menuItem atIndex:trackInfoIndex];
- [menuItem release];
- }
-
- if ([defaults boolForKey:@"showArtist"]) {
- didHaveArtistName = (([curArtistName length] > 0) ? YES : NO);
- }
-
- if ([defaults boolForKey:@"showAlbum"]) {
- didHaveAlbumName = (([curAlbumName length] > 0) ? YES : NO);