From 29a27007840b51bcf789c04fa05c7fcbc40cd665 Mon Sep 17 00:00:00 2001 From: ritsuka Date: Sun, 24 Aug 2014 05:59:00 +0000 Subject: MacGui: removed a couple of unused preferences keys (CheckForUpdates, DisableDvdAutoDetect, DefAdvancedx264Flags) and the empty TOOLBAR_PICTURE tab. Added a new checkbox to hide the Advanced tab. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6353 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/English.lproj/Preferences.xib | 63 ++++++++++----------- macosx/HBPreferencesController.h | 10 +--- macosx/HBPreferencesController.m | 105 +++++++++++++++-------------------- 3 files changed, 76 insertions(+), 102 deletions(-) diff --git a/macosx/English.lproj/Preferences.xib b/macosx/English.lproj/Preferences.xib index 2e1dfef5e..3122bf98a 100644 --- a/macosx/English.lproj/Preferences.xib +++ b/macosx/English.lproj/Preferences.xib @@ -1,7 +1,7 @@ - + - + @@ -11,7 +11,6 @@ - @@ -320,21 +319,6 @@ - - - - - - - - - - - - - - - @@ -386,11 +370,11 @@ - + - + @@ -399,7 +383,7 @@ - + @@ -417,7 +401,7 @@ - + @@ -440,7 +424,7 @@ - + @@ -482,7 +466,7 @@ - + @@ -524,7 +508,7 @@ - + @@ -533,7 +517,7 @@ - + @@ -542,7 +526,7 @@ - + @@ -551,7 +535,7 @@ - + @@ -560,7 +544,7 @@ - + @@ -569,7 +553,7 @@ - + @@ -578,7 +562,7 @@ - + @@ -589,6 +573,17 @@ + diff --git a/macosx/HBPreferencesController.h b/macosx/HBPreferencesController.h index 3db3d528b..6003aa8bd 100644 --- a/macosx/HBPreferencesController.h +++ b/macosx/HBPreferencesController.h @@ -6,15 +6,7 @@ #import @interface HBPreferencesController : NSWindowController -{ - IBOutlet NSView * fGeneralView, * fPictureView, * fAudioView, * fAdvancedView; - IBOutlet NSTextField * fSendEncodeToAppField; -} + (void)registerUserDefaults; -- (id)init; -/* Manage the send encode to xxx.app windows and field */ -- (IBAction) browseSendToApp: (id) sender; -- (void) browseSendToAppDone: (NSOpenPanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo; + @end diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m index d3d016f58..d1740f9b4 100644 --- a/macosx/HBPreferencesController.m +++ b/macosx/HBPreferencesController.m @@ -7,7 +7,6 @@ #import "HBLanguagesSelection.h" #define TOOLBAR_GENERAL @"TOOLBAR_GENERAL" -#define TOOLBAR_PICTURE @"TOOLBAR_PICTURE" #define TOOLBAR_AUDIO @"TOOLBAR_AUDIO" #define TOOLBAR_ADVANCED @"TOOLBAR_ADVANCED" @@ -23,6 +22,13 @@ */ @interface HBPreferencesController () +{ + IBOutlet NSView * fGeneralView, * fAudioView, * fAdvancedView; + IBOutlet NSTextField * fSendEncodeToAppField; +} + +/* Manage the send encode to xxx.app windows and field */ +- (IBAction) browseSendToApp: (id) sender; - (void) setPrefView: (id) sender; - (NSToolbarItem *)toolbarItemWithIdentifier: (NSString *)identifier @@ -31,10 +37,10 @@ @property (assign) IBOutlet NSTokenField *formatTokenField; @property (assign) IBOutlet NSTokenField *builtInTokenField; -@property (readonly, nonatomic) NSArray *buildInFormatTokens; -@property (retain, nonatomic) NSArray *matches; +@property (nonatomic, readonly) NSArray *buildInFormatTokens; +@property (nonatomic, retain) NSArray *matches; -@property (retain, nonatomic) HBLanguagesSelection *languages; +@property (nonatomic, retain) HBLanguagesSelection *languages; @end @@ -50,32 +56,28 @@ { NSString *desktopDirectory = [@"~/Desktop" stringByExpandingTildeInPath]; - [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: - @"YES", @"CheckForUpdates", - @"Open Source", @"LaunchSourceBehavior", - @"English", @"DefaultLanguage", - @"Auto", @"DefaultMpegExtension", - @"YES", @"UseDvdNav", - @"", @"DefAdvancedx264Flags", - @"YES", @"DefaultPresetsDrawerShow", - desktopDirectory, @"LastDestinationDirectory", - desktopDirectory, @"LastSourceDirectory", - @"NO", @"DefaultAutoNaming", - @"NO", @"DisableDvdAutoDetect", - @"Alert Window", @"AlertWhenDone", - @"YES", @"AlertWhenDoneSound", - @"1", @"LoggingLevel", - @"NO", @"EncodeLogLocation", - @"10", @"MinTitleScanSeconds", - @"10", @"PreviewsNumber", - @"", @"Drawer Size", - @"0.25", @"x264CqSliderFractional", - @"YES", @"AlertBuiltInPresetUpdate", - @"MetaX", @"SendCompletedEncodeToApp", - @"NO", @"ShowAdvancedOptsForAutoPassthru", - - @[@"{Source}", @" ", @"{Title}"], @"HBAutoNamingFormat", - nil]]; + [[NSUserDefaults standardUserDefaults] registerDefaults:@{ + @"LaunchSourceBehavior": @"Open Source", + @"DefaultLanguage": @"English", + @"DefaultMpegExtension": @"Auto", + @"UseDvdNav": @"YES", + @"DefaultPresetsDrawerShow": @YES, + @"LastDestinationDirectory": desktopDirectory, + @"LastSourceDirectory": desktopDirectory, + @"DefaultAutoNaming": @NO, + @"AlertWhenDone": @"Alert Window", + @"AlertWhenDoneSound": @"YES", + @"LoggingLevel": @"1", + @"EncodeLogLocation": @"NO", + @"MinTitleScanSeconds": @"10", + @"PreviewsNumber": @"10", + @"Drawer Size": @"", + @"x264CqSliderFractional": @"0.25", + @"AlertBuiltInPresetUpdate": @"YES", + @"SendCompletedEncodeToApp": @"MetaX", + @"HBShowAdvancedTab": @NO, + @"HBAutoNamingFormat": @[@"{Source}", @" ", @"{Title}"] + }]; } /** @@ -138,12 +140,6 @@ label:NSLocalizedString(@"General", @"Preferences General Toolbar Item") image:[NSImage imageNamed:@"settings"]]; } - else if ( [ident isEqualToString:TOOLBAR_PICTURE] ) - { - return [self toolbarItemWithIdentifier:ident - label:NSLocalizedString(@"Picture", @"Preferences Picture Toolbar Item") - image:[NSImage imageNamed:@"picturesettings"]]; - } else if ( [ident isEqualToString:TOOLBAR_AUDIO] ) { return [self toolbarItemWithIdentifier:ident @@ -172,8 +168,7 @@ - (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar { - return [NSArray arrayWithObjects: TOOLBAR_GENERAL, /*TOOLBAR_PICTURE, */ - TOOLBAR_AUDIO, TOOLBAR_ADVANCED, nil]; + return @[TOOLBAR_GENERAL, TOOLBAR_AUDIO, TOOLBAR_ADVANCED]; } /* Manage the send encode to xxx.app windows and field */ @@ -196,28 +191,22 @@ sendToAppDirectory = @"/Applications"; } [panel setDirectoryURL:[NSURL fileURLWithPath:sendToAppDirectory]]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { - [self browseSendToAppDone:panel returnCode:(int)result contextInfo:sender]; + if (result == NSOKButton) + { + NSURL *sendToAppURL = [panel URL]; + NSURL *sendToAppDirectory = [sendToAppURL URLByDeletingLastPathComponent]; + [[NSUserDefaults standardUserDefaults] setObject:[sendToAppDirectory path] forKey:@"LastSendToAppDirectory"]; + + NSString *sendToAppName = [[sendToAppURL lastPathComponent] stringByDeletingPathExtension]; + /* we set the name of the app to send to in the display field */ + [fSendEncodeToAppField setStringValue:sendToAppName]; + [[NSUserDefaults standardUserDefaults] setObject:[fSendEncodeToAppField stringValue] forKey:@"SendCompletedEncodeToApp"]; + } }]; } -- (void) browseSendToAppDone: (NSOpenPanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if( returnCode == NSOKButton ) - { - NSURL *sendToAppURL = [[sheet URLs] objectAtIndex: 0]; - NSURL *sendToAppDirectory = [sendToAppURL URLByDeletingLastPathComponent]; - [[NSUserDefaults standardUserDefaults] setObject:[sendToAppDirectory path] forKey:@"LastSendToAppDirectory"]; - [sheet orderOut: self]; - NSString *sendToAppName; - sendToAppName = [[sendToAppURL lastPathComponent] stringByDeletingPathExtension]; - /* we set the name of the app to send to in the display field */ - [fSendEncodeToAppField setStringValue:sendToAppName]; - [[NSUserDefaults standardUserDefaults] setObject:[fSendEncodeToAppField stringValue] forKey:@"SendCompletedEncodeToApp"]; - } -} - #pragma mark - Format Token Field Delegate - (NSString *)tokenField:(NSTokenField *)tokenField displayStringForRepresentedObject:(id)representedObject @@ -289,9 +278,7 @@ if( sender ) { NSString * identifier = [sender itemIdentifier]; - if( [identifier isEqualToString: TOOLBAR_PICTURE] ) - view = fPictureView; - else if( [identifier isEqualToString: TOOLBAR_AUDIO] ) + if( [identifier isEqualToString: TOOLBAR_AUDIO] ) view = fAudioView; else if( [identifier isEqualToString: TOOLBAR_ADVANCED] ) view = fAdvancedView; -- cgit v1.2.3