Add animations preference

This commit is contained in:
Yann Diorcet 2012-08-23 10:25:23 +02:00
parent a1b2f96db3
commit 3e929b8dd7
5 changed files with 24 additions and 6 deletions

View file

@ -183,6 +183,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
[self setString: lp_config_get_string(linphone_core_get_config(lc),"app","rotation_preference", "auto") forKey:@"rotation_preference"]; [self setString: lp_config_get_string(linphone_core_get_config(lc),"app","rotation_preference", "auto") forKey:@"rotation_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"]; [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","debugenable_preference", 0) forKey:@"debugenable_preference"]; [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","debugenable_preference", 0) forKey:@"debugenable_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","animations_preference", 1) forKey:@"animations_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","check_config_disable_preference", 0) forKey:@"check_config_disable_preference"]; [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","check_config_disable_preference", 0) forKey:@"check_config_disable_preference"];
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","wifi_only_preference", 0) forKey:@"wifi_only_preference"]; [self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","wifi_only_preference", 0) forKey:@"wifi_only_preference"];
@ -486,6 +487,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
lp_config_set_int(linphone_core_get_config(lc),"app","debugenable_preference", debugmode); lp_config_set_int(linphone_core_get_config(lc),"app","debugenable_preference", debugmode);
if (debugmode) linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler); if (debugmode) linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
else linphone_core_disable_logs(); else linphone_core_disable_logs();
BOOL animations = [self boolForKey:@"animations_preference"];
lp_config_set_int(linphone_core_get_config(lc),"app","animations_preference", animations);
/*keep this one also in the standardUserDefaults so that it can be read before starting liblinphone*/ /*keep this one also in the standardUserDefaults so that it can be read before starting liblinphone*/
BOOL start_at_boot = [self boolForKey:@"start_at_boot_preference"]; BOOL start_at_boot = [self boolForKey:@"start_at_boot_preference"];

View file

@ -371,9 +371,9 @@
- (IBAction)onPadClick:(id)sender { - (IBAction)onPadClick:(id)sender {
if([padView isHidden]) { if([padView isHidden]) {
[self showPad:TRUE]; [self showPad:[[LinphoneManager instance].settingsStore boolForKey:@"animations_preference"]];
} else { } else {
[self hidePad:TRUE]; [self hidePad:[[LinphoneManager instance].settingsStore boolForKey:@"animations_preference"]];
} }
} }
@ -399,9 +399,9 @@
- (IBAction)onOptionsClick:(id)sender { - (IBAction)onOptionsClick:(id)sender {
if([optionsView isHidden]) { if([optionsView isHidden]) {
[self showOptions:TRUE]; [self showOptions:[[LinphoneManager instance].settingsStore boolForKey:@"animations_preference"]];
} else { } else {
[self hideOptions:TRUE]; [self hideOptions:[[LinphoneManager instance].settingsStore boolForKey:@"animations_preference"]];
} }
} }

View file

@ -484,7 +484,11 @@ static PhoneMainView* phoneMainViewInstance=nil;
if(force || ![view equal: currentView]) { if(force || ![view equal: currentView]) {
if(transition == nil) if(transition == nil)
transition = [PhoneMainView getTransition:currentView new:view]; transition = [PhoneMainView getTransition:currentView new:view];
[mainViewController setViewTransition:transition]; if ([[LinphoneManager instance].settingsStore boolForKey:@"animations_preference"] == true) {
[mainViewController setViewTransition:transition];
} else {
[mainViewController setViewTransition:nil];
}
[mainViewController changeView:view]; [mainViewController changeView:view];
currentView = view; currentView = view;
} }

View file

@ -226,7 +226,7 @@ static UICompositeViewDescription *compositeDescription = nil;
} }
// Animation // Animation
if(animation) { if(animation && [[LinphoneManager instance].settingsStore boolForKey:@"animations_preference"] == true) {
CATransition* trans = [CATransition animation]; CATransition* trans = [CATransition animation];
[trans setType:kCATransitionPush]; [trans setType:kCATransitionPush];
[trans setDuration:0.35]; [trans setDuration:0.35];

View file

@ -14,6 +14,16 @@
<key>Type</key> <key>Type</key>
<string>PSToggleSwitchSpecifier</string> <string>PSToggleSwitchSpecifier</string>
</dict> </dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>animations_preference</string>
<key>Title</key>
<string>Animations</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict> <dict>
<key>DefaultValue</key> <key>DefaultValue</key>
<string>auto</string> <string>auto</string>