summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-08-30 16:15:01 +0000
committersr55 <[email protected]>2009-08-30 16:15:01 +0000
commit20ff4c1c7f0e888400aecef0c6cf7355abba8ae4 (patch)
tree0cb03b0122cc5f8bc844678e696fb2f6a5c385bd /win
parentc1adf4d22a63a6e63b4b0955e67db4f885c58c04 (diff)
WinGui:
- Set use m4v option enabled by default. - Fix some issues with auto setting m4v when use m4v is disabled. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2795 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/Functions/PresetLoader.cs14
-rw-r--r--win/C#/Functions/QueryGenerator.cs6
-rw-r--r--win/C#/Properties/Settings.Designer.cs2
-rw-r--r--win/C#/Properties/Settings.settings2
-rw-r--r--win/C#/app.config2
-rw-r--r--win/C#/frmMain.cs60
-rw-r--r--win/C#/frmPreview.cs4
7 files changed, 53 insertions, 37 deletions
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs
index fae48ee46..f0ac81c3c 100644
--- a/win/C#/Functions/PresetLoader.cs
+++ b/win/C#/Functions/PresetLoader.cs
@@ -47,9 +47,19 @@ namespace Handbrake.Functions
if (presetQuery.Format != null)
{
if (presetQuery.Format == "mp4" || presetQuery.Format == "m4v")
- mainWindow.drop_format.SelectedIndex = 0;
+ {
+ if (mainWindow.drop_format.SelectedIndex == 0)
+ mainWindow.SetExtension(".mp4");
+ else
+ mainWindow.drop_format.SelectedIndex = 0;
+ }
else if (presetQuery.Format == "mkv")
- mainWindow.drop_format.SelectedIndex = 1;
+ {
+ if(mainWindow.drop_format.SelectedIndex == 1)
+ mainWindow.SetExtension(".mkv");
+ else
+ mainWindow.drop_format.SelectedIndex = 1;
+ }
}
mainWindow.check_iPodAtom.CheckState = presetQuery.IpodAtom ? CheckState.Checked : CheckState.Unchecked;
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index 4d0033415..15dfc0f70 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -21,7 +21,7 @@ namespace Handbrake.Functions
/// <param name="duration"></param>
/// <param name="preview"></param>
/// <returns></returns>
- public string generateCLIQuery(frmMain mainWindow, int duration, string preview)
+ public string GenerateCLIQuery(frmMain mainWindow, int duration, string preview)
{
string query = "";
@@ -61,7 +61,7 @@ namespace Handbrake.Functions
query += " -o " + '"' + mainWindow.text_destination.Text + '"';
}
- query += generateTabbedComponentsQuery(mainWindow);
+ query += GenerateTabbedComponentsQuery(mainWindow);
return query;
}
@@ -71,7 +71,7 @@ namespace Handbrake.Functions
/// </summary>
/// <param name="mainWindow"></param>
/// <returns></returns>
- public static string generateTabbedComponentsQuery(frmMain mainWindow)
+ public static string GenerateTabbedComponentsQuery(frmMain mainWindow)
{
string query = "";
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs
index 86c2c76d0..bf243e7a0 100644
--- a/win/C#/Properties/Settings.Designer.cs
+++ b/win/C#/Properties/Settings.Designer.cs
@@ -396,7 +396,7 @@ namespace Handbrake.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool useM4v {
get {
return ((bool)(this["useM4v"]));
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings
index f88c3e3d7..360089ff0 100644
--- a/win/C#/Properties/Settings.settings
+++ b/win/C#/Properties/Settings.settings
@@ -96,7 +96,7 @@
<Value Profile="(Default)">7</Value>
</Setting>
<Setting Name="useM4v" Type="System.Boolean" Scope="User">
- <Value Profile="(Default)">False</Value>
+ <Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="PromptOnUnmatchingQueries" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
diff --git a/win/C#/app.config b/win/C#/app.config
index e87b03240..12068df9a 100644
--- a/win/C#/app.config
+++ b/win/C#/app.config
@@ -101,7 +101,7 @@
<value>7</value>
</setting>
<setting name="useM4v" serializeAs="String">
- <value>False</value>
+ <value>True</value>
</setting>
<setting name="PromptOnUnmatchingQueries" serializeAs="String">
<value>True</value>
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index cbacdc782..973076552 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -69,12 +69,12 @@ namespace Handbrake
DateTime lastCheck = Properties.Settings.Default.lastUpdateCheckDate;
TimeSpan elapsed = now.Subtract(lastCheck);
if (elapsed.TotalDays > Properties.Settings.Default.daysBetweenUpdateCheck)
- {
+ {
lblStatus.Text = "Checking for updates ...";
Application.DoEvents();
Main.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDone), false);
- }
+ }
}
// Setup the GUI components
@@ -103,7 +103,7 @@ namespace Handbrake
// Send the query from the file to the Query Parser class, then load the preset
QueryParser presetQuery = QueryParser.Parse(query);
PresetLoader.presetLoader(this, presetQuery, Properties.Settings.Default.defaultPreset, loadPictureSettings);
-
+
// The x264 widgets will need updated, so do this now:
x264Panel.X264_StandardizeOptString();
x264Panel.X264_SetCurrentSettingsInPanel();
@@ -375,7 +375,7 @@ namespace Handbrake
}
private void btn_new_preset_Click(object sender, EventArgs e)
{
- Form preset = new frmAddPreset(this, queryGen.generateCLIQuery(this, 0, null), presetHandler);
+ Form preset = new frmAddPreset(this, queryGen.GenerateCLIQuery(this, 0, null), presetHandler);
preset.ShowDialog();
}
#endregion
@@ -455,9 +455,9 @@ namespace Handbrake
{
DialogResult result = MessageBox.Show("Do you wish to include picture settings when updating the preset: " + treeView_presets.SelectedNode.Text, "Update Preset", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
- presetHandler.updatePreset(treeView_presets.SelectedNode.Text, QueryGenerator.generateTabbedComponentsQuery(this), true);
+ presetHandler.updatePreset(treeView_presets.SelectedNode.Text, QueryGenerator.GenerateTabbedComponentsQuery(this), true);
else if (result == DialogResult.No)
- presetHandler.updatePreset(treeView_presets.SelectedNode.Text, QueryGenerator.generateTabbedComponentsQuery(this), false);
+ presetHandler.updatePreset(treeView_presets.SelectedNode.Text, QueryGenerator.GenerateTabbedComponentsQuery(this), false);
}
private void pmnu_delete_click(object sender, EventArgs e)
{
@@ -484,7 +484,7 @@ namespace Handbrake
// Presets Management
private void btn_addPreset_Click(object sender, EventArgs e)
{
- Form preset = new frmAddPreset(this, QueryGenerator.generateTabbedComponentsQuery(this), presetHandler);
+ Form preset = new frmAddPreset(this, QueryGenerator.GenerateTabbedComponentsQuery(this), presetHandler);
preset.ShowDialog();
}
private void btn_removePreset_Click(object sender, EventArgs e)
@@ -617,16 +617,16 @@ namespace Handbrake
if (result == DialogResult.Yes)
{
PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);
- presetHandler.updatePreset(parsed.PresetName + " (Imported)", queryGen.generateCLIQuery(this, 0, null),
+ presetHandler.updatePreset(parsed.PresetName + " (Imported)", queryGen.GenerateCLIQuery(this, 0, null),
parsed.UsesPictureSettings);
}
}
else
{
PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);
- presetHandler.addPreset(parsed.PresetName, queryGen.generateCLIQuery(this, 0, null), parsed.UsesPictureSettings);
+ presetHandler.addPreset(parsed.PresetName, queryGen.GenerateCLIQuery(this, 0, null), parsed.UsesPictureSettings);
- if (presetHandler.addPreset(parsed.PresetName + " (Imported)", queryGen.generateCLIQuery(this, 0, null), parsed.UsesPictureSettings))
+ if (presetHandler.addPreset(parsed.PresetName + " (Imported)", queryGen.GenerateCLIQuery(this, 0, null), parsed.UsesPictureSettings))
{
TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)") { ForeColor = Color.Black };
treeView_presets.Nodes.Add(preset_treeview);
@@ -671,8 +671,8 @@ namespace Handbrake
{
if (encodeQueue.Count != 0 || (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text)))
{
- string generatedQuery = queryGen.generateCLIQuery(this, 0, null);
- string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateCLIQuery(this, 0, null);
+ string generatedQuery = queryGen.GenerateCLIQuery(this, 0, null);
+ string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.GenerateCLIQuery(this, 0, null);
string query = string.Empty;
// Check to make sure the generated query matches the GUI settings
@@ -740,7 +740,7 @@ namespace Handbrake
MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
{
- String query = queryGen.generateCLIQuery(this, 0, null);
+ String query = queryGen.GenerateCLIQuery(this, 0, null);
if (rtf_query.Text != "")
query = rtf_query.Text;
@@ -967,7 +967,7 @@ namespace Handbrake
}
private void chapersChanged(object sender, EventArgs e)
{
- Control ctl = (Control) sender;
+ Control ctl = (Control)sender;
int chapterStart, chapterEnd;
int.TryParse(drop_chapterStart.Text, out chapterStart);
int.TryParse(drop_chapterFinish.Text, out chapterEnd);
@@ -1062,13 +1062,13 @@ namespace Handbrake
case 1:
if (!Path.GetExtension(DVD_Save.FileName).Equals(".mp4", StringComparison.InvariantCultureIgnoreCase))
if (Properties.Settings.Default.useM4v)
- DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".m4v").Replace(".mkv",".m4v");
+ DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".m4v").Replace(".mkv", ".m4v");
else
DVD_Save.FileName = DVD_Save.FileName.Replace(".m4v", ".mp4").Replace(".mkv", ".mp4");
break;
case 2:
if (!Path.GetExtension(DVD_Save.FileName).Equals(".mkv", StringComparison.InvariantCultureIgnoreCase))
- DVD_Save.FileName = DVD_Save.FileName .Replace(".mp4", ".mkv").Replace(".m4v",".mkv");
+ DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", ".mkv").Replace(".m4v", ".mkv");
break;
default:
//do nothing
@@ -1078,7 +1078,7 @@ namespace Handbrake
// Quicktime requires .m4v file for chapter markers to work. If checked, change the extension to .m4v (mp4 and m4v are the same thing)
if (Check_ChapterMarkers.Checked && DVD_Save.FilterIndex != 2)
- setExtension(".m4v");
+ SetExtension(".m4v");
}
}
}
@@ -1098,19 +1098,19 @@ namespace Handbrake
{
case 0:
if (Properties.Settings.Default.useM4v || Check_ChapterMarkers.Checked || AudioSettings.RequiresM4V() || Subtitles.RequiresM4V())
- setExtension(".m4v");
+ SetExtension(".m4v");
else
- setExtension(".mp4");
+ SetExtension(".mp4");
break;
case 1:
- setExtension(".mkv");
+ SetExtension(".mkv");
break;
}
AudioSettings.SetContainer(drop_format.Text);
Subtitles.setContainer(drop_format.SelectedIndex);
- if ((drop_format.Text.Contains("MP4")) || (drop_format.Text.Contains("M4V")))
+ if (drop_format.Text.Contains("MP4"))
{
if (drp_videoEncoder.Items.Contains("VP3 (Theora)"))
{
@@ -1121,8 +1121,14 @@ namespace Handbrake
else if (drop_format.Text.Contains("MKV"))
drp_videoEncoder.Items.Add("VP3 (Theora)");
}
- private void setExtension(string newExtension)
+ public void SetExtension(string newExtension)
{
+ if (newExtension == ".mp4" || newExtension == ".m4v")
+ if (Properties.Settings.Default.useM4v || Check_ChapterMarkers.Checked || AudioSettings.RequiresM4V() || Subtitles.RequiresM4V())
+ newExtension = ".m4v" ;
+ else
+ newExtension = ".mp4";
+
text_destination.Text = text_destination.Text.Replace(".mp4", newExtension);
text_destination.Text = text_destination.Text.Replace(".m4v", newExtension);
text_destination.Text = text_destination.Text.Replace(".mkv", newExtension);
@@ -1224,7 +1230,7 @@ namespace Handbrake
check_iPodAtom.Checked = false;
}
}
- private double _cachedCqStep = Properties.Settings.Default.x264cqstep;
+ private double _cachedCqStep = Properties.Settings.Default.x264cqstep;
/// <summary>
/// Update the CQ slider for x264 for a new CQ step. This is set from option
/// </summary>
@@ -1233,7 +1239,7 @@ namespace Handbrake
// Work out the current RF value.
double cqStep = _cachedCqStep;
double rfValue = 51.0 - slider_videoQuality.Value * cqStep;
-
+
// Change the maximum value for the slider
switch (Properties.Settings.Default.x264cqstep.ToString(new CultureInfo("en-US")))
{
@@ -1341,14 +1347,14 @@ namespace Handbrake
if (Check_ChapterMarkers.Checked)
{
if (drop_format.SelectedIndex != 1)
- setExtension(".m4v");
+ SetExtension(".m4v");
data_chpt.Enabled = true;
btn_importChapters.Enabled = true;
}
else
{
if (drop_format.SelectedIndex != 1 && !Properties.Settings.Default.useM4v)
- setExtension(".mp4");
+ SetExtension(".mp4");
data_chpt.Enabled = false;
btn_importChapters.Enabled = false;
}
@@ -1376,7 +1382,7 @@ namespace Handbrake
// Query Editor Tab
private void btn_generate_Query_Click(object sender, EventArgs e)
{
- rtf_query.Text = queryGen.generateCLIQuery(this, 0, null);
+ rtf_query.Text = queryGen.GenerateCLIQuery(this, 0, null);
}
private void btn_clear_Click(object sender, EventArgs e)
{
diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs
index fbd695f5e..59e6c2520 100644
--- a/win/C#/frmPreview.cs
+++ b/win/C#/frmPreview.cs
@@ -59,7 +59,7 @@ namespace Handbrake
lbl_status.Text = "Encoding Sample for (VLC) ...";
int duration;
int.TryParse(cb_duration.Text, out duration);
- String query = hb_common_func.generateCLIQuery(mainWindow, duration, cb_preview.Text);
+ String query = hb_common_func.GenerateCLIQuery(mainWindow, duration, cb_preview.Text);
ThreadPool.QueueUserWorkItem(procMonitor, query);
}
private void btn_playQT_Click(object sender, EventArgs e)
@@ -89,7 +89,7 @@ namespace Handbrake
lbl_status.Text = "Encoding Sample for (QT) ...";
int duration;
int.TryParse(cb_duration.Text, out duration);
- String query = hb_common_func.generateCLIQuery(mainWindow, duration, cb_preview.Text);
+ String query = hb_common_func.GenerateCLIQuery(mainWindow, duration, cb_preview.Text);
ThreadPool.QueueUserWorkItem(procMonitor, query);
}