X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/aeae287077a886690921baaea0a0f1149bc891db..5c68843e215011cab04f402cb4dc66bec3225081:/MainController.m diff --git a/MainController.m b/MainController.m index 3c1cb6c..2ac5ac6 100755 --- a/MainController.m +++ b/MainController.m @@ -55,6 +55,12 @@ static MainController *sharedController; SetITDebugMode(YES); } + if (![df stringForKey:@"appVersion"]) { + [df removePersistentDomainForName:@"com.ithinksw.menutunes"]; + [df setObject:@"1.2" forKey:@"appVersion"]; + [[StatusWindowController sharedController] showPreferencesUpdateWindow]; + } + currentRemote = [self loadRemote]; [[self currentRemote] begin]; @@ -290,12 +296,9 @@ static MainController *sharedController; { if ([networkController isConnectedToServer]) { [statusItem setMenu:[menuController menu]]; - if ([[networkController networkObject] remote] == nil) { - [self networkError:nil]; - } } - if ( [self songChanged] && (timerUpdating != YES) ) { + if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) { ITDebugLog(@"The song changed."); timerUpdating = YES; @@ -409,6 +412,7 @@ static MainController *sharedController; { ITDebugLog(@"Selecting playlist %i", index); NS_DURING + //[[self currentRemote] switchToPlaylistAtIndex:(index % 1000) ofSourceAtIndex:(index / 1000)]; [[self currentRemote] switchToPlaylistAtIndex:index]; NS_HANDLER [self networkError:localException]; @@ -478,6 +482,15 @@ static MainController *sharedController; [[PreferencesController sharedPrefs] showPrefsWindow:self]; } +- (void)showPreferencesAndClose +{ + ITDebugLog(@"Show preferences."); + [[PreferencesController sharedPrefs] showPrefsWindow:self]; + [[StatusWindow sharedWindow] setLocked:NO]; + [[StatusWindow sharedWindow] vanish:self]; + [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES]; +} + - (void)showTestWindow { [self showCurrentTrackInfo]; @@ -502,6 +515,10 @@ static MainController *sharedController; - (ITMTRemote *)currentRemote { + if ([networkController isConnectedToServer] && ![[networkController networkObject] isValid]) { + [self networkError:nil]; + return nil; + } return currentRemote; } @@ -1071,12 +1088,12 @@ static MainController *sharedController; NS_DURING if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]) { ITDebugLog(@"Remote application terminated."); + playerRunningState = ITMTRemotePlayerNotRunning; [[self currentRemote] halt]; [refreshTimer invalidate]; [refreshTimer release]; refreshTimer = nil; [self clearHotKeys]; - playerRunningState = ITMTRemotePlayerNotRunning; if ([df objectForKey:@"ShowPlayer"] != nil) { ITHotKey *hotKey;