From 3a6f545a6bd88001c994383b32e9560000111899 Mon Sep 17 00:00:00 2001
From: sr55 <sr55.hb@outlook.com>
Date: Fri, 3 Jun 2011 19:49:57 +0000
Subject: WinGui: - Added support for naming tracks. New text entry field on
 the Advanced Audio Window. (Note: May be some CLI issues that need to be
 fixed up for this. We'll see) - Disabled application settings upgrade when
 moving from a release to a svn build. Upgrades now only work for svn -> svn
 builds as there has been reliability issues when upgrading from much older
 builds.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4019 b64f7644-9d1e-0410-96f1-a4d463321fa5
---
 win/CS/Functions/QueryGenerator.cs | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'win/CS/Functions/QueryGenerator.cs')

diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs
index 25003582b..027ad024b 100644
--- a/win/CS/Functions/QueryGenerator.cs
+++ b/win/CS/Functions/QueryGenerator.cs
@@ -392,6 +392,7 @@ namespace Handbrake.Functions
             string bitrates = string.Empty;
             string drvValues = string.Empty;
             string gainValues = string.Empty;
+            string trackNames = string.Empty;
 
             // If we have no audio tracks, set the query to none
             if (mainWindow.AudioSettings.AudioTracks.ToList().Count == 0)
@@ -430,9 +431,28 @@ namespace Handbrake.Functions
 
                 // Audio Gain Control
                 gainValues += string.IsNullOrEmpty(gainValues) ? audioTrack.Gain.ToString(Culture) : string.Format(",{0}", audioTrack.Gain.ToString(Culture));
+
+                trackNames += string.IsNullOrEmpty(trackNames)
+                                ? string.IsNullOrEmpty(audioTrack.TrackName) ? "\" \"" : string.Format("\"{0}\"", audioTrack.TrackName.Trim())
+                                : string.IsNullOrEmpty(audioTrack.TrackName) ? ",\" \"" : string.Format(",\"{0}\"", audioTrack.TrackName.Trim());
+            }
+
+            string audioQuery = string.Format(
+                " -a {0} -E {1} -B {2} -6 {3} -R {4} -D {5} --gain={6}",
+                tracks,
+                encoders,
+                bitrates,
+                mixdowns,
+                samplerates,
+                drvValues,
+                gainValues);
+
+            if (!string.IsNullOrEmpty(trackNames.Trim()) && trackNames.Trim() != ",")
+            {
+                audioQuery += string.Format(" --aname={0}", trackNames);
             }
 
-            return string.Format(" -a {0} -E {1} -B {2} -6 {3} -R {4} -D {5} --gain={6}", tracks, encoders, bitrates, mixdowns, samplerates, drvValues, gainValues);
+            return audioQuery;
         }
 
         private static string ChapterMarkersQuery(frmMain mainWindow)
-- 
cgit v1.2.3