{
ITDebugLog(@"Show preferences.");
[[PreferencesController sharedPrefs] showPrefsWindow:self];
- [[StatusWindow sharedWindow] setLocked:NO];
+ [(StatusWindow *)[StatusWindow sharedWindow] setLocked:NO];
[[StatusWindow sharedWindow] vanish:self];
[[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
}
[[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
}
+ if ([df objectForKey:@"ToggleShufflability"] != nil) {
+ ITDebugLog(@"Setting up toggle song shufflability hot key.");
+ hotKey = [[ITHotKey alloc] init];
+ [hotKey setName:@"ToggleShufflability"];
+ [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"ToggleShufflability"]]];
+ [hotKey setTarget:self];
+ [hotKey setAction:@selector(toggleSongShufflable)];
+ [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
+ }
+
if ([df objectForKey:@"PopupMenu"] != nil) {
ITDebugLog(@"Setting up popup menu hot key.");
hotKey = [[ITHotKey alloc] init];
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
+ _timeUpdateCount = 0;
+ [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTime:) userInfo:nil repeats:YES];
}
if ( [df boolForKey:@"showTrackNumber"] ) {
image:art];
}
+- (void)updateTime:(NSTimer *)timer
+{
+ _timeUpdateCount++;
+ if (_timeUpdateCount > (int)[df floatForKey:@"statusWindowVanishDelay"] - 1) {
+ NSString *time = nil;
+ NS_DURING
+ time = [NSString stringWithFormat:@"%@: %@ / %@",
+ NSLocalizedString(@"time", @"Time"),
+ [[self currentRemote] currentSongElapsed],
+ [[self currentRemote] currentSongLength]];
+ [[StatusWindowController sharedController] updateTime:time];
+ NS_HANDLER
+ [self networkError:localException];
+ NS_ENDHANDLER
+ }
+}
+
- (void)showUpcomingSongs
{
int numSongs = 0;
NS_ENDHANDLER
}
+- (void)toggleSongShufflable
+{
+ 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
{
- [[StatusWindow sharedWindow] setLocked:NO];
+ [(StatusWindow *)[StatusWindow sharedWindow] setLocked:NO];
[[StatusWindow sharedWindow] vanish:self];
[[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
- (void)registerNowCancel
{
- [[StatusWindow sharedWindow] setLocked:NO];
+ [(StatusWindow *)[StatusWindow sharedWindow] setLocked:NO];
[[StatusWindow sharedWindow] vanish:self];
[[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
[NSTimer scheduledTimerWithTimeInterval:90.0 target:self selector:@selector(checkForRemoteServer) userInfo:nil repeats:NO];
}*/
[self checkForRemoteServerAndConnectImmediately:YES];
- [[StatusWindow sharedWindow] setLocked:NO];
+ [(StatusWindow *)[StatusWindow sharedWindow] setLocked:NO];
[[StatusWindow sharedWindow] vanish:self];
[[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
}
- (void)cancelReconnect
{
- [[StatusWindow sharedWindow] setLocked:NO];
+ [(StatusWindow *)[StatusWindow sharedWindow] setLocked:NO];
[[StatusWindow sharedWindow] vanish:self];
[[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
}
- (void)applicationDidBecomeActive:(NSNotification *)note
{
//This appears to not work in 10.4
- if (_open && !blinged && ![[ITAboutBox sharedController] isVisible] && ![NSApp mainWindow] && ([[StatusWindow sharedWindow] exitMode] == ITTransientStatusWindowExitAfterDelay)) {
+ if (_open && !blinged && ![[ITAboutWindowController sharedController] isVisible] && ![NSApp mainWindow] && ([[StatusWindow sharedWindow] exitMode] == ITTransientStatusWindowExitAfterDelay)) {
[[MainController sharedController] showPreferences];
}
}