summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/English.lproj/SubtitlesDefaults.xib6
-rw-r--r--macosx/HBLanguagesSelection.h2
-rw-r--r--macosx/HBLanguagesSelection.m14
-rw-r--r--macosx/HBSubtitlesController.m43
-rw-r--r--macosx/HBSubtitlesDefaultsController.m3
5 files changed, 44 insertions, 24 deletions
diff --git a/macosx/English.lproj/SubtitlesDefaults.xib b/macosx/English.lproj/SubtitlesDefaults.xib
index 11c528809..e124d8203 100644
--- a/macosx/English.lproj/SubtitlesDefaults.xib
+++ b/macosx/English.lproj/SubtitlesDefaults.xib
@@ -97,14 +97,14 @@
<rect key="frame" x="1" y="1" width="244" height="133"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" id="Of7-71-Ci6">
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" autosaveColumns="NO" rowHeight="14" id="Of7-71-Ci6">
<rect key="frame" x="0.0" y="0.0" width="244" height="133"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn width="20" minWidth="20" maxWidth="20" id="G44-XP-6xE">
+ <tableColumn identifier="checkBox" width="20" minWidth="20" maxWidth="20" id="G44-XP-6xE">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -119,7 +119,7 @@
<binding destination="ZBe-aP-wvq" name="value" keyPath="arrangedObjects.isSelected" id="fRp-oC-H6C"/>
</connections>
</tableColumn>
- <tableColumn width="210" minWidth="10" maxWidth="2000" id="IJ6-jx-Nba">
+ <tableColumn identifier="name" width="210" minWidth="10" maxWidth="2000" id="IJ6-jx-Nba">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
diff --git a/macosx/HBLanguagesSelection.h b/macosx/HBLanguagesSelection.h
index cb017555b..bd95a003b 100644
--- a/macosx/HBLanguagesSelection.h
+++ b/macosx/HBLanguagesSelection.h
@@ -40,7 +40,7 @@
/**
* HBLanguageArrayController
*/
-@interface HBLanguageArrayController : NSArrayController
+@interface HBLanguageArrayController : NSArrayController <NSTableViewDelegate>
/**
* Set whether to show only the selected languages or all languages
diff --git a/macosx/HBLanguagesSelection.m b/macosx/HBLanguagesSelection.m
index c57df8bbe..9dac0883d 100644
--- a/macosx/HBLanguagesSelection.m
+++ b/macosx/HBLanguagesSelection.m
@@ -138,6 +138,20 @@ NSString *kHBLanguagesDragRowsType = @"kHBLanguagesDragRowsType";
self.isDragginEnabled = YES;
}
+#pragma mark - NSTableView Delegate
+
+- (NSString *)tableView:(NSTableView *)tableView typeSelectStringForTableColumn:(NSTableColumn *)tableColumn
+ row:(NSInteger)row
+{
+ if ([[tableColumn identifier] isEqualToString:@"name"])
+ {
+ NSUInteger tableColumnIndex = [[tableView tableColumns] indexOfObject:tableColumn];
+ return [[tableView preparedCellAtColumn:tableColumnIndex
+ row:row] stringValue];
+ }
+ return nil;
+}
+
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
{
if (self.isDragginEnabled)
diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m
index a01812606..f9706973e 100644
--- a/macosx/HBSubtitlesController.m
+++ b/macosx/HBSubtitlesController.m
@@ -277,6 +277,10 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
*/
- (IBAction)addTracksFromDefaults:(id)sender
{
+ // Keeps a set of the indexes of the added track
+ // so we don't add the same track twice.
+ NSMutableIndexSet *tracksAdded = [NSMutableIndexSet indexSet];
+
[self.subtitleArray removeAllObjects];
// Add the foreign audio search pass
@@ -285,35 +289,28 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
[self addTrack:[self trackFromSourceTrackIndex:-1]];
}
- // If the languages list contains the "(Any)" language, remove all the others
- NSArray *languages = nil;
- if ([self.settings.trackSelectionLanguages containsObject:@"und"])
- {
- languages = @[@"und"];
- }
- else
- {
- languages = self.settings.trackSelectionLanguages;
- }
-
// Add the tracks for the selected languages
if (self.settings.trackSelectionBehavior != HBSubtitleTrackSelectionBehaviorNone)
{
- for (NSString *lang in languages)
+ for (NSString *lang in self.settings.trackSelectionLanguages)
{
- NSInteger sourceIndex = 0;
for (NSDictionary *track in self.subtitleSourceArray)
{
if ([lang isEqualToString:@"und"] || [track[keySubTrackLanguageIsoCode] isEqualToString:lang])
{
- [self addTrack:[self trackFromSourceTrackIndex:sourceIndex]];
+ NSInteger sourceIndex = [track[keySubTrackIndex] intValue];
+
+ if (![tracksAdded containsIndex:sourceIndex])
+ {
+ [self addTrack:[self trackFromSourceTrackIndex:sourceIndex]];
+ }
+ [tracksAdded addIndex:sourceIndex];
if (self.settings.trackSelectionBehavior == HBSubtitleTrackSelectionBehaviorFirst)
{
break;
}
}
- sourceIndex++;
}
}
}
@@ -321,19 +318,27 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex";
// Add the closed captions track if there is one.
if (self.settings.addCC)
{
- NSInteger sourceIndex = 0;
for (NSDictionary *track in self.subtitleSourceArray)
{
if ([track[keySubTrackType] intValue] == CC608SUB)
{
- [self addTrack:[self trackFromSourceTrackIndex:sourceIndex]];
- break;
+ NSInteger sourceIndex = [track[keySubTrackIndex] intValue];
+ if (![tracksAdded containsIndex:sourceIndex])
+ {
+ [self addTrack:[self trackFromSourceTrackIndex:sourceIndex]];
+ }
+
+ if (self.settings.trackSelectionBehavior == HBSubtitleTrackSelectionBehaviorFirst)
+ {
+ break;
+ }
}
- sourceIndex++;
}
}
+ // Add an empty track
[self.subtitleArray addObject:[self createSubtitleTrack]];
+
[self validatePassthru];
[self.fTableView reloadData];
}
diff --git a/macosx/HBSubtitlesDefaultsController.m b/macosx/HBSubtitlesDefaultsController.m
index ead542080..e19c18aa2 100644
--- a/macosx/HBSubtitlesDefaultsController.m
+++ b/macosx/HBSubtitlesDefaultsController.m
@@ -45,7 +45,8 @@ static void *HBSubtitlesDefaultsContex = &HBSubtitlesDefaultsContex;
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
- if (context == HBSubtitlesDefaultsContex) {
+ if (context == HBSubtitlesDefaultsContex)
+ {
if ([keyPath isEqualToString:@"tableController.showSelectedOnly"])
{
[self.showAllButton setState:!self.tableController.showSelectedOnly];