Encoder Profiles UI moved from Application Form to a standalone form

This commit is contained in:
mcored 2014-08-09 11:18:27 +08:00
parent 334da1e633
commit ad3fe1f167
7 changed files with 384 additions and 238 deletions

View file

@ -100,18 +100,6 @@ private void InitializeComponent()
this.cbPrintDontShowWindowsDialog = new System.Windows.Forms.CheckBox();
this.cbDontShowPrintSettingDialog = new System.Windows.Forms.CheckBox();
this.btnShowImagePrintSettings = new System.Windows.Forms.Button();
this.tpProfiles = new System.Windows.Forms.TabPage();
this.tcProfiles = new System.Windows.Forms.TabControl();
this.tpEncodersCLI = new System.Windows.Forms.TabPage();
this.btnEncoderDuplicate = new System.Windows.Forms.Button();
this.lvEncoders = new HelpersLib.MyListView();
this.chEncoderDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chEncoderPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chEncoderArgs = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chEncoderOutputExtension = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnEncodersAdd = new System.Windows.Forms.Button();
this.btnEncodersEdit = new System.Windows.Forms.Button();
this.btnEncodersRemove = new System.Windows.Forms.Button();
this.tpAdvanced = new System.Windows.Forms.TabPage();
this.pgSettings = new System.Windows.Forms.PropertyGrid();
this.tcSettings.SuspendLayout();
@ -133,9 +121,6 @@ private void InitializeComponent()
this.gbSecondaryTextUploaders.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudRetryUpload)).BeginInit();
this.tpPrint.SuspendLayout();
this.tpProfiles.SuspendLayout();
this.tcProfiles.SuspendLayout();
this.tpEncodersCLI.SuspendLayout();
this.tpAdvanced.SuspendLayout();
this.SuspendLayout();
//
@ -146,7 +131,6 @@ private void InitializeComponent()
this.tcSettings.Controls.Add(this.tpProxy);
this.tcSettings.Controls.Add(this.tpUpload);
this.tcSettings.Controls.Add(this.tpPrint);
this.tcSettings.Controls.Add(this.tpProfiles);
this.tcSettings.Controls.Add(this.tpAdvanced);
this.tcSettings.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcSettings.Location = new System.Drawing.Point(3, 3);
@ -919,123 +903,6 @@ private void InitializeComponent()
this.btnShowImagePrintSettings.UseVisualStyleBackColor = true;
this.btnShowImagePrintSettings.Click += new System.EventHandler(this.btnShowImagePrintSettings_Click);
//
// tpProfiles
//
this.tpProfiles.Controls.Add(this.tcProfiles);
this.tpProfiles.Location = new System.Drawing.Point(4, 22);
this.tpProfiles.Name = "tpProfiles";
this.tpProfiles.Padding = new System.Windows.Forms.Padding(3);
this.tpProfiles.Size = new System.Drawing.Size(610, 370);
this.tpProfiles.TabIndex = 6;
this.tpProfiles.Text = "Profiles";
this.tpProfiles.UseVisualStyleBackColor = true;
//
// tcProfiles
//
this.tcProfiles.Controls.Add(this.tpEncodersCLI);
this.tcProfiles.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcProfiles.Location = new System.Drawing.Point(3, 3);
this.tcProfiles.Name = "tcProfiles";
this.tcProfiles.SelectedIndex = 0;
this.tcProfiles.Size = new System.Drawing.Size(604, 364);
this.tcProfiles.TabIndex = 0;
//
// tpEncodersCLI
//
this.tpEncodersCLI.Controls.Add(this.btnEncoderDuplicate);
this.tpEncodersCLI.Controls.Add(this.lvEncoders);
this.tpEncodersCLI.Controls.Add(this.btnEncodersAdd);
this.tpEncodersCLI.Controls.Add(this.btnEncodersEdit);
this.tpEncodersCLI.Controls.Add(this.btnEncodersRemove);
this.tpEncodersCLI.Location = new System.Drawing.Point(4, 22);
this.tpEncodersCLI.Name = "tpEncodersCLI";
this.tpEncodersCLI.Padding = new System.Windows.Forms.Padding(3);
this.tpEncodersCLI.Size = new System.Drawing.Size(596, 338);
this.tpEncodersCLI.TabIndex = 0;
this.tpEncodersCLI.Text = "CLI encoders";
this.tpEncodersCLI.UseVisualStyleBackColor = true;
//
// btnEncoderDuplicate
//
this.btnEncoderDuplicate.Location = new System.Drawing.Point(168, 8);
this.btnEncoderDuplicate.Name = "btnEncoderDuplicate";
this.btnEncoderDuplicate.Size = new System.Drawing.Size(75, 23);
this.btnEncoderDuplicate.TabIndex = 2;
this.btnEncoderDuplicate.Text = "Duplicate";
this.btnEncoderDuplicate.UseVisualStyleBackColor = true;
this.btnEncoderDuplicate.Click += new System.EventHandler(this.btnEncoderDuplicate_Click);
//
// lvEncoders
//
this.lvEncoders.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvEncoders.AutoFillColumn = true;
this.lvEncoders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chEncoderDescription,
this.chEncoderPath,
this.chEncoderArgs,
this.chEncoderOutputExtension});
this.lvEncoders.FullRowSelect = true;
this.lvEncoders.Location = new System.Drawing.Point(8, 40);
this.lvEncoders.MultiSelect = false;
this.lvEncoders.Name = "lvEncoders";
this.lvEncoders.Size = new System.Drawing.Size(576, 289);
this.lvEncoders.TabIndex = 4;
this.lvEncoders.UseCompatibleStateImageBehavior = false;
this.lvEncoders.View = System.Windows.Forms.View.Details;
this.lvEncoders.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvEncoders_MouseDoubleClick);
//
// chEncoderDescription
//
this.chEncoderDescription.Text = "Description";
this.chEncoderDescription.Width = 130;
//
// chEncoderPath
//
this.chEncoderPath.Text = "Path";
this.chEncoderPath.Width = 80;
//
// chEncoderArgs
//
this.chEncoderArgs.Text = "Args";
this.chEncoderArgs.Width = 230;
//
// chEncoderOutputExtension
//
this.chEncoderOutputExtension.Text = "Output extension";
this.chEncoderOutputExtension.Width = 100;
//
// btnEncodersAdd
//
this.btnEncodersAdd.Location = new System.Drawing.Point(8, 8);
this.btnEncodersAdd.Name = "btnEncodersAdd";
this.btnEncodersAdd.Size = new System.Drawing.Size(75, 23);
this.btnEncodersAdd.TabIndex = 0;
this.btnEncodersAdd.Text = "Add";
this.btnEncodersAdd.UseVisualStyleBackColor = true;
this.btnEncodersAdd.Click += new System.EventHandler(this.btnEncodersAdd_Click);
//
// btnEncodersEdit
//
this.btnEncodersEdit.Location = new System.Drawing.Point(88, 8);
this.btnEncodersEdit.Name = "btnEncodersEdit";
this.btnEncodersEdit.Size = new System.Drawing.Size(75, 23);
this.btnEncodersEdit.TabIndex = 1;
this.btnEncodersEdit.Text = "Edit";
this.btnEncodersEdit.UseVisualStyleBackColor = true;
this.btnEncodersEdit.Click += new System.EventHandler(this.btnEncodersEdit_Click);
//
// btnEncodersRemove
//
this.btnEncodersRemove.Location = new System.Drawing.Point(248, 8);
this.btnEncodersRemove.Name = "btnEncodersRemove";
this.btnEncodersRemove.Size = new System.Drawing.Size(75, 23);
this.btnEncodersRemove.TabIndex = 3;
this.btnEncodersRemove.Text = "Remove";
this.btnEncodersRemove.UseVisualStyleBackColor = true;
this.btnEncodersRemove.Click += new System.EventHandler(this.btnEncodersRemove_Click);
//
// tpAdvanced
//
this.tpAdvanced.Controls.Add(this.pgSettings);
@ -1098,9 +965,6 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.nudRetryUpload)).EndInit();
this.tpPrint.ResumeLayout(false);
this.tpPrint.PerformLayout();
this.tpProfiles.ResumeLayout(false);
this.tcProfiles.ResumeLayout(false);
this.tpEncodersCLI.ResumeLayout(false);
this.tpAdvanced.ResumeLayout(false);
this.ResumeLayout(false);
@ -1181,18 +1045,6 @@ private void InitializeComponent()
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.TabPage tpProfiles;
private System.Windows.Forms.TabControl tcProfiles;
private System.Windows.Forms.TabPage tpEncodersCLI;
private System.Windows.Forms.Button btnEncodersAdd;
private System.Windows.Forms.Button btnEncodersEdit;
private System.Windows.Forms.Button btnEncodersRemove;
private MyListView lvEncoders;
private System.Windows.Forms.ColumnHeader chEncoderDescription;
private System.Windows.Forms.ColumnHeader chEncoderPath;
private System.Windows.Forms.ColumnHeader chEncoderArgs;
private System.Windows.Forms.ColumnHeader chEncoderOutputExtension;
private System.Windows.Forms.Button btnEncoderDuplicate;
private System.Windows.Forms.CheckBox cbPrintDontShowWindowsDialog;
private System.Windows.Forms.CheckBox cbRememberMainFormPosition;
}

