OSDN Git Service

MacGui: Disable DVD Drive Auto-Detect option in preferences.
[handbrake-jp/handbrake-jp-git.git] / macosx / HBPreferencesController.m
1 /**
2  * @file
3  * Implementation of class HBPreferencesController.
4  */
5
6 #import "HBPreferencesController.h"
7
8 /**
9  * This class controls the preferences window of HandBrake. Default values for
10  * all preferences and user defaults are specified in class method
11  * @c registerUserDefaults. The preferences window is loaded from
12  * Preferences.nib file when HBPreferencesController is initialized.
13  *
14  * All preferences are bound to user defaults in Interface Builder, therefore
15  * no getter/setter code is needed in this file (unless more complicated
16  * preference settings are added that cannot be handled with Cocoa bindings).
17  */
18 @implementation HBPreferencesController
19
20 /**
21  * Registers default values to user defaults. This is called immediately
22  * when HandBrake starts, from [HBController init].
23  */
24 + (void)registerUserDefaults
25 {
26     NSString *desktopDirectory =  [@"~/Desktop" stringByExpandingTildeInPath];
27     
28     [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
29         @"YES",             @"CheckForUpdates",
30         @"English",         @"DefaultLanguage",
31         @"NO",              @"DefaultMpegName",
32         @"YES",             @"DefaultCrf",
33         @"NO",              @"DefaultDeinterlaceOn",
34         @"YES",             @"DefaultPicSizeAutoiPod",
35         @"NO",              @"PixelRatio",
36         @"",                @"DefAdvancedx264Flags",
37         @"YES",             @"DefaultPresetsDrawerShow",
38         desktopDirectory,   @"LastDestinationDirectory",
39         desktopDirectory,   @"LastSourceDirectory",
40         @"NO",              @"DefaultAutoNaming",
41         @"NO",              @"DefaultChapterMarkers",
42         @"NO",              @"ShowVerboseOutput",
43                 @"NO",              @"AllowLargeFiles",
44                 @"NO",              @"DisableDvdAutoDetect",
45         nil]];
46 }
47
48 /**
49  * Initializes the preferences controller by loading Preferences.nib file.
50  */
51 - (id)init
52 {
53     if (self = [super initWithWindowNibName:@"Preferences"])
54     {
55         NSAssert([self window], @"[HBPreferencesController init] window outlet is not connected in Preferences.nib");
56     }
57     return self; 
58 }
59
60 /**
61  * Shows the preferences window in modal state.
62  */
63 - (IBAction)runModal:(id)sender
64 {
65     [NSApp runModalForWindow:[self window]];
66 }
67
68 /**
69  * Closes the window and stops modal state. Any changes made in field editor
70  * are saved by [NSWindow endEditingFor:] before closing the window.
71  */
72 - (IBAction)close:(id)sender
73 {
74     [[self window] endEditingFor:nil];
75     [[self window] orderOut:sender];
76     [NSApp stopModal];
77 }
78
79 @end