From e94fba9564bd270cddc7f2065ab13d76c68586a3 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 4 Jan 2012 17:24:12 +0100 Subject: [PATCH] Fix Xcode warnings --- Classes/ConferenceCallDetailView.m | 1 + Classes/IncallViewController.m | 133 ++++++++++++------------- Classes/LinphoneUI/UIBluetoothButton.m | 6 +- Classes/LinphoneUI/UICamSwitch.h | 4 +- Classes/LinphoneUI/UICamSwitch.m | 3 +- Classes/PhoneViewController.h | 5 - Classes/PhoneViewController.m | 63 ++++-------- Classes/VideoViewController.h | 2 - 8 files changed, 90 insertions(+), 127 deletions(-) diff --git a/Classes/ConferenceCallDetailView.m b/Classes/ConferenceCallDetailView.m index 884dd0768..08467e3a8 100644 --- a/Classes/ConferenceCallDetailView.m +++ b/Classes/ConferenceCallDetailView.m @@ -18,6 +18,7 @@ @synthesize back; @synthesize hangup; @synthesize table; +@synthesize addCall; @synthesize conferenceDetailCell; diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index ec93cef29..a0d43dce3 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -17,6 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #import "IncallViewController.h" +#import "VideoViewController.h" #import #import #import "linphonecore.h" @@ -58,16 +59,8 @@ const NSInteger SECURE_BUTTON_TAG=5; @synthesize hash; @synthesize videoViewController; -/* -// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { - // Custom initialization +@synthesize addVideo; - } - return self; -} -*/ + (UIImage*) stat_sys_signal_0 { return [[UIImage imageNamed:@"stat_sys_signal_0.png"] retain]; @@ -108,6 +101,63 @@ int callCount(LinphoneCore* lc) { return count; } +-(void) updateUIFromLinphoneState:(UIViewController *)viewCtrl { + activeCallCell = nil; + [mute reset]; + + LinphoneCore* lc; + + @try { + lc = [LinphoneManager getLc]; + + if (callCount([LinphoneManager getLc]) > 1) { + [pause setHidden:YES]; + [mergeCalls setHidden:NO]; + } else { + [pause setHidden:NO]; + [mergeCalls setHidden:YES]; + } + + [callTableView reloadData]; + } @catch (NSException* exc) { + return; + } + LinphoneCall* selectedCall = linphone_core_get_current_call([LinphoneManager getLc]); + int callsCount = linphone_core_get_calls_nb(lc); + // hide pause/resume if in conference + if (selectedCall) { + if (linphone_core_is_in_conference(lc)) + [pause setHidden:YES]; + else if (callCount(lc) == callsCount && callsCount == 1) { + [pause setHidden:NO]; + pause.selected = NO; + } else { + [pause setHidden:YES]; + } + } else { + if (callsCount == 1) { + LinphoneCall* c = (LinphoneCall*)linphone_core_get_calls(lc)->data; + if (linphone_call_get_state(c) == LinphoneCallPaused || + linphone_call_get_state(c) == LinphoneCallPausing) { + [pause setHidden:NO]; + pause.selected = YES; + } + [pause setHidden:NO]; + } else { + [pause setHidden:YES]; + } + } + [mergeCalls setHidden:!pause.hidden]; + + // update conference details view if diaplsyed + if (self.presentedViewController == conferenceDetail) { + if (!linphone_core_is_in_conference(lc)) + [self dismissModalViewControllerAnimated:YES]; + else + [conferenceDetail.table reloadData]; + } +} + // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; @@ -288,7 +338,7 @@ int callCount(LinphoneCore* lc) { } -(void) dismissVideoView { - [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO]; + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; [self dismissModalViewControllerAnimated:FALSE];//just in case mVideoShown=FALSE; } @@ -315,7 +365,7 @@ int callCount(LinphoneCore* lc) { linphone_core_set_native_video_window_id([LinphoneManager getLc],0); linphone_core_set_native_preview_window_id([LinphoneManager getLc],0); } - [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO]; + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; [self dismissModalViewControllerAnimated:FALSE];//just in case } @@ -325,7 +375,7 @@ int callCount(LinphoneCore* lc) { } -(void) displayVideoCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { if (mIncallViewIsReady) { - [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]; + [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; mVideoShown=TRUE; [self presentModalViewController:mVideoViewController animated:true]; } else { @@ -333,65 +383,6 @@ int callCount(LinphoneCore* lc) { mVideoIsPending=TRUE; } } --(void) updateUIFromLinphoneState:(UIViewController *)viewCtrl { - activeCallCell = nil; - [mute reset]; - // if ( - // [pause reset]; - - - LinphoneCore* lc; - - @try { - lc = [LinphoneManager getLc]; - - if (callCount([LinphoneManager getLc]) > 1) { - [pause setHidden:YES]; - [mergeCalls setHidden:NO]; - } else { - [pause setHidden:NO]; - [mergeCalls setHidden:YES]; - } - - [callTableView reloadData]; - } @catch (NSException* exc) { - return; - } - LinphoneCall* selectedCall = linphone_core_get_current_call([LinphoneManager getLc]); - int callsCount = linphone_core_get_calls_nb(lc); - // hide pause/resume if in conference - if (selectedCall) { - if (linphone_core_is_in_conference(lc)) - [pause setHidden:YES]; - else if (callCount(lc) == callsCount && callsCount == 1) { - [pause setHidden:NO]; - pause.selected = NO; - } else { - [pause setHidden:YES]; - } - } else { - if (callsCount == 1) { - LinphoneCall* c = (LinphoneCall*)linphone_core_get_calls(lc)->data; - if (linphone_call_get_state(c) == LinphoneCallPaused || - linphone_call_get_state(c) == LinphoneCallPausing) { - [pause setHidden:NO]; - pause.selected = YES; - } - [pause setHidden:NO]; - } else { - [pause setHidden:YES]; - } - } - [mergeCalls setHidden:!pause.hidden]; - - // update conference details view if diaplsyed - if (self.presentedViewController == conferenceDetail) { - if (!linphone_core_is_in_conference(lc)) - [self dismissModalViewControllerAnimated:YES]; - else - [conferenceDetail.table reloadData]; - } -} - (IBAction)doAction:(id)sender { diff --git a/Classes/LinphoneUI/UIBluetoothButton.m b/Classes/LinphoneUI/UIBluetoothButton.m index 4f3248a39..c565779be 100644 --- a/Classes/LinphoneUI/UIBluetoothButton.m +++ b/Classes/LinphoneUI/UIBluetoothButton.m @@ -29,7 +29,7 @@ if (au!=0) ms_error("UIBluetoothButton error for %s: ret=%ld",method,au) //redirect audio to bluetooth UInt32 size = sizeof(CFStringRef); - CFStringRef route="HeadsetBT"; + CFStringRef route=CFSTR("HeadsetBT"); OSStatus result = AudioSessionSetProperty(kAudioSessionProperty_AudioRoute, size, &route); check_auresult(result,"set kAudioSessionProperty_AudioRoute HeadsetBT"); @@ -52,8 +52,8 @@ if (au!=0) ms_error("UIBluetoothButton error for %s: ret=%ld",method,au) ); check_auresult(result,"set kAudioSessionProperty_OverrideCategoryEnableBluetoothInput 0"); UInt32 size = sizeof(CFStringRef); - CFStringRef route="ReceiverAndMicrophone"; - result = AudioSessionSetProperty(kAudioSessionProperty_AudioRoute, &size, &route); + CFStringRef route=CFSTR("ReceiverAndMicrophone"); + result = AudioSessionSetProperty(kAudioSessionProperty_AudioRoute, size, &route); check_auresult(result,"set kAudioSessionProperty_AudioRoute ReceiverAndMicrophone"); diff --git a/Classes/LinphoneUI/UICamSwitch.h b/Classes/LinphoneUI/UICamSwitch.h index beaab07e6..a3927bf17 100644 --- a/Classes/LinphoneUI/UICamSwitch.h +++ b/Classes/LinphoneUI/UICamSwitch.h @@ -23,8 +23,8 @@ @interface UICamSwitch : UIButton { @private - char* currentCamId; - char* nextCamId; + const char* currentCamId; + const char* nextCamId; UIView* preview; } @property (nonatomic, retain) IBOutlet UIView* preview; diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m index aaa3032e3..45c208c4d 100644 --- a/Classes/LinphoneUI/UICamSwitch.m +++ b/Classes/LinphoneUI/UICamSwitch.m @@ -32,7 +32,8 @@ linphone_core_update_call([LinphoneManager getLc] , linphone_core_get_current_call([LinphoneManager getLc]) ,NULL); - linphone_core_set_native_preview_window_id([LinphoneManager getLc],preview); + linphone_core_set_native_preview_window_id([LinphoneManager getLc], + (unsigned long)preview); } } diff --git a/Classes/PhoneViewController.h b/Classes/PhoneViewController.h index f30177d2c..259af213d 100644 --- a/Classes/PhoneViewController.h +++ b/Classes/PhoneViewController.h @@ -91,11 +91,6 @@ @property (nonatomic, retain) IBOutlet UIButton* switchCamera; - -// method to handle keypad event -- (IBAction)doKeyPad:(id)sender; - - @property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController; @property (nonatomic, retain) IBOutlet MainScreenWithVideoPreview* mMainScreenWithVideoPreview; @end diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 97cd28226..da2455057 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -19,6 +19,7 @@ #import "PhoneViewController.h" #import "linphoneAppDelegate.h" +#import "IncallViewController.h" #import #import #import "LinphoneManager.h" @@ -55,17 +56,25 @@ @synthesize switchCamera; -//implements keypad behavior -/*-(IBAction) doKeyPad:(id)sender { - if (sender == back) { - if ([address.text length] >0) { - NSString* newAddress; - newAddress = [address.text substringToIndex: [address.text length]-1]; - [address setText:newAddress]; - } - } - -}*/ +-(void) updateCallAndBackButtons { + @try { + if (linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) { + [callLarge setHidden:FALSE]; + [callShort setHidden:TRUE]; + [backToCallView setHidden:TRUE]; + } else { + [callShort setEnabled:!linphone_core_sound_resources_locked([LinphoneManager getLc])]; + [callLarge setHidden:TRUE]; + [callShort setHidden:FALSE]; + [backToCallView setHidden:FALSE]; + } + } @catch (NSException* exc) { + // R.A.S: linphone core si simply not ready... + ms_warning("Exception %s: %s", + [exc.name cStringUsingEncoding:[NSString defaultCStringEncoding]], + [exc.reason cStringUsingEncoding:[NSString defaultCStringEncoding]]); + } +} - (void)viewDidAppear:(BOOL)animated { [[UIApplication sharedApplication] setIdleTimerDisabled:true]; @@ -109,20 +118,8 @@ mIncallViewController = [[IncallViewController alloc] initWithNibName:[LinphoneManager runningOnIpad]?@"InCallViewController-ipad":@"IncallViewController" bundle:[NSBundle mainBundle]]; - } - - - -/* - // Override to allow orientations other than the default portrait orientation. - - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // Return YES for supported orientations - return (interfaceOrientation == UIInterfaceOrientationPortrait); - } - */ - - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; @@ -144,26 +141,6 @@ return YES; } --(void) updateCallAndBackButtons { - @try { - if (linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) { - [callLarge setHidden:FALSE]; - [callShort setHidden:TRUE]; - [backToCallView setHidden:TRUE]; - } else { - [callShort setEnabled:!linphone_core_sound_resources_locked([LinphoneManager getLc])]; - [callLarge setHidden:TRUE]; - [callShort setHidden:FALSE]; - [backToCallView setHidden:FALSE]; - } - } @catch (NSException* exc) { - // R.A.S: linphone core si simply not ready... - ms_warning("Exception %s: %s", - [exc.name cStringUsingEncoding:[NSString defaultCStringEncoding]], - [exc.reason cStringUsingEncoding:[NSString defaultCStringEncoding]]); - } -} - -(void)viewWillAppear:(BOOL)animated { [self updateCallAndBackButtons]; } diff --git a/Classes/VideoViewController.h b/Classes/VideoViewController.h index 1cad26a13..7f4db8d17 100644 --- a/Classes/VideoViewController.h +++ b/Classes/VideoViewController.h @@ -71,6 +71,4 @@ - (void) updateCallQualityIndicator; -- (void) waitBeforeUpdatingCallQualityIndicator; - @end \ No newline at end of file