OSDN Git Service

Improved debug messages for Cell start/stop with Cell number and block.
[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                 @"Alert Window",         @"AlertWhenDone",
46         nil]];
47 }
48
49 /**
50  * Initializes the preferences controller by loading Preferences.nib file.
51  */
52 - (id)init
53 {
54     if (self = [super initWithWindowNibName:@"Preferences"])
55     {
56         NSAssert([self window], @"[HBPreferencesController init] window outlet is not connected in Preferences.nib");
57     }
58     return self; 
59 }
60
61 /**
62  * Shows the preferences window in modal state.
63  */
64 - (IBAction)runModal:(id)sender
65 {
66     [NSApp runModalForWindow:[self window]];
67 }
68
69 /**
70  * Closes the window and stops modal state. Any changes made in field editor
71  * are saved by [NSWindow endEditingFor:] before closing the window.
72  */
73 - (IBAction)close:(id)sender
74 {
75     [[self window] endEditingFor:nil];
76     [[self window] orderOut:sender];
77     [NSApp stopModal];
78 }
79
80 @end