summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-08-10 16:05:07 +0000
committerritsuka <[email protected]>2014-08-10 16:05:07 +0000
commit6aee3b7518264af46fd7d2f4580579313e2eaf72 (patch)
tree9e2839ae202e1c07baeb181abba643714ae71b21
parentc50899dd7361801c04463fe1630392500608ebab (diff)
MacGui: implemented the HBViewValidation protocol in each of the main window view controllers.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6285 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.m18
-rw-r--r--macosx/HBAdvancedController.h4
-rw-r--r--macosx/HBAdvancedController.m8
-rw-r--r--macosx/HBAudioController.h5
-rw-r--r--macosx/HBAudioController.m12
-rw-r--r--macosx/HBChapterTitlesController.h6
-rw-r--r--macosx/HBChapterTitlesController.m10
-rw-r--r--macosx/HBPresetsViewController.m16
-rw-r--r--macosx/HBSubtitlesController.h4
-rw-r--r--macosx/HBSubtitlesController.m12
-rw-r--r--macosx/HBVideoController.h6
-rw-r--r--macosx/HBVideoController.m14
-rw-r--r--macosx/HBViewValidation.h2
13 files changed, 52 insertions, 65 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 83d7d06c0..3ba09b792 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -725,22 +725,14 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
}
[controls[i] setEnabled: b];
}
-
-
- if (b)
- {
- /* we also call calculatePictureSizing here to sense check if we already have vfr selected ??? */
- [self pictureSettingsDidChange];
- }
- [fPresetsView setEnabled:b];
- [fVideoController enableUI:b];
- [fChapterTitlesController enableUI:b];
- [fSubtitlesViewController enableUI:b];
- [fAudioController enableUI:b];
+ [fPresetsView setUIEnabled:b];
+ [fVideoController setUIEnabled:b];
+ [fAudioController setUIEnabled:b];
+ [fSubtitlesViewController setUIEnabled:b];
+ [fChapterTitlesController setUIEnabled:b];
}
-
/***********************************************************************
* updateDockIcon
***********************************************************************
diff --git a/macosx/HBAdvancedController.h b/macosx/HBAdvancedController.h
index cf077b448..d80923ddd 100644
--- a/macosx/HBAdvancedController.h
+++ b/macosx/HBAdvancedController.h
@@ -5,11 +5,12 @@
It may be used under the terms of the GNU General Public License. */
#import <Cocoa/Cocoa.h>
+#import "HBViewValidation.h"
/**
* HBAdvancedController
*/
-@interface HBAdvancedController : NSViewController
+@interface HBAdvancedController : NSViewController <HBViewValidation>
{
/* Advanced Tab for opts fX264optView*/
IBOutlet NSBox * fOptionsBox;
@@ -69,7 +70,6 @@
- (NSString *) optionsStringLavc;
- (void) setOptions: (NSString *)string;
- (void) setLavcOptions: (NSString *)string;
-- (void) enableUI: (bool) b;
- (void) setHidden: (BOOL) hide;
- (void) setLavcOptsEnabled: (BOOL) lavc;
- (IBAction) X264AdvancedOptionsAnimate: (id) sender;
diff --git a/macosx/HBAdvancedController.m b/macosx/HBAdvancedController.m
index 0900c010e..e0f509235 100644
--- a/macosx/HBAdvancedController.m
+++ b/macosx/HBAdvancedController.m
@@ -76,7 +76,7 @@
return;
}
- - (void) enableUI: (bool) b
+ - (void)setUIEnabled:(BOOL)flag
{
unsigned i;
NSControl * controls[] =
@@ -97,16 +97,16 @@
NSTextField * tf = (NSTextField *) controls[i];
if( ![tf isBezeled] )
{
- [tf setTextColor: b ? [NSColor controlTextColor] :
+ [tf setTextColor: flag ? [NSColor controlTextColor] :
[NSColor disabledControlTextColor]];
continue;
}
}
- [controls[i] setEnabled: b];
+ [controls[i] setEnabled: flag];
}
- [fX264optView setWantsLayer:YES];
+ //[fX264optView setWantsLayer:YES];
}
- (void)dealloc
diff --git a/macosx/HBAudioController.h b/macosx/HBAudioController.h
index 8655a0792..b77b3ad20 100644
--- a/macosx/HBAudioController.h
+++ b/macosx/HBAudioController.h
@@ -6,6 +6,7 @@
//
#import <Cocoa/Cocoa.h>
+#import "HBViewValidation.h"
extern NSString *keyAudioTrackIndex;
extern NSString *keyAudioTrackName;
@@ -24,7 +25,7 @@ extern NSString *HBMixdownChangedNotification;
*
* Responds to HBContainerChangedNotification and HBTitleChangedNotification notifications.
*/
-@interface HBAudioController : NSViewController
+@interface HBAudioController : NSViewController <HBViewValidation>
@property (nonatomic, readonly, retain) NSArray *masterTrackArray;
@property (nonatomic, readonly) NSDictionary *noneTrack;
@@ -34,8 +35,6 @@ extern NSString *HBMixdownChangedNotification;
// Get the list of audio tracks
@property (readonly, nonatomic, copy) NSArray *audioTracks;
-- (void) enableUI: (BOOL) b;
-
- (void) applySettingsFromPreset:(NSDictionary *)preset;
- (void) addTracksFromQueue: (NSMutableDictionary *) aQueue;
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index 171f37e39..df623d877 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -95,13 +95,13 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
[self switchingTrackFromNone:nil];
}
-- (void)enableUI:(BOOL)b
+- (void)setUIEnabled:(BOOL)flag
{
- self.enabled = b;
- [fTableView setEnabled:b];
- [self.trackPopup setEnabled:b];
- [self.configureDefaults setEnabled:b];
- [self.reloadDefaults setEnabled:b];
+ self.enabled = flag;
+ [fTableView setEnabled:flag];
+ [self.trackPopup setEnabled:flag];
+ [self.configureDefaults setEnabled:flag];
+ [self.reloadDefaults setEnabled:flag];
}
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
diff --git a/macosx/HBChapterTitlesController.h b/macosx/HBChapterTitlesController.h
index f56fd367b..0e59ce902 100644
--- a/macosx/HBChapterTitlesController.h
+++ b/macosx/HBChapterTitlesController.h
@@ -4,15 +4,15 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
+#import "HBViewValidation.h"
/**
* HBChapterTitlesController
* Responds to HBTitleChangedNotification notifications.
*/
-@interface HBChapterTitlesController : NSViewController
+@interface HBChapterTitlesController : NSViewController <HBViewValidation>
-- (void)enableUI:(BOOL)b;
- (void)addChaptersFromQueue:(NSMutableArray *)newChaptersArray;
/**
diff --git a/macosx/HBChapterTitlesController.m b/macosx/HBChapterTitlesController.m
index c4f6a6583..6702a5d81 100644
--- a/macosx/HBChapterTitlesController.m
+++ b/macosx/HBChapterTitlesController.m
@@ -83,12 +83,12 @@
[fChapterTable reloadData];
}
-- (void)enableUI:(BOOL)b
+- (void)setUIEnabled:(BOOL)flag
{
- [fCreateChaptersMarkers setEnabled:b];
- [fChapterTable setEnabled:b];
- [fLoadChaptersButton setEnabled:b];
- [fSaveChaptersButton setEnabled:b];
+ [fCreateChaptersMarkers setEnabled:flag];
+ [fChapterTable setEnabled:flag];
+ [fLoadChaptersButton setEnabled:flag];
+ [fSaveChaptersButton setEnabled:flag];
}
- (NSArray *)chapterTitlesArray
diff --git a/macosx/HBPresetsViewController.m b/macosx/HBPresetsViewController.m
index 6dd76793a..08e03e31e 100644
--- a/macosx/HBPresetsViewController.m
+++ b/macosx/HBPresetsViewController.m
@@ -85,9 +85,9 @@
#pragma mark - HBViewValidation methods
-- (void)setEnabled:(BOOL)enabled
+- (void)setUIEnabled:(BOOL)flag
{
- _enabled = enabled;
+ self.enabled = flag;
}
#pragma mark - UI Methods
@@ -135,18 +135,14 @@
- (IBAction)insertFolder:(id)sender
{
NSIndexPath *selectionIndexPath = [self.treeController selectionIndexPath];
- if (!selectionIndexPath)
+ if (!selectionIndexPath || [[[self.treeController selectedObjects] firstObject] isBuiltIn])
{
selectionIndexPath = [NSIndexPath indexPathWithIndex:self.presets.root.children.count];
}
- HBPreset *selectedNode = [[self.treeController selectedObjects] firstObject];
- if (!selectedNode.isBuiltIn)
- {
- HBPreset *node = [[HBPreset alloc] initWithFolderName:@"New Folder" builtIn:NO];
- [self.treeController insertObject:node atArrangedObjectIndexPath:selectionIndexPath];
- [node autorelease];
- }
+ HBPreset *node = [[HBPreset alloc] initWithFolderName:@"New Folder" builtIn:NO];
+ [self.treeController insertObject:node atArrangedObjectIndexPath:selectionIndexPath];
+ [node autorelease];
}
- (IBAction)setDefault:(id)sender
diff --git a/macosx/HBSubtitlesController.h b/macosx/HBSubtitlesController.h
index 71bafe868..a117cee0f 100644
--- a/macosx/HBSubtitlesController.h
+++ b/macosx/HBSubtitlesController.h
@@ -5,6 +5,7 @@
It may be used under the terms of the GNU General Public License. */
#import <Cocoa/Cocoa.h>
+#import "HBViewValidation.h"
extern NSString *keySubTrackName;
extern NSString *keySubTrackIndex;
@@ -24,9 +25,8 @@ extern NSString *keySubTrackSrtCharCode;
* HBSubtitlesController
* Responds to HBContainerChangedNotification and HBTitleChangedNotification notifications.
*/
-@interface HBSubtitlesController : NSViewController
+@interface HBSubtitlesController : NSViewController <HBViewValidation>
-- (void)enableUI:(BOOL)b;
- (void)addTracksFromQueue:(NSMutableArray *)newSubtitleArray;
- (void)applySettingsFromPreset:(NSDictionary *)preset;
diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m
index f9706973e..996105796 100644
--- a/macosx/HBSubtitlesController.m
+++ b/macosx/HBSubtitlesController.m
@@ -92,13 +92,13 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
return self;
}
-- (void)enableUI:(BOOL)b
+- (void)setUIEnabled:(BOOL)flag
{
- [self.trackPopUp setEnabled:b];
- [self.configureDefaults setEnabled:b];
- [self.reloadDefaults setEnabled:b];
- [self.fTableView setEnabled:b];
- self.enabled = b;
+ [self.trackPopUp setEnabled:flag];
+ [self.configureDefaults setEnabled:flag];
+ [self.reloadDefaults setEnabled:flag];
+ [self.fTableView setEnabled:flag];
+ self.enabled = flag;
}
- (void)titleChanged:(NSNotification *)aNotification
diff --git a/macosx/HBVideoController.h b/macosx/HBVideoController.h
index 75a65f292..b3d0637bc 100644
--- a/macosx/HBVideoController.h
+++ b/macosx/HBVideoController.h
@@ -5,6 +5,8 @@
It may be used under the terms of the GNU General Public License. */
#import <Cocoa/Cocoa.h>
+#import "HBViewValidation.h"
+
#include "hb.h"
@class HBController;
@@ -17,9 +19,7 @@ extern NSString *HBVideoEncoderChangedNotification;
*
* Responds to HBContainerChangedNotification and HBTitleChangedNotification notifications.
*/
-@interface HBVideoController : NSViewController
-
-- (void)enableUI:(BOOL)b;
+@interface HBVideoController : NSViewController <HBViewValidation>
// Methods to apply the settings to the controller
- (void)applyVideoSettingsFromQueue:(NSDictionary *)queueToApply;
diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m
index e602e3f8d..3490b483d 100644
--- a/macosx/HBVideoController.m
+++ b/macosx/HBVideoController.m
@@ -120,8 +120,8 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
* avoids an invalid free
*/
fX264PresetsUnparsedUTF8String = NULL;
- _pictureFiltersField = @"Pictures Filters:";
- _pictureSettingsField = @"Pictures Settings:";
+ _pictureFiltersField = @"Picture Filters:";
+ _pictureSettingsField = @"Picture Settings:";
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
@@ -187,7 +187,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
[fVidTurboPassCheck setState: NSOffState];
}
-- (void)enableUI:(BOOL)b {
+- (void)setUIEnabled:(BOOL)flag {
NSControl *controls[] =
{
fFramerateMatrix,
@@ -214,17 +214,17 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
NSTextField *tf = (NSTextField *)controls[i];
if (![tf isBezeled])
{
- [tf setTextColor: (b ?
+ [tf setTextColor: (flag ?
[NSColor controlTextColor] :
[NSColor disabledControlTextColor])];
continue;
}
}
- [controls[i] setEnabled: b];
+ [controls[i] setEnabled:flag];
}
[self videoMatrixChanged:nil];
- [self enableX264Widgets:b];
+ [self enableX264Widgets:flag];
}
- (void)containerChanged:(NSNotification *)aNotification
@@ -1065,7 +1065,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
// enable/disable the checkbox and advanced panel
[fX264UseAdvancedOptionsCheck setEnabled:enable];
- [self.fAdvancedOptions enableUI:enable_advanced_panel];
+ [self.fAdvancedOptions setUIEnabled:enable_advanced_panel];
// enable/disable the x264 preset system controls
for (unsigned i = 0; i < (sizeof(controls) / sizeof(NSControl*)); i++)
diff --git a/macosx/HBViewValidation.h b/macosx/HBViewValidation.h
index 610d7bb25..779208cd4 100644
--- a/macosx/HBViewValidation.h
+++ b/macosx/HBViewValidation.h
@@ -10,6 +10,6 @@
@protocol HBViewValidation <NSObject>
-- (void)setEnabled:(BOOL)enabled;
+- (void)setUIEnabled:(BOOL)flag;
@end