View file

@ -117,17 +117,6 @@ private void LoadSettings()
cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog;
cbPrintDontShowWindowsDialog.Checked = !Program.Settings.PrintSettings.ShowPrintDialog;
// Profiles
if (Program.Settings.VideoEncoders.Count == 0)
{
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Encode using x264.exe to H.264", Path = "x264.exe", Args = "--output %output %input", OutputExtension = "mp4" });
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Encode using ffmpeg.exe to WebM", Path = "ffmpeg.exe", Args = "-i %input -c:v libvpx -crf 12 -b:v 500K %output", OutputExtension = "webm" });
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Change container to MP4 using ffmpeg.exe", Path = "ffmpeg.exe", Args = "-i %input -c:v copy %output", OutputExtension = "mp4" });
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Optimize GIF using gifsicle.exe", Path = "gifsicle.exe", Args = "-O2 %input -o %output", OutputExtension = "gif" });
}
Program.Settings.VideoEncoders.ForEach(x => AddVideoEncoder(x));
// Advanced
pgSettings.SelectedObject = Program.Settings;
}
@ -180,12 +169,6 @@ private void UpdatePersonalFolderPathPreview()
lblPreviewPersonalFolderPath.Text = personalPath;
}
public void SelectProfilesTab()
{
tcSettings.SelectedTab = tpProfiles;
tcProfiles.SelectedTab = tpEncodersCLI;
}
#region General
private void cbShowTray_CheckedChanged(object sender, EventArgs e)
@ -459,76 +442,5 @@ private void cbPrintDontShowWindowsDialog_CheckedChanged(object sender, EventArg
}
#endregion Print
#region Profiles
private void btnEncodersAdd_Click(object sender, EventArgs e)
{
using (EncoderProgramForm form = new EncoderProgramForm())
{
if (form.ShowDialog() == DialogResult.OK)
{
VideoEncoder encoder = form.encoder;
Program.Settings.VideoEncoders.Add(encoder);
AddVideoEncoder(encoder);
}
}
}
private void AddVideoEncoder(VideoEncoder encoder)
{
ListViewItem lvi = new ListViewItem(encoder.Name ?? "");
lvi.Tag = encoder;
lvi.SubItems.Add(encoder.Path ?? "");
lvi.SubItems.Add(encoder.Args ?? "");
lvi.SubItems.Add(encoder.OutputExtension ?? "");
lvEncoders.Items.Add(lvi);
}
private void lvEncoders_MouseDoubleClick(object sender, MouseEventArgs e)
{
btnEncodersEdit_Click(sender, e);
}
private void btnEncodersEdit_Click(object sender, EventArgs e)
{
if (lvEncoders.SelectedItems.Count > 0)
{
ListViewItem lvi = lvEncoders.SelectedItems[0];
VideoEncoder encoder = lvi.Tag as VideoEncoder;
using (EncoderProgramForm form = new EncoderProgramForm(encoder))
{
if (form.ShowDialog() == DialogResult.OK)
{
lvi.Text = encoder.Name ?? "";
lvi.SubItems[1].Text = encoder.Path ?? "";
lvi.SubItems[2].Text = encoder.Args ?? "";
lvi.SubItems[3].Text = encoder.OutputExtension ?? "";
}
}
}
}
private void btnEncoderDuplicate_Click(object sender, EventArgs e)
{
var encoders = lvEncoders.SelectedItems.Cast<ListViewItem>().Select(x => ((VideoEncoder)x.Tag).Copy()).ToList();
encoders.ForEach(x => AddVideoEncoder(x));
encoders.ForEach(x => Program.Settings.VideoEncoders.Add(x));
}
private void btnEncodersRemove_Click(object sender, EventArgs e)
{
if (lvEncoders.SelectedItems.Count > 0)
{
ListViewItem lvi = lvEncoders.SelectedItems[0];
VideoEncoder encoder = lvi.Tag as VideoEncoder;
Program.Settings.VideoEncoders.Remove(encoder);
lvEncoders.Items.Remove(lvi);
}
}
#endregion Profiles
}
}

