From 3a6f545a6bd88001c994383b32e9560000111899 Mon Sep 17 00:00:00 2001 From: sr55 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 +++++++++++++++- .../Model/Encoding/AudioTrack.cs | 5 ++++ win/CS/Program.cs | 19 +++++++++++--- win/CS/ToolWindows/AdvancedAudio.Designer.cs | 29 +++++++++++++++++++--- win/CS/ToolWindows/AdvancedAudio.cs | 13 ++++++++++ win/CS/frmOptions.Designer.cs | 10 ++++---- win/CS/frmOptions.resx | 3 --- 7 files changed, 85 insertions(+), 16 deletions(-) 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) diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs index 59f411b85..738670aea 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs @@ -141,6 +141,11 @@ namespace HandBrake.ApplicationServices.Model.Encoding /// public double SampleRate { get; set; } + /// + /// Gets or sets TrackName. + /// + public string TrackName { get; set; } + /// /// Gets or sets Dynamic Range Compression /// diff --git a/win/CS/Program.cs b/win/CS/Program.cs index a04c45e12..4e7dfcbc0 100644 --- a/win/CS/Program.cs +++ b/win/CS/Program.cs @@ -10,6 +10,7 @@ namespace Handbrake using System.IO; using System.Windows.Forms; + using HandBrake.ApplicationServices; using HandBrake.ApplicationServices.Exceptions; using HandBrake.ApplicationServices.Services; @@ -60,10 +61,20 @@ namespace Handbrake { if (Settings.Default.UpdateRequired) { - Settings.Default.Upgrade(); - Settings.Default.UpdateRequired = false; - Settings.Default.Save(); - + // Upgrading user settings seems to be problematic from 0.9.5 -> Current, + // Seems to be seeing user.config corrupation from time to time. + // So I'm going to only allow this for users using svn builds. + // Going from major to major will require the user to reset. + // Going from svn to svn will attempt the upgrade. + UserSettingService service = new UserSettingService(); + string version = service.GetUserSettingString(UserSettingConstants.HandBrakeVersion); + if (version.Contains("svn")) + { + Settings.Default.Upgrade(); + Settings.Default.UpdateRequired = false; + Settings.Default.Save(); + } + // Re-detect the CLI version data. Functions.Main.SetCliVersionData(); } diff --git a/win/CS/ToolWindows/AdvancedAudio.Designer.cs b/win/CS/ToolWindows/AdvancedAudio.Designer.cs index 41e28429a..534a5119e 100644 --- a/win/CS/ToolWindows/AdvancedAudio.Designer.cs +++ b/win/CS/ToolWindows/AdvancedAudio.Designer.cs @@ -36,6 +36,8 @@ this.label2 = new System.Windows.Forms.Label(); this.lbl_drc = new System.Windows.Forms.Label(); this.tb_drc = new System.Windows.Forms.TrackBar(); + this.label3 = new System.Windows.Forms.Label(); + this.audioTrackName = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.gainTrackBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tb_drc)).BeginInit(); this.SuspendLayout(); @@ -75,7 +77,7 @@ this.btn_close.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btn_close.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_close.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_close.Location = new System.Drawing.Point(207, 133); + this.btn_close.Location = new System.Drawing.Point(206, 199); this.btn_close.Name = "btn_close"; this.btn_close.Size = new System.Drawing.Size(71, 22); this.btn_close.TabIndex = 5; @@ -114,11 +116,31 @@ this.tb_drc.TabIndex = 61; this.tb_drc.Scroll += new System.EventHandler(this.tb_drc_Scroll); // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(12, 134); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(77, 13); + this.label3.TabIndex = 62; + this.label3.Text = "Track Name:"; + // + // audioTrackName + // + this.audioTrackName.Location = new System.Drawing.Point(15, 150); + this.audioTrackName.Name = "audioTrackName"; + this.audioTrackName.Size = new System.Drawing.Size(228, 21); + this.audioTrackName.TabIndex = 63; + this.audioTrackName.TextChanged += new System.EventHandler(this.audioTrackName_TextChanged); + // // AdvancedAudio // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(289, 164); + this.ClientSize = new System.Drawing.Size(289, 233); + this.Controls.Add(this.audioTrackName); + this.Controls.Add(this.label3); this.Controls.Add(this.tb_drc); this.Controls.Add(this.lbl_drc); this.Controls.Add(this.label2); @@ -129,7 +151,6 @@ this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "AdvancedAudio"; @@ -156,5 +177,7 @@ private System.Windows.Forms.Label label2; private System.Windows.Forms.Label lbl_drc; internal System.Windows.Forms.TrackBar tb_drc; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox audioTrackName; } } \ No newline at end of file diff --git a/win/CS/ToolWindows/AdvancedAudio.cs b/win/CS/ToolWindows/AdvancedAudio.cs index 5ac8e819b..d1fb0763e 100644 --- a/win/CS/ToolWindows/AdvancedAudio.cs +++ b/win/CS/ToolWindows/AdvancedAudio.cs @@ -73,6 +73,9 @@ namespace Handbrake.ToolWindows tb_drc.Value = drcCalculated; lbl_drc.Text = track.DRC.ToString(Culture); tb_drc.Enabled = track.TrackDisplay.Contains("(AC3)"); + + // Se the Track Name + audioTrackName.Text = this.track.TrackName; } } @@ -142,5 +145,15 @@ namespace Handbrake.ToolWindows lbl_drc.Text = value.ToString(Culture); track.DRC = value; } + + /// + /// Set the Audio Track Name Variable + /// + /// The Sender + /// The event args + private void audioTrackName_TextChanged(object sender, EventArgs e) + { + this.Track.TrackName = audioTrackName.Text; + } } } diff --git a/win/CS/frmOptions.Designer.cs b/win/CS/frmOptions.Designer.cs index 2d91fcf3f..04350e9b3 100644 --- a/win/CS/frmOptions.Designer.cs +++ b/win/CS/frmOptions.Designer.cs @@ -424,7 +424,7 @@ namespace Handbrake this.check_autoNaming.AutoSize = true; this.check_autoNaming.Location = new System.Drawing.Point(111, 13); this.check_autoNaming.Name = "check_autoNaming"; - this.check_autoNaming.Size = new System.Drawing.Size(176, 17); + this.check_autoNaming.Size = new System.Drawing.Size(171, 17); this.check_autoNaming.TabIndex = 72; this.check_autoNaming.Text = "Automatically name output files"; this.ToolTip.SetToolTip(this.check_autoNaming, "Automatically name output files"); @@ -624,7 +624,7 @@ namespace Handbrake this.radio_preferredAudioAndSubs.AutoSize = true; this.radio_preferredAudioAndSubs.Location = new System.Drawing.Point(200, 99); this.radio_preferredAudioAndSubs.Name = "radio_preferredAudioAndSubs"; - this.radio_preferredAudioAndSubs.Size = new System.Drawing.Size(254, 17); + this.radio_preferredAudioAndSubs.Size = new System.Drawing.Size(250, 17); this.radio_preferredAudioAndSubs.TabIndex = 93; this.radio_preferredAudioAndSubs.TabStop = true; this.radio_preferredAudioAndSubs.Text = "Use Preferred Language for Audio and Subtitles"; @@ -637,7 +637,7 @@ namespace Handbrake this.check_AddCCTracks.AutoSize = true; this.check_AddCCTracks.Location = new System.Drawing.Point(200, 131); this.check_AddCCTracks.Name = "check_AddCCTracks"; - this.check_AddCCTracks.Size = new System.Drawing.Size(199, 17); + this.check_AddCCTracks.Size = new System.Drawing.Size(198, 17); this.check_AddCCTracks.TabIndex = 92; this.check_AddCCTracks.Text = "Add Closed Captions when available"; this.ToolTip.SetToolTip(this.check_AddCCTracks, "Add any CC tracks if they exist"); @@ -670,7 +670,7 @@ namespace Handbrake this.radio_foreignAndSubs.AutoSize = true; this.radio_foreignAndSubs.Location = new System.Drawing.Point(200, 76); this.radio_foreignAndSubs.Name = "radio_foreignAndSubs"; - this.radio_foreignAndSubs.Size = new System.Drawing.Size(358, 17); + this.radio_foreignAndSubs.Size = new System.Drawing.Size(347, 17); this.radio_foreignAndSubs.TabIndex = 90; this.radio_foreignAndSubs.TabStop = true; this.radio_foreignAndSubs.Text = "Use foreign language audio and add first preferred language subtitle."; @@ -695,7 +695,7 @@ namespace Handbrake this.radio_dub.AutoSize = true; this.radio_dub.Location = new System.Drawing.Point(200, 53); this.radio_dub.Name = "radio_dub"; - this.radio_dub.Size = new System.Drawing.Size(164, 17); + this.radio_dub.Size = new System.Drawing.Size(167, 17); this.radio_dub.TabIndex = 89; this.radio_dub.TabStop = true; this.radio_dub.Text = "DUB Foreign Language Audio"; diff --git a/win/CS/frmOptions.resx b/win/CS/frmOptions.resx index 110371424..ce774a25a 100644 --- a/win/CS/frmOptions.resx +++ b/win/CS/frmOptions.resx @@ -120,9 +120,6 @@ 132, 18 - - 132, 18 - The default file extension for MP4 Files. Automatic - This will use M4v when AC3 Audio, SRT Subtitles or Chapters are present, otherwise MP4. -- cgit v1.2.3