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/HBSubtitlesSettings.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/HBSubtitlesSettings.m')
-rw-r--r-- | macosx/HBSubtitlesSettings.m | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/macosx/HBSubtitlesSettings.m b/macosx/HBSubtitlesSettings.m new file mode 100644 index 000000000..fd85dcfcb --- /dev/null +++ b/macosx/HBSubtitlesSettings.m @@ -0,0 +1,61 @@ +/* HBSubtitlesSettings.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 "HBSubtitlesSettings.h" + +@implementation HBSubtitlesSettings + +- (instancetype)init +{ + self = [super init]; + if (self) + { + _trackSelectionLanguages = [[NSMutableArray alloc] init]; + } + return self; +} + +- (void)applySettingsFromPreset:(NSDictionary *)preset +{ + if ([preset[@"SubtitleTrackSelectionBehavior"] isEqualToString:@"first"]) + { + self.trackSelectionBehavior = HBSubtitleTrackSelectionBehaviorFirst; + } + else if ([preset[@"SubtitleTrackSelectionBehavior"] isEqualToString:@"all"]) + { + self.trackSelectionBehavior = HBSubtitleTrackSelectionBehaviorAll; + } + else + { + self.trackSelectionBehavior = HBSubtitleTrackSelectionBehaviorNone; + } + self.trackSelectionLanguages = [NSMutableArray arrayWithArray:preset[@"SubtitleLanguageList"]]; + self.addCC = [preset[@"SubtitleAddCC"] boolValue]; + self.addForeignAudioSearch = [preset[@"SubtitleAddForeignAudioSearch"] boolValue]; + self.addForeignAudioSubtitle = [preset[@"SubtitleAddForeignAudioSubtitle"] boolValue]; +} + +- (void)prepareSubtitlesForPreset:(NSMutableDictionary *)preset +{ + if (self.trackSelectionBehavior == HBSubtitleTrackSelectionBehaviorFirst) + { + preset[@"SubtitleTrackSelectionBehavior"] = @"first"; + } + else if (self.trackSelectionBehavior == HBSubtitleTrackSelectionBehaviorAll) + { + preset[@"SubtitleTrackSelectionBehavior"] = @"all"; + } + else + { + preset[@"SubtitleTrackSelectionBehavior"] = @"none"; + } + preset[@"SubtitleLanguageList"] = self.trackSelectionLanguages; + preset[@"SubtitleAddCC"] = @(self.addCC); + preset[@"SubtitleAddForeignAudioSearch"] = @(self.addForeignAudioSearch); + preset[@"SubtitleAddForeignAudioSubtitle"] = @(self.addForeignAudioSubtitle); +} + +@end |