From c7d11989dc6b95325bc3b1f6e8131659d6eb56e8 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 16 Mar 2011 12:38:51 +0100 Subject: [PATCH] add erase button --- Classes/LinphoneUI/UIEraseButton.h | 29 ++ Classes/LinphoneUI/UIEraseButton.m | 40 +++ Classes/LinphoneUI/UILinphone.h | 1 + Classes/PhoneViewController.h | 4 + Classes/PhoneViewController.m | 11 +- Classes/PhoneViewController.xib | 505 ++++++++++++++++++----------- linphone.xcodeproj/project.pbxproj | 6 + 7 files changed, 396 insertions(+), 200 deletions(-) create mode 100644 Classes/LinphoneUI/UIEraseButton.h create mode 100644 Classes/LinphoneUI/UIEraseButton.m diff --git a/Classes/LinphoneUI/UIEraseButton.h b/Classes/LinphoneUI/UIEraseButton.h new file mode 100644 index 000000000..272166e18 --- /dev/null +++ b/Classes/LinphoneUI/UIEraseButton.h @@ -0,0 +1,29 @@ +/* UIEraseButton.h + * + * Copyright (C) 2011 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import + + +@interface UIEraseButton : UIButton { +@private + UITextField* mAddress; + +} +-(void) initWithAddressField:(UITextField*) address; +@end diff --git a/Classes/LinphoneUI/UIEraseButton.m b/Classes/LinphoneUI/UIEraseButton.m new file mode 100644 index 000000000..2ce1059c0 --- /dev/null +++ b/Classes/LinphoneUI/UIEraseButton.m @@ -0,0 +1,40 @@ +/* UIEraseButton.m + * + * Copyright (C) 2011 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "UIEraseButton.h" + + +@implementation UIEraseButton +-(void) touchUp:(id) sender { + if ([mAddress.text length] > 0) { + [mAddress setText:[mAddress.text substringToIndex:[mAddress.text length]-1]]; + } +} + +-(void) initWithAddressField:(UITextField*) address { + mAddress = address; + [self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside]; +} + +- (void)dealloc { + [super dealloc]; +} + + +@end diff --git a/Classes/LinphoneUI/UILinphone.h b/Classes/LinphoneUI/UILinphone.h index de158faad..6c9ed3840 100644 --- a/Classes/LinphoneUI/UILinphone.h +++ b/Classes/LinphoneUI/UILinphone.h @@ -24,4 +24,5 @@ #import "UIMuteButton.h" #import "UISpeakerButton.h" #import "UIDuration.h" +#import "UIEraseButton.h" #import "LinphoneUIDelegates.h" diff --git a/Classes/PhoneViewController.h b/Classes/PhoneViewController.h index ce3f08f49..8dd0c49cc 100644 --- a/Classes/PhoneViewController.h +++ b/Classes/PhoneViewController.h @@ -29,8 +29,10 @@ @private //UI definition + UIView* dialerView; UITextField* address; UILabel* mDisplayName; + UIEraseButton* erase; UIView* incallView; UIDuration* callDuration; @@ -66,10 +68,12 @@ FirstLoginViewController* myFirstLoginViewController; } +@property (nonatomic, retain) IBOutlet UIView* dialerView; @property (nonatomic, retain) IBOutlet UITextField* address; @property (nonatomic, retain) IBOutlet UIButton* call; @property (nonatomic, retain) IBOutlet UIButton* hangup; @property (nonatomic, retain) IBOutlet UILabel* status; +@property (nonatomic, retain) IBOutlet UIEraseButton* erase; @property (nonatomic, retain) IBOutlet UIView* incallView; @property (nonatomic, retain) IBOutlet UILabel* callDuration; diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 0aa8df5cd..8b0efb8cc 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -26,10 +26,13 @@ @implementation PhoneViewController +@synthesize dialerView ; @synthesize address ; @synthesize call; @synthesize hangup; @synthesize status; +@synthesize erase; + @synthesize incallView; @synthesize callDuration; @@ -117,7 +120,7 @@ [call initWithAddress:address withDisplayName:mDisplayName]; [mute initWithOnImage:[UIImage imageNamed:@"mic_muted.png"] offImage:[UIImage imageNamed:@"mic_active.png"] ]; [speaker initWithOnImage:[UIImage imageNamed:@"Speaker-32-on.png"] offImage:[UIImage imageNamed:@"Speaker-32-off.png"] ]; - + [erase initWithAddressField:address]; } @@ -173,9 +176,11 @@ [mDisplayName setText:displayName]; [incallView setHidden:true]; + [dialerView setHidden:false]; + [call setEnabled:true]; [hangup setEnabled:false]; - + [callDuration stop]; [peerLabel setText:@""]; @@ -195,6 +200,7 @@ } [address setHidden:true]; [incallView setHidden:false]; + [dialerView setHidden:true]; } -(void) displayCallInProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { [self displayIncalViewforUser:username @@ -260,6 +266,7 @@ [address dealloc]; [ mDisplayName dealloc]; [incallView dealloc]; + [dialerView dealloc]; [callDuration dealloc]; [mute dealloc]; [speaker dealloc]; diff --git a/Classes/PhoneViewController.xib b/Classes/PhoneViewController.xib index 03494eccc..2150c0314 100644 --- a/Classes/PhoneViewController.xib +++ b/Classes/PhoneViewController.xib @@ -12,7 +12,7 @@ YES - + YES @@ -70,7 +70,7 @@ 292 - {{98, 46}, {124, 21}} + {{98, 38}, {124, 21}} NO YES @@ -86,7 +86,7 @@ 292 - {{241, 38}, {72, 37}} + {{239, 14}, {72, 37}} NO NO @@ -118,7 +118,7 @@ 292 - {{0, 38}, {72, 37}} + {{0, 14}, {72, 37}} NO NO @@ -138,7 +138,7 @@ - {320, 90} + {320, 65} 1 @@ -147,10 +147,78 @@ NO IBCocoaTouchFramework + + + 292 + + YES + + + 292 + {{254, 0}, {66, 65}} + + NO + IBCocoaTouchFramework + 0 + 0 + + <- + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + clavier-01-106px.png + + + + + 292 + {{5, 0}, {255, 66}} + + NO + NO + IBCocoaTouchFramework + 0 + + sip: + + 3 + MAA + + 2 + + + + Helvetica + 36 + 16 + + YES + 15 + + 1 + 3 + IBCocoaTouchFramework + + 1 + + + {320, 65} + + + 1 + MC45MDE5NjA3OSAwLjkwMTk2MDc5IDAuOTAxOTYwNzkAA + + IBCocoaTouchFramework + 292 - {{0, 331}, {160, 60}} + {{0, 328}, {160, 66}} NO NO @@ -176,7 +244,7 @@ 292 - {{9, 389}, {304, 21}} + {{9, 390}, {304, 21}} NO YES @@ -191,7 +259,7 @@ 292 - {{213, 91}, {107, 60}} + {{213, 64}, {107, 66}} NO NO @@ -206,15 +274,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - NSImage - clavier-01-106px.png - + 292 - {{0, 151}, {107, 60}} + {{0, 130}, {107, 66}} NO NO @@ -229,12 +294,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{107, 151}, {106, 60}} + {{107, 130}, {106, 66}} NO NO @@ -257,7 +322,7 @@ 292 - {{213, 151}, {107, 60}} + {{213, 130}, {107, 66}} NO NO @@ -272,12 +337,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{0, 211}, {107, 60}} + {{0, 196}, {107, 66}} NO NO @@ -292,12 +357,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{213, 211}, {107, 60}} + {{213, 196}, {107, 66}} NO NO @@ -312,12 +377,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{107, 91}, {106, 60}} + {{107, 64}, {106, 66}} NO NO @@ -337,7 +402,7 @@ 292 - {{0, 91}, {107, 60}} + {{0, 64}, {107, 66}} 1 @@ -356,12 +421,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{0, 271}, {107, 60}} + {{0, 262}, {107, 66}} NO NO @@ -376,12 +441,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{107, 271}, {106, 60}} + {{107, 262}, {106, 66}} NO NO @@ -401,7 +466,7 @@ 292 - {{213, 271}, {107, 60}} + {{213, 262}, {107, 66}} NO NO @@ -416,12 +481,12 @@ MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - + 292 - {{107, 211}, {106, 60}} + {{107, 196}, {106, 66}} NO NO @@ -441,7 +506,7 @@ 292 - {{160, 331}, {160, 60}} + {{160, 328}, {160, 66}} NO NO @@ -462,39 +527,6 @@ - - - 292 - {{20, 30}, {282, 31}} - - NO - NO - IBCocoaTouchFramework - 0 - - 3 - sip: - - 3 - MAA - - 2 - - - - Helvetica - 24 - 16 - - YES - 17 - - 1 - 3 - IBCocoaTouchFramework - - 3 - {320, 460} @@ -709,6 +741,22 @@ 125 + + + erase + + + + 151 + + + + dialerView + + + + 158 + @@ -744,41 +792,26 @@ YES - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - 41 - - - - - 40 - - - - - 39 - - - 38 @@ -789,6 +822,85 @@ + + 29 + + + + + 114 + + + YES + + + + + + + inCall + + + 117 + + + speaker + + + 116 + + + duration + + + 118 + + + mute + + + 115 + + + display + + + 39 + + + + + 107 + + + hangup + + + 5 + + + Call + + + 7 + + + + + 35 + + + + + 41 + + + + + 40 + + + 36 @@ -815,75 +927,28 @@ - 29 - + 157 + + + YES + + + + Dialer - 7 - - - - - 5 - - - Call - - - 35 - - - - - 107 - - - hangup + 150 + + + Erase 4 - + Address - - 114 - - - YES - - - - - - - inCall - - - 117 - - - speaker - - - 118 - - - mute - - - 116 - - - duration - - - 115 - - - display - @@ -900,15 +965,24 @@ 114.IBEditorWindowLastContentRect 114.IBPluginDependency 114.IBUserGuides + 114.IBViewBoundsToFrameTransform 115.IBPluginDependency 116.CustomClassName 116.IBPluginDependency + 116.IBViewBoundsToFrameTransform 117.CustomClassName 117.IBPluginDependency + 117.IBViewBoundsToFrameTransform 118.CustomClassName 118.IBPluginDependency + 118.IBViewBoundsToFrameTransform + 150.CustomClassName + 150.IBPluginDependency + 150.IBViewBoundsToFrameTransform + 157.IBPluginDependency 29.CustomClassName 29.IBPluginDependency + 29.IBViewBoundsToFrameTransform 30.CustomClassName 30.IBPluginDependency 31.CustomClassName @@ -923,11 +997,14 @@ 36.IBPluginDependency 37.CustomClassName 37.IBPluginDependency + 37.IBViewBoundsToFrameTransform 38.CustomClassName 38.IBPluginDependency + 38.IBViewBoundsToFrameTransform 39.CustomClassName 39.IBPluginDependency 4.IBPluginDependency + 4.IBViewBoundsToFrameTransform 40.CustomClassName 40.IBPluginDependency 41.CustomClassName @@ -953,7 +1030,7 @@ - 90 + 65 1 @@ -969,13 +1046,34 @@ 1 + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIDuration com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABCxAAAwoIAAA + UISpeakerButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDcQAAwpIAAA + UIMuteButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAwpIAAA + + UIEraseButton + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + AUNxAAAAAAAAA + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIDigitButton + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABDVQAAwxsAAA + UIDigitButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIDigitButton @@ -990,13 +1088,18 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIDigitButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAABC1gAAwxsAAA + UIDigitButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIDigitButton - com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + P4AAAL+AAAAAAAAAwxsAAA + UIDigitButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIDigitButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIDigitButton @@ -1004,7 +1107,7 @@ UICallButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{53, 318}, {320, 480}} + {{60, 553}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -1024,7 +1127,7 @@ - 149 + 158 @@ -1033,42 +1136,14 @@ PhoneViewController UIViewController - YES - - YES - doAction: - doKeyPad: - doKeyPadUp: - - - YES - id - id - id - + doKeyPad: + id - YES - - YES - doAction: - doKeyPad: - doKeyPadUp: - - - YES - - doAction: - id - - - doKeyPad: - id - - - doKeyPadUp: - id - + doKeyPad: + + doKeyPad: + id @@ -1079,13 +1154,16 @@ back call callDuration + dialerView eight + erase five four hangup hash incallView mute + myTabBarController nine one peerLabel @@ -1104,13 +1182,16 @@ UIButton UIButton UILabel + UIView UIButton + UIEraseButton UIButton UIButton UIButton UIButton UIView UIButton + UITabBarController UIButton UIButton UILabel @@ -1132,13 +1213,16 @@ back call callDuration + dialerView eight + erase five four hangup hash incallView mute + myTabBarController nine one peerLabel @@ -1169,10 +1253,18 @@ callDuration UILabel + + dialerView + UIView + eight UIButton + + erase + UIEraseButton + five UIButton @@ -1197,6 +1289,10 @@ mute UIButton + + myTabBarController + UITabBarController + nine UIButton @@ -1280,6 +1376,14 @@ Classes/LinphoneUI/UIDuration.h + + UIEraseButton + UIButton + + IBProjectSource + Classes/LinphoneUI/UIEraseButton.h + + UIHangUpButton UIButton @@ -1462,6 +1566,14 @@ UIKit.framework/Headers/UISearchDisplayController.h + + UITabBarController + UIViewController + + IBFrameworkSource + UIKit.framework/Headers/UITabBarController.h + + UITextField UIControl @@ -1512,10 +1624,7 @@ UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - + UIViewController diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 6c18177ba..9e9a7972f 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -64,6 +64,7 @@ 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */; }; 22B5EFE510CE5E5800777D97 /* ContactPickerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */; }; 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5F03410CE6B2F00777D97 /* AddressBook.framework */; }; + 22BB1A69132FF16A005CD7AA /* UIEraseButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22BB1A68132FF16A005CD7AA /* UIEraseButton.m */; }; 22C755601317E59C007BC101 /* UIBluetoothButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 22C7555F1317E59C007BC101 /* UIBluetoothButton.m */; }; 22C7564D13265CF8007BC101 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22C7564C13265CF8007BC101 /* libcrypto.a */; }; 22C7564F13265CF8007BC101 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22C7564E13265CF8007BC101 /* libssl.a */; }; @@ -288,6 +289,8 @@ 22B5EFE310CE5E5800777D97 /* ContactPickerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactPickerDelegate.h; sourceTree = ""; }; 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactPickerDelegate.m; sourceTree = ""; }; 22B5F03410CE6B2F00777D97 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; + 22BB1A67132FF16A005CD7AA /* UIEraseButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEraseButton.h; sourceTree = ""; }; + 22BB1A68132FF16A005CD7AA /* UIEraseButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIEraseButton.m; sourceTree = ""; }; 22C7555E1317E59C007BC101 /* UIBluetoothButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBluetoothButton.h; sourceTree = ""; }; 22C7555F1317E59C007BC101 /* UIBluetoothButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBluetoothButton.m; sourceTree = ""; }; 22C7560513265C6A007BC101 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = ""; }; @@ -669,6 +672,8 @@ 2218A5CE12F973450088A667 /* LogView.h */, 22C7555E1317E59C007BC101 /* UIBluetoothButton.h */, 22C7555F1317E59C007BC101 /* UIBluetoothButton.m */, + 22BB1A67132FF16A005CD7AA /* UIEraseButton.h */, + 22BB1A68132FF16A005CD7AA /* UIEraseButton.m */, ); path = LinphoneUI; sourceTree = ""; @@ -971,6 +976,7 @@ 22968A8812F87C2000588287 /* UIDuration.m in Sources */, 2218A92512FBE1340088A667 /* FirstLoginViewController.m in Sources */, 22C755601317E59C007BC101 /* UIBluetoothButton.m in Sources */, + 22BB1A69132FF16A005CD7AA /* UIEraseButton.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };