X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/3a1a21d1ea3e060f88ca1d24ea881f3ccb97640c..04367132ac506360ff31ef1404087678a8cb275b:/MenuController.m diff --git a/MenuController.m b/MenuController.m index 632d45d..b0ee60f 100755 --- a/MenuController.m +++ b/MenuController.m @@ -193,13 +193,13 @@ [tempItem setTag:MTMenuPreferencesItem]; [tempItem setTarget:self]; } else if ([nextObject isEqualToString:@"quit"]) { - ITDebugLog(@"Add \"Quit\" menu item."); if ([[MainController sharedController] blingBling] == NO) { ITDebugLog(@"Add \"Register MenuTunes...\" menu item."); tempItem = [menu addItemWithTitle:NSLocalizedString(@"register", @"Register MenuTunes...") action:@selector(performMainMenuAction:) keyEquivalent:@""]; [tempItem setTag:MTMenuRegisterItem]; [tempItem setTarget:self]; } + ITDebugLog(@"Add \"Quit\" menu item."); tempItem = [menu addItemWithTitle:NSLocalizedString(@"quit", @"Quit") action:@selector(performMainMenuAction:) keyEquivalent:@""]; @@ -242,20 +242,20 @@ 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:@"showTrackRating"]) { + } + + 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 (!_playingRadio) { + if ([defaults boolForKey:@"showTrackRating"] && ( [currentRemote currentSongRating] != -1.0 )) { NSString *string = nil; switch ((int)([currentRemote currentSongRating] * 5)) { case 0: @@ -309,10 +309,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 +338,6 @@ } } } - } ITDebugLog(@"Finished building menu."); [_currentMenu release]; _currentMenu = menu; @@ -660,7 +656,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; @@ -721,8 +717,8 @@ break; case 105: - ITDebugLog(@"Keycode for menu item \"%@\": 105 (F3)", [item title]); - charcode = NSF3FunctionKey; + ITDebugLog(@"Keycode for menu item \"%@\": 105 (F13)", [item title]); + charcode = NSF13FunctionKey; break; case 107: