diff options
author | ritsuka <[email protected]> | 2014-07-29 18:38:01 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-07-29 18:38:01 +0000 |
commit | 56680a9b967772ca6eb9112ac6f2a9e9bbe7244b (patch) | |
tree | fa4ec9a0b75a63313b566325920225e666dcea42 /macosx/HBSubtitlesDefaultsController.m | |
parent | 6dc3dd8351bec754610bbed5fff5bfe3f5738b01 (diff) |
MacGui: Implemented a configuration panel similar to the win/lin gui one for the subtitles defaults, and added some more options from the other guis (add all, remove all).
The SubtitleAddForeignAudioSubtitle setting will be added later after the automatic audio selection is done.
Fixed a bug where HandBrake used 50% of cpu time if the subtitles table view was selected.
Refactored a big part of HBSubtitlesController to make it works with the new automatic options and to cleaned the table view data source.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6241 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBSubtitlesDefaultsController.m')
-rw-r--r-- | macosx/HBSubtitlesDefaultsController.m | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/macosx/HBSubtitlesDefaultsController.m b/macosx/HBSubtitlesDefaultsController.m new file mode 100644 index 000000000..f529798d4 --- /dev/null +++ b/macosx/HBSubtitlesDefaultsController.m @@ -0,0 +1,68 @@ +/* HBSubtitlesDefaultsController.m $ + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import "HBSubtitlesDefaultsController.h" +#import "HBSubtitlesSettings.h" +#import "HBLanguagesSelection.h" + +@interface HBSubtitlesDefaultsController () + +@property (nonatomic, readonly) HBSubtitlesSettings *settings; + +@property (nonatomic, readonly) HBLanguagesSelection *languagesList; +@property (assign) IBOutlet HBLanguageArrayController *tableController; +@property (assign) IBOutlet NSButton *showAllButton; + +@end + +@implementation HBSubtitlesDefaultsController + +- (instancetype)initWithSettings:(HBSubtitlesSettings *)settings +{ + self = [super initWithWindowNibName:@"SubtitlesDefaults"]; + if (self) + { + _settings = [settings retain]; + _languagesList = [[HBLanguagesSelection alloc] initWithLanguages:_settings.trackSelectionLanguages]; + } + return self; +} + +- (void)windowDidLoad +{ + if (self.settings.trackSelectionLanguages.count) + { + self.tableController.showSelectedOnly = YES; + [self.showAllButton setState:NSOffState]; + } +} + +- (IBAction)edit:(id)sender +{ + self.tableController.showSelectedOnly = !self.tableController.showSelectedOnly; +} + +- (IBAction)done:(id)sender +{ + [[self window] orderOut:nil]; + [NSApp endSheet:[self window]]; + + [self.settings.trackSelectionLanguages removeAllObjects]; + [self.settings.trackSelectionLanguages addObjectsFromArray:self.languagesList.selectedLanguages]; + + if ([self.delegate respondsToSelector:@selector(sheetDidEnd)]) + { + [self.delegate performSelector:@selector(sheetDidEnd)]; + } +} + +- (void)dealloc +{ + [super dealloc]; + [_settings release]; +} + +@end |