ExportImport control to FFmpegOptionsForm

This commit is contained in:
Jaex 2014-06-08 07:07:55 +03:00
parent cfad67bd58
commit 68385a99f7
4 changed files with 40 additions and 10 deletions

View file

@ -81,6 +81,7 @@ private void InitializeComponent()
this.btnRefreshSources = new System.Windows.Forms.Button(); this.btnRefreshSources = new System.Windows.Forms.Button();
this.cbShowError = new System.Windows.Forms.CheckBox(); this.cbShowError = new System.Windows.Forms.CheckBox();
this.btnHelp = new System.Windows.Forms.Button(); this.btnHelp = new System.Windows.Forms.Button();
this.eiFFmpeg = new HelpersLib.UserControls.ExportImportControl();
((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudx264CRF)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudQscale)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudQscale)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudVPxCRF)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudVPxCRF)).BeginInit();
@ -687,20 +688,31 @@ private void InitializeComponent()
// //
// btnHelp // btnHelp
// //
this.btnHelp.Location = new System.Drawing.Point(599, 413); this.btnHelp.Location = new System.Drawing.Point(592, 412);
this.btnHelp.Name = "btnHelp"; this.btnHelp.Name = "btnHelp";
this.btnHelp.Size = new System.Drawing.Size(59, 24); this.btnHelp.Size = new System.Drawing.Size(64, 24);
this.btnHelp.TabIndex = 0; this.btnHelp.TabIndex = 0;
this.btnHelp.Text = "Help..."; this.btnHelp.Text = "Help...";
this.btnHelp.UseVisualStyleBackColor = true; this.btnHelp.UseVisualStyleBackColor = true;
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click); this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
// //
// eiFFmpeg
//
this.eiFFmpeg.Location = new System.Drawing.Point(448, 412);
this.eiFFmpeg.Name = "eiFFmpeg";
this.eiFFmpeg.ObjectType = null;
this.eiFFmpeg.Size = new System.Drawing.Size(136, 24);
this.eiFFmpeg.TabIndex = 12;
this.eiFFmpeg.ExportRequested += new HelpersLib.UserControls.ExportImportControl.ExportEventHandler(this.eiFFmpeg_ExportRequested);
this.eiFFmpeg.ImportRequested += new HelpersLib.UserControls.ExportImportControl.ImportEventHandler(this.eiFFmpeg_ImportRequested);
//
// FFmpegOptionsForm // FFmpegOptionsForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(666, 445); this.ClientSize = new System.Drawing.Size(666, 445);
this.Controls.Add(this.eiFFmpeg);
this.Controls.Add(this.btnHelp); this.Controls.Add(this.btnHelp);
this.Controls.Add(this.cbShowError); this.Controls.Add(this.cbShowError);
this.Controls.Add(this.btnRefreshSources); this.Controls.Add(this.btnRefreshSources);
@ -811,5 +823,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox cbShowError; private System.Windows.Forms.CheckBox cbShowError;
private System.Windows.Forms.CheckBox cbCustomCommands; private System.Windows.Forms.CheckBox cbCustomCommands;
private System.Windows.Forms.Button btnHelp; private System.Windows.Forms.Button btnHelp;
private HelpersLib.UserControls.ExportImportControl eiFFmpeg;
} }
} }

View file

@ -42,8 +42,11 @@ public FFmpegOptionsForm(ScreencastOptions options)
{ {
InitializeComponent(); InitializeComponent();
Icon = ShareXResources.Icon; Icon = ShareXResources.Icon;
Options = options; Options = options;
eiFFmpeg.ObjectType = typeof(FFmpegOptions);
cboVideoCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegVideoCodec>());
cboAudioCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegAudioCodec>());
cbPreset.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegPreset>());
if (Options != null) if (Options != null)
{ {
@ -55,9 +58,8 @@ private void SettingsLoad()
{ {
// General // General
RefreshSourcesAsync(); RefreshSourcesAsync();
cboVideoCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegVideoCodec>());
cboVideoCodec.SelectedIndex = (int)Options.FFmpeg.VideoCodec; cboVideoCodec.SelectedIndex = (int)Options.FFmpeg.VideoCodec;
cboAudioCodec.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegAudioCodec>());
cboAudioCodec.SelectedIndex = (int)Options.FFmpeg.AudioCodec; cboAudioCodec.SelectedIndex = (int)Options.FFmpeg.AudioCodec;
cbShowError.Checked = Options.FFmpeg.ShowError; cbShowError.Checked = Options.FFmpeg.ShowError;
@ -73,7 +75,6 @@ private void SettingsLoad()
// x264 // x264
nudx264CRF.Value = Options.FFmpeg.x264_CRF.Between((int)nudx264CRF.Minimum, (int)nudx264CRF.Maximum); nudx264CRF.Value = Options.FFmpeg.x264_CRF.Between((int)nudx264CRF.Minimum, (int)nudx264CRF.Maximum);
cbPreset.Items.AddRange(Helpers.GetEnumDescriptions<FFmpegPreset>());
cbPreset.SelectedIndex = (int)Options.FFmpeg.Preset; cbPreset.SelectedIndex = (int)Options.FFmpeg.Preset;
// VPx // VPx
@ -355,5 +356,23 @@ private void btnHelp_Click(object sender, EventArgs e)
{ {
Helpers.OpenURL("https://docs.google.com/document/d/1aKLSqsouoeC5Tjf-Z3P880V3rpzvQU0A2Clayn9ElZo/edit?usp=sharing"); Helpers.OpenURL("https://docs.google.com/document/d/1aKLSqsouoeC5Tjf-Z3P880V3rpzvQU0A2Clayn9ElZo/edit?usp=sharing");
} }
private object eiFFmpeg_ExportRequested()
{
return Options.FFmpeg;
}
private void eiFFmpeg_ImportRequested(object obj)
{
FFmpegOptions ffmpegOptions = obj as FFmpegOptions;
if (ffmpegOptions != null)
{
string tempFFmpegPath = Options.FFmpeg.CLIPath;
Options.FFmpeg = ffmpegOptions;
Options.FFmpeg.CLIPath = tempFFmpegPath;
SettingsLoad();
}
}
} }
} }

View file

@ -126,7 +126,6 @@ private void InitializeComponent()
// //
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(240, 112); this.btnCancel.Location = new System.Drawing.Point(240, 112);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(75, 23);
@ -137,7 +136,6 @@ private void InitializeComponent()
// //
// btnOK // btnOK
// //
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.Location = new System.Drawing.Point(160, 112); this.btnOK.Location = new System.Drawing.Point(160, 112);
this.btnOK.Name = "btnOK"; this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.Size = new System.Drawing.Size(75, 23);

View file

@ -112,9 +112,9 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
</root> </root>