From 6d6b8677bb42c3b7e2e82a112de57f3d42191bf4 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 16 Nov 2008 19:29:42 +0000 Subject: WinGui: Fix for Ticket #107 - Destination Save File Dialog window now shows extension of currently file in the destination field if there is one. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1924 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/frmMain.cs | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'win/C#') diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index b234b05e6..e7345b539 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -664,18 +664,31 @@ namespace Handbrake DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "").Replace(".ogm", "").Replace(".avi", ""); // Show the dialog and set the main form file path - DVD_Save.ShowDialog(); - if (DVD_Save.FileName.StartsWith("\\")) - MessageBox.Show("Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); - else - { - setAudioByContainer(DVD_Save.FileName); - text_destination.Text = DVD_Save.FileName; + if (text_destination.Text.EndsWith(".mp4")) + DVD_Save.FilterIndex = 1; + else if (text_destination.Text.EndsWith(".m4v")) + DVD_Save.FilterIndex = 2; + else if (text_destination.Text.EndsWith(".avi")) + DVD_Save.FilterIndex = 3; + else if (text_destination.Text.EndsWith(".ogm")) + DVD_Save.FilterIndex = 4; + else if (text_destination.Text.EndsWith(".mkv")) + DVD_Save.FilterIndex = 5; + + if (DVD_Save.ShowDialog() == DialogResult.OK) + { + if (DVD_Save.FileName.StartsWith("\\")) + MessageBox.Show("Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + else + { + setAudioByContainer(DVD_Save.FileName); + text_destination.Text = DVD_Save.FileName; - // 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) - text_destination.Text = text_destination.Text.Replace(".mp4", ".m4v"); + // 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) + text_destination.Text = text_destination.Text.Replace(".mp4", ".m4v"); + } } } private void text_destination_TextChanged(object sender, EventArgs e) @@ -1442,7 +1455,7 @@ namespace Handbrake { if (treeView_presets.SelectedNode != null) presetHandler.remove(treeView_presets.SelectedNode.Text); - + // Remember each nodes expanded status so we can reload it List nodeStatus = saveTreeViewState(); @@ -1561,7 +1574,7 @@ namespace Handbrake foreach (TreeNode node in treenode.Nodes) { if (node.Text.ToString().Equals("Normal")) - treeView_presets.SelectedNode = treeView_presets.Nodes[treenode.Index].Nodes[0]; + treeView_presets.SelectedNode = treeView_presets.Nodes[treenode.Index].Nodes[0]; } } } -- cgit v1.2.3