diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h index f185a0445..a17617aa6 100644 --- a/Classes/IncallViewController.h +++ b/Classes/IncallViewController.h @@ -22,6 +22,7 @@ #import "ConferenceCallDetailView.h" #import #include "UILinphone.h" + @class VideoViewController; @interface IncallViewController : UIViewController { @@ -76,22 +77,28 @@ BOOL mIncallViewIsReady; UIImage* verified, *unverified; + UIImage* stat_sys_signal_0, *stat_sys_signal_1, *stat_sys_signal_2, *stat_sys_signal_3, *stat_sys_signal_4; UIActionSheet* zrtpVerificationSheet; } ++ (UIImage*) stat_sys_signal_0; ++ (UIImage*) stat_sys_signal_1; ++ (UIImage*) stat_sys_signal_2; ++ (UIImage*) stat_sys_signal_3; ++ (UIImage*) stat_sys_signal_4; + -(void)displayStatus:(NSString*) message; - (IBAction)doAction:(id)sender; +(LinphoneCall*) retrieveCallAtIndex: (NSInteger) index inConference:(bool) conf; -+ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIButton*)accessoryView withCall:(LinphoneCall*) call; ++ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIView*)accessoryView withCall:(LinphoneCall*) call; @property (nonatomic, retain) IBOutlet UIView* controlSubView; @property (nonatomic, retain) IBOutlet UIView* padSubView; @property (nonatomic, retain) IBOutlet UIView* hangUpView; @property (nonatomic, retain) IBOutlet UIViewController* conferenceDetail; - @property (nonatomic, retain) IBOutlet UIButton* endCtrl; @property (nonatomic, retain) IBOutlet UIButton* dialer; @property (nonatomic, retain) IBOutlet UIButton* mute; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 4edef94a3..a376d0051 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -26,7 +26,6 @@ @implementation IncallViewController - @synthesize controlSubView; @synthesize padSubView; @synthesize hangUpView; @@ -68,6 +67,25 @@ } */ ++ (UIImage*) stat_sys_signal_0 { + return [[UIImage imageNamed:@"stat_sys_signal_0.png"] retain]; +} + ++ (UIImage*) stat_sys_signal_1 { + return [[UIImage imageNamed:@"stat_sys_signal_1.png"] retain]; +} + ++ (UIImage*) stat_sys_signal_2 { + return [[UIImage imageNamed:@"stat_sys_signal_2.png"] retain]; +} + ++ (UIImage*) stat_sys_signal_3 { + return [[UIImage imageNamed:@"stat_sys_signal_3.png"] retain]; +} + ++ (UIImage*) stat_sys_signal_4 { + return [[UIImage imageNamed:@"stat_sys_signal_4.png"] retain];; +} bool isInConference(LinphoneCall* call) { if (!call) @@ -472,7 +490,7 @@ int callCount(LinphoneCore* lc) { [self updateActive:(cell == activeCallCell) cell:cell]; } -+ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIButton*)accessoryView withCall:(LinphoneCall*) call { ++ (void) updateCellImageView:(UIImageView*)imageView Label:(UILabel*)label DetailLabel:(UILabel*)detailLabel AndAccessoryView:(UIView*)accessoryView withCall:(LinphoneCall*) call { if (call == NULL) { ms_warning("UpdateCell called with null call"); [label setText:@""]; @@ -526,9 +544,8 @@ int callCount(LinphoneCore* lc) { [detailLabel setText:ms]; [ms release]; } - + /* if (accessoryView != nil) { - /* LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); if (enc != LinphoneMediaEncryptionNone) { if (accessoryView.imageView.image == nil) { @@ -540,8 +557,8 @@ int callCount(LinphoneCore* lc) { } } else { [accessoryView setImage: (UIImage*)nil forState:UIControlStateNormal]; - }*/ - } + } + }*/ } @@ -573,7 +590,7 @@ int callCount(LinphoneCore* lc) { [self presentModalViewController:conferenceDetail animated:true]; } - + // UITableViewDataSource (required) - (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [callTableView dequeueReusableCellWithIdentifier:@"MyIdentifier"]; @@ -586,48 +603,73 @@ int callCount(LinphoneCore* lc) { } LinphoneCore* lc = [LinphoneManager getLc]; - if (indexPath.row == 0 && linphone_core_get_conference_size(lc) > 0) { + + if (indexPath.row == 0 && linphone_core_get_conference_size(lc) > 0) { [self updateConferenceCell:cell at:indexPath]; if (linphone_core_is_in_conference(lc)) activeCallCell = cell; - cell.accessoryView = nil; + cell.accessoryView = nil; if (linphone_core_is_in_conference(lc)) cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; else cell.accessoryType = UITableViewCellAccessoryNone; } else { - if (cell.accessoryView == nil) { - UIButton* b = [UIButton buttonWithType:UIButtonTypeCustom]; - [b setFrame:CGRectMake(0, 0, 28, 28)]; - [b setImage:nil forState:UIControlStateNormal]; - b.backgroundColor = [UIColor clearColor]; - b.userInteractionEnabled = YES; - cell.accessoryView = b; - } LinphoneCall* call = [IncallViewController retrieveCallAtIndex:indexPath.row inConference:NO]; if (call == nil) return nil; - [IncallViewController updateCellImageView:cell.imageView Label:cell.textLabel DetailLabel:cell.detailTextLabel AndAccessoryView:(UIButton*)cell.accessoryView withCall:call]; + if (cell.accessoryView == nil) { + UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 28)] autorelease]; + cell.accessoryView = containerView; + } + else { + for (UIView *view in cell.accessoryView.subviews) { + [view removeFromSuperview]; + } + } + [IncallViewController updateCellImageView:cell.imageView Label:cell.textLabel DetailLabel:cell.detailTextLabel AndAccessoryView:(UIView*)cell.accessoryView withCall:call]; if (linphone_core_get_current_call(lc) == call) activeCallCell = cell; cell.accessoryType = UITableViewCellAccessoryNone; - - LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); - - UIButton* accessoryBtn = (UIButton*) cell.accessoryView; + + // Call Quality Indicator + UIImageView* callquality = [UIImageView new]; + [callquality setFrame:CGRectMake(0, 0, 28, 28)]; + if (linphone_call_get_average_quality(call) >= 4) { + [callquality setImage: [IncallViewController stat_sys_signal_4]]; + } + else if (linphone_call_get_average_quality(call) >= 3) { + [callquality setImage: [IncallViewController stat_sys_signal_3]]; + } + else if (linphone_call_get_average_quality(call) >= 2) { + [callquality setImage: [IncallViewController stat_sys_signal_2]]; + } + else if (linphone_call_get_average_quality(call) >= 1) { + [callquality setImage: [IncallViewController stat_sys_signal_1]]; + } + else { + [callquality setImage: [IncallViewController stat_sys_signal_0]]; + } + [cell.accessoryView addSubview:callquality]; + + LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); if (enc != LinphoneMediaEncryptionNone) { + UIButton* accessoryBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + [accessoryBtn setFrame:CGRectMake(30, 0, 28, 28)]; + [accessoryBtn setImage:nil forState:UIControlStateNormal]; + accessoryBtn.backgroundColor = [UIColor clearColor]; + accessoryBtn.userInteractionEnabled = YES; + if (enc == LinphoneMediaEncryptionSRTP || linphone_call_get_authentication_token_verified(call)) { [accessoryBtn setImage: verified forState:UIControlStateNormal]; } else { [accessoryBtn setImage: unverified forState:UIControlStateNormal]; } - } else { - [accessoryBtn setImage: (UIImage*)nil forState:UIControlStateNormal]; - } - - if (((UIButton*)cell.accessoryView).imageView.image != nil && linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) == LinphoneMediaEncryptionZRTP) { - [((UIButton*)cell.accessoryView) addTarget:self action:@selector(secureIconPressed:withEvent:) forControlEvents:UIControlEventTouchUpInside]; - } + [cell.accessoryView addSubview:accessoryBtn]; + + if (((UIButton*)accessoryBtn).imageView.image != nil && linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) == LinphoneMediaEncryptionZRTP) { + [((UIButton*)accessoryBtn) addTarget:self action:@selector(secureIconPressed:withEvent:) forControlEvents:UIControlEventTouchUpInside]; + } + } } cell.userInteractionEnabled = YES; diff --git a/Resources/stat_sys_signal_0.png b/Resources/stat_sys_signal_0.png new file mode 100644 index 000000000..0b7a04f44 Binary files /dev/null and b/Resources/stat_sys_signal_0.png differ diff --git a/Resources/stat_sys_signal_1.png b/Resources/stat_sys_signal_1.png new file mode 100644 index 000000000..5376e9258 Binary files /dev/null and b/Resources/stat_sys_signal_1.png differ diff --git a/Resources/stat_sys_signal_2.png b/Resources/stat_sys_signal_2.png new file mode 100644 index 000000000..fd543636c Binary files /dev/null and b/Resources/stat_sys_signal_2.png differ diff --git a/Resources/stat_sys_signal_3.png b/Resources/stat_sys_signal_3.png new file mode 100644 index 000000000..6c4873af3 Binary files /dev/null and b/Resources/stat_sys_signal_3.png differ diff --git a/Resources/stat_sys_signal_4.png b/Resources/stat_sys_signal_4.png new file mode 100644 index 000000000..a3320cbb4 Binary files /dev/null and b/Resources/stat_sys_signal_4.png differ