瀏覽代碼

Use boolValue instead of intValue for settings options

Gleb Pinigin 12 年之前
父節點
當前提交
faa0c47009
共有 3 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      AspenProject/VLCAppDelegate.m
  2. 2 2
      AspenProject/VLCMovieViewController.m
  3. 1 1
      AspenProject/VLCSettingsController.m

+ 1 - 1
AspenProject/VLCAppDelegate.m

@@ -139,7 +139,7 @@
 {
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     NSString *passcode = [defaults objectForKey:kVLCSettingPasscodeKey];
-    if ([passcode isEqualToString:@""] || ![[defaults objectForKey:kVLCSettingPasscodeOnKey] intValue]) {
+    if ([passcode isEqualToString:@""] || ![[defaults objectForKey:kVLCSettingPasscodeOnKey] boolValue]) {
         self.passcodeValidated = YES;
         return;
     }

+ 2 - 2
AspenProject/VLCMovieViewController.m

@@ -83,8 +83,8 @@
 - (void)viewWillAppear:(BOOL)animated
 {
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-    NSArray *options = @[[[defaults objectForKey:kVLCSettingVerboseOutput] intValue] ? kVLCSettingVerboseOutputOnValue : kVLCSettingVerboseOutputOffValue,
-                         [[defaults objectForKey:kVLCSettingStretchAudio] intValue] ? kVLCSettingStretchAudioOnValue : kVLCSettingStretchAudioOffValue,
+    NSArray *options = @[[[defaults objectForKey:kVLCSettingVerboseOutput] boolValue] ? kVLCSettingVerboseOutputOnValue : kVLCSettingVerboseOutputOffValue,
+                         [[defaults objectForKey:kVLCSettingStretchAudio] boolValue] ? kVLCSettingStretchAudioOnValue : kVLCSettingStretchAudioOffValue,
                          [NSString stringWithFormat:@"--subsdec-encoding=%@",[defaults objectForKey:kVLCSettingTextEncoding]]];
 
     _mediaPlayer = [[VLCMediaPlayer alloc] initWithOptions:options];

+ 1 - 1
AspenProject/VLCSettingsController.m

@@ -31,7 +31,7 @@
 - (void)settingDidChange:(NSNotification*)notification
 {
     if ([notification.object isEqual:kVLCSettingPasscodeOnKey]) {
-        BOOL passcodeOn = (BOOL)[[notification.userInfo objectForKey:kVLCSettingPasscodeOnKey] intValue];
+        BOOL passcodeOn = [[notification.userInfo objectForKey:kVLCSettingPasscodeOnKey] boolValue];
 
         if (passcodeOn) {
             PAPasscodeViewController *passcodeLockController = [[PAPasscodeViewController alloc] initForAction:PasscodeActionSet];