Log 'toggle buttons' state change

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2012-01-09 11:21:52 +01:00
parent 8bbd36a62a
commit bcc0bcee80
6 changed files with 16 additions and 12 deletions

View file

@ -51,8 +51,8 @@ NSTimer *callQualityRefresher;
table.rowHeight = 80;
[mute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] ];
[speaker initWithOnImage:[UIImage imageNamed:@"HP_inverse.png"] offImage:[UIImage imageNamed:@"HP.png"] ];
[mute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] debugName:"MUTE button"];
[speaker initWithOnImage:[UIImage imageNamed:@"HP_inverse.png"] offImage:[UIImage imageNamed:@"HP.png"] debugName:"SPEAKER button"];
}
-(void) backButtonPressed {

View file

@ -161,8 +161,8 @@ int callCount(LinphoneCore* lc) {
- (void)viewDidLoad {
[super viewDidLoad];
//Controls
[mute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] ];
[speaker initWithOnImage:[UIImage imageNamed:@"HP_inverse.png"] offImage:[UIImage imageNamed:@"HP.png"] ];
[mute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] debugName:"MUTE button"];
[speaker initWithOnImage:[UIImage imageNamed:@"HP_inverse.png"] offImage:[UIImage imageNamed:@"HP.png"] debugName:"SPEAKER button"];
verified = [[UIImage imageNamed:@"secured.png"] retain];
unverified = [[UIImage imageNamed:@"unverified.png"] retain];

View file

@ -34,8 +34,8 @@ static void audioRouteChangeListenerCallback (
}
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage {
[super initWithOnImage:onImage offImage:offImage];
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage debugName:(const char *)name{
[super initWithOnImage:onImage offImage:offImage debugName:name];
AudioSessionPropertyID routeChangeID = kAudioSessionProperty_AudioRouteChange;
AudioSessionInitialize(NULL, NULL, NULL, NULL);
OSStatus lStatus = AudioSessionAddPropertyListener(routeChangeID, audioRouteChangeListenerCallback, self);

View file

@ -30,10 +30,11 @@
UIImage* mOnImage;
UIImage* mOffImage;
bool mIsOn;
const char* debugName;
}
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage;
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage debugName:(const char*) name;
-(bool) reset;
-(bool) isOn;
-(bool) toggle;

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "UIToggleButton.h"
#include "linphonecore.h"
@implementation UIToggleButton
@ -28,6 +28,8 @@
return mIsOn;
}
-(bool) toggle {
ms_message("UI - Toggle button '%s' state change %d -> %d",
debugName, mIsOn, !mIsOn);
if (mIsOn) {
[self setImage:mOffImage forState:UIControlStateNormal];
mIsOn=!mIsOn;
@ -46,10 +48,11 @@
return mIsOn;
}
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage {
-(void) initWithOnImage:(UIImage*) onImage offImage:(UIImage*) offImage debugName:(const char *)name{
mOnImage = [onImage retain];
mOffImage = [offImage retain];
mIsOn=false;
debugName = name;
[self reset];
[self addTarget:self action:@selector(touchUp:) forControlEvents:UIControlEventTouchUpInside];

View file

@ -78,9 +78,9 @@ NSTimer *callQualityRefresher;
- (void)viewDidLoad
{
[super viewDidLoad];
[mMute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] ];
[mMuteLandRight initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] ];
[mMuteLandLeft initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] ];
[mMute initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] debugName:"MUTE button"];
[mMuteLandRight initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] debugName:"MUTE2 button"];
[mMuteLandLeft initWithOnImage:[UIImage imageNamed:@"micro_inverse.png"] offImage:[UIImage imageNamed:@"micro.png"] debugName:"MUTE3 button"];
[mCamSwitch setPreview:mPreview];
[mCamSwitchLandRight setPreview:mPreviewLandRight];
[mCamSwitchLandLeft setPreview:mPreviewLandLeft];