From: Kent Sutherland Date: Wed, 14 Sep 2005 05:08:42 +0000 (+0000) Subject: Implemented the status window for song shufflability. X-Git-Tag: v1.6~6 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/93a60b6d98f84d592631266e1ee0caabe3642551 Implemented the status window for song shufflability. --- diff --git a/English.lproj/Localizable.strings b/English.lproj/Localizable.strings index 67011b8..4badbe6 100755 --- a/English.lproj/Localizable.strings +++ b/English.lproj/Localizable.strings @@ -28,6 +28,8 @@ open = "Open"; playCount = "Play Count"; shuffleOn = "Shuffle On"; shuffleOff = "Shuffle Off"; +shufflableOn = "Current Song Skipped When Shuffling"; +shufflableOff = "Current Song Not Skipped When Shuffling"; repeatOff = "Repeat Off"; repeatPlaylist = "Repeat Playlist"; repeatOneTrack = "Repeat One Track"; diff --git a/MainController.m b/MainController.m index 9a8b493..b9f856a 100755 --- a/MainController.m +++ b/MainController.m @@ -1349,15 +1349,17 @@ static MainController *sharedController; - (void)toggleSongShufflable { - NS_DURING - BOOL flag = ![[self currentRemote] currentSongShufflable]; - ITDebugLog(@"Toggling shufflability."); - [[self currentRemote] setCurrentSongShufflable:flag]; - //Show song shufflability status window - //[statusWindowController showSongShuffabilityWindow:flag]; - NS_HANDLER - [self networkError:localException]; - NS_ENDHANDLER + if ([self songIsPlaying]) { + NS_DURING + BOOL flag = ![[self currentRemote] currentSongShufflable]; + ITDebugLog(@"Toggling shufflability."); + [[self currentRemote] setCurrentSongShufflable:flag]; + //Show song shufflability status window + [statusWindowController showSongShufflabilityWindow:flag]; + NS_HANDLER + [self networkError:localException]; + NS_ENDHANDLER + } } - (void)registerNowOK diff --git a/StatusWindowController.h b/StatusWindowController.h index b192d36..307975d 100755 --- a/StatusWindowController.h +++ b/StatusWindowController.h @@ -38,6 +38,7 @@ typedef enum { - (void)showRatingWindowWithRating:(float)rating; - (void)showShuffleWindow:(BOOL)shuffle; - (void)showRepeatWindowWithMode:(StatusWindowRepeatMode)mode; +- (void)showSongShufflabilityWindow:(BOOL)shufflable; - (void)showSetupQueryWindow; - (void)showRegistrationQueryWindow; - (void)showReconnectQueryWindow; diff --git a/StatusWindowController.m b/StatusWindowController.m index 269681d..a3336a6 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -254,6 +254,14 @@ static StatusWindowController *sharedController; [_window appear:self]; } +- (void)showSongShufflabilityWindow:(BOOL)shufflable +{ + [_window setImage:[NSImage imageNamed:@"Shuffle"]]; + [_window setSizing:(ITTransientStatusWindowSizing)[df integerForKey:@"statusWindowSizing"]]; + [_window buildTextWindowWithString:( !shufflable ? NSLocalizedString(@"shufflableOn", @"Current Song Skipped When Shuffling") : NSLocalizedString(@"shufflableOff", @"Current Song Not Skipped When Shuffling"))]; + [_window appear:self]; +} + - (void)showSetupQueryWindow { NSString *message = NSLocalizedString(@"autolaunch_msg", @"Would you like MenuTunes to launch\nautomatically at startup?"); diff --git a/iTunesRemote.m b/iTunesRemote.m index 3dc2504..c537975 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -747,7 +747,7 @@ ITDebugLog(@"Not a valid track to set status to, returning."); return NO; } - ITSendAEWithString([NSString stringWithFormat:@"data:long(%lu), '----':obj { form:'prop', want:type('prop'), seld:type('pSfa'), from:obj { form:'indx', want:type('cTrk'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }", !shufflable, [self currentSongIndex]], 'core', 'setd', &savedPSN); + ITSendAEWithString([NSString stringWithFormat:@"data:long(%lu), '----':obj { form:'prop', want:type('prop'), seld:type('pSfa'), from:obj { form:'indx', want:type('cTrk'), seld:long(%lu), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }", shufflable, [self currentSongIndex]], 'core', 'setd', &savedPSN); ITDebugLog(@"Setting current song shufflable status to %i done.", shufflable); return YES; }