diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/HandBrakeCS.csproj | 1 | ||||
-rw-r--r-- | win/C#/Presets/PlistPresetHandler.cs | 378 | ||||
-rw-r--r-- | win/C#/frmActivityWindow.Designer.cs | 6 | ||||
-rw-r--r-- | win/C#/frmActivityWindow.cs | 4 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 64 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 21 | ||||
-rw-r--r-- | win/C#/frmMain.resx | 6 |
7 files changed, 255 insertions, 225 deletions
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 221211cc0..98c9d23f9 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -320,6 +320,7 @@ </EmbeddedResource>
<EmbeddedResource Include="frmExceptionWindow.resx">
<DependentUpon>frmExceptionWindow.cs</DependentUpon>
+ <SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="frmPreview.resx">
<DependentUpon>frmPreview.cs</DependentUpon>
diff --git a/win/C#/Presets/PlistPresetHandler.cs b/win/C#/Presets/PlistPresetHandler.cs index 53b0d8c91..0d4e5e904 100644 --- a/win/C#/Presets/PlistPresetHandler.cs +++ b/win/C#/Presets/PlistPresetHandler.cs @@ -14,65 +14,28 @@ namespace Handbrake.Presets using Functions;
using Model;
+ /// <summary>
+ /// Plist Preset Converter
+ /// </summary>
public class PlistPresetHandler
{
- /* WARNING This file is not complete!!!!!!
- *
- * TODO
- * 1. Hookup all the widgets in the GUI so it exports real values.
- * 2. Check for any missing key/value pairs
- * 3. Test with MacGui / Cleanup code / Retest
- */
-
- private XmlTextWriter Writer;
-
- /// <summary>
- /// Import a Plist preset generated by the Mac or Linux GUI
- /// </summary>
- /// <param name="filename"></param>
- /// <returns></returns>
+ #region Import
+
public static QueryParser Import(string filename)
{
- XmlNode root = null;
- try
- {
- if (!File.Exists(filename))
- return null;
-
- StreamReader sr = File.OpenText(filename);
- string fromfile = string.Empty;
- int fileChar;
- while ((fileChar = sr.Read()) != -1)
- fromfile += Convert.ToChar(fileChar);
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(fromfile);
-
- root = doc;
- if (!root.HasChildNodes)
- {
- MessageBox.Show(
- "The Preset file you selected appears to be invlaid or from an older version of HandBrake",
- "Error",
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- return null;
- }
- }
- catch (Exception)
- {
- MessageBox.Show(
- "The Preset file you selected appears to be invlaid or from an older version of HandBrake.\n\n Please note, if you are exporting from the MacGui you may need to rebuild your preset so that it uses the current preset plist format.\n The MacGui does not currently update user presets automatically.",
- "Error",
- MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
-
+ XmlNode root = loadFile(filename);
+ if (root == null) return null;
+
// We'll query a query parser object and use it's public var structures to store all the data.
// This will allow the preset loader logic to be used instead of writing custom logic just for this file.
QueryParser queryParsed = new QueryParser();
- string QualityMode = string.Empty;
- /***** Get the Audio Tracks *****/
+ string qualityMode = string.Empty;
+
+
+ #region Get a List of Audio Track Objects
XmlNode audioListDict = root.ChildNodes[2].ChildNodes[0].FirstChild.ChildNodes[1];
- ArrayList AudioInfo = new ArrayList();
+ ArrayList audioTracks = new ArrayList();
+
for (int i = 0; i < audioListDict.ChildNodes.Count; i++)
{
XmlNode audioChannel = audioListDict.ChildNodes[i];
@@ -105,14 +68,17 @@ namespace Handbrake.Presets break;
}
}
- AudioInfo.Add(track);
+ audioTracks.Add(track);
+ queryParsed.AudioInformation = audioTracks;
}
- queryParsed.AudioInformation = AudioInfo;
+ #endregion
+
+ #region Parse the reset of the plist keys into local variables
- /***** Get the rest of the settings. *****/
XmlNode presetSettings = root.ChildNodes[2].ChildNodes[0].FirstChild;
- for (int i = 2; i < presetSettings.ChildNodes.Count; i += 2)
+
// Start from 2 to avoid the audio settings which we don't need.
+ for (int i = 2; i < presetSettings.ChildNodes.Count; i += 2)
{
string key = presetSettings.ChildNodes[i].InnerText;
string value = presetSettings.ChildNodes[i + 1].InnerText;
@@ -135,6 +101,7 @@ namespace Handbrake.Presets // Picture Settings
case "PictureAutoCrop":
+ // Not used
break;
case "PictureTopCrop":
queryParsed.CropTop = value;
@@ -161,13 +128,13 @@ namespace Handbrake.Presets queryParsed.AnamorphicMode = int.Parse(value);
break;
-
// Filters
case "PictureDeblock":
queryParsed.DeBlock = int.Parse(value);
break;
case "PictureDecomb":
queryParsed.Decomb = "Off";
+ // Don't place custom here as it's handled in the filter panel
if (value == "2") queryParsed.Decomb = "Default";
break;
case "PictureDecombCustom":
@@ -183,6 +150,7 @@ namespace Handbrake.Presets case "0":
queryParsed.DeInterlace = "Off";
break;
+ // Don't place custom here as it's handled in the filter panel
case "2":
queryParsed.DeInterlace = "Fast";
break;
@@ -204,6 +172,7 @@ namespace Handbrake.Presets case "0":
queryParsed.DeNoise = "Off";
break;
+ // Don't place custom here as it's handled in the filter panel
case "2":
queryParsed.DeNoise = "Weak";
break;
@@ -246,7 +215,7 @@ namespace Handbrake.Presets queryParsed.VideoQuality = float.Parse(value);
break;
case "VideoQualityType": // The Type of Quality Mode used
- QualityMode = value;
+ qualityMode = value;
break;
case "VideoTargetSize":
queryParsed.VideoTargetSize = value;
@@ -294,7 +263,7 @@ namespace Handbrake.Presets }
// Kill any Quality values we don't need.
- switch (QualityMode)
+ switch (qualityMode)
{
case "0": // FileSize
queryParsed.VideoQuality = -1;
@@ -309,187 +278,218 @@ namespace Handbrake.Presets queryParsed.VideoTargetSize = null;
break;
}
+ #endregion
return queryParsed;
}
- /// <summary>
- /// Export a preset to a Plist file readable by the Mac and Linux GUI's
- /// </summary>
- /// <param name="path"></param>
- public void Export(string path)
+ private static XmlNode loadFile(string filename)
{
- Writer = new XmlTextWriter("C:\\test.xml", Encoding.UTF8);
+ try
+ {
+ XmlNode root;
+
+ if (!File.Exists(filename))
+ return null;
+
+ StreamReader sr = File.OpenText(filename);
+ string fromfile = string.Empty;
+ int fileChar;
+ while ((fileChar = sr.Read()) != -1)
+ fromfile += Convert.ToChar(fileChar);
+
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(fromfile);
+
+ root = doc;
+ if (!root.HasChildNodes)
+ {
+ MessageBox.Show(
+ "The Preset file you selected appears to be invlaid or from an older version of HandBrake",
+ "Error",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return null;
+ }
+
+ return root;
+ }
+ catch (Exception)
+ {
+ MessageBox.Show(
+ "The Preset file you selected appears to be invlaid or from an older version of HandBrake.\n\n Please note, if you are exporting from the MacGui you may need to rebuild your preset so that it uses the current preset plist format.\n The MacGui does not currently update user presets automatically.",
+ "Error",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return null;
+ }
+ }
+ #endregion
+
+ #region Export
+
+ public static void Export(string path, QueryParser parsed)
+ {
+ XmlTextWriter xmlWriter;
+
+ xmlWriter = new XmlTextWriter(path, Encoding.UTF8);
// Header
- Writer.WriteStartDocument();
- Writer.WriteDocType("plist", "-//Apple//DTD PLIST 1.0//EN",
+ xmlWriter.WriteStartDocument();
+ xmlWriter.WriteDocType("plist", "-//Apple//DTD PLIST 1.0//EN",
@"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
- Writer.WriteStartElement("plist");
- Writer.WriteStartElement("array");
+ xmlWriter.WriteStartElement("plist");
+ xmlWriter.WriteStartElement("array");
// Add New Preset Here. Can write multiple presets here if required in future.
- WritePreset();
+ WritePreset(xmlWriter, parsed);
// Footer
- Writer.WriteEndElement();
- Writer.WriteEndElement();
+ xmlWriter.WriteEndElement();
+ xmlWriter.WriteEndElement();
- Writer.WriteEndDocument();
+ xmlWriter.WriteEndDocument();
// Closeout
- Writer.Close();
+ xmlWriter.Close();
}
- /// <summary>
- /// Write a Plist file
- /// </summary>
- private void WritePreset()
+ private static void WritePreset(XmlTextWriter xmlWriter, QueryParser parsed)
{
- Writer.WriteStartElement("dict");
- AudioListArrayDict();
- AddEncodeSettings();
+ xmlWriter.WriteStartElement("dict");
+ AudioListArrayDict(xmlWriter, parsed);
+ AddEncodeSettings(xmlWriter, parsed);
- Writer.WriteEndElement();
+ xmlWriter.WriteEndElement();
}
- /// <summary>
- /// Add all the encode settings to the preset
- /// </summary>
- private void AddEncodeSettings()
+ private static void AddEncodeSettings(XmlTextWriter xmlWriter, QueryParser parsed)
{
- AddEncodeElement("ChapterMarkers", "integer", string.Empty);
- AddEncodeElement("Default", "integer", string.Empty);
- AddEncodeElement("FileFormat", "String", string.Empty);
- AddBooleanElement("Folder", true);
- AddEncodeElement("Mp4HttpOptimize", "integer", string.Empty);
- AddEncodeElement("Mp4LargeFile", "integer", string.Empty);
- AddEncodeElement("Mp4iPodCompatible", "integer", string.Empty);
- AddEncodeElement("PictureAutoCrop", "integer", string.Empty);
- AddEncodeElement("PictureBottomCrop", "integer", string.Empty);
- AddEncodeElement("PictureDeblock", "integer", string.Empty);
- AddEncodeElement("PictureDecomb", "integer", string.Empty);
- AddEncodeElement("PictureDecombCustom", "string", string.Empty);
- AddEncodeElement("PictureDecombDeinterlace", "integer", string.Empty);
- AddEncodeElement("PictureDeinterlace", "integer", string.Empty);
- AddEncodeElement("PictureDeinterlaceCustom", "string", string.Empty);
- AddEncodeElement("PictureDenoise", "integer", string.Empty);
- AddEncodeElement("PictureDenoiseCustom", "string", string.Empty);
- AddEncodeElement("PictureDetelecine", "integer", string.Empty);
- AddEncodeElement("PictureDetelecineCustom", "string", string.Empty);
- AddEncodeElement("PictureHeight", "integer", string.Empty);
- AddEncodeElement("PictureKeepRatio", "integer", string.Empty);
- AddEncodeElement("PictureLeftCrop", "integer", string.Empty);
- AddEncodeElement("PicturePAR", "integer", string.Empty);
- AddEncodeElement("PictureRightCrop", "integer", string.Empty);
- AddEncodeElement("PictureTopCrop", "integer", string.Empty);
- AddEncodeElement("PictureWidth", "integer", string.Empty);
- AddEncodeElement("PresetBuildNumber", "string", string.Empty);
- AddEncodeElement("PresetDescription", "string", string.Empty);
- AddEncodeElement("PresetName", "string", string.Empty);
- AddEncodeElement("Type", "integer", string.Empty);
- AddEncodeElement("UsesMaxPictureSettings", "integer", string.Empty);
- AddEncodeElement("UsesPictureFilters", "integer", string.Empty);
- AddEncodeElement("UsesPictureSettings", "integer", string.Empty);
- AddEncodeElement("VideoAvgBitrate", "string", string.Empty);
- AddEncodeElement("VideoEncoder", "string", string.Empty);
- AddEncodeElement("VideoFramerate", "string", string.Empty);
- AddEncodeElement("VideoGrayScale", "integer", string.Empty);
- AddEncodeElement("VideoQualitySlider", "real", string.Empty);
- AddEncodeElement("VideoQualityType", "integer", string.Empty);
- AddEncodeElement("VideoTargetSize", "string", string.Empty);
- AddEncodeElement("VideoTurboTwoPass", "integer", string.Empty);
- AddEncodeElement("VideoTwoPass", "integer", string.Empty);
- AddEncodeElement("x264Option", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "ChapterMarkers", "integer", parsed.ChapterMarkers ? "1" : "0");
+ AddEncodeElement(xmlWriter, "Default", "integer", string.Empty); // TODO
+ AddEncodeElement(xmlWriter, "FileFormat", "string", parsed.Format);
+ AddBooleanElement(xmlWriter, "Folder", true); // TODO
+ AddEncodeElement(xmlWriter, "Mp4HttpOptimize", "integer", parsed.OptimizeMP4 ? "1" : "0");
+ AddEncodeElement(xmlWriter, "Mp4LargeFile", "integer", parsed.LargeMP4 ? "1" : "0");
+ AddEncodeElement(xmlWriter, "Mp4iPodCompatible", "integer", parsed.IpodAtom ? "1" : "0");
+ AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", string.Empty); // TODO
+ AddEncodeElement(xmlWriter, "PictureBottomCrop", "integer", parsed.CropBottom);
+
+ // Filters - TODO Requires Some Logic to convert modes
+ AddEncodeElement(xmlWriter, "PictureDeblock", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDecomb", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDecombCustom", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDecombDeinterlace", "integer", string.Empty); // TODO Requires Logic
+ AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDenoise", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDetelecine", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureDetelecineCustom", "string", string.Empty);
+
+ AddEncodeElement(xmlWriter, "PictureHeight", "integer", parsed.Height.ToString());
+ AddEncodeElement(xmlWriter, "PictureKeepRatio", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureLeftCrop", "integer", parsed.CropLeft);
+ AddEncodeElement(xmlWriter, "PicturePAR", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "PictureRightCrop", "integer", parsed.CropRight);
+ AddEncodeElement(xmlWriter, "PictureTopCrop", "integer", parsed.CropTop);
+ AddEncodeElement(xmlWriter, "PictureWidth", "integer", parsed.Width.ToString());
+
+ AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "PresetDescription", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "PresetName", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "Type", "integer", string.Empty);
+
+ AddEncodeElement(xmlWriter, "UsesMaxPictureSettings", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "UsesPictureFilters", "integer", string.Empty);
+ AddEncodeElement(xmlWriter, "UsesPictureSettings", "integer", string.Empty);
+
+ AddEncodeElement(xmlWriter, "VideoAvgBitrate", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "VideoEncoder", "string", string.Empty);
+ AddEncodeElement(xmlWriter, "VideoFramerate", "string", string.Empty);
+
+ AddEncodeElement(xmlWriter, "VideoGrayScale", "integer", parsed.Grayscale ? "1" : "0");
+ AddEncodeElement(xmlWriter, "VideoQualitySlider", "real", parsed.VideoQuality.ToString());
+ AddEncodeElement(xmlWriter, "VideoQualityType", "integer", string.Empty); // TODO Requires Logic
+ AddEncodeElement(xmlWriter, "VideoTargetSize", "string", parsed.VideoTargetSize);
+ AddEncodeElement(xmlWriter, "VideoTurboTwoPass", "integer", parsed.TurboFirstPass ? "1" : "0");
+ AddEncodeElement(xmlWriter, "VideoTwoPass", "integer", parsed.TwoPass ? "1" : "0");
+
+ AddEncodeElement(xmlWriter, "x264Option", "string", parsed.H264Query);
}
- /// <summary>
- /// Add Preset setting + value
- /// </summary>
- /// <param name="keyName"></param>
- /// <param name="value"></param>
- private void AddBooleanElement(string keyName, bool value)
+ private static void AddBooleanElement(XmlTextWriter xmlWriter, string keyName, bool value)
{
- Writer.WriteStartElement("key");
- Writer.WriteString(keyName);
- Writer.WriteEndElement();
+ xmlWriter.WriteStartElement("key");
+ xmlWriter.WriteString(keyName);
+ xmlWriter.WriteEndElement();
if (value)
{
- Writer.WriteStartElement("true");
- Writer.WriteEndElement();
+ xmlWriter.WriteStartElement("true");
+ xmlWriter.WriteEndElement();
}
else
{
- Writer.WriteStartElement("false");
- Writer.WriteEndElement();
+ xmlWriter.WriteStartElement("false");
+ xmlWriter.WriteEndElement();
}
}
- /// <summary>
- /// Add Preset setting + value
- /// </summary>
- /// <param name="keyName"></param>
- /// <param name="type"></param>
- /// <param name="value"></param>
- private void AddEncodeElement(string keyName, string type, string value)
+ private static void AddEncodeElement(XmlTextWriter xmlWriter, string keyName, string type, string value)
{
- Writer.WriteElementString("key", keyName);
- Writer.WriteElementString(type, value);
+ xmlWriter.WriteElementString("key", keyName);
+ xmlWriter.WriteElementString(type, value);
}
- /// <summary>
- /// Add List of audio tracks
- /// </summary>
- private void AudioListArrayDict()
+ private static void AudioListArrayDict(XmlTextWriter xmlWriter, QueryParser parsed)
{
- Writer.WriteStartElement("key");
- Writer.WriteString("AudioList");
- Writer.WriteEndElement();
-
- Writer.WriteStartElement("array");
- AddAudioItem();
- AddAudioItem();
- Writer.WriteEndElement();
+ xmlWriter.WriteStartElement("key");
+ xmlWriter.WriteString("AudioList");
+ xmlWriter.WriteEndElement();
+
+ xmlWriter.WriteStartElement("array");
+ foreach (AudioTrack track in parsed.AudioInformation)
+ {
+ AddAudioItem(xmlWriter, track);
+ }
+ xmlWriter.WriteEndElement();
}
- /// <summary>
- /// Add List of audio tracks
- /// </summary>
- private void AddAudioItem()
+ private static void AddAudioItem(XmlTextWriter xmlWriter, AudioTrack audioTrack)
{
- int bitrate = 448;
- string encoder = "AC3 Passthru";
- string mixdown = "AC3 Passthru";
- string sample = "Auto";
- int track = 1;
- double drc = 0.0;
- string desc = "English (AC3) (5.1 ch)";
+ string bitrate = audioTrack.Bitrate;
+ string encoder = audioTrack.Encoder;
+ string mixdown = audioTrack.MixDown;
+ string sample = audioTrack.SampleRate;
+ int track;
+ int.TryParse(audioTrack.Track, out track);
+ string drc = audioTrack.DRC;
+ string desc = "Automatic";
- Writer.WriteStartElement("dict");
+ xmlWriter.WriteStartElement("dict");
- Writer.WriteElementString("key", "AudioBitrate");
- Writer.WriteElementString("string", bitrate.ToString());
+ xmlWriter.WriteElementString("key", "AudioBitrate");
+ xmlWriter.WriteElementString("string", bitrate);
- Writer.WriteElementString("key", "AudioEncoder");
- Writer.WriteElementString("string", encoder);
+ xmlWriter.WriteElementString("key", "AudioEncoder");
+ xmlWriter.WriteElementString("string", encoder);
- Writer.WriteElementString("key", "AudioMixdown");
- Writer.WriteElementString("string", mixdown);
+ xmlWriter.WriteElementString("key", "AudioMixdown");
+ xmlWriter.WriteElementString("string", mixdown);
- Writer.WriteElementString("key", "AudioSamplerate");
- Writer.WriteElementString("string", sample);
+ xmlWriter.WriteElementString("key", "AudioSamplerate");
+ xmlWriter.WriteElementString("string", sample);
- Writer.WriteElementString("key", "AudioTrack");
- Writer.WriteElementString("integer", track.ToString());
+ xmlWriter.WriteElementString("key", "AudioTrack");
+ xmlWriter.WriteElementString("integer", track.ToString());
- Writer.WriteElementString("key", "AudioTrackDRCSlider");
- Writer.WriteElementString("real", drc.ToString());
+ xmlWriter.WriteElementString("key", "AudioTrackDRCSlider");
+ xmlWriter.WriteElementString("real", drc.ToString());
- Writer.WriteElementString("key", "AudioTrackDescription");
- Writer.WriteElementString("string", desc);
+ xmlWriter.WriteElementString("key", "AudioTrackDescription");
+ xmlWriter.WriteElementString("string", desc);
- Writer.WriteEndElement();
+ xmlWriter.WriteEndElement();
}
+ #endregion
}
}
\ No newline at end of file diff --git a/win/C#/frmActivityWindow.Designer.cs b/win/C#/frmActivityWindow.Designer.cs index 536a13115..7b066695f 100644 --- a/win/C#/frmActivityWindow.Designer.cs +++ b/win/C#/frmActivityWindow.Designer.cs @@ -152,7 +152,7 @@ namespace Handbrake this.panel1.Size = new System.Drawing.Size(404, 552);
this.panel1.TabIndex = 97;
//
- // NewActivityWindow
+ // frmActivityWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -165,10 +165,10 @@ namespace Handbrake this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
- this.Name = "NewActivityWindow";
+ this.Name = "frmActivityWindow";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "New Activity Window";
+ this.Text = "Activity Window";
this.Load += new System.EventHandler(this.NewActivityWindow_Load);
this.rightClickMenu.ResumeLayout(false);
this.toolStrip1.ResumeLayout(false);
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index 7686a0d1d..613a1a4c2 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -96,7 +96,7 @@ namespace Handbrake /// </param>
private delegate void SetModeCallback(ActivityLogMode setMode);
- /* Public Methods */
+ /* Private Methods */
/// <summary>
/// Set the window to scan mode
@@ -143,8 +143,6 @@ namespace Handbrake }
}
- /* Private Methods */
-
/// <summary>
/// On Window load, start a new timer
/// </summary>
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index a8069e35a..50d850eeb 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -39,7 +39,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container();
System.Windows.Forms.ContextMenuStrip notifyIconMenu;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);
@@ -55,6 +55,8 @@ namespace Handbrake this.check_optimiseMP4 = new System.Windows.Forms.CheckBox();
this.check_iPodAtom = new System.Windows.Forms.CheckBox();
this.data_chpt = new System.Windows.Forms.DataGridView();
+ this.number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ChaptersMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnu_resetChapters = new System.Windows.Forms.ToolStripMenuItem();
this.btn_addPreset = new System.Windows.Forms.Button();
@@ -171,8 +173,7 @@ namespace Handbrake this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.openPreset = new System.Windows.Forms.OpenFileDialog();
this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();
- this.number = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.mnu_exportMacPreset = new System.Windows.Forms.ToolStripMenuItem();
notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
notifyIconMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();
@@ -276,7 +277,7 @@ namespace Handbrake this.check_turbo.Enabled = false;
this.check_turbo.Location = new System.Drawing.Point(146, 123);
this.check_turbo.Name = "check_turbo";
- this.check_turbo.Size = new System.Drawing.Size(99, 17);
+ this.check_turbo.Size = new System.Drawing.Size(101, 17);
this.check_turbo.TabIndex = 7;
this.check_turbo.Text = "Turbo first Pass";
this.ToolTip.SetToolTip(this.check_turbo, "Makes the first pass of a 2 pass encode faster.");
@@ -398,6 +399,26 @@ namespace Handbrake this.data_chpt.TabIndex = 3;
this.ToolTip.SetToolTip(this.data_chpt, resources.GetString("data_chpt.ToolTip"));
//
+ // number
+ //
+ dataGridViewCellStyle2.Format = "N0";
+ dataGridViewCellStyle2.NullValue = null;
+ this.number.DefaultCellStyle = dataGridViewCellStyle2;
+ this.number.Frozen = true;
+ this.number.HeaderText = "Chapter Number";
+ this.number.MaxInputLength = 3;
+ this.number.Name = "number";
+ this.number.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+ this.number.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.number.Width = 165;
+ //
+ // name
+ //
+ this.name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.name.HeaderText = "Chapter Name";
+ this.name.Name = "name";
+ this.name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ //
// ChaptersMenu
//
this.ChaptersMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -642,6 +663,7 @@ namespace Handbrake this.toolStripSeparator7,
this.btn_new_preset,
this.mnu_importMacPreset,
+ this.mnu_exportMacPreset,
this.mnu_SelectDefault});
this.PresetsToolStripMenuItem.Name = "PresetsToolStripMenuItem";
this.PresetsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
@@ -840,7 +862,7 @@ namespace Handbrake this.radio_cq.BackColor = System.Drawing.Color.Transparent;
this.radio_cq.Location = new System.Drawing.Point(336, 97);
this.radio_cq.Name = "radio_cq";
- this.radio_cq.Size = new System.Drawing.Size(105, 17);
+ this.radio_cq.Size = new System.Drawing.Size(110, 17);
this.radio_cq.TabIndex = 18;
this.radio_cq.Text = "Constant Quality:";
this.radio_cq.UseVisualStyleBackColor = false;
@@ -853,7 +875,7 @@ namespace Handbrake this.radio_avgBitrate.Checked = true;
this.radio_avgBitrate.Location = new System.Drawing.Point(336, 64);
this.radio_avgBitrate.Name = "radio_avgBitrate";
- this.radio_avgBitrate.Size = new System.Drawing.Size(112, 17);
+ this.radio_avgBitrate.Size = new System.Drawing.Size(116, 17);
this.radio_avgBitrate.TabIndex = 17;
this.radio_avgBitrate.TabStop = true;
this.radio_avgBitrate.Text = "Avg Bitrate (kbps):";
@@ -866,7 +888,7 @@ namespace Handbrake this.radio_targetFilesize.BackColor = System.Drawing.Color.Transparent;
this.radio_targetFilesize.Location = new System.Drawing.Point(336, 37);
this.radio_targetFilesize.Name = "radio_targetFilesize";
- this.radio_targetFilesize.Size = new System.Drawing.Size(107, 17);
+ this.radio_targetFilesize.Size = new System.Drawing.Size(108, 17);
this.radio_targetFilesize.TabIndex = 16;
this.radio_targetFilesize.Text = "Target Size (MB):";
this.radio_targetFilesize.UseVisualStyleBackColor = false;
@@ -889,7 +911,7 @@ namespace Handbrake this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent;
this.check_2PassEncode.Location = new System.Drawing.Point(125, 100);
this.check_2PassEncode.Name = "check_2PassEncode";
- this.check_2PassEncode.Size = new System.Drawing.Size(106, 17);
+ this.check_2PassEncode.Size = new System.Drawing.Size(104, 17);
this.check_2PassEncode.TabIndex = 6;
this.check_2PassEncode.Text = "2-Pass Encoding";
this.check_2PassEncode.UseVisualStyleBackColor = false;
@@ -1182,9 +1204,9 @@ namespace Handbrake this.treeView_presets.ShowLines = false;
this.treeView_presets.Size = new System.Drawing.Size(240, 424);
this.treeView_presets.TabIndex = 0;
+ this.treeView_presets.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeview_presets_mouseUp);
this.treeView_presets.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_presets_AfterSelect);
this.treeView_presets.KeyUp += new System.Windows.Forms.KeyEventHandler(this.treeView_presets_deleteKey);
- this.treeView_presets.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeview_presets_mouseUp);
//
// presets_menu
//
@@ -1624,25 +1646,12 @@ namespace Handbrake //
this.File_ChapterImport.Filter = "CSV Files|*.csv";
//
- // number
+ // mnu_exportMacPreset
//
- dataGridViewCellStyle1.Format = "N0";
- dataGridViewCellStyle1.NullValue = null;
- this.number.DefaultCellStyle = dataGridViewCellStyle1;
- this.number.Frozen = true;
- this.number.HeaderText = "Chapter Number";
- this.number.MaxInputLength = 3;
- this.number.Name = "number";
- this.number.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.number.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.number.Width = 165;
- //
- // name
- //
- this.name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.name.HeaderText = "Chapter Name";
- this.name.Name = "name";
- this.name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+ this.mnu_exportMacPreset.Name = "mnu_exportMacPreset";
+ this.mnu_exportMacPreset.Size = new System.Drawing.Size(194, 22);
+ this.mnu_exportMacPreset.Text = "Export";
+ this.mnu_exportMacPreset.Click += new System.EventHandler(this.mnu_exportMacPreset_Click);
//
// frmMain
//
@@ -1845,5 +1854,6 @@ namespace Handbrake private Button btn_export;
private DataGridViewTextBoxColumn number;
private DataGridViewTextBoxColumn name;
+ private ToolStripMenuItem mnu_exportMacPreset;
}
}
\ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 229c25516..61efc879c 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -437,6 +437,12 @@ namespace Handbrake ImportPreset();
}
+ private void mnu_exportMacPreset_Click(object sender, EventArgs e)
+ {
+ ExportPreset();
+ }
+
+
private void btn_new_preset_Click(object sender, EventArgs e)
{
Form preset = new frmAddPreset(this, QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null),
@@ -739,6 +745,21 @@ namespace Handbrake }
}
+ private void ExportPreset()
+ {
+ MessageBox.Show("This feature has not been implimented yet.", "Not Implimented", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+
+ SaveFileDialog savefiledialog = new SaveFileDialog();
+ savefiledialog.Filter = "plist|*.plist";
+
+ if (savefiledialog.ShowDialog() == DialogResult.OK)
+ {
+ QueryParser parsed = QueryParser.Parse(QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null));
+ PlistPresetHandler.Export(savefiledialog.FileName, parsed);
+ }
+ }
+
#endregion
#region ToolStrip
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index 49b97ddb8..7f7acfbab 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -117,12 +117,12 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <metadata name="notifyIconMenu.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>False</value>
- </metadata>
<metadata name="notifyIconMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 54</value>
</metadata>
+ <metadata name="notifyIconMenu.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </metadata>
<metadata name="DVD_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>556, 15</value>
</metadata>
|