summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-29 08:37:40 +0000
committerritsuka <[email protected]>2014-12-29 08:37:40 +0000
commit0ca568a18216cfaa4785c36637a81a241fd8821e (patch)
tree342d6b7e3f2e868a1b916962ecc44bc587e8e38f
parentf1c5cb5f2388aeebbe7ec9f105b406bebf2345e0 (diff)
MacGui: use bindings to toggle the chapters/seconds/frames UI.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6669 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.h3
-rw-r--r--macosx/Controller.m71
-rw-r--r--macosx/English.lproj/MainMenu.xib34
-rw-r--r--macosx/HBRange+UIAdditions.h4
-rw-r--r--macosx/HBRange+UIAdditions.m15
-rw-r--r--macosx/HBRange.m8
6 files changed, 66 insertions, 69 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index faf45553c..e0dae9d3f 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -163,9 +163,6 @@
- (void) enableUI: (BOOL) enable;
-- (IBAction) encodeStartStopPopUpChanged: (id) sender;
-
-
- (IBAction) titlePopUpChanged: (id) sender;
- (IBAction) chapterPopUpChanged: (id) sender;
diff --git a/macosx/Controller.m b/macosx/Controller.m
index bc0da2012..4dd1a3d1b 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -2483,60 +2483,12 @@ static void queueFSEventStreamCallback(
}
}
-- (IBAction) encodeStartStopPopUpChanged: (id) sender;
-{
- // We are chapters
- if ([fEncodeStartStopPopUp indexOfSelectedItem] == 0)
- {
- self.job.range.type = HBRangeTypeChapters;
-
- [fSrcChapterStartPopUp setHidden: NO];
- [fSrcChapterEndPopUp setHidden: NO];
-
- [fSrcTimeStartEncodingField setHidden: YES];
- [fSrcTimeEndEncodingField setHidden: YES];
-
- [fSrcFrameStartEncodingField setHidden: YES];
- [fSrcFrameEndEncodingField setHidden: YES];
-
- [self chapterPopUpChanged:nil];
- }
- // We are time based (seconds)
- else if ([fEncodeStartStopPopUp indexOfSelectedItem] == 1)
- {
- self.job.range.type = HBRangeTypeSeconds;
-
- [fSrcChapterStartPopUp setHidden: YES];
- [fSrcChapterEndPopUp setHidden: YES];
-
- [fSrcTimeStartEncodingField setHidden: NO];
- [fSrcTimeEndEncodingField setHidden: NO];
-
- [fSrcFrameStartEncodingField setHidden: YES];
- [fSrcFrameEndEncodingField setHidden: YES];
- }
- // We are frame based
- else if ([fEncodeStartStopPopUp indexOfSelectedItem] == 2)
- {
- self.job.range.type = HBRangeTypeFrames;
-
- [fSrcChapterStartPopUp setHidden: YES];
- [fSrcChapterEndPopUp setHidden: YES];
-
- [fSrcTimeStartEncodingField setHidden: YES];
- [fSrcTimeEndEncodingField setHidden: YES];
-
- [fSrcFrameStartEncodingField setHidden: NO];
- [fSrcFrameEndEncodingField setHidden: NO];
- }
-}
-
-- (IBAction) chapterPopUpChanged: (id) sender
+- (void)chapterPopUpChanged:(NSNotification *)notification
{
// We're changing the chapter range - we may need to flip the m4v/mp4 extension
if ([[fDstFormatPopUp selectedItem] tag] & HB_MUX_MASK_MP4)
{
- [self autoSetM4vExtension:sender];
+ [self autoSetM4vExtension:notification];
}
// If Auto Naming is on it might need to be update if it includes the chapters range
@@ -2719,29 +2671,22 @@ static void queueFSEventStreamCallback(
self.selectedPreset = preset;
self.customPreset = NO;
- NSDictionary *chosenPreset = preset.content;
-
- [fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]];
-
- if ([[chosenPreset objectForKey:@"Default"] intValue] == 1)
+ if (preset.isDefault)
{
- [fPresetSelectedDisplay setStringValue:[NSString stringWithFormat:@"%@ (Default)", [chosenPreset objectForKey:@"PresetName"]]];
+ fPresetSelectedDisplay.stringValue = [NSString stringWithFormat:@"%@ (Default)", preset.name];
}
else
{
- [fPresetSelectedDisplay setStringValue:[chosenPreset objectForKey:@"PresetName"]];
+ fPresetSelectedDisplay.stringValue = preset.name;
}
// Apply the preset to the current job
[self.job applyPreset:preset];
- // check to see if we have only one chapter
- [self chapterPopUpChanged:nil];
-
- // Audio
+ // Have to apply the presets the audio and subtitles controllers too
+ // because they haven't been moved to HBJob yer.
+ NSDictionary *chosenPreset = preset.content;
[fAudioController applySettingsFromPreset: chosenPreset];
-
- // Subtitles
[fSubtitlesViewController applySettingsFromPreset:chosenPreset];
// If Auto Naming is on. We create an output filename of dvd name - title number
diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib
index ca054e290..889f71771 100644
--- a/macosx/English.lproj/MainMenu.xib
+++ b/macosx/English.lproj/MainMenu.xib
@@ -119,7 +119,7 @@
<menu key="menu" title="OtherViews" id="5515"/>
</popUpButtonCell>
<connections>
- <action selector="encodeStartStopPopUpChanged:" target="240" id="5520"/>
+ <binding destination="240" name="selectedIndex" keyPath="self.job.range.type" previousBinding="nr8-sN-wpW" id="eJw-0h-DAa"/>
<binding destination="240" name="content" keyPath="self.job.range.types" id="nr8-sN-wpW"/>
</connections>
</popUpButton>
@@ -275,6 +275,11 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
+ <binding destination="240" name="hidden" keyPath="self.job.range.secondsSelected" id="VlL-Hz-ZR5">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
+ </dictionary>
+ </binding>
<binding destination="240" name="value" keyPath="self.job.range.secondsStart" id="yuS-GN-avp"/>
</connections>
</textField>
@@ -287,6 +292,11 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
+ <binding destination="240" name="hidden" keyPath="self.job.range.framesSelected" id="nnF-AN-v4Q">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
+ </dictionary>
+ </binding>
<binding destination="240" name="value" keyPath="self.job.range.frameStart" id="7yg-HW-q0R"/>
</connections>
</textField>
@@ -299,6 +309,11 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
+ <binding destination="240" name="hidden" keyPath="self.job.range.secondsSelected" id="Qmg-D1-0rm">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
+ </dictionary>
+ </binding>
<binding destination="240" name="value" keyPath="self.job.range.secondsStop" id="BUI-Zz-m1A"/>
</connections>
</textField>
@@ -311,6 +326,11 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
+ <binding destination="240" name="hidden" keyPath="self.job.range.framesSelected" id="P5u-F3-Qyx">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
+ </dictionary>
+ </binding>
<binding destination="240" name="value" keyPath="self.job.range.frameStop" id="8G6-K0-vyD"/>
</connections>
</textField>
@@ -423,7 +443,11 @@
</popUpButtonCell>
<accessibility description="Start Chapter"/>
<connections>
- <action selector="chapterPopUpChanged:" target="240" id="1615"/>
+ <binding destination="240" name="hidden" keyPath="self.job.range.chaptersSelected" id="fix-9c-5P3">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
+ </dictionary>
+ </binding>
<binding destination="240" name="selectedIndex" keyPath="self.job.range.chapterStart" previousBinding="6kP-TS-bEc" id="U76-2W-TvD"/>
<binding destination="240" name="content" keyPath="self.job.range.chapters" id="6kP-TS-bEc"/>
</connections>
@@ -442,7 +466,11 @@
</popUpButtonCell>
<accessibility description="End Chapter"/>
<connections>
- <action selector="chapterPopUpChanged:" target="240" id="1616"/>
+ <binding destination="240" name="hidden" keyPath="self.job.range.chaptersSelected" id="PxP-LY-ZXR">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
+ </dictionary>
+ </binding>
<binding destination="240" name="selectedIndex" keyPath="self.job.range.chapterStop" previousBinding="Yqp-Sg-lBf" id="4k2-Sm-RoJ"/>
<binding destination="240" name="content" keyPath="self.job.range.chapters" id="Yqp-Sg-lBf"/>
</connections>
diff --git a/macosx/HBRange+UIAdditions.h b/macosx/HBRange+UIAdditions.h
index 82aacca18..0750b34b7 100644
--- a/macosx/HBRange+UIAdditions.h
+++ b/macosx/HBRange+UIAdditions.h
@@ -12,4 +12,8 @@
@property (nonatomic, readonly) NSArray *chapters;
@property (nonatomic, readonly) NSArray *types;
+@property (nonatomic, readonly) BOOL chaptersSelected;
+@property (nonatomic, readonly) BOOL secondsSelected;
+@property (nonatomic, readonly) BOOL framesSelected;
+
@end
diff --git a/macosx/HBRange+UIAdditions.m b/macosx/HBRange+UIAdditions.m
index 27b32081e..f7061acf7 100644
--- a/macosx/HBRange+UIAdditions.m
+++ b/macosx/HBRange+UIAdditions.m
@@ -25,4 +25,19 @@
NSLocalizedString(@"Frames", @"")];
}
+- (BOOL)chaptersSelected
+{
+ return self.type == HBRangeTypeChapters;
+}
+
+- (BOOL)secondsSelected
+{
+ return self.type == HBRangeTypeSeconds;
+}
+
+- (BOOL)framesSelected
+{
+ return self.type == HBRangeTypeFrames;
+}
+
@end
diff --git a/macosx/HBRange.m b/macosx/HBRange.m
index b632d4c34..b176c872f 100644
--- a/macosx/HBRange.m
+++ b/macosx/HBRange.m
@@ -94,6 +94,14 @@
@"secondsStart", @"secondsStop",nil];
}
+ if ([key isEqualToString:@"chaptersSelected"] ||
+ [key isEqualToString:@"secondsSelected"] ||
+ [key isEqualToString:@"framesSelected"])
+ {
+ retval = [NSSet setWithObjects:@"type",nil];
+
+ }
+
return retval;
}