+
+ [statusWindowController showUpcomingSongsWindowWithTitles:songList];
+ } else {
+ [statusWindowController showUpcomingSongsWindowWithTitles:[NSArray arrayWithObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")]];
+ }
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+}
+
+- (void)popupMenu
+{
+ if (!_popped) {
+ _popped = YES;
+ [self menuClicked];
+ NSMenu *menu = [statusItem menu];
+ [(NSCarbonMenuImpl *)[menu _menuImpl] popUpMenu:menu atLocation:[NSEvent mouseLocation] width:1 forView:nil withSelectedItem:-30 withFont:[NSFont menuFontOfSize:32]];
+ _popped = NO;
+ }
+}
+
+- (void)incrementVolume
+{
+ NS_DURING
+ float volume = [[self currentRemote] volume];
+ float dispVol = volume;
+ ITDebugLog(@"Incrementing volume.");
+ volume += 0.110;
+ dispVol += 0.100;
+
+ if (volume > 1.0) {
+ volume = 1.0;
+ dispVol = 1.0;
+ }
+
+ ITDebugLog(@"Setting volume to %f", volume);
+ [[self currentRemote] setVolume:volume];
+
+ // Show volume status window
+ [self invalidateStatusWindowUpdateTimer];
+ [statusWindowController showVolumeWindowWithLevel:dispVol];
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+}
+
+- (void)decrementVolume
+{
+ NS_DURING
+ float volume = [[self currentRemote] volume];
+ float dispVol = volume;
+ ITDebugLog(@"Decrementing volume.");
+ volume -= 0.090;
+ dispVol -= 0.100;
+
+ if (volume < 0.0) {
+ volume = 0.0;
+ dispVol = 0.0;
+ }
+
+ ITDebugLog(@"Setting volume to %f", volume);
+ [[self currentRemote] setVolume:volume];
+
+ //Show volume status window
+ [self invalidateStatusWindowUpdateTimer];
+ [statusWindowController showVolumeWindowWithLevel:dispVol];
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+}
+
+- (void)incrementRating
+{
+ NS_DURING
+ float rating = [[self currentRemote] currentSongRating];
+ ITDebugLog(@"Incrementing rating.");
+
+ if ([[self currentRemote] currentPlaylistIndex] == 0) {
+ ITDebugLog(@"No song playing, rating change aborted.");
+ return;
+ }
+
+ rating += 0.2;
+ if (rating > 1.0) {
+ rating = 1.0;
+ }
+ ITDebugLog(@"Setting rating to %f", rating);
+ [[self currentRemote] setCurrentSongRating:rating];
+
+ //Show rating status window
+ [self invalidateStatusWindowUpdateTimer];
+ [statusWindowController showRatingWindowWithRating:rating];
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+}
+
+- (void)decrementRating
+{
+ NS_DURING
+ float rating = [[self currentRemote] currentSongRating];
+ ITDebugLog(@"Decrementing rating.");
+
+ if ([[self currentRemote] currentPlaylistIndex] == 0) {
+ ITDebugLog(@"No song playing, rating change aborted.");
+ return;
+ }
+
+ rating -= 0.2;
+ if (rating < 0.0) {
+ rating = 0.0;
+ }
+ ITDebugLog(@"Setting rating to %f", rating);
+ [[self currentRemote] setCurrentSongRating:rating];
+
+ //Show rating status window
+ [self invalidateStatusWindowUpdateTimer];
+ [statusWindowController showRatingWindowWithRating:rating];
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+}
+
+- (void)setRating:(ITHotKey *)sender
+{
+ if ([self songIsPlaying]) {
+ int stars = [[sender name] characterAtIndex:9] - 48;
+ [self selectSongRating:stars * 20];
+ [statusWindowController showRatingWindowWithRating:(float)stars / 5.0];
+ }
+}
+
+- (void)toggleLoop
+{
+ NS_DURING
+ ITMTRemotePlayerRepeatMode repeatMode = [[self currentRemote] repeatMode];
+ ITDebugLog(@"Toggling repeat mode.");
+ switch (repeatMode) {
+ case ITMTRemotePlayerRepeatOff:
+ repeatMode = ITMTRemotePlayerRepeatAll;
+ break;
+ case ITMTRemotePlayerRepeatAll:
+ repeatMode = ITMTRemotePlayerRepeatOne;
+ break;
+ case ITMTRemotePlayerRepeatOne:
+ repeatMode = ITMTRemotePlayerRepeatOff;
+ break;