View file

@ -724,9 +724,8 @@ private void cboEncoder_SelectedIndexChanged(object sender, EventArgs e)
private void btnEncoderConfig_Click(object sender, EventArgs e)
{
using (ApplicationSettingsForm form = new ApplicationSettingsForm())
using (VideoEncodersForm form = new VideoEncodersForm() { Icon = this.Icon })
{
form.SelectProfilesTab();
form.ShowDialog();
UpdateVideoEncoders();
}

View file

@ -242,6 +242,12 @@
<Compile Include="Forms\HotkeySettingsForm.Designer.cs">
<DependentUpon>HotkeySettingsForm.cs</DependentUpon>
</Compile>
<Compile Include="VideoEncodersForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="VideoEncodersForm.Designer.cs">
<DependentUpon>VideoEncodersForm.cs</DependentUpon>
</Compile>
<Compile Include="WatchFolder.cs" />
<Compile Include="WatchFolderManager.cs" />
<Compile Include="WatchFolderSettings.cs" />
@ -316,6 +322,9 @@
<EmbeddedResource Include="Forms\HotkeySettingsForm.resx">
<DependentUpon>HotkeySettingsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="VideoEncodersForm.resx">
<DependentUpon>VideoEncodersForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DNSChanger\DNSChanger.csproj">

154
ShareX/VideoEncodersForm.Designer.cs generated Normal file
View file

@ -0,0 +1,154 @@
namespace ShareX
{
partial class VideoEncodersForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnEncoderDuplicate = new System.Windows.Forms.Button();
this.btnEncodersAdd = new System.Windows.Forms.Button();
this.btnEncodersEdit = new System.Windows.Forms.Button();
this.btnEncodersRemove = new System.Windows.Forms.Button();
this.lvEncoders = new HelpersLib.MyListView();
this.chEncoderDescription = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chEncoderPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chEncoderArgs = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chEncoderOutputExtension = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.SuspendLayout();
//
// btnEncoderDuplicate
//
this.btnEncoderDuplicate.Location = new System.Drawing.Point(168, 8);
this.btnEncoderDuplicate.Name = "btnEncoderDuplicate";
this.btnEncoderDuplicate.Size = new System.Drawing.Size(75, 23);
this.btnEncoderDuplicate.TabIndex = 2;
this.btnEncoderDuplicate.Text = "Duplicate";
this.btnEncoderDuplicate.UseVisualStyleBackColor = true;
this.btnEncoderDuplicate.Click += new System.EventHandler(this.btnEncoderDuplicate_Click);
//
// btnEncodersAdd
//
this.btnEncodersAdd.Location = new System.Drawing.Point(8, 8);
this.btnEncodersAdd.Name = "btnEncodersAdd";
this.btnEncodersAdd.Size = new System.Drawing.Size(75, 23);
this.btnEncodersAdd.TabIndex = 0;
this.btnEncodersAdd.Text = "Add";
this.btnEncodersAdd.UseVisualStyleBackColor = true;
this.btnEncodersAdd.Click += new System.EventHandler(this.btnEncodersAdd_Click);
//
// btnEncodersEdit
//
this.btnEncodersEdit.Location = new System.Drawing.Point(88, 8);
this.btnEncodersEdit.Name = "btnEncodersEdit";
this.btnEncodersEdit.Size = new System.Drawing.Size(75, 23);
this.btnEncodersEdit.TabIndex = 1;
this.btnEncodersEdit.Text = "Edit";
this.btnEncodersEdit.UseVisualStyleBackColor = true;
this.btnEncodersEdit.Click += new System.EventHandler(this.btnEncodersEdit_Click);
//
// btnEncodersRemove
//
this.btnEncodersRemove.Location = new System.Drawing.Point(248, 8);
this.btnEncodersRemove.Name = "btnEncodersRemove";
this.btnEncodersRemove.Size = new System.Drawing.Size(75, 23);
this.btnEncodersRemove.TabIndex = 3;
this.btnEncodersRemove.Text = "Remove";
this.btnEncodersRemove.UseVisualStyleBackColor = true;
this.btnEncodersRemove.Click += new System.EventHandler(this.btnEncodersRemove_Click);
//
// lvEncoders
//
this.lvEncoders.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvEncoders.AutoFillColumn = true;
this.lvEncoders.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chEncoderDescription,
this.chEncoderPath,
this.chEncoderArgs,
this.chEncoderOutputExtension});
this.lvEncoders.FullRowSelect = true;
this.lvEncoders.Location = new System.Drawing.Point(8, 40);
this.lvEncoders.MultiSelect = false;
this.lvEncoders.Name = "lvEncoders";
this.lvEncoders.Size = new System.Drawing.Size(646, 330);
this.lvEncoders.TabIndex = 4;
this.lvEncoders.UseCompatibleStateImageBehavior = false;
this.lvEncoders.View = System.Windows.Forms.View.Details;
this.lvEncoders.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvEncoders_MouseDoubleClick);
//
// chEncoderDescription
//
this.chEncoderDescription.Text = "Description";
this.chEncoderDescription.Width = 130;
//
// chEncoderPath
//
this.chEncoderPath.Text = "Path";
this.chEncoderPath.Width = 80;
//
// chEncoderArgs
//
this.chEncoderArgs.Text = "Args";
this.chEncoderArgs.Width = 230;
//
// chEncoderOutputExtension
//
this.chEncoderOutputExtension.Text = "Output extension";
this.chEncoderOutputExtension.Width = 100;
//
// VideoEncodersForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(664, 381);
this.Controls.Add(this.btnEncoderDuplicate);
this.Controls.Add(this.lvEncoders);
this.Controls.Add(this.btnEncodersAdd);
this.Controls.Add(this.btnEncodersRemove);
this.Controls.Add(this.btnEncodersEdit);
this.MinimumSize = new System.Drawing.Size(680, 420);
this.Name = "VideoEncodersForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ShareX - Encoder Profiles";
this.Load += new System.EventHandler(this.VideoEncodersForm_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnEncoderDuplicate;
private HelpersLib.MyListView lvEncoders;
private System.Windows.Forms.ColumnHeader chEncoderDescription;
private System.Windows.Forms.ColumnHeader chEncoderPath;
private System.Windows.Forms.ColumnHeader chEncoderArgs;
private System.Windows.Forms.ColumnHeader chEncoderOutputExtension;
private System.Windows.Forms.Button btnEncodersAdd;
private System.Windows.Forms.Button btnEncodersEdit;
private System.Windows.Forms.Button btnEncodersRemove;
}
}

100
ShareX/VideoEncodersForm.cs Normal file
View file

@ -0,0 +1,100 @@
using HelpersLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ShareX
{
public partial class VideoEncodersForm : Form
{
public VideoEncodersForm()
{
InitializeComponent();
}
private void btnEncoderDuplicate_Click(object sender, EventArgs e)
{
var encoders = lvEncoders.SelectedItems.Cast<ListViewItem>().Select(x => ((VideoEncoder)x.Tag).Copy()).ToList();
encoders.ForEach(x => AddVideoEncoder(x));
encoders.ForEach(x => Program.Settings.VideoEncoders.Add(x));
}
private void lvEncoders_MouseDoubleClick(object sender, MouseEventArgs e)
{
btnEncodersEdit_Click(sender, e);
}
private void btnEncodersAdd_Click(object sender, EventArgs e)
{
using (EncoderProgramForm form = new EncoderProgramForm())
{
if (form.ShowDialog() == DialogResult.OK)
{
VideoEncoder encoder = form.encoder;
Program.Settings.VideoEncoders.Add(encoder);
AddVideoEncoder(encoder);
}
}
}
private void btnEncodersEdit_Click(object sender, EventArgs e)
{
if (lvEncoders.SelectedItems.Count > 0)
{
ListViewItem lvi = lvEncoders.SelectedItems[0];
VideoEncoder encoder = lvi.Tag as VideoEncoder;
using (EncoderProgramForm form = new EncoderProgramForm(encoder))
{
if (form.ShowDialog() == DialogResult.OK)
{
lvi.Text = encoder.Name ?? "";
lvi.SubItems[1].Text = encoder.Path ?? "";
lvi.SubItems[2].Text = encoder.Args ?? "";
lvi.SubItems[3].Text = encoder.OutputExtension ?? "";
}
}
}
}
private void btnEncodersRemove_Click(object sender, EventArgs e)
{
if (lvEncoders.SelectedItems.Count > 0)
{
ListViewItem lvi = lvEncoders.SelectedItems[0];
VideoEncoder encoder = lvi.Tag as VideoEncoder;
Program.Settings.VideoEncoders.Remove(encoder);
lvEncoders.Items.Remove(lvi);
}
}
private void AddVideoEncoder(VideoEncoder encoder)
{
ListViewItem lvi = new ListViewItem(encoder.Name ?? "");
lvi.Tag = encoder;
lvi.SubItems.Add(encoder.Path ?? "");
lvi.SubItems.Add(encoder.Args ?? "");
lvi.SubItems.Add(encoder.OutputExtension ?? "");
lvEncoders.Items.Add(lvi);
}
private void VideoEncodersForm_Load(object sender, EventArgs e)
{
if (Program.Settings.VideoEncoders.Count == 0)
{
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Encode using x264.exe to H.264", Path = "x264.exe", Args = "--output %output %input", OutputExtension = "mp4" });
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Encode using ffmpeg.exe to WebM", Path = "ffmpeg.exe", Args = "-i %input -c:v libvpx -crf 12 -b:v 500K %output", OutputExtension = "webm" });
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Change container to MP4 using ffmpeg.exe", Path = "ffmpeg.exe", Args = "-i %input -c:v copy %output", OutputExtension = "mp4" });
Program.Settings.VideoEncoders.Add(new VideoEncoder() { Name = "Optimize GIF using gifsicle.exe", Path = "gifsicle.exe", Args = "-O2 %input -o %output", OutputExtension = "gif" });
}
Program.Settings.VideoEncoders.ForEach(x => AddVideoEncoder(x));
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>