Status query windows can show only one button if you want. Network error
authorKent Sutherland <ksuther@ithinksw.com>
Mon, 24 May 2004 14:41:31 +0000 (14:41 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Mon, 24 May 2004 14:41:31 +0000 (14:41 +0000)
panel is now a status window. Other network stuff.

MainController.m
StatusWindow.m
StatusWindowController.h
StatusWindowController.m

index 011f73e..8abe8de 100755 (executable)
@@ -777,7 +777,19 @@ static MainController *sharedController;
     NS_ENDHANDLER
     
     if ( title ) {
-
+        if ( [df boolForKey:@"showAlbumArtwork"] ) {
+           NSSize oldSize, newSize;
+             NS_DURING
+                art = [[self currentRemote] currentSongAlbumArt];
+                oldSize = [art size];
+                if (oldSize.width > oldSize.height) newSize = NSMakeSize(110,oldSize.height * (110.0f / oldSize.width));
+                else newSize = NSMakeSize(oldSize.width * (110.0f / oldSize.height),110);
+                art = [[[[NSImage alloc] initWithData:[art TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:newSize];
+            NS_HANDLER
+                [self networkError:localException];
+            NS_ENDHANDLER
+        }
+        
         if ( [df boolForKey:@"showAlbum"] ) {
             NS_DURING
                 album = [[self currentRemote] currentSongAlbum];
@@ -843,20 +855,6 @@ static MainController *sharedController;
                 rating = ( currentRating * 5 );
             }
         }
-        
-        if ( [df boolForKey:@"showAlbumArtwork"] ) {
-           NSSize oldSize, newSize;
-             NS_DURING
-                art = [[self currentRemote] currentSongAlbumArt];
-                oldSize = [art size];
-                if (oldSize.width > oldSize.height) newSize = NSMakeSize(110,oldSize.height * (110.0f / oldSize.width));
-                else newSize = NSMakeSize(oldSize.width * (110.0f / oldSize.height),110);
-                art = [[[[NSImage alloc] initWithData:[art TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:newSize];
-            NS_HANDLER
-                [self networkError:localException];
-            NS_ENDHANDLER
-        }
-        
     } else {
         title = NSLocalizedString(@"noSongPlaying", @"No song is playing.");
     }
@@ -1168,7 +1166,8 @@ static MainController *sharedController;
 {
     ITDebugLog(@"Remote exception thrown: %@: %@", [exception name], [exception reason]);
     if ( ((exception == nil) || [[exception name] isEqualToString:NSPortTimeoutException]) && [networkController isConnectedToServer]) {
-        NSRunCriticalAlertPanel(@"Remote MenuTunes Disconnected", @"The MenuTunes server you were connected to stopped responding or quit. MenuTunes will revert back to the local player.", @"OK", nil, nil);
+        //NSRunCriticalAlertPanel(@"Remote MenuTunes Disconnected", @"The MenuTunes server you were connected to stopped responding or quit. MenuTunes will revert back to the local player.", @"OK", nil, nil);
+        [[StatusWindowController sharedController] showNetworkErrorQueryWindow];
         if ([self disconnectFromServer]) {
             [[PreferencesController sharedPrefs] resetRemotePlayerTextFields];
             [NSTimer scheduledTimerWithTimeInterval:90.0 target:self selector:@selector(checkForRemoteServer) userInfo:nil repeats:YES];
index ef0f878..ffbc1e6 100755 (executable)
                                            wideButtonW,
                                            24.0)];
         [[self contentView] addSubview:okButton];
-        [[self contentView] addSubview:cancelButton];
+        if (alternateTitle) {
+            [[self contentView] addSubview:cancelButton];
+        }
 
         [self setIgnoresMouseEvents:NO];
   
index c0ec9eb..5819e78 100755 (executable)
@@ -40,6 +40,7 @@ typedef enum {
 - (void)showSetupQueryWindow;
 - (void)showRegistrationQueryWindow;
 - (void)showReconnectQueryWindow;
+- (void)showNetworkErrorQueryWindow;
 - (void)showPreferencesUpdateWindow;
 
 - (void)showSongInfoWindowWithSource:(ITMTRemotePlayerSource)source
index cd14b33..0cb9b72 100755 (executable)
@@ -281,6 +281,23 @@ static StatusWindowController *sharedController;
     [_window setLocked:YES];
 }
 
+- (void)showNetworkErrorQueryWindow
+{
+    NSString *message = @"The remote MenuTunes server is unreachable.\nMenuTunes will revert back to the local player.";
+
+    [_window setImage:[NSImage imageNamed:@"Setup"]];
+    [_window setSizing:(ITTransientStatusWindowSizing)[df integerForKey:@"statusWindowSizing"]];
+    [_window buildDialogWindowWithMessage:message
+                            defaultButton:@" OK "
+                          alternateButton:nil
+                                   target:[MainController sharedController]
+                            defaultAction:@selector(cancelReconnect)
+                          alternateAction:nil];
+
+    [_window appear:self];
+    [_window setLocked:YES];
+}
+
 - (void)showPreferencesUpdateWindow
 {
     NSString *message = @"The new features in this version of MenuTunes\nrequire you to reconfigure your preferences.";