From 55d61755dff7b1188799db2043023fe7b8600965 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 3 Aug 2007 00:06:40 -0700 Subject: [PATCH] Adding support for error viewing on the Debugger window and statuses. * English.lproj/Debugger.nib: - Making the error text be hidden by default. - Hooking up outlets into DebuggerWindow * Source/DebuggerWindowController.m|h: Adding _status and _error outlets and setters for them ([DebuggerWindowController setStatus:]): New method ([DebuggerWindowController setError:]): New method * Source/DebuggerController.m: ([DebuggerController initWithPort:]): Set the inital status to be "Connecting" ([DebuggerController updateStatus:]): New method ([DebuggerController handshake:]): Send a status command to the server and then receive the results using updateStatus: ([DebuggerController errorEncountered:]): Calls [_windowController setError:] using the error message from the NSError --- English.lproj/Debugger.nib/classes.nib | 1 + English.lproj/Debugger.nib/keyedobjects.nib | Bin 11410 -> 11773 bytes Source/DebuggerConnection.m | 15 +++++++++++++-- Source/DebuggerWindowController.h | 6 ++++++ Source/DebuggerWindowController.m | 19 +++++++++++++++++++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/English.lproj/Debugger.nib/classes.nib b/English.lproj/Debugger.nib/classes.nib index 7c50c6a..3a7fdfa 100644 --- a/English.lproj/Debugger.nib/classes.nib +++ b/English.lproj/Debugger.nib/classes.nib @@ -3,6 +3,7 @@ { CLASS = DebuggerWindowController; LANGUAGE = ObjC; + OUTLETS = {"_error" = NSTextField; "_status" = NSTextField; }; SUPERCLASS = NSWindowController; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } diff --git a/English.lproj/Debugger.nib/keyedobjects.nib b/English.lproj/Debugger.nib/keyedobjects.nib index 744d6bf648d85a6b0fb4cde75b3779dfd9988a62..2a7196cdedf9917a120b511f831710bd90875e43 100644 GIT binary patch delta 7403 zcma)A34Baf+dt>rGy8V$?EB2Ub6d2eNhE^UV;9lBA@-mIsYr;VBoT8^Rc%!nYTqIW zQcLYZt5r%ZrM6m{qO_%|szp)CckWE0>aF+d%v#i4kVh+3mIa182* zx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=d=@{P&*5|V(R?01mM`ST@r0ki&)_%nTlg}5E5D83!GFQ; z=D+0k@dx;?_^6cUBrLWVFx7%LPA zMZy$esxV!cBkUA*344US!hYePa7Z{T91)HR$Ay!^Dd9Wetnj^XUMLqX3YUb-!d2nA za8Kk#QLHA0i#5gCVqLMm7%4`JF=DJ3CpHnAi7mudVjHn-Ke4?SFLn|W#4chtF-hzx z_7eMuuZpjU{lzqKpqL>J7Ke(ji*Jad#W7;OI6<5!P8Q!5XNj}LMdJHF`XE&K%M7Ue JefC#e_iw2B17ZLG diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index 7098918..a279d3b 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -35,6 +35,7 @@ // now that we have our host information, open the socket _socket = [[SocketWrapper alloc] initWithPort: port]; [_socket setDelegate: self]; + [_windowController setStatus: @"Connecting"]; [_socket connect]; // clean up after ourselves @@ -117,7 +118,7 @@ */ - (void)errorEncountered: (NSError *)error { - NSLog(@"error = %@", error); + [_windowController setError: [error domain]]; } /** @@ -126,7 +127,17 @@ */ - (void)handshake: (NSString *)packet { - NSLog(@"packet = %@", packet); + [_socket send: @"status -i foo"]; + [_socket receive: @selector(updateStatus:)]; +} + +/** + * Handler used by dataReceived:deliverTo: for anytime the status command is issued. It sets + * the window controller's status text + */ +- (void)updateStatus: (NSString *)packet +{ + [_windowController setStatus: packet]; } @end diff --git a/Source/DebuggerWindowController.h b/Source/DebuggerWindowController.h index d49a9b7..b1ba3b6 100644 --- a/Source/DebuggerWindowController.h +++ b/Source/DebuggerWindowController.h @@ -21,8 +21,14 @@ @interface DebuggerWindowController : NSWindowController { DebuggerConnection *_connection; + + IBOutlet NSTextField *_status; + IBOutlet NSTextField *_error; } - (id)initWithConnection: (DebuggerConnection *)cnx; +- (void)setStatus: (NSString *)status; +- (void)setError: (NSString *)error; + @end diff --git a/Source/DebuggerWindowController.m b/Source/DebuggerWindowController.m index 51b0819..3433caf 100644 --- a/Source/DebuggerWindowController.m +++ b/Source/DebuggerWindowController.m @@ -43,4 +43,23 @@ [super dealloc]; } +/** + * Sets the status and clears any error message + */ +- (void)setStatus: (NSString *)status +{ + [_error setHidden: YES]; + [_status setStringValue: status]; +} + +/** + * Sets the status to be "Error" and then displays the error message + */ +- (void)setError: (NSString *)error +{ + [_error setStringValue: error]; + [self setStatus: @"Error"]; + [_error setHidden: NO]; +} + @end -- 2.43.5