summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-03-12 21:59:52 +0000
committersr55 <[email protected]>2010-03-12 21:59:52 +0000
commit965aebaa5b64188ad21874f0f48f3e2b2a7c443c (patch)
tree21a7add3d9a73c0177b82924272c1d2480f059b4
parent8cd6d5369932ac0889cb9910df92a79531f073cb (diff)
WinGui:
Two new options for autocrop. - Remove Underscores from source name. - Change to Title Case. (e.g "Source Name") git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3163 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/Functions/Main.cs40
-rw-r--r--win/C#/Properties/Settings.Designer.cs24
-rw-r--r--win/C#/Properties/Settings.settings6
-rw-r--r--win/C#/app.config6
-rw-r--r--win/C#/frmOptions.Designer.cs35
-rw-r--r--win/C#/frmOptions.cs17
6 files changed, 119 insertions, 9 deletions
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs
index 3285b5f3a..ff183178f 100644
--- a/win/C#/Functions/Main.cs
+++ b/win/C#/Functions/Main.cs
@@ -8,8 +8,10 @@ namespace Handbrake.Functions
using System;
using System.Collections.Generic;
using System.Diagnostics;
+ using System.Globalization;
using System.IO;
using System.Net;
+ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
@@ -151,7 +153,7 @@ namespace Handbrake.Functions
foreach (DataGridViewRow item in dataChpt.Rows)
{
string name;
- chapterMap.TryGetValue((int) item.Cells[0].Value, out name);
+ chapterMap.TryGetValue((int)item.Cells[0].Value, out name);
item.Cells[1].Value = name ?? "Chapter " + item.Cells[0].Value;
}
@@ -176,6 +178,12 @@ namespace Handbrake.Functions
// Get the Source Name
string sourceName = mainWindow.SourceName;
+ if (Properties.Settings.Default.AutoNameRemoveUnderscore)
+ sourceName = sourceName.Replace("_", " ");
+
+ if (Properties.Settings.Default.AutoNameTitleCase)
+ sourceName = TitleCase(sourceName);
+
// Get the Selected Title Number
string[] titlesplit = mainWindow.drp_dvdtitle.Text.Split(' ');
string dvdTitle = titlesplit[0].Replace("Automatic", string.Empty);
@@ -254,9 +262,9 @@ namespace Handbrake.Functions
Process cliProcess = new Process();
ProcessStartInfo handBrakeCli = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")
{
- UseShellExecute = false,
- RedirectStandardError = true,
- RedirectStandardOutput = true,
+ UseShellExecute = false,
+ RedirectStandardError = true,
+ RedirectStandardOutput = true,
CreateNoWindow = true
};
cliProcess.StartInfo = handBrakeCli;
@@ -471,7 +479,7 @@ namespace Handbrake.Functions
UpdateCheckInformation info =
new UpdateCheckInformation
{
- NewVersionAvailable = false,
+ NewVersionAvailable = false,
BuildInformation = null
};
callback(new UpdateCheckResult(debug, info));
@@ -486,7 +494,7 @@ namespace Handbrake.Functions
UpdateCheckInformation info2 =
new UpdateCheckInformation
{
- NewVersionAvailable = latest > current,
+ NewVersionAvailable = latest > current,
BuildInformation = reader
};
callback(new UpdateCheckResult(debug, info2));
@@ -509,7 +517,7 @@ namespace Handbrake.Functions
/// </returns>
public static UpdateCheckInformation EndCheckForUpdates(IAsyncResult result)
{
- UpdateCheckResult checkResult = (UpdateCheckResult) result;
+ UpdateCheckResult checkResult = (UpdateCheckResult)result;
return checkResult.Result;
}
@@ -728,7 +736,7 @@ namespace Handbrake.Functions
drives.Add(new DriveInformation
{
Id = id,
- VolumeLabel = curDrive.VolumeLabel,
+ VolumeLabel = curDrive.VolumeLabel,
RootDirectory = curDrive.RootDirectory + "VIDEO_TS"
});
id++;
@@ -736,5 +744,21 @@ namespace Handbrake.Functions
}
return drives;
}
+
+ public static string TitleCase(string input)
+ {
+ string[] tokens = input.Split(' ');
+ StringBuilder sb = new StringBuilder(input.Length);
+ foreach (string s in tokens)
+ {
+ sb.Append(s[0].ToString().ToUpper());
+ sb.Append(s.Substring(1).ToLower());
+ sb.Append(" ");
+ }
+
+ return sb.ToString().Trim();
+ }
+
+
}
} \ No newline at end of file
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs
index 1a159140c..c911a94cc 100644
--- a/win/C#/Properties/Settings.Designer.cs
+++ b/win/C#/Properties/Settings.Designer.cs
@@ -500,5 +500,29 @@ namespace Handbrake.Properties {
this["showCliForInGuiEncodeStatus"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool AutoNameTitleCase {
+ get {
+ return ((bool)(this["AutoNameTitleCase"]));
+ }
+ set {
+ this["AutoNameTitleCase"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool AutoNameRemoveUnderscore {
+ get {
+ return ((bool)(this["AutoNameRemoveUnderscore"]));
+ }
+ set {
+ this["AutoNameRemoveUnderscore"] = value;
+ }
+ }
}
}
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings
index c9c75d01e..1e4b9387a 100644
--- a/win/C#/Properties/Settings.settings
+++ b/win/C#/Properties/Settings.settings
@@ -122,5 +122,11 @@
<Setting Name="showCliForInGuiEncodeStatus" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
+ <Setting Name="AutoNameTitleCase" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">False</Value>
+ </Setting>
+ <Setting Name="AutoNameRemoveUnderscore" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">False</Value>
+ </Setting>
</Settings>
</SettingsFile> \ No newline at end of file
diff --git a/win/C#/app.config b/win/C#/app.config
index d1401d03f..1c4e60392 100644
--- a/win/C#/app.config
+++ b/win/C#/app.config
@@ -128,6 +128,12 @@
<setting name="showCliForInGuiEncodeStatus" serializeAs="String">
<value>True</value>
</setting>
+ <setting name="AutoNameTitleCase" serializeAs="String">
+ <value>False</value>
+ </setting>
+ <setting name="AutoNameRemoveUnderscore" serializeAs="String">
+ <value>False</value>
+ </setting>
</Handbrake.Properties.Settings>
</userSettings>
<startup />
diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs
index dac9e9a19..86bdc09ff 100644
--- a/win/C#/frmOptions.Designer.cs
+++ b/win/C#/frmOptions.Designer.cs
@@ -40,6 +40,8 @@ namespace Handbrake
this.drp_completeOption = new System.Windows.Forms.ComboBox();
this.tab_options = new System.Windows.Forms.TabControl();
this.tab_general = new System.Windows.Forms.TabPage();
+ this.check_TitleCase = new System.Windows.Forms.CheckBox();
+ this.check_removeUnderscores = new System.Windows.Forms.CheckBox();
this.check_growlEncode = new System.Windows.Forms.CheckBox();
this.check_GrowlQueue = new System.Windows.Forms.CheckBox();
this.check_m4v = new System.Windows.Forms.CheckBox();
@@ -200,6 +202,8 @@ namespace Handbrake
//
// tab_general
//
+ this.tab_general.Controls.Add(this.check_TitleCase);
+ this.tab_general.Controls.Add(this.check_removeUnderscores);
this.tab_general.Controls.Add(this.check_growlEncode);
this.tab_general.Controls.Add(this.check_GrowlQueue);
this.tab_general.Controls.Add(this.check_m4v);
@@ -225,6 +229,33 @@ namespace Handbrake
this.tab_general.Text = "General";
this.tab_general.UseVisualStyleBackColor = true;
//
+ // check_TitleCase
+ //
+ this.check_TitleCase.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.check_TitleCase.AutoSize = true;
+ this.check_TitleCase.Location = new System.Drawing.Point(297, 279);
+ this.check_TitleCase.Name = "check_TitleCase";
+ this.check_TitleCase.Size = new System.Drawing.Size(151, 17);
+ this.check_TitleCase.TabIndex = 101;
+ this.check_TitleCase.Text = "Change case to Title Case";
+ this.ToolTip.SetToolTip(this.check_TitleCase, "For the {source} option:.\r\nChange the source name to Title Case\r\ne.g \"MOVIE NAME\"" +
+ " to \"Movie Name\"\r\n");
+ this.check_TitleCase.UseVisualStyleBackColor = true;
+ this.check_TitleCase.CheckedChanged += new System.EventHandler(this.check_TitleCase_CheckedChanged);
+ //
+ // check_removeUnderscores
+ //
+ this.check_removeUnderscores.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.check_removeUnderscores.AutoSize = true;
+ this.check_removeUnderscores.Location = new System.Drawing.Point(108, 279);
+ this.check_removeUnderscores.Name = "check_removeUnderscores";
+ this.check_removeUnderscores.Size = new System.Drawing.Size(183, 17);
+ this.check_removeUnderscores.TabIndex = 100;
+ this.check_removeUnderscores.Text = "Remove Underscores from Name";
+ this.ToolTip.SetToolTip(this.check_removeUnderscores, "For the {source} option:\r\nRemove any underscores from the source name.\r\n\r\n");
+ this.check_removeUnderscores.UseVisualStyleBackColor = true;
+ this.check_removeUnderscores.CheckedChanged += new System.EventHandler(this.check_removeUnderscores_CheckedChanged);
+ //
// check_growlEncode
//
this.check_growlEncode.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -259,7 +290,7 @@ namespace Handbrake
//
this.check_m4v.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.check_m4v.AutoSize = true;
- this.check_m4v.Location = new System.Drawing.Point(108, 279);
+ this.check_m4v.Location = new System.Drawing.Point(108, 303);
this.check_m4v.Name = "check_m4v";
this.check_m4v.Size = new System.Drawing.Size(319, 17);
this.check_m4v.TabIndex = 82;
@@ -1567,5 +1598,7 @@ namespace Handbrake
private System.Windows.Forms.Label label33;
internal System.Windows.Forms.CheckBox check_clearOldLogs;
internal System.Windows.Forms.CheckBox check_showCliForInGUIEncode;
+ internal System.Windows.Forms.CheckBox check_TitleCase;
+ internal System.Windows.Forms.CheckBox check_removeUnderscores;
}
} \ No newline at end of file
diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs
index 6aa612dbc..b5b742963 100644
--- a/win/C#/frmOptions.cs
+++ b/win/C#/frmOptions.cs
@@ -81,6 +81,12 @@ namespace Handbrake
if (Properties.Settings.Default.useM4v)
check_m4v.CheckState = CheckState.Checked;
+ // Remove Underscores
+ check_removeUnderscores.Checked = Properties.Settings.Default.AutoNameRemoveUnderscore;
+
+ // Title case
+ check_TitleCase.Checked = Properties.Settings.Default.AutoNameTitleCase;
+
// #############################
// Picture Tab
// #############################
@@ -265,6 +271,16 @@ namespace Handbrake
Properties.Settings.Default.useM4v = check_m4v.Checked;
}
+ private void check_removeUnderscores_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.AutoNameRemoveUnderscore = check_removeUnderscores.Checked;
+ }
+
+ private void check_TitleCase_CheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.AutoNameTitleCase = check_TitleCase.Checked;
+ }
+
#endregion
#region Picture
@@ -471,5 +487,6 @@ namespace Handbrake
Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this
this.Close();
}
+
}
} \ No newline at end of file