From 701d53006945f9cf890e9b3d554f493d81f66640 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Mon, 14 Apr 2003 18:49:59 +0000 Subject: [PATCH] Changing hotkeys in the prefs now writes to the prefs and rebuilds the menu. The app crashes on launch because the remote isn't responding for some reason. --- OldMainController.m | 13 ++++--------- PreferencesController.m | 2 ++ iTunesRemote.m | 4 ---- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/OldMainController.m b/OldMainController.m index 8160644..4171538 100755 --- a/OldMainController.m +++ b/OldMainController.m @@ -144,16 +144,11 @@ [[ratingMenu addItemWithTitle:[NSString stringWithFormat:@"%@%@%@%@%@", fullStarChar, fullStarChar, fullStarChar, emptyStarChar, emptyStarChar] action:@selector(selectSongRating:) keyEquivalent:@""] setTag:60]; [[ratingMenu addItemWithTitle:[NSString stringWithFormat:@"%@%@%@%@%@", fullStarChar, fullStarChar, fullStarChar, fullStarChar, emptyStarChar] action:@selector(selectSongRating:) keyEquivalent:@""] setTag:80]; [[ratingMenu addItemWithTitle:[NSString stringWithFormat:@"%@%@%@%@%@", fullStarChar, fullStarChar, fullStarChar, fullStarChar, fullStarChar] action:@selector(selectSongRating:) keyEquivalent:@""] setTag:100]; - [NSThread detachNewThreadSelector:@selector(startTimerInNewThread) toTarget:self withObject:nil]; - [self rebuildMenu]; [self setupHotKeys]; + [self rebuildMenu]; isAppRunning = ITMTRemotePlayerRunning; - return; } - - isAppRunning = ITMTRemotePlayerRunning; - NSLog(@"applicationTerminated"); } - (void)applicationTerminated:(NSNotification *)note @@ -347,13 +342,13 @@ lastSongIdentifier = [[currentRemote currentSongUniqueIdentifier] retain]; //If we're in a playlist or radio mode - if ( (trackInfoIndex > -1) ) { + if ( ![lastSongIdentifier isEqualToString:@"0-0"] && (trackInfoIndex > -1) ) { NSString *title; if ( (i = [menu indexOfItemWithTitle:@"No Song"]) ) { if ( (i > -1) ) { [menu removeItemAtIndex:i]; - [menu insertItemWithTitle:@"Now Playing" action:NULL keyEquivalent:@"" atIndex:i-1]; + [menu insertItemWithTitle:@"Now Playing" action:NULL keyEquivalent:@"" atIndex:i]; } } @@ -487,9 +482,9 @@ [tempItem autorelease]; } } + [eqItem setSubmenu:eqMenu]; [eqItem setEnabled:YES]; - [[eqMenu itemAtIndex:([currentRemote currentEQPresetIndex] - 1)] setState:NSOnState]; } diff --git a/PreferencesController.m b/PreferencesController.m index af1838b..5c9f059 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -459,6 +459,8 @@ static PreferencesController *prefs = nil; toggleShuffleCombo = [combo copy]; [toggleShuffleButton setTitle:string]; } + [df setKeyCombo:combo forKey:setHotKey]; + [controller rebuildMenu]; [self cancelHotKey:sender]; } diff --git a/iTunesRemote.m b/iTunesRemote.m index 0f537fb..1ab3043 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -25,10 +25,6 @@ - (BOOL)begin { iTunesPSN = [self iTunesPSN]; - - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(applicationLaunched:) name:NSWorkspaceDidLaunchApplicationNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(applicationTerminated:) name:NSWorkspaceDidTerminateApplicationNotification object:nil]; - return YES; } -- 2.20.1