Permalink
Browse files

120 columns in call controllers and views

  • Loading branch information...
1 parent b53c9a4 commit c4b36e9dceda7ffd4774e304b0ae5e691c535620 @eofster eofster committed Nov 25, 2012
View
@@ -33,23 +33,22 @@
@protocol AKActiveCallViewDelegate;
-// The AKActiveCallView class receives DTMF digits |0123456789*#| and control
-// characters |mh| from the keyboard. It gives its delegate a chance to get
-// those DTMF digits and it sends control characters further.
+// The AKActiveCallView class receives DTMF digits |0123456789*#| and control characters |mh| from the keyboard. It
+// gives its delegate a chance to get those DTMF digits and it sends control characters further.
@interface AKActiveCallView : NSView {
- @private
- id <AKActiveCallViewDelegate> delegate_;
+ @private
+ id <AKActiveCallViewDelegate> delegate_;
}
// The receiver's delegate.
@property (nonatomic, assign) IBOutlet id <AKActiveCallViewDelegate> delegate;
+
@end
// Declares the interface that AKActiveCallView delegates must implement.
@protocol AKActiveCallViewDelegate <NSObject>
@optional
// Sent when a view receives text input from the keyboard.
// Now it handles only DTMF digits |0123456789*#|.
-- (void)activeCallView:(AKActiveCallView *)sender
- didReceiveText:(NSString *)aString;
+- (void)activeCallView:(AKActiveCallView *)sender didReceiveText:(NSString *)aString;
@end
View
@@ -36,40 +36,37 @@ @implementation AKActiveCallView
@synthesize delegate = delegate_;
- (BOOL)acceptsFirstResponder {
- return YES;
+ return YES;
}
- (void)keyDown:(NSEvent *)theEvent {
- NSCharacterSet *DTMFCharacterSet
- = [NSCharacterSet characterSetWithCharactersInString:@"0123456789*#"];
- NSCharacterSet *commandsCharacterSet
- = [NSCharacterSet characterSetWithCharactersInString:@"mh"];
-
- unichar firstCharacter = [[theEvent characters] characterAtIndex:0];
- if ([DTMFCharacterSet characterIsMember:firstCharacter]) {
- if (![theEvent isARepeat]) {
- // We want to get DTMF string as text.
- [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
+ NSCharacterSet *DTMFCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789*#"];
+ NSCharacterSet *commandsCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"mh"];
+
+ unichar firstCharacter = [[theEvent characters] characterAtIndex:0];
+ if ([DTMFCharacterSet characterIsMember:firstCharacter]) {
+ if (![theEvent isARepeat]) {
+ // We want to get DTMF string as text.
+ [self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
+ }
+ } else if ([commandsCharacterSet characterIsMember:firstCharacter]) {
+ if (![theEvent isARepeat]) {
+ // Pass call control commands further so that main menu will catch them.
+ // The corresponding key equivalents must be set in the main menu.
+ // We need this because we have key equivalents without modifiers,
+ // in which case NSApplication can't recognize them and can't dispatch
+ // appropriate events before we even get here.
+ [super keyDown:theEvent];
+ }
+ } else {
+ [super keyDown:theEvent];
}
- } else if ([commandsCharacterSet characterIsMember:firstCharacter]) {
- if (![theEvent isARepeat]) {
- // Pass call control commands further so that main menu will catch them.
- // The corresponding key equivalents must be set in the main menu.
- // We need this because we have key equivalents without modifiers,
- // in which case NSApplication can't recognize them and can't dispatch
- // appropriate events before we even get here.
- [super keyDown:theEvent];
- }
- } else {
- [super keyDown:theEvent];
- }
}
- (void)insertText:(id)aString {
- if ([[self delegate] respondsToSelector:
- @selector(activeCallView:didReceiveText:)]) {
- [[self delegate] activeCallView:self didReceiveText:aString];
- }
+ if ([[self delegate] respondsToSelector:@selector(activeCallView:didReceiveText:)]) {
+ [[self delegate] activeCallView:self didReceiveText:aString];
+ }
}
@end
@@ -31,12 +31,11 @@
#import <Cocoa/Cocoa.h>
-// Allows progress indicator to send an action message to a target on mouse-up
-// events.
+// Allows progress indicator to send an action message to a target on mouse-up events.
@interface AKResponsiveProgressIndicator : NSProgressIndicator {
- @private
- id target_;
- SEL action_;
+ @private
+ id target_;
+ SEL action_;
}
// The receiver's target.
@@ -37,7 +37,7 @@ @implementation AKResponsiveProgressIndicator
@synthesize action = action_;
- (void)mouseUp:(NSEvent *)theEvent {
- [NSApp sendAction:[self action] to:[self target] from:self];
+ [NSApp sendAction:[self action] to:[self target] from:self];
}
@end
@@ -35,38 +35,35 @@ @implementation ActiveAccountTransferViewController
- (id)initWithAccountController:(AccountController *)anAccountController
windowController:(XSWindowController *)windowController {
-
- self = [super initWithNibName:@"ActiveAccountTransferView"
- bundle:nil
- windowController:windowController];
-
- if (self != nil) {
- [self setAccountController:anAccountController];
- }
- return self;
+
+ self = [super initWithNibName:@"ActiveAccountTransferView" bundle:nil windowController:windowController];
+
+ if (self != nil) {
+ [self setAccountController:anAccountController];
+ }
+ return self;
}
- (IBAction)makeCallToTransferDestination:(id)sender {
- if ([[[self callDestinationField] objectValue] count] == 0) {
- return;
- }
-
- NSDictionary *callDestinationDict
- = [[[[self callDestinationField] objectValue] objectAtIndex:0]
- objectAtIndex:[self callDestinationURIIndex]];
-
- NSString *phoneLabel = [callDestinationDict objectForKey:kPhoneLabel];
-
- AKSIPURI *uri = [self callDestinationURI];
- if (uri != nil) {
- [[self accountController] makeCallToURI:uri
- phoneLabel:phoneLabel
- callTransferController:[[sender window] windowController]];
- }
+ if ([[[self callDestinationField] objectValue] count] == 0) {
+ return;
+ }
+
+ NSDictionary *callDestinationDict = [[[[self callDestinationField] objectValue] objectAtIndex:0]
+ objectAtIndex:[self callDestinationURIIndex]];
+
+ NSString *phoneLabel = [callDestinationDict objectForKey:kPhoneLabel];
+
+ AKSIPURI *uri = [self callDestinationURI];
+ if (uri != nil) {
+ [[self accountController] makeCallToURI:uri
+ phoneLabel:phoneLabel
+ callTransferController:[[sender window] windowController]];
+ }
}
- (IBAction)makeCall:(id)sender {
- return;
+ return;
}
@end
@@ -35,8 +35,8 @@
// An active call controller of a call transfer.
@interface ActiveCallTransferViewController : ActiveCallViewController {
- @private
- NSButton *transferButton_;
+ @private
+ NSButton *transferButton_;
}
// Call transfer button.
@@ -40,38 +40,38 @@ @implementation ActiveCallTransferViewController
@synthesize transferButton = transferButton_;
- (void)dealloc {
- [transferButton_ release];
- [super dealloc];
+ [transferButton_ release];
+ [super dealloc];
}
- (void)awakeFromNib {
- [super awakeFromNib];
-
- [[[self displayedNameField] cell] setBackgroundStyle:NSBackgroundStyleLight];
- [[[self statusField] cell] setBackgroundStyle:NSBackgroundStyleLight];
+ [super awakeFromNib];
+
+ [[[self displayedNameField] cell] setBackgroundStyle:NSBackgroundStyleLight];
+ [[[self statusField] cell] setBackgroundStyle:NSBackgroundStyleLight];
}
- (IBAction)transferCall:(id)sender {
- if (![[self callController] isCallOnHold]) {
- [[self callController] toggleCallHold];
- }
- [(CallTransferController *)[self callController] transferCall];
+ if (![[self callController] isCallOnHold]) {
+ [[self callController] toggleCallHold];
+ }
+ [(CallTransferController *)[self callController] transferCall];
}
- (IBAction)showCallTransferSheet:(id)sender {
- // Do nothing.
+ // Do nothing.
}
#pragma mark -
#pragma mark NSMenuValidation protocol
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
- if ([menuItem action] == @selector(showCallTransferSheet:)) {
- return NO;
- }
-
- return [super validateMenuItem:menuItem];
+ if ([menuItem action] == @selector(showCallTransferSheet:)) {
+ return NO;
+ }
+
+ return [super validateMenuItem:menuItem];
}
@end
@@ -37,16 +37,16 @@
@class AKResponsiveProgressIndicator, CallController;
@interface ActiveCallViewController : XSViewController <AKActiveCallViewDelegate> {
- @private
- CallController *callController_;
- NSTimer *callTimer_;
- NSMutableString *enteredDTMF_;
- NSTrackingArea *callProgressIndicatorTrackingArea_;
-
- NSTextField *displayedNameField_;
- NSTextField *statusField_;
- AKResponsiveProgressIndicator *callProgressIndicator_;
- NSButton *hangUpButton_;
+ @private
+ CallController *callController_;
+ NSTimer *callTimer_;
+ NSMutableString *enteredDTMF_;
+ NSTrackingArea *callProgressIndicatorTrackingArea_;
+
+ NSTextField *displayedNameField_;
+ NSTextField *statusField_;
+ AKResponsiveProgressIndicator *callProgressIndicator_;
+ NSButton *hangUpButton_;
}
// Call controller the receiver belongs to.
@@ -58,8 +58,8 @@
// DTMF digits entered by a user.
@property (nonatomic, retain) NSMutableString *enteredDTMF;
-// Tracking area to monitor a mouse hovering call progress indicator. When mouse
-// enters that area, progress indicator is being replaced with hang-up button.
+// Tracking area to monitor a mouse hovering call progress indicator. When mouse enters that area, progress indicator
+// is being replaced with hang-up button.
@property (nonatomic, retain) NSTrackingArea *callProgressIndicatorTrackingArea;
@@ -77,10 +77,8 @@
// Designated initializer.
-// Initializes an ActiveCallViewController object with a given nib file and call
-// controller.
-- (id)initWithNibName:(NSString *)nibName
- callController:(CallController *)callController;
+// Initializes an ActiveCallViewController object with a given nib file and call controller.
+- (id)initWithNibName:(NSString *)nibName callController:(CallController *)callController;
// Hangs up call.
- (IBAction)hangUpCall:(id)sender;
Oops, something went wrong.

0 comments on commit c4b36e9

Please sign in to comment.