diff --git a/Classes/ConferenceCallDetailView.h b/Classes/ConferenceCallDetailView.h index ccc5d10c8..8e1e19de0 100644 --- a/Classes/ConferenceCallDetailView.h +++ b/Classes/ConferenceCallDetailView.h @@ -29,4 +29,6 @@ @property (nonatomic, retain) IBOutlet UITableView* table; @property (nonatomic, assign) IBOutlet UITableViewCell* conferenceDetailCell; + +-(void) updateCallQuality; @end diff --git a/Classes/ConferenceCallDetailView.m b/Classes/ConferenceCallDetailView.m index 0ca6890c5..ede51d08b 100644 --- a/Classes/ConferenceCallDetailView.m +++ b/Classes/ConferenceCallDetailView.m @@ -21,6 +21,8 @@ @synthesize conferenceDetailCell; +NSTimer *callQualityRefresher; + - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -75,6 +77,25 @@ [speaker reset]; } +-(void) viewDidAppear:(BOOL)animated { + callQualityRefresher = [NSTimer scheduledTimerWithTimeInterval:1 + target:self + selector:@selector(updateCallQuality) + userInfo:nil + repeats:YES]; +} + +-(void) viewDidDisappear:(BOOL)animated { + if (callQualityRefresher != nil) { + [callQualityRefresher invalidate]; + callQualityRefresher=nil; + } +} + +-(void) updateCallQuality { + [table setNeedsDisplay]; +} + #pragma mark - UITableView delegates -(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row % 2) @@ -97,9 +118,38 @@ UILabel* label = (UILabel*) [cell viewWithTag:2]; /* update cell content */ - LinphoneCall* call = [IncallViewController retrieveCallAtIndex:indexPath.row inConference:YES]; + LinphoneCall* call = [IncallViewController retrieveCallAtIndex:indexPath.row inConference:YES]; [IncallViewController updateCellImageView:image Label:label DetailLabel:nil AndAccessoryView:nil withCall:call]; + cell.accessoryType = UITableViewCellAccessoryNone; + if (cell.accessoryView == nil) { + UIView *containerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)] autorelease]; + cell.accessoryView = containerView; + } + else { + for (UIView *view in cell.accessoryView.subviews) { + [view removeFromSuperview]; + } + } + 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]; + tableView.rowHeight = 80;//cell.bounds.size.height; return cell; diff --git a/Classes/VideoViewController.m b/Classes/VideoViewController.m index fe4b931a5..d9f677f2f 100644 --- a/Classes/VideoViewController.m +++ b/Classes/VideoViewController.m @@ -44,6 +44,8 @@ @synthesize mHangUpLandLeft; @synthesize mCamSwitchLandLeft; +NSTimer *callQualityRefresher; + - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -79,16 +81,8 @@ [mCamSwitchLandRight setPreview:mPreviewLandRight]; [mCamSwitchLandLeft setPreview:mPreviewLandLeft]; - [self performSelector:@selector(waitBeforeUpdatingCallQualityIndicator) withObject:nil afterDelay:1]; isFirst=TRUE; } - -- (void) waitBeforeUpdatingCallQualityIndicator -{ - [self performSelectorOnMainThread:@selector(updateCallQualityIndicator) withObject:nil waitUntilDone:YES]; - - [self performSelector:@selector(waitBeforeUpdatingCallQualityIndicator) withObject:nil afterDelay:1]; -} - (void) updateCallQualityIndicator { @@ -158,6 +152,11 @@ [super viewDidDisappear:animated]; [[UIApplication sharedApplication] setIdleTimerDisabled:NO]; linphone_core_set_max_calls([LinphoneManager getLc], maxCall); + + if (callQualityRefresher != nil) { + [callQualityRefresher invalidate]; + callQualityRefresher=nil; + } } -(void) viewWillAppear:(BOOL)animated { @@ -183,6 +182,12 @@ - (void) viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; + + callQualityRefresher = [NSTimer scheduledTimerWithTimeInterval:1 + target:self + selector:@selector(updateCallQualityIndicator) + userInfo:nil + repeats:YES]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {