diff options
author | cleaner <[email protected]> | 2007-06-06 17:12:12 +0000 |
---|---|---|
committer | cleaner <[email protected]> | 2007-06-06 17:12:12 +0000 |
commit | c28fb996414514bc90ab6a9ac103afe428fb102c (patch) | |
tree | 9bc5b9fe278c666fafb3b61f157fc679e4316f5a /macosx | |
parent | 98d438e568256d1815c374651c41090111b0db45 (diff) |
- Moved preferences window from MainMenu.nib to Preferences.nib
- Moved languages from PrefsController.m to Preferences.nib
- Renamed PrefsController to HBPreferencesController
- Implemented bindings in Preferences.nib
- Enabled autocomplete in audio language combobox
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@601 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.mm | 24 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/classes.nib | 1 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/info.nib | 6 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.nib/keyedobjects.nib | bin | 133367 -> 121111 bytes | |||
-rw-r--r-- | macosx/English.lproj/Preferences.nib/classes.nib | 11 | ||||
-rw-r--r-- | macosx/English.lproj/Preferences.nib/info.nib | 16 | ||||
-rw-r--r-- | macosx/English.lproj/Preferences.nib/keyedobjects.nib | bin | 0 -> 18388 bytes | |||
-rw-r--r-- | macosx/HBPreferencesController.h | 17 | ||||
-rw-r--r-- | macosx/HBPreferencesController.m | 78 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 32 | ||||
-rw-r--r-- | macosx/PrefsController.h | 33 | ||||
-rw-r--r-- | macosx/PrefsController.m | 395 |
12 files changed, 165 insertions, 448 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm index e2fac51ab..9584f169a 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -7,14 +7,10 @@ #include "Controller.h" #include "a52dec/a52.h" #import "HBOutputPanelController.h" -#import "PrefsController.h" +#import "HBPreferencesController.h" #define _(a) NSLocalizedString(a,NULL) - - - - static int FormatSettings[3][4] = { { HB_MUX_MP4 | HB_VCODEC_FFMPEG | HB_ACODEC_FAAC, HB_MUX_MP4 | HB_VCODEC_X264 | HB_ACODEC_FAAC, @@ -37,7 +33,7 @@ static int FormatSettings[3][4] = - init { self = [super init]; - [PrefsController registerUserDefaults]; + [HBPreferencesController registerUserDefaults]; fHandle = NULL; outputPanel = [[HBOutputPanelController alloc] init]; return self; @@ -3387,9 +3383,23 @@ id theRecord, theValue; URLWithString:@"http://handbrake.m0k.org/trac/wiki/HandBrakeGuide"]]; } +/** + * Shows debug output window. + */ - (IBAction)showDebugOutputPanel:(id)sender { - [outputPanel showOutputPanel:nil]; + [outputPanel showOutputPanel:sender]; +} + +/** + * Creates preferences controller, shows preferences window modally, and + * releases the controller after user has closed the window. + */ +- (IBAction)showPreferencesWindow:(id)sender +{ + HBPreferencesController *controller = [[HBPreferencesController alloc] init]; + [controller runModal:nil]; + [controller release]; } @end diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 6f7f2be17..ea774a1bc 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -41,6 +41,7 @@ X264AdvancedOptionsStandardizeOptString = id; showDebugOutputPanel = id; showGrowlDoneNotification = id; + showPreferencesWindow = id; tableViewSelected = id; }; CLASS = HBController; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 421967e0d..d8e8e2321 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -9,7 +9,7 @@ <key>1843</key> <string>863 409 220 592 0 0 1920 1058 </string> <key>29</key> - <string>225 581 365 44 0 0 1920 1058 </string> + <string>132 421 365 44 0 0 1280 778 </string> </dict> <key>IBFramework Version</key> <string>446.1</string> @@ -19,11 +19,11 @@ </array> <key>IBOpenObjects</key> <array> - <integer>21</integer> <integer>29</integer> + <integer>21</integer> </array> <key>IBSystem Version</key> - <string>8L127</string> + <string>8P2137</string> <key>IBUserGuides</key> <dict> <key>21</key> diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib Binary files differindex 8480e2ad3..d677534d1 100644 --- a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib +++ b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib diff --git a/macosx/English.lproj/Preferences.nib/classes.nib b/macosx/English.lproj/Preferences.nib/classes.nib new file mode 100644 index 000000000..0451c4903 --- /dev/null +++ b/macosx/English.lproj/Preferences.nib/classes.nib @@ -0,0 +1,11 @@ +{ + IBClasses = ( + { + ACTIONS = {close = id; runModal = id; }; + CLASS = HBPreferencesController; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/macosx/English.lproj/Preferences.nib/info.nib b/macosx/English.lproj/Preferences.nib/info.nib new file mode 100644 index 000000000..9186f2909 --- /dev/null +++ b/macosx/English.lproj/Preferences.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>6 1 356 240 0 0 1280 778 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8P2137</string> +</dict> +</plist> diff --git a/macosx/English.lproj/Preferences.nib/keyedobjects.nib b/macosx/English.lproj/Preferences.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..877457fa0 --- /dev/null +++ b/macosx/English.lproj/Preferences.nib/keyedobjects.nib diff --git a/macosx/HBPreferencesController.h b/macosx/HBPreferencesController.h new file mode 100644 index 000000000..221a088b4 --- /dev/null +++ b/macosx/HBPreferencesController.h @@ -0,0 +1,17 @@ +/** + * @file + * Interface of class HBPreferencesController. + */ + +#import <Cocoa/Cocoa.h> + +@interface HBPreferencesController : NSWindowController +{ +} + ++ (void)registerUserDefaults; +- (id)init; +- (IBAction)runModal:(id)sender; +- (IBAction)close:(id)sender; + +@end diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m new file mode 100644 index 000000000..3fe75b903 --- /dev/null +++ b/macosx/HBPreferencesController.m @@ -0,0 +1,78 @@ +/** + * @file + * Implementation of class HBPreferencesController. + */ + +#import "HBPreferencesController.h" + +/** + * This class controls the preferences window of HandBrake. Default values for + * all preferences and user defaults are specified in class method + * @c registerUserDefaults. The preferences window is loaded from + * Preferences.nib file when HBPreferencesController is initialized. + * + * All preferences are bound to user defaults in Interface Builder, therefore + * no getter/setter code is needed in this file (unless more complicated + * preference settings are added that cannot be handled with Cocoa bindings). + */ +@implementation HBPreferencesController + +/** + * Registers default values to user defaults. This is called immediately + * when HandBrake starts, from [HBController init]. + */ ++ (void)registerUserDefaults +{ + NSString *desktopDirectory = [@"~/Desktop" stringByExpandingTildeInPath]; + + [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: + @"YES", @"CheckForUpdates", + @"English", @"DefaultLanguage", + @"NO", @"DefaultMpegName", + @"YES", @"DefaultCrf", + @"NO", @"DefaultDeinterlaceOn", + @"YES", @"DefaultPicSizeAutoiPod", + @"NO", @"PixelRatio", + @"NO", @"DefAdvancedx264FlagsShow", + @"", @"DefAdvancedx264Flags", + @"YES", @"DefaultPresetsDrawerShow", + desktopDirectory, @"LastDestinationDirectory", + desktopDirectory, @"LastSourceDirectory", + @"NO", @"DefaultAutoNaming", + @"NO", @"DefaultChapterMarkers", + @"NO", @"ShowVerboseOutput", + nil]]; +} + +/** + * Initializes the preferences controller by loading Preferences.nib file. + */ +- (id)init +{ + if (self = [super initWithWindowNibName:@"Preferences"]) + { + NSAssert([self window], @"[HBPreferencesController init] window outlet is not connected in Preferences.nib"); + } + return self; +} + +/** + * Shows the preferences window in modal state. + */ +- (IBAction)runModal:(id)sender +{ + [NSApp runModalForWindow:[self window]]; +} + +/** + * Closes the window and stops modal state. Any changes made in field editor + * are saved by [NSWindow endEditingFor:] before closing the window. + */ +- (IBAction)close:(id)sender +{ + [[self window] endEditingFor:nil]; + [[self window] orderOut:sender]; + [NSApp stopModal]; +} + +@end diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index e978dc9fc..afcc631f2 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -74,6 +74,9 @@ 2538860C0BFE0B730064E995 /* OutputPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 2538860A0BFE0B730064E995 /* OutputPanel.nib */; }; 253886170BFE0C160064E995 /* HBOutputPanelController.h in Headers */ = {isa = PBXBuildFile; fileRef = 253886150BFE0C160064E995 /* HBOutputPanelController.h */; }; 253886180BFE0C160064E995 /* HBOutputPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 253886160BFE0C160064E995 /* HBOutputPanelController.m */; }; + 25DE1FAD0C1699E500F01FC8 /* Preferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 25DE1FAB0C1699E500F01FC8 /* Preferences.nib */; }; + 25DE1FB60C169A0C00F01FC8 /* HBPreferencesController.h in Headers */ = {isa = PBXBuildFile; fileRef = 25DE1FB40C169A0C00F01FC8 /* HBPreferencesController.h */; }; + 25DE1FB70C169A0C00F01FC8 /* HBPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 25DE1FB50C169A0C00F01FC8 /* HBPreferencesController.m */; }; 4D1125D809D72FD200E0657B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D1125D709D72FD200E0657B /* libz.dylib */; }; 4D1125D909D72FD200E0657B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D1125D709D72FD200E0657B /* libz.dylib */; }; 4D1EA2EA0993B09A00FDC1A2 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.mm */; }; @@ -90,7 +93,6 @@ 4DD93F91082036E8008E1322 /* ScanController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D86C74F07281F4E007BA979 /* ScanController.h */; }; 4DD93F92082036E8008E1322 /* PictureController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1FD381073D19CE00E46515 /* PictureController.h */; }; 4DD93F93082036E8008E1322 /* QueueController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DD27BA507C0065C0023D231 /* QueueController.h */; }; - 4DD93F94082036E8008E1322 /* PrefsController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DE93A3507F5A2C900F3C78F /* PrefsController.h */; }; 4DD93F96082036E8008E1322 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; }; 4DD93F97082036E8008E1322 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 4DD93F9A082036E8008E1322 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.mm */; settings = {ATTRIBUTES = (); }; }; @@ -99,7 +101,6 @@ 4DD93F9D082036E8008E1322 /* ScanController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4D86C74E07281F4E007BA979 /* ScanController.mm */; }; 4DD93F9E082036E8008E1322 /* PictureController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4D1FD382073D19CE00E46515 /* PictureController.mm */; }; 4DD93F9F082036E8008E1322 /* QueueController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4DD27BA607C0065C0023D231 /* QueueController.mm */; }; - 4DD93FA0082036E8008E1322 /* PrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DE93A3607F5A2C900F3C78F /* PrefsController.m */; }; 4DD93FA2082036E8008E1322 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 4DD93FA3082036E8008E1322 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DEB2024052B055F00C39CA9 /* IOKit.framework */; }; 4DD93FA4082036E8008E1322 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DDE9724052B7B2B00C39CA9 /* OpenGL.framework */; }; @@ -192,6 +193,9 @@ 2538860B0BFE0B730064E995 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/OutputPanel.nib; sourceTree = "<group>"; }; 253886150BFE0C160064E995 /* HBOutputPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBOutputPanelController.h; sourceTree = "<group>"; }; 253886160BFE0C160064E995 /* HBOutputPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBOutputPanelController.m; sourceTree = "<group>"; }; + 25DE1FAC0C1699E500F01FC8 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; }; + 25DE1FB40C169A0C00F01FC8 /* HBPreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPreferencesController.h; sourceTree = "<group>"; }; + 25DE1FB50C169A0C00F01FC8 /* HBPreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPreferencesController.m; sourceTree = "<group>"; }; 29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; }; 29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; @@ -215,8 +219,6 @@ 4DD27BA507C0065C0023D231 /* QueueController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = QueueController.h; sourceTree = "<group>"; }; 4DD27BA607C0065C0023D231 /* QueueController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = QueueController.mm; sourceTree = "<group>"; }; 4DDE9724052B7B2B00C39CA9 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; }; - 4DE93A3507F5A2C900F3C78F /* PrefsController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PrefsController.h; sourceTree = "<group>"; }; - 4DE93A3607F5A2C900F3C78F /* PrefsController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PrefsController.m; sourceTree = "<group>"; }; 4DEB2024052B055F00C39CA9 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; }; 4DF3C8CB052889CD00A80101 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = "<group>"; }; 4DF3C8CC052889CD00A80101 /* Controller.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = Controller.mm; sourceTree = "<group>"; }; @@ -300,6 +302,7 @@ 526FBC8D0B4CA9F90064E04C /* libhb Sources */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); @@ -319,9 +322,9 @@ children = ( 0DFA5C7A0B8DD1E90020BC09 /* HandBrake.icns */, 29B97318FDCFA39411CA2CEA /* MainMenu.nib */, - 4D1EA3000993B13700FDC1A2 /* Express.nib */, - 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 2538860A0BFE0B730064E995 /* OutputPanel.nib */, + 25DE1FAB0C1699E500F01FC8 /* Preferences.nib */, + 4D1EA3000993B13700FDC1A2 /* Express.nib */, ); name = Resources; sourceTree = "<group>"; @@ -400,8 +403,6 @@ 4D85758F052B78E300C39CA9 /* PictureGLView.h */, 4DD27BA507C0065C0023D231 /* QueueController.h */, 4DD27BA607C0065C0023D231 /* QueueController.mm */, - 4DE93A3507F5A2C900F3C78F /* PrefsController.h */, - 4DE93A3607F5A2C900F3C78F /* PrefsController.m */, 4D3ECC2509A4917000B2E45F /* WhiteBox.h */, 4D3ECC2609A4917000B2E45F /* WhiteBox.m */, 4D2AE78909CCB24C007E18F6 /* DriveDetector.m */, @@ -412,6 +413,8 @@ 253886000BFE0A5B0064E995 /* HBOutputRedirect.m */, 253886150BFE0C160064E995 /* HBOutputPanelController.h */, 253886160BFE0C160064E995 /* HBOutputPanelController.m */, + 25DE1FB40C169A0C00F01FC8 /* HBPreferencesController.h */, + 25DE1FB50C169A0C00F01FC8 /* HBPreferencesController.m */, ); name = "HandBrake Sources"; sourceTree = "<group>"; @@ -453,10 +456,10 @@ 4DD93F91082036E8008E1322 /* ScanController.h in Headers */, 4DD93F92082036E8008E1322 /* PictureController.h in Headers */, 4DD93F93082036E8008E1322 /* QueueController.h in Headers */, - 4DD93F94082036E8008E1322 /* PrefsController.h in Headers */, 4D2AEA2A09CCB8FC007E18F6 /* DriveDetector.h in Headers */, 253886010BFE0A5B0064E995 /* HBOutputRedirect.h in Headers */, 253886170BFE0C160064E995 /* HBOutputPanelController.h in Headers */, + 25DE1FB60C169A0C00F01FC8 /* HBPreferencesController.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -592,6 +595,7 @@ 4DD93F97082036E8008E1322 /* InfoPlist.strings in Resources */, 0DFA5C7B0B8DD1E90020BC09 /* HandBrake.icns in Resources */, 2538860C0BFE0B730064E995 /* OutputPanel.nib in Resources */, + 25DE1FAD0C1699E500F01FC8 /* Preferences.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -703,10 +707,10 @@ 4DD93F9D082036E8008E1322 /* ScanController.mm in Sources */, 4DD93F9E082036E8008E1322 /* PictureController.mm in Sources */, 4DD93F9F082036E8008E1322 /* QueueController.mm in Sources */, - 4DD93FA0082036E8008E1322 /* PrefsController.m in Sources */, 4D2AEA2909CCB8F9007E18F6 /* DriveDetector.m in Sources */, 253886020BFE0A5B0064E995 /* HBOutputRedirect.m in Sources */, 253886180BFE0C160064E995 /* HBOutputPanelController.m in Sources */, + 25DE1FB70C169A0C00F01FC8 /* HBPreferencesController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -747,6 +751,14 @@ name = OutputPanel.nib; sourceTree = "<group>"; }; + 25DE1FAB0C1699E500F01FC8 /* Preferences.nib */ = { + isa = PBXVariantGroup; + children = ( + 25DE1FAC0C1699E500F01FC8 /* English */, + ); + name = Preferences.nib; + sourceTree = "<group>"; + }; 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { isa = PBXVariantGroup; children = ( diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h deleted file mode 100644 index af5a7b6fe..000000000 --- a/macosx/PrefsController.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file - * Interface of class PrefsController. - */ - -#include <Cocoa/Cocoa.h> - -@interface PrefsController : NSObject -{ - IBOutlet NSPanel * fPanel; - IBOutlet NSButton * fUpdateCheck; - IBOutlet NSComboBox * fdefaultlanguage; - IBOutlet NSButton * fFileExtItunes; - IBOutlet NSButton * fDefCrf; - IBOutlet NSButton * fDefDeinterlace; - IBOutlet NSButton * fDefPicSizeAutoSetipod; - IBOutlet NSButton * fDefPixelRatio; - IBOutlet NSButton * fDefPresetDrawerShow; - IBOutlet NSButton * fDefAutoNaming; - IBOutlet NSButton * fDefChapterMarkers; - - IBOutlet NSTextField * fDefAdvancedx264FlagsView; - IBOutlet NSButton * fDefAdvancedx264FlagsShow; - -} - -+ (void)registerUserDefaults; - -- (IBAction) OpenPanel: (id) sender; -- (IBAction) ClosePanel: (id) sender; -- (IBAction) CheckChanged: (id) sender; - -@end diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m deleted file mode 100644 index 7a6e6cbc3..000000000 --- a/macosx/PrefsController.m +++ /dev/null @@ -1,395 +0,0 @@ -/** - * @file - * Implementation of class PrefsController. - */ - -#import "PrefsController.h" - -@implementation PrefsController - -/** - * Registers default values to user defaults. This is called immediately - * when HandBrake starts, from [HBController init]. - */ -+ (void)registerUserDefaults -{ - NSString *desktopDirectory = [@"~/Desktop" stringByExpandingTildeInPath]; - - [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - @"YES", @"CheckForUpdates", - @"English", @"DefaultLanguage", - @"NO", @"DefaultMpegName", - @"YES", @"DefaultCrf", - @"NO", @"DefaultDeinterlaceOn", - @"YES", @"DefaultPicSizeAutoiPod", - @"NO", @"PixelRatio", - @"NO", @"DefAdvancedx264FlagsShow", - @"", @"DefAdvancedx264Flags", - @"YES", @"DefaultPresetsDrawerShow", - desktopDirectory, @"LastDestinationDirectory", - desktopDirectory, @"LastSourceDirectory", - @"NO", @"DefaultAutoNaming", - @"NO", @"DefaultChapterMarkers", - @"NO", @"ShowVerboseOutput", - nil]]; -} - -- (void) awakeFromNib -{ - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - /* fUpdateCheck Check or uncheck according to the preferences */ - [fUpdateCheck setState: [defaults boolForKey:@"CheckForUpdates"] ? - NSOnState : NSOffState]; - - // Fill the languages combobox - [fdefaultlanguage removeAllItems]; - [fdefaultlanguage addItemWithObjectValue: @"Afar"]; - [fdefaultlanguage addItemWithObjectValue: @"Abkhazian"]; - [fdefaultlanguage addItemWithObjectValue: @"Afrikaans"]; - [fdefaultlanguage addItemWithObjectValue: @"Albanian"]; - [fdefaultlanguage addItemWithObjectValue: @"Amharic"]; - [fdefaultlanguage addItemWithObjectValue: @"Arabic"]; - [fdefaultlanguage addItemWithObjectValue: @"Armenian"]; - [fdefaultlanguage addItemWithObjectValue: @"Assamese"]; - [fdefaultlanguage addItemWithObjectValue: @"Avestan"]; - [fdefaultlanguage addItemWithObjectValue: @"Aymara"]; - [fdefaultlanguage addItemWithObjectValue: @"Azerbaijani"]; - [fdefaultlanguage addItemWithObjectValue: @"Bashkir"]; - [fdefaultlanguage addItemWithObjectValue: @"Basque"]; - [fdefaultlanguage addItemWithObjectValue: @"Belarusian"]; - [fdefaultlanguage addItemWithObjectValue: @"Bengali"]; - [fdefaultlanguage addItemWithObjectValue: @"Bihari"]; - [fdefaultlanguage addItemWithObjectValue: @"Bislama"]; - [fdefaultlanguage addItemWithObjectValue: @"Bosnian"]; - [fdefaultlanguage addItemWithObjectValue: @"Breton"]; - [fdefaultlanguage addItemWithObjectValue: @"Bulgarian"]; - [fdefaultlanguage addItemWithObjectValue: @"Burmese"]; - [fdefaultlanguage addItemWithObjectValue: @"Catalan"]; - [fdefaultlanguage addItemWithObjectValue: @"Chamorro"]; - [fdefaultlanguage addItemWithObjectValue: @"Chechen"]; - [fdefaultlanguage addItemWithObjectValue: @"Chichewa; Nyanja"]; - [fdefaultlanguage addItemWithObjectValue: @"Chinese"]; - [fdefaultlanguage addItemWithObjectValue: @"Church Slavic"]; - [fdefaultlanguage addItemWithObjectValue: @"Chuvash"]; - [fdefaultlanguage addItemWithObjectValue: @"Cornish"]; - [fdefaultlanguage addItemWithObjectValue: @"Corsican"]; - [fdefaultlanguage addItemWithObjectValue: @"Croatian"]; - [fdefaultlanguage addItemWithObjectValue: @"Czech"]; - [fdefaultlanguage addItemWithObjectValue: @"Dansk"]; - [fdefaultlanguage addItemWithObjectValue: @"Deutsch"]; - [fdefaultlanguage addItemWithObjectValue: @"Dzongkha"]; - [fdefaultlanguage addItemWithObjectValue: @"English"]; - [fdefaultlanguage addItemWithObjectValue: @"Espanol"]; - [fdefaultlanguage addItemWithObjectValue: @"Esperanto"]; - [fdefaultlanguage addItemWithObjectValue: @"Estonian"]; - [fdefaultlanguage addItemWithObjectValue: @"Faroese"]; - [fdefaultlanguage addItemWithObjectValue: @"Fijian"]; - [fdefaultlanguage addItemWithObjectValue: @"Francais"]; - [fdefaultlanguage addItemWithObjectValue: @"Frisian"]; - [fdefaultlanguage addItemWithObjectValue: @"Georgian"]; - [fdefaultlanguage addItemWithObjectValue: @"Gaelic (Scots)"]; - [fdefaultlanguage addItemWithObjectValue: @"Gallegan"]; - [fdefaultlanguage addItemWithObjectValue: @"Greek, Modern ()"]; - [fdefaultlanguage addItemWithObjectValue: @"Guarani"]; - [fdefaultlanguage addItemWithObjectValue: @"Gujarati"]; - [fdefaultlanguage addItemWithObjectValue: @"Hebrew"]; - [fdefaultlanguage addItemWithObjectValue: @"Herero"]; - [fdefaultlanguage addItemWithObjectValue: @"Hindi"]; - [fdefaultlanguage addItemWithObjectValue: @"Hiri Motu"]; - [fdefaultlanguage addItemWithObjectValue: @"Inuktitut"]; - [fdefaultlanguage addItemWithObjectValue: @"Interlingue"]; - [fdefaultlanguage addItemWithObjectValue: @"Interlingua"]; - [fdefaultlanguage addItemWithObjectValue: @"Indonesian"]; - [fdefaultlanguage addItemWithObjectValue: @"Inupiaq"]; - [fdefaultlanguage addItemWithObjectValue: @"Irish"]; - [fdefaultlanguage addItemWithObjectValue: @"Islenska"]; - [fdefaultlanguage addItemWithObjectValue: @"Italian"]; - [fdefaultlanguage addItemWithObjectValue: @"Javanese"]; - [fdefaultlanguage addItemWithObjectValue: @"Japanese"]; - [fdefaultlanguage addItemWithObjectValue: @"Kalaallisut (Greenlandic)"]; - [fdefaultlanguage addItemWithObjectValue: @"Kannada"]; - [fdefaultlanguage addItemWithObjectValue: @"Kashmiri"]; - [fdefaultlanguage addItemWithObjectValue: @"Kazakh"]; - [fdefaultlanguage addItemWithObjectValue: @"Khmer"]; - [fdefaultlanguage addItemWithObjectValue: @"Kikuyu"]; - [fdefaultlanguage addItemWithObjectValue: @"Kinyarwanda"]; - [fdefaultlanguage addItemWithObjectValue: @"Kirghiz"]; - [fdefaultlanguage addItemWithObjectValue: @"Komi"]; - [fdefaultlanguage addItemWithObjectValue: @"Korean"]; - [fdefaultlanguage addItemWithObjectValue: @"Kuanyama"]; - [fdefaultlanguage addItemWithObjectValue: @"Kurdish"]; - [fdefaultlanguage addItemWithObjectValue: @"Lao"]; - [fdefaultlanguage addItemWithObjectValue: @"Latin"]; - [fdefaultlanguage addItemWithObjectValue: @"Latvian"]; - [fdefaultlanguage addItemWithObjectValue: @"Lingala"]; - [fdefaultlanguage addItemWithObjectValue: @"Lithuanian"]; - [fdefaultlanguage addItemWithObjectValue: @"Letzeburgesch"]; - [fdefaultlanguage addItemWithObjectValue: @"Macedonian"]; - [fdefaultlanguage addItemWithObjectValue: @"Magyar"]; - [fdefaultlanguage addItemWithObjectValue: @"Malay"]; - [fdefaultlanguage addItemWithObjectValue: @"Malayalam"]; - [fdefaultlanguage addItemWithObjectValue: @"Malagasy"]; - [fdefaultlanguage addItemWithObjectValue: @"Maltese"]; - [fdefaultlanguage addItemWithObjectValue: @"Manx"]; - [fdefaultlanguage addItemWithObjectValue: @"Maori"]; - [fdefaultlanguage addItemWithObjectValue: @"Marathi"]; - [fdefaultlanguage addItemWithObjectValue: @"Marshall"]; - [fdefaultlanguage addItemWithObjectValue: @"Moldavian"]; - [fdefaultlanguage addItemWithObjectValue: @"Mongolian"]; - [fdefaultlanguage addItemWithObjectValue: @"Nauru"]; - [fdefaultlanguage addItemWithObjectValue: @"Navajo"]; - [fdefaultlanguage addItemWithObjectValue: @"Ndebele, South"]; - [fdefaultlanguage addItemWithObjectValue: @"Ndebele, North"]; - [fdefaultlanguage addItemWithObjectValue: @"Ndonga"]; - [fdefaultlanguage addItemWithObjectValue: @"Nederlands"]; - [fdefaultlanguage addItemWithObjectValue: @"Nepali"]; - [fdefaultlanguage addItemWithObjectValue: @"Northern Sami"]; - [fdefaultlanguage addItemWithObjectValue: @"Norwegian"]; - [fdefaultlanguage addItemWithObjectValue: @"Norwegian Bokmal"]; - [fdefaultlanguage addItemWithObjectValue: @"Norwegian Nynorsk"]; - [fdefaultlanguage addItemWithObjectValue: @"Occitan (post 1500); Provencal"]; - [fdefaultlanguage addItemWithObjectValue: @"Oriya"]; - [fdefaultlanguage addItemWithObjectValue: @"Oromo"]; - [fdefaultlanguage addItemWithObjectValue: @"Ossetian; Ossetic"]; - [fdefaultlanguage addItemWithObjectValue: @"Panjabi"]; - [fdefaultlanguage addItemWithObjectValue: @"Persian"]; - [fdefaultlanguage addItemWithObjectValue: @"Pali"]; - [fdefaultlanguage addItemWithObjectValue: @"Polish"]; - [fdefaultlanguage addItemWithObjectValue: @"Portugues"]; - [fdefaultlanguage addItemWithObjectValue: @"Pushto"]; - [fdefaultlanguage addItemWithObjectValue: @"Quechua"]; - [fdefaultlanguage addItemWithObjectValue: @"Raeto-Romance"]; - [fdefaultlanguage addItemWithObjectValue: @"Romanian"]; - [fdefaultlanguage addItemWithObjectValue: @"Rundi"]; - [fdefaultlanguage addItemWithObjectValue: @"Russian"]; - [fdefaultlanguage addItemWithObjectValue: @"Sango"]; - [fdefaultlanguage addItemWithObjectValue: @"Sanskrit"]; - [fdefaultlanguage addItemWithObjectValue: @"Sardinian"]; - [fdefaultlanguage addItemWithObjectValue: @"Serbian"]; - [fdefaultlanguage addItemWithObjectValue: @"Sinhalese"]; - [fdefaultlanguage addItemWithObjectValue: @"Slovak"]; - [fdefaultlanguage addItemWithObjectValue: @"Slovenian"]; - [fdefaultlanguage addItemWithObjectValue: @"Samoan"]; - [fdefaultlanguage addItemWithObjectValue: @"Shona"]; - [fdefaultlanguage addItemWithObjectValue: @"Sindhi"]; - [fdefaultlanguage addItemWithObjectValue: @"Somali"]; - [fdefaultlanguage addItemWithObjectValue: @"Sotho, Southern"]; - [fdefaultlanguage addItemWithObjectValue: @"Sundanese"]; - [fdefaultlanguage addItemWithObjectValue: @"Suomi"]; - [fdefaultlanguage addItemWithObjectValue: @"Svenska"]; - [fdefaultlanguage addItemWithObjectValue: @"Swahili"]; - [fdefaultlanguage addItemWithObjectValue: @"Swati"]; - [fdefaultlanguage addItemWithObjectValue: @"Tahitian"]; - [fdefaultlanguage addItemWithObjectValue: @"Tamil"]; - [fdefaultlanguage addItemWithObjectValue: @"Tatar"]; - [fdefaultlanguage addItemWithObjectValue: @"Telugu"]; - [fdefaultlanguage addItemWithObjectValue: @"Tajik"]; - [fdefaultlanguage addItemWithObjectValue: @"Tagalog"]; - [fdefaultlanguage addItemWithObjectValue: @"Thai"]; - [fdefaultlanguage addItemWithObjectValue: @"Tibetan"]; - [fdefaultlanguage addItemWithObjectValue: @"Tigrinya"]; - [fdefaultlanguage addItemWithObjectValue: @"Tonga (Tonga Islands)"]; - [fdefaultlanguage addItemWithObjectValue: @"Tswana"]; - [fdefaultlanguage addItemWithObjectValue: @"Tsonga"]; - [fdefaultlanguage addItemWithObjectValue: @"Turkish"]; - [fdefaultlanguage addItemWithObjectValue: @"Turkmen"]; - [fdefaultlanguage addItemWithObjectValue: @"Twi"]; - [fdefaultlanguage addItemWithObjectValue: @"Uighur"]; - [fdefaultlanguage addItemWithObjectValue: @"Ukrainian"]; - [fdefaultlanguage addItemWithObjectValue: @"Urdu"]; - [fdefaultlanguage addItemWithObjectValue: @"Uzbek"]; - [fdefaultlanguage addItemWithObjectValue: @"Vietnamese"]; - [fdefaultlanguage addItemWithObjectValue: @"Volapk"]; - [fdefaultlanguage addItemWithObjectValue: @"Welsh"]; - [fdefaultlanguage addItemWithObjectValue: @"Wolof"]; - [fdefaultlanguage addItemWithObjectValue: @"Xhosa"]; - [fdefaultlanguage addItemWithObjectValue: @"Yiddish"]; - [fdefaultlanguage addItemWithObjectValue: @"Yoruba"]; - [fdefaultlanguage addItemWithObjectValue: @"Zhuang"]; - [fdefaultlanguage addItemWithObjectValue: @"Zulu"]; - [fdefaultlanguage setStringValue:@"English"]; - - /* If a Default Language is selected then write it otherwise let English as default */ - - if ([defaults stringForKey:@"DefaultLanguage"]!=NULL) - { - [fdefaultlanguage setStringValue:[defaults stringForKey:@"DefaultLanguage"]]; - } - [fdefaultlanguage selectItemWithObjectValue:[defaults stringForKey:@"DefaultLanguage"]]; - - - - - /* fFileExtItunes Check or uncheck according to the preferences */ - [fFileExtItunes setState: [defaults boolForKey:@"DefaultMpegName"] ? - NSOnState : NSOffState]; - - /* fDefCrf Check or uncheck according to the preferences*/ - [fDefCrf setState: [defaults boolForKey:@"DefaultCrf"] ? - NSOnState : NSOffState]; - - /* fDefDeinterlace Check or uncheck according to the preferences*/ - [fDefDeinterlace setState: [defaults boolForKey:@"DefaultDeinterlaceOn"] ? - NSOnState : NSOffState]; - - /* fDefPicSizeAutoSetipod Check or uncheck according to the preferences*/ - [fDefPicSizeAutoSetipod setState: [defaults boolForKey:@"DefaultPicSizeAutoiPod"] ? - NSOnState : NSOffState]; - /* fDefPixelRatio */ - [fDefPixelRatio setState: [defaults boolForKey:@"PixelRatio"] ? - NSOnState : NSOffState]; - - /* fDefAdvancedx264FlagsShow */ - [fDefAdvancedx264FlagsShow setState: [defaults boolForKey:@"DefAdvancedx264FlagsShow"] ? - NSOnState : NSOffState]; - /* Insert default DefAdvanced x264 Flag here */ - if ([defaults stringForKey:@"DefAdvancedx264Flags"]!=NULL) - { - [fDefAdvancedx264FlagsView setStringValue:[defaults stringForKey:@"DefAdvancedx264Flags"]]; - } - - /* fDefPresetDrawerShow Check or uncheck according to the preferences*/ - [fDefPresetDrawerShow setState: [defaults boolForKey:@"DefaultPresetsDrawerShow"] ? - NSOnState : NSOffState]; - /* fDefAutoNaming Check or uncheck according to the preferences*/ - [fDefAutoNaming setState: [defaults boolForKey:@"DefaultAutoNaming"] ? - NSOnState : NSOffState]; - /* fDefChapterMarkers Check or uncheck according to the preferences*/ - [fDefChapterMarkers setState: [defaults boolForKey:@"DefaultChapterMarkers"] ? - NSOnState : NSOffState]; -} - - -- (IBAction) OpenPanel: (id) sender; -{ - [NSApp runModalForWindow: fPanel]; -} - -- (IBAction) ClosePanel: (id) sender; -{ - [self CheckChanged: sender]; - [NSApp stopModal]; - [fPanel orderOut: sender]; -} - -- (IBAction) CheckChanged: (id) sender -{ - NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults]; - - /* Check Update CheckForUpdates Set */ - if( [fUpdateCheck state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"CheckForUpdates"]; - } - else - { - [defaults setObject:@"NO" forKey:@"CheckForUpdates"]; - } - - /* Preferred Language Combobox Set */ - - [defaults setObject:[fdefaultlanguage objectValueOfSelectedItem] forKey:@"DefaultLanguage"]; - - - /* File Extension Itunes Set */ - - if( [fFileExtItunes state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultMpegName"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultMpegName"]; - } - - /* Use CRF for constant mode */ - - if( [fDefCrf state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultCrf"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultCrf"]; - } - - /* Use Deinterlace on as a default*/ - - if( [fDefDeinterlace state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultDeinterlaceOn"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultDeinterlaceOn"]; - } - - /* Use Picture size set to 640 upon x264 (iPod) Selection as a default*/ - - if( [fDefPicSizeAutoSetipod state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultPicSizeAutoiPod"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultPicSizeAutoiPod"]; - } - - /* Use Pixel Ratio*/ - - if( [fDefPixelRatio state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"PixelRatio"]; - } - else - { - [defaults setObject:@"NO" forKey:@"PixelRatio"]; - } - /* Show Chosen Advanced Flags to be used in main window*/ - if( [fDefAdvancedx264FlagsShow state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefAdvancedx264FlagsShow"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefAdvancedx264FlagsShow"]; - } - - /*Advanced x264 Flag string into */ - [defaults setObject:[fDefAdvancedx264FlagsView stringValue] forKey:@"DefAdvancedx264Flags"]; - - /* Show Presets Drawer upon launch*/ - - if( [fDefPresetDrawerShow state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultPresetsDrawerShow"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultPresetsDrawerShow"]; - } - - /* Use Auto Naming */ - - if( [fDefAutoNaming state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultAutoNaming"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultAutoNaming"]; - } - /* Chapter Markers */ - if( [fDefChapterMarkers state] == NSOnState ) - { - [defaults setObject:@"YES" forKey:@"DefaultChapterMarkers"]; - } - else - { - [defaults setObject:@"NO" forKey:@"DefaultChapterMarkers"]; - } - -} - -@end |