diff options
author | sr55 <[email protected]> | 2011-12-01 22:11:32 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-12-01 22:11:32 +0000 |
commit | f12fe4521c0555e907caecf118b7539e03ea1b38 (patch) | |
tree | 18af236300ad406061ceb165fdc8197c764b799c /win/CS/Controls | |
parent | 608d03fdab381791aef98ddb53eea09e8f42bb57 (diff) |
WinGui: Extended the Automatic Audioo/Subtitle selection feature to allow a preferred language to be set for Subtitles and remove some restrictions on the window to make it more flexible.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4370 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/Controls')
-rw-r--r-- | win/CS/Controls/AudioPanel.cs | 13 | ||||
-rw-r--r-- | win/CS/Controls/Subtitles.cs | 19 |
2 files changed, 16 insertions, 16 deletions
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs index fc9083586..f50340f80 100644 --- a/win/CS/Controls/AudioPanel.cs +++ b/win/CS/Controls/AudioPanel.cs @@ -609,7 +609,6 @@ namespace Handbrake.Controls }
}
-
/// <summary>
/// Attempt to automatically select the correct audio tracks based on the users settings.
/// </summary>
@@ -621,10 +620,10 @@ namespace Handbrake.Controls this.AudioTracks.Clear();
return;
}
-
- // Handle Preferred Language
+
if (this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
{
+ // If we have Any as the preferred Language, just set the first track to all audio tracks.
drp_audioTrack.SelectedIndex = 0;
foreach (AudioTrack track in this.audioTracks)
{
@@ -634,10 +633,10 @@ namespace Handbrake.Controls }
}
- return;
}
else
- {
+ {
+ // Otherwise, set all the tracks to the first track of the preferred language.
foreach (Audio item in drp_audioTrack.Items)
{
if (item.Language.Contains(this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage)))
@@ -663,7 +662,7 @@ namespace Handbrake.Controls // Now add any additional Langauges tracks on top of the presets tracks.
int mode = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeAudio);
ArrayList languageOrder = new ArrayList(); // This is used to keep the Prefered Language in the front and the other languages in order. TODO this is no longer required, refactor this.
- if (mode > 0)
+ if (mode > 1)
{
foreach (string item in this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
@@ -706,7 +705,7 @@ namespace Handbrake.Controls {
case 1: // Adding all remaining audio tracks
this.mnu_AddAll_Click(this, EventArgs.Empty);
- break;
+ break;
case 2: // Add Langauges tracks for the additional languages selected, in-order.
audioList.ClearSelection();
foreach (string item in languageOrder)
diff --git a/win/CS/Controls/Subtitles.cs b/win/CS/Controls/Subtitles.cs index 4a5bc5fd5..1775f3b6e 100644 --- a/win/CS/Controls/Subtitles.cs +++ b/win/CS/Controls/Subtitles.cs @@ -229,14 +229,11 @@ namespace Handbrake.Controls // New DUB Settings
int mode = UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeSubtitle);
- if (UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
- mode = 0;
-
// Native Language is not 'Any', so initialising the Language Dictionary
if (mode >= 3)
{
- languageIndex.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage), new ArrayList());
- languageOrder.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage));
+ languageIndex.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles), new ArrayList());
+ languageOrder.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles));
foreach (string item in UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
@@ -282,7 +279,7 @@ namespace Handbrake.Controls if (drp_subtitleTracks.SelectedItem != null)
this.btn_addSubtitleTrack_Click(this, new EventArgs());
break;
- case 3:
+ case 3: // Selected Languages Only
foreach (string item in languageOrder)
{
if (languageIndex[item].Count > 0)
@@ -293,13 +290,13 @@ namespace Handbrake.Controls if (drp_subtitleTracks.SelectedItem != null)
{
this.btn_addSubtitleTrack_Click(this, new EventArgs());
- //subList.ClearSelection();
}
}
}
}
break;
- case 4:
+ case 4: // Prefered Only
+ case 5: // Prefered Only All
if (languageIndex[(string)languageOrder[0]].Count > 0)
{
foreach (int i in languageIndex[(string)languageOrder[0]])
@@ -308,7 +305,11 @@ namespace Handbrake.Controls if (drp_subtitleTracks.SelectedItem != null)
{
this.btn_addSubtitleTrack_Click(this, new EventArgs());
- //subList.ClearSelection();
+ if (mode == 4)
+ {
+ // Mode 4 is First, 5 is All
+ break;
+ }
}
}
}
|