From d509e2b3eb350584b802a9892e08abeebe6b98f0 Mon Sep 17 00:00:00 2001 From: dynaflash Date: Wed, 28 Mar 2007 14:20:13 +0000 Subject: MacGui: Preset refinements - Added current settings field in main window, uses the preset name if one is chosen and "Custom" if any settings are outside of the selected preset - Deselects the preset if settings are changed from currently selected preset - Uses a new method - (IBAction) CustomSettingUsed: (id) sender to make determination via the sender value. presets use a NULL value to make determination - Currently, changing Picture Settings DOES NOT trigger the display change. Still sorting through those conditionals. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@460 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/Controller.h | 2 +- macosx/Controller.mm | 54 +++++++++++++++------ macosx/English.lproj/MainMenu.nib/classes.nib | 2 +- macosx/English.lproj/MainMenu.nib/info.nib | 8 +-- macosx/English.lproj/MainMenu.nib/keyedobjects.nib | Bin 96832 -> 97382 bytes 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index ea35ac295..9d6969466 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -195,7 +195,7 @@ - (IBAction) OpenForums: (id) sender; // Preset Methods Here - +- (IBAction) CustomSettingUsed: (id) sender; - (IBAction) ShowAddPresetPanel: (id) sender; - (IBAction) CloseAddPresetPanel: (id) sender; - (NSDictionary *)CreatePreset; diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 717303ebf..71d065462 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -433,8 +433,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow } // Select the longuest title [fSrcTitlePopUp selectItemAtIndex: indxpri]; - - + /* We set the Settings Display to "Default" here + until we get default presets implemented */ + [fPresetSelectedDisplay setStringValue: @"Default"]; [self TitlePopUpChanged: NULL]; [self EnableUI: YES]; @@ -656,6 +657,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow [self QualitySliderChanged: sender]; [self CalculateBitrate: sender]; + [self CustomSettingUsed: sender]; } - (IBAction) QualitySliderChanged: (id) sender @@ -663,6 +665,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow [fVidConstantCell setTitle: [NSString stringWithFormat: _( @"Constant quality: %.0f %%" ), 100.0 * [fVidQualitySlider floatValue]]]; + [self CustomSettingUsed: sender]; } - (IBAction) BrowseFile: (id) sender @@ -1231,7 +1234,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow /* changing the codecs on offer may mean that we are/aren't now offering AAC, so */ /* check if this change means we should / should't offer 6-channel AAC extraction */ [self Check6ChannelAACExtraction: sender]; - + /* We call method method to change UI to reflect whether a preset is used or not*/ + [self CustomSettingUsed: sender]; + } - (IBAction) CodecsPopUpChanged: (id) sender @@ -1274,7 +1279,8 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow [self Check6ChannelAACExtraction: sender]; [self CalculateBitrate: sender]; - + /* We call method method to change UI to reflect whether a preset is used or not*/ + [self CustomSettingUsed: sender]; } - (IBAction) EncoderPopUpChanged: (id) sender @@ -1303,8 +1309,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow } - [self CalculatePictureSizing: sender]; - + [self CalculatePictureSizing: sender]; + /* We call method method to change UI to reflect whether a preset is used or not*/ + [self CustomSettingUsed: sender]; } - (IBAction) Check6ChannelAACExtraction: (id) sender @@ -1473,8 +1480,25 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow [fVidBitrateField setIntValue: hb_calc_bitrate( job, [fVidTargetSizeField intValue] )]; + + +} + +/* Method to determine if we should change the UI +To reflect whether or not a Preset is being used or if +the user is using "Custom" settings by determining the sender*/ +- (IBAction) CustomSettingUsed: (id) sender +{ + if ([sender stringValue] != NULL) + { + /* Deselect the currently selected Preset if there is one*/ + [tableView deselectRow:[tableView selectedRow]]; + /* Change UI to show "Custom" settings are being used */ + [fPresetSelectedDisplay setStringValue: @"Custom"]; + } } + - (IBAction) ShowAddPresetPanel: (id) sender { /* Show the panel */ @@ -1773,7 +1797,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow /* we get the chosen preset from the UserPresets array */ chosenPreset = [UserPresets objectAtIndex:[sender selectedRow]]; /* we set the preset display field in main window here */ - //[fPresetSelectedDisplay setStringValue: [NSString stringWithFormat: @"%@", [chosenPreset valueForKey:@"PresetName"]]]; + [fPresetSelectedDisplay setStringValue: [NSString stringWithFormat: @"%@", [chosenPreset valueForKey:@"PresetName"]]]; /* File Format */ [fDstFormatPopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"FileFormat"]]]; [self FormatPopUpChanged: NULL]; @@ -1785,9 +1809,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow /* Video encoder */ [fVidEncoderPopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoEncoder"]]]; /* Lets run through the following functions to get variables set there */ - [self EncoderPopUpChanged: sender]; - [self Check6ChannelAACExtraction: sender]; - [self CalculateBitrate: sender]; + [self EncoderPopUpChanged: NULL]; + [self Check6ChannelAACExtraction: NULL]; + [self CalculateBitrate: NULL]; /* Video quality */ [fVidQualityMatrix selectCellAtRow:[[chosenPreset objectForKey:@"VideoQualityType"] intValue] column:0]; @@ -1796,7 +1820,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow [fVidBitrateField setStringValue: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoAvgBitrate"]]]; [fVidQualitySlider setFloatValue: [[chosenPreset valueForKey:@"VideoQualitySlider"] floatValue]]; - [self VideoMatrixChanged: sender]; + [self VideoMatrixChanged: NULL]; /* Video framerate */ [fVidRatePopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"VideoFramerate"]]]; @@ -1813,7 +1837,7 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow [fAudLang1PopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioLang1"]]]; /* Audio Language One Surround Sound Checkbox*/ [fAudLang1SurroundCheck setState:[[chosenPreset objectForKey:@"AudioLang1Surround"] intValue]]; - [self Check6ChannelAACExtraction: sender]; + [self Check6ChannelAACExtraction: NULL]; /* Audio Sample Rate*/ [fAudRatePopUp selectItemWithTitle: [NSString stringWithFormat:[chosenPreset valueForKey:@"AudioSampleRate"]]]; /* Audio Bitrate Rate*/ @@ -1838,11 +1862,9 @@ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultPresetsDrawerShow job->crop[1] = [[chosenPreset objectForKey:@"PictureBottomCrop"] intValue]; job->crop[2] = [[chosenPreset objectForKey:@"PictureLeftCrop"] intValue]; job->crop[3] = [[chosenPreset objectForKey:@"PictureRightCrop"] intValue]; - [self CalculatePictureSizing: sender]; + [self CalculatePictureSizing: NULL]; } - - // Deselect the currently selected table // - //[tableView deselectRow:[tableView selectedRow]]; + } } diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index fb50aa48f..28e806f96 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -12,6 +12,7 @@ ChapterPopUpChanged = id; CloseAddPresetPanel = id; CodecsPopUpChanged = id; + CustomSettingUsed = id; DeletePreset = id; EnableQueue = id; EncoderPopUpChanged = id; @@ -29,7 +30,6 @@ ShowScanPanel = id; TitlePopUpChanged = id; VideoMatrixChanged = id; - myAction = id; tableViewSelected = id; }; CLASS = HBController; diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index f4bcaea33..079775a97 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -3,11 +3,11 @@ IBDocumentLocation - -6 259 630 601 0 0 1440 878 + -2 228 630 601 0 0 1440 878 IBEditorPositions 1843 - 610 276 220 592 0 0 1440 878 + 1970 386 220 592 1440 0 1280 1024 29 102 834 300 44 0 0 1440 878 @@ -19,8 +19,8 @@ IBOpenObjects - 1438 - 1843 + 21 + 29 IBSystem Version 8P2137 diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index f5251873d..0b02921b3 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ -- cgit v1.2.3