summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-02-04 16:45:29 +0000
committersr55 <[email protected]>2012-02-04 16:45:29 +0000
commit53e2efcc66a556b2e3b7788a2152d6ed9a033f1b (patch)
tree4cc2cd7e0a15f2a1b21ffebdaecfd7b80053fb29 /win
parent24468ce428c512fe6375a92eb6957cada4e0e89a (diff)
WinGui: Fix the plist importer. New Passthru keys added.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4437 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs26
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs6
-rw-r--r--win/CS/frmMain.cs35
3 files changed, 40 insertions, 27 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 19a98c3f5..1d2e4d3af 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
@@ -42,7 +42,7 @@ namespace HandBrake.ApplicationServices.Utilities
string qualityMode = string.Empty;
#region Get a List of Audio Track Objects
- XmlNode audioListDict = root.ChildNodes[2].ChildNodes[0].FirstChild.ChildNodes[1];
+ XmlNode audioListDict = root.ChildNodes[2].ChildNodes[0].FirstChild.ChildNodes[13];
ObservableCollection<AudioTrack> audioTracks = new ObservableCollection<AudioTrack>();
for (int i = 0; i < audioListDict.ChildNodes.Count; i++)
@@ -76,7 +76,7 @@ namespace HandBrake.ApplicationServices.Utilities
track.DRC = double.Parse(value);
break;
case "AudioTrackGainSlider":
- track.Gain = int.Parse(value);
+ track.Gain = int.Parse(value.Replace("0.0", "0"));
break;
}
}
@@ -90,7 +90,7 @@ namespace HandBrake.ApplicationServices.Utilities
XmlNode presetSettings = root.ChildNodes[2].ChildNodes[0].FirstChild;
// Start from 2 to avoid the audio settings which we don't need.
- for (int i = 2; i < presetSettings.ChildNodes.Count; i += 2)
+ for (int i = 0; i < presetSettings.ChildNodes.Count; i += 2)
{
string key = presetSettings.ChildNodes[i].InnerText;
string value = presetSettings.ChildNodes[i + 1].InnerText;
@@ -321,6 +321,26 @@ namespace HandBrake.ApplicationServices.Utilities
case "UsesPictureSettings":
parsed.UsesPictureSettings = value == "1";
break;
+
+ // Allowed Passthru
+ case "AudioAllowAACPass":
+ parsed.AllowedPassthruOptions.AudioAllowAACPass = value == "1";
+ break;
+ case "AudioAllowAC3Pass":
+ parsed.AllowedPassthruOptions.AudioAllowAC3Pass = value == "1";
+ break;
+ case "AudioAllowDTSHDPass":
+ parsed.AllowedPassthruOptions.AudioAllowDTSHDPass = value == "1";
+ break;
+ case "AudioAllowDTSPass":
+ parsed.AllowedPassthruOptions.AudioAllowDTSPass = value == "1";
+ break;
+ case "AudioAllowMP3Pass":
+ parsed.AllowedPassthruOptions.AudioAllowMP3Pass = value == "1";
+ break;
+ case "AudioEncoderFallback":
+ parsed.AllowedPassthruOptions.AudioEncoderFallback = EnumHelper<AudioEncoder>.GetValue(value);
+ break;
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index 2f3d2b557..67717ecab 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -269,7 +269,11 @@ namespace HandBrake.ApplicationServices.Utilities
query += string.Format(" --pixel-aspect {0}:{1}", task.PixelAspectX, task.PixelAspectY);
break;
}
- query += " --modulus " + task.Modulus;
+
+ if (task.Modulus.HasValue)
+ {
+ query += " --modulus " + task.Modulus;
+ }
return query;
}
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs
index cc2445367..4e7862d99 100644
--- a/win/CS/frmMain.cs
+++ b/win/CS/frmMain.cs
@@ -828,20 +828,10 @@ namespace Handbrake
/// </summary>
private void ImportPreset()
{
- if (this.selectedTitle == null)
- {
- MessageBox.Show(
- "Please scan a source before trying to import a preset.",
- "Error",
- MessageBoxButtons.OK,
- MessageBoxIcon.Error);
- return;
- }
-
if (openPreset.ShowDialog() == DialogResult.OK)
{
EncodeTask parsed = PlistPresetHandler.Import(openPreset.FileName);
- PresetLoader.LoadPreset(this, parsed);
+
if (presetHandler.CheckIfPresetExists(parsed.PresetName))
{
if (!presetHandler.CanUpdatePreset(parsed.PresetName))
@@ -861,27 +851,26 @@ namespace Handbrake
if (result == DialogResult.Yes)
{
Preset preset = new Preset
- {
- Name = parsed.PresetName,
- Query = QueryGenerator.GenerateFullQuery(this).Query,
- CropSettings = parsed.UsesPictureSettings,
- Task = parsed,
- AudioPassthruSettings = new AllowedPassthru(false), // TODO at a future point, support this.
- };
+ {
+ Name = parsed.PresetName,
+ Query = QueryGeneratorUtility.GenerateQuery(parsed),
+ CropSettings = parsed.UsesPictureSettings,
+ Description = string.Empty,
+ AudioPassthruSettings = parsed.AllowedPassthruOptions
+ };
presetHandler.Update(preset);
}
}
else
{
-
- Preset preset = new Preset
+ Preset preset = new Preset
{
Name = parsed.PresetName,
- Query = QueryGenerator.GenerateFullQuery(this).Query,
+ Query = QueryGeneratorUtility.GenerateQuery(parsed),
CropSettings = parsed.UsesPictureSettings,
- Task = parsed,
- AudioPassthruSettings = new AllowedPassthru(false), // TODO at a future point, support this.
+ Description = string.Empty,
+ AudioPassthruSettings = parsed.AllowedPassthruOptions
};
if (presetHandler.Add(preset))