[statusItem setMenu:menu];
// Below line of code is for creating builds for Beta Testers
// [statusItem setToolTip:@[NSString stringWithFormat:@"This Nontransferable Beta (Built on %s) of iThink Software's MenuTunes is Registered to: Beta Tester (betatester@somedomain.com).",__DATE__]];
- [statusWindow orderFront:self]; //DEBUG
}
- (ITMTRemote *)loadRemote
@"<separator>",
@"Upcoming Songs",
@"Playlists",
+ @"Song Rating",
@"<separator>",
@"PreferencesÉ",
@"Quit",
[menu addItemWithTitle:@"No Song"
action:nil
keyEquivalent:@""];
+ } else if ([item isEqualToString:@"Song Rating"]) {
+ NSMenu *ratingSubmenu = [[NSMenu alloc] initWithTitle:@""];
+ unichar whiteStar = 'o';//2606;
+ unichar blackStar = 'x';//2605;
+ NSString *whiteStarString = [NSString stringWithCharacters:&whiteStar
+ length:1];
+ NSString *blackStarString = [NSString stringWithCharacters:&blackStar
+ length:1];
+ NSString *string = @"";
+ int i;
+
+ for (i = 0; i < 5; i++) {
+ string = [string stringByAppendingString:whiteStarString];
+ }
+ for (i = 0; i < 6; i++) {
+ NSMenuItem *ratingItem;
+ ratingItem = [ratingSubmenu addItemWithTitle:string action:@selector(setSongRating:) keyEquivalent:@""];
+ [ratingItem setTarget:self];
+ [ratingItem setTag:i * 20];
+ string = [string substringToIndex:4];
+ string = [blackStarString stringByAppendingString:string];
+ }
+ [[menu addItemWithTitle:@"Song Rating"
+ action:nil
+ keyEquivalent:@""] setSubmenu:ratingSubmenu];
+ [ratingSubmenu autorelease];
} else if ([item isEqualToString:@"<separator>"]) {
[menu addItem:[NSMenuItem separatorItem]];
}
- (void)rebuildEQPresetsMenu
{
NSArray *eqPresets = [currentRemote eqPresets];
+ NSMenuItem *enabledItem;
int i;
if (eqMenu && ([[currentRemote eqPresets] count] == [eqMenu numberOfItems]))
[eqMenu release];
eqMenu = [[NSMenu alloc] initWithTitle:@""];
+ enabledItem = [eqMenu addItemWithTitle:@"EQ Enabled"
+ action:NULL
+ keyEquivalent:@""];
+ [eqMenu addItem:[NSMenuItem separatorItem]];
+
for (i = 0; i < [eqPresets count]; i++) {
NSString *setName = [eqPresets objectAtIndex:i];
NSMenuItem *tempItem;
- (void)timerUpdate
{
int playlist = [currentRemote currentPlaylistIndex];
- PlayerState playerState = [currentRemote playerState];
+ ITMTRemotePlayerState playerState = [currentRemote playerState];
if ((playlist > 0) || playerState != stopped) {
int trackPlayingIndex = [currentRemote currentSongIndex];
[playPauseMenuItem setTitle:@"Play"];
}
}
+ } else if ((lastPlaylistIndex > 0) && (playlist == 0)) {
+ NSMenuItem *menuItem;
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ //Remote the now playing item and add no song item
+ [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];
+ }
+
+ [playPauseMenuItem setTitle:@"Play"];
+
+ didHaveArtistName = NO;
+ didHaveAlbumName = NO;
+ lastPlaylistIndex = -1;
+ lastSongIndex = -1;
+
+ [upcomingSongsItem setSubmenu:nil];
+ [upcomingSongsItem setEnabled:NO];
+
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"No Song" action:nil keyEquivalent:@""];
+ [menu insertItem:menuItem atIndex:trackInfoIndex];
+ [menuItem release];
}
}
int playlist = [[sender representedObject] intValue];
if (!isPlayingRadio) {
int curPlaylist = [currentRemote currentPlaylistIndex];
- [[playlistMenu itemAtIndex:curPlaylist - 1] setState:NSOffState];
+ if (curPlaylist > 0) {
+ [[playlistMenu itemAtIndex:curPlaylist - 1] setState:NSOffState];
+ }
}
[currentRemote switchToPlaylistAtIndex:playlist];
[[playlistMenu itemAtIndex:playlist - 1] setState:NSOnState];
- (void)playPause:(id)sender
{
- PlayerState state = [currentRemote playerState];
+ ITMTRemotePlayerState state = [currentRemote playerState];
if (state == playing) {
[currentRemote pause];
[playPauseMenuItem setTitle:@"Play"];
}
+- (void)setSongRating:(id)sender
+{
+ NSLog(@"%f", (float)[sender tag] / 100.0);
+ [currentRemote setCurrentSongRating:(float)[sender tag] / 100.0];
+}
+
//
//
// Plugin independent selectors