diff options
-rw-r--r-- | macosx/Controller.h | 79 | ||||
-rw-r--r-- | macosx/Controller.m | 56 | ||||
-rw-r--r-- | macosx/English.lproj/MainMenu.xib | 77 |
3 files changed, 101 insertions, 111 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index fcdeaaaa8..1572ab5e5 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -26,34 +26,33 @@ @interface HBController : NSObject <NSApplicationDelegate, NSDrawerDelegate> { - IBOutlet NSWindow *fWindow; - + IBOutlet NSWindow *fWindow; IBOutlet NSTabView *fMainTabView; - /* Video view controller */ + // Video view controller HBVideoController * fVideoController; IBOutlet NSTabViewItem * fVideoTab; - /* Subtitles view controller */ + // Subtitles view controller HBSubtitlesController * fSubtitlesViewController; IBOutlet NSTabViewItem * fSubtitlesTab; - /* Audio view controller */ + // Audio view controller HBAudioController * fAudioController; IBOutlet NSTabViewItem * fAudioTab; - /* Chapters view controller */ + // Chapters view controller HBChapterTitlesController * fChapterTitlesController; IBOutlet NSTabViewItem * fChaptersTitlesTab; - /* Advanced options tab */ + // Advanced options tab HBAdvancedController * fAdvancedOptions; IBOutlet NSTabViewItem * fAdvancedTab; - /* Main Menu Outlets */ + // Main Menu Outlets NSMenuItem * fOpenSourceTitleMMenu; - /* Source Title Scan Outlets */ + // Source Title Scan Outlets IBOutlet NSPanel * fScanSrcTitlePanel; IBOutlet NSTextField * fScanSrcTitlePathField; IBOutlet NSTextField * fSrcDsplyNameTitleScan; @@ -61,70 +60,42 @@ IBOutlet NSButton * fScanSrcTitleCancelButton; IBOutlet NSButton * fScanSrcTitleOpenButton; - /* Picture Settings */ - HBPictureController * fPictureController; - - /* Picture Preview */ - HBPreviewController * fPreviewController; - - HBPreferencesController * fPreferencesController; + // Picture Settings + HBPictureController * fPictureController; + // Picture Preview + HBPreviewController * fPreviewController; + HBPreferencesController * fPreferencesController; - /* Queue panel */ + // Queue panel HBQueueController * fQueueController; - IBOutlet NSTextField * fQueueStatus; - - /* Output panel */ + + // Output panel HBOutputPanelController * outputPanel; - /* Source box */ + // Source box IBOutlet NSProgressIndicator * fScanIndicator; IBOutlet NSBox * fScanHorizontalLine; IBOutlet NSTextField * fSrcDVD2Field; - IBOutlet NSTextField * fSrcTitleField; IBOutlet NSPopUpButton * fSrcTitlePopUp; - - /* lib dvd nav specific */ - IBOutlet NSTextField * fSrcAngleLabel; - IBOutlet NSPopUpButton * fSrcAnglePopUp; - - /* Source start and end points */ - IBOutlet NSPopUpButton * fEncodeStartStopPopUp; - /* pts based start / stop */ + // pts based start / stop IBOutlet NSTextField * fSrcTimeStartEncodingField; IBOutlet NSTextField * fSrcTimeEndEncodingField; - /* frame based based start / stop */ + // frame based based start / stop IBOutlet NSTextField * fSrcFrameStartEncodingField; IBOutlet NSTextField * fSrcFrameEndEncodingField; - + IBOutlet NSPopUpButton * fSrcChapterStartPopUp; - IBOutlet NSTextField * fSrcChapterToField; IBOutlet NSPopUpButton * fSrcChapterEndPopUp; - - /* Source duration information */ - IBOutlet NSTextField * fSrcDuration1Field; - IBOutlet NSTextField * fSrcDuration2Field; - - /* Destination box */ - IBOutlet NSTextField * fDstFormatField; - IBOutlet NSPopUpButton * fDstFormatPopUp; - - IBOutlet NSTextField * fDstFile1Field; - IBOutlet NSTextField * fDstFile2Field; - IBOutlet NSButton * fDstBrowseButton; - /* MP4 Options */ - // Optimizes mp4's for http - IBOutlet NSButton * fDstMp4HttpOptFileCheck; - // Creates iPod compatible mp4's (add ipod uuid atom) - IBOutlet NSButton * fDstMp4iPodFileCheck; - - /* Bottom */ + + // Bottom IBOutlet NSTextField * fStatusField; + IBOutlet NSTextField * fQueueStatus; IBOutlet NSProgressIndicator * fRipIndicator; BOOL fRipIndicatorShown; - /* User Preset variables here */ + // User Preset HBPresetsManager * presetManager; HBPresetsViewController * fPresetsView; @@ -139,8 +110,6 @@ - (IBAction) closeSourceTitleScanPanel: (id) sender; - (void) performScan:(NSURL *)scanURL scanTitleNum:(NSInteger)scanTitleNum; -- (void)enableUI:(BOOL)enable; - - (IBAction) titlePopUpChanged: (id) sender; - (IBAction) chapterPopUpChanged: (id) sender; diff --git a/macosx/Controller.m b/macosx/Controller.m index 4023d1300..9c4c4b39d 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -12,7 +12,6 @@ #import "HBPreferencesController.h" #import "HBPresetsManager.h" #import "HBPreset.h" -#import "HBDockTile.h" #import "HBUtilities.h" #import "HBVideoController.h" @@ -47,6 +46,8 @@ /// The HBCore used for scanning. @property (nonatomic, retain) HBCore *core; +@property (nonatomic, readwrite) NSColor *labelColor; + @end @implementation HBController @@ -126,15 +127,11 @@ NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:previewDirectory error:&error]; for (NSString *file in files) { - if (![file isEqual:@"."] && ![file isEqual:@".."]) + BOOL result = [[NSFileManager defaultManager] removeItemAtPath:[previewDirectory stringByAppendingPathComponent:file] error:&error]; + if (result == NO && error) { - BOOL result = [[NSFileManager defaultManager] removeItemAtPath:[previewDirectory stringByAppendingPathComponent:file] error:&error]; - if (result == NO && error) - { - //an error occurred - [HBUtilities writeToActivityLog: "Could not remove existing preview at : %s", file.UTF8String]; - } - } + [HBUtilities writeToActivityLog: "Could not remove existing preview at : %s", file.UTF8String]; + } } } @@ -307,6 +304,8 @@ // Retain the new job [_job autorelease]; _job = [job retain]; + + [self enableUI:(job != nil)]; } #pragma mark - @@ -521,38 +520,18 @@ } } -- (void) enableUI: (BOOL) b +- (void)enableUI:(BOOL)enabled { - NSControl * controls[] = + if (enabled) { - fSrcTitleField, fSrcTitlePopUp, - fSrcChapterStartPopUp, fSrcChapterToField, - fSrcChapterEndPopUp, fSrcDuration1Field, fSrcDuration2Field, - fDstFormatField, fDstFormatPopUp, fDstFile1Field, fDstFile2Field, - fDstBrowseButton, fSrcAngleLabel, fSrcAnglePopUp, - fDstMp4HttpOptFileCheck, fDstMp4iPodFileCheck, - fEncodeStartStopPopUp, fSrcTimeStartEncodingField, - fSrcTimeEndEncodingField, fSrcFrameStartEncodingField, - fSrcFrameEndEncodingField, - - }; - for (unsigned i = 0; i < (sizeof(controls) / sizeof(NSControl*)); i++) + self.labelColor = [NSColor controlTextColor]; + } + else { - if ([[controls[i] className] isEqualToString: @"NSTextField"]) - { - NSTextField *tf = (NSTextField*)controls[i]; - if (![tf isBezeled]) - { - [tf setTextColor: (b ? - [NSColor controlTextColor] : - [NSColor disabledControlTextColor])]; - continue; - } - } - [controls[i] setEnabled: b]; + self.labelColor = [NSColor disabledControlTextColor]; } - fPresetsView.enabled = b; + fPresetsView.enabled = enabled; } #pragma mark - @@ -923,7 +902,6 @@ } self.job = nil; - [self enableUI:NO]; NSError *outError = NULL; BOOL suppressWarning = [[NSUserDefaults standardUserDefaults] boolForKey:@"suppresslibdvdcss"]; @@ -1053,8 +1031,6 @@ [fSrcTitlePopUp selectItemAtIndex:0]; } - // Updates the main window ui - [self enableUI:YES]; [self titlePopUpChanged:nil]; // Open preview window now if it was visible when HB was closed @@ -1479,7 +1455,7 @@ - (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) + if (self.job.container & HB_MUX_MASK_MP4) { [self autoSetM4vExtension:notification]; } diff --git a/macosx/English.lproj/MainMenu.xib b/macosx/English.lproj/MainMenu.xib index 2aa8f63da..e905e8410 100644 --- a/macosx/English.lproj/MainMenu.xib +++ b/macosx/English.lproj/MainMenu.xib @@ -92,6 +92,9 @@ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="240" name="textColor" keyPath="self.labelColor" id="hQD-eK-scB"/> + </connections> </textField> <popUpButton verticalHuggingPriority="750" id="1541"> <rect key="frame" x="53" y="506" width="312" height="22"/> @@ -108,6 +111,11 @@ <accessibility description="Title"/> <connections> <action selector="titlePopUpChanged:" target="240" id="1567"/> + <binding destination="240" name="enabled" keyPath="self.job" id="qhW-2r-Dyu"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> </connections> </popUpButton> <popUpButton verticalHuggingPriority="750" id="5513"> @@ -119,6 +127,11 @@ <menu key="menu" title="OtherViews" id="5515"/> </popUpButtonCell> <connections> + <binding destination="240" name="enabled" keyPath="self.job" id="0hv-wd-DYQ"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <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> @@ -132,6 +145,7 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> + <binding destination="240" name="textColor" keyPath="self.labelColor" id="04p-bK-jZu"/> <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" id="GhV-lP-BWw"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> @@ -153,8 +167,13 @@ </popUpButtonCell> <accessibility description="Angle"/> <connections> + <binding destination="240" name="enabled" keyPath="self.job" id="E6D-8s-CYK"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="240" name="content" keyPath="self.job.angles" id="oFZ-d6-aeJ"/> - <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" id="8xq-AL-yDc"> + <binding destination="5676" name="hidden" keyPath="values.UseDvdNav" previousBinding="E6D-8s-CYK" id="U04-3Y-Z7d"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> @@ -169,6 +188,9 @@ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="240" name="textColor" keyPath="self.labelColor" id="qTW-e6-NIe"/> + </connections> </textField> <textField verticalHuggingPriority="750" id="1553"> <rect key="frame" x="764" y="511" width="65" height="14"/> @@ -178,6 +200,13 @@ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="240" name="hidden" keyPath="self.job" id="1z1-WP-lXF"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNil</string> + </dictionary> + </binding> + </connections> </textField> <textField verticalHuggingPriority="750" id="1554"> <rect key="frame" x="829" y="511" width="99" height="14"/> @@ -188,6 +217,11 @@ <color key="backgroundColor" red="0.76630436999999996" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/> </textFieldCell> <connections> + <binding destination="240" name="hidden" keyPath="self.job" id="Xf7-IA-bzp"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNil</string> + </dictionary> + </binding> <binding destination="240" name="value" keyPath="self.job.range.duration" id="D3F-S5-u15"/> </connections> </textField> @@ -214,6 +248,11 @@ </popUpButtonCell> <accessibility description="Format"/> <connections> + <binding destination="240" name="enabled" keyPath="self.job" id="rkV-UW-k5X"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="240" name="selectedValue" keyPath="self.job.container" previousBinding="7Po-AA-KsM" id="brh-Ek-It1"> <dictionary key="options"> <string key="NSValueTransformerName">HBContainerTransformer</string> @@ -231,6 +270,11 @@ </buttonCell> <connections> <action selector="browseFile:" target="240" id="1579"/> + <binding destination="240" name="enabled" keyPath="self.job" id="MHg-yi-1ag"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> </connections> </button> <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="1623"> @@ -258,6 +302,11 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> + <binding destination="240" name="enabled" keyPath="self.job" id="13e-O9-Pfx"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="240" name="value" keyPath="self.job.destURL" id="Vmi-3b-LD5"> <dictionary key="options"> <bool key="NSContinuouslyUpdatesValue" value="YES"/> @@ -379,6 +428,9 @@ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="240" name="textColor" keyPath="self.labelColor" id="Esr-ae-0fm"/> + </connections> </textField> <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="3205"> <rect key="frame" x="386" y="543" width="540" height="5"/> @@ -431,6 +483,13 @@ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> + <connections> + <binding destination="240" name="hidden" keyPath="self.job" id="6TJ-gX-20A"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNil</string> + </dictionary> + </binding> + </connections> </textField> <popUpButton verticalHuggingPriority="750" id="1545"> <rect key="frame" x="578" y="506" width="60" height="22"/> @@ -546,7 +605,7 @@ <connections> <outlet property="delegate" destination="240" id="433"/> </connections> - <point key="canvasLocation" x="954" y="541"/> + <point key="canvasLocation" x="842" y="531"/> </window> <menu title="MainMenu" systemMenu="main" id="29" userLabel="MainMenu"> <items> @@ -1017,14 +1076,6 @@ DQ <outlet property="fAdvancedTab" destination="2015" id="4eO-Lg-7cH"/> <outlet property="fAudioTab" destination="1475" id="AuZ-Uf-bla"/> <outlet property="fChaptersTitlesTab" destination="1989" id="oUt-8L-Ag2"/> - <outlet property="fDstBrowseButton" destination="1562" id="1578"/> - <outlet property="fDstFile1Field" destination="1552" id="1596"/> - <outlet property="fDstFile2Field" destination="1561" id="N8U-j2-c00"/> - <outlet property="fDstFormatField" destination="1556" id="1583"/> - <outlet property="fDstFormatPopUp" destination="1557" id="1584"/> - <outlet property="fDstMp4HttpOptFileCheck" destination="4579" id="4581"/> - <outlet property="fDstMp4iPodFileCheck" destination="4967" id="4969"/> - <outlet property="fEncodeStartStopPopUp" destination="5513" id="5527"/> <outlet property="fMainTabView" destination="1474" id="XMU-Vi-8QM"/> <outlet property="fOpenSourceTitleMMenu" destination="2698" id="2700"/> <outlet property="fPresetDrawer" destination="1841" id="1889"/> @@ -1037,20 +1088,14 @@ DQ <outlet property="fScanSrcTitleOpenButton" destination="2708" id="2712"/> <outlet property="fScanSrcTitlePanel" destination="2701" id="2713"/> <outlet property="fScanSrcTitlePathField" destination="2703" id="2709"/> - <outlet property="fSrcAngleLabel" destination="5180" id="5186"/> - <outlet property="fSrcAnglePopUp" destination="5181" id="5533"/> <outlet property="fSrcChapterEndPopUp" destination="1548" id="1569"/> <outlet property="fSrcChapterStartPopUp" destination="1545" id="1568"/> - <outlet property="fSrcChapterToField" destination="5505" id="5532"/> <outlet property="fSrcDVD2Field" destination="1539" id="1591"/> <outlet property="fSrcDsplyNameTitleScan" destination="2720" id="2721"/> - <outlet property="fSrcDuration1Field" destination="1553" id="1589"/> - <outlet property="fSrcDuration2Field" destination="1554" id="1590"/> <outlet property="fSrcFrameEndEncodingField" destination="5523" id="5526"/> <outlet property="fSrcFrameStartEncodingField" destination="5521" id="5525"/> <outlet property="fSrcTimeEndEncodingField" destination="5493" id="5508"/> <outlet property="fSrcTimeStartEncodingField" destination="5491" id="5507"/> - <outlet property="fSrcTitleField" destination="1540" id="1592"/> <outlet property="fSrcTitlePopUp" destination="1541" id="1593"/> <outlet property="fStatusField" destination="1123" id="1238"/> <outlet property="fSubtitlesTab" destination="5194" id="d9b-rJ-XrS"/> |