From 70673cd52ad401943d956821d234c7f6a41623cb Mon Sep 17 00:00:00 2001 From: mcored Date: Sat, 19 Apr 2014 11:44:07 +0800 Subject: [PATCH] CLI Video Encoder GUI fixes --- ShareX/Forms/ApplicationSettingsForm.cs | 4 +++- ShareX/Forms/TaskSettingsForm.Designer.cs | 15 +++++++++++- ShareX/Forms/TaskSettingsForm.cs | 28 +++++++++++------------ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ShareX/Forms/ApplicationSettingsForm.cs b/ShareX/Forms/ApplicationSettingsForm.cs index c014895ab..4ceb218c0 100644 --- a/ShareX/Forms/ApplicationSettingsForm.cs +++ b/ShareX/Forms/ApplicationSettingsForm.cs @@ -504,7 +504,9 @@ private void btnEncodersEdit_Click(object sender, EventArgs e) private void btnEncoderDuplicate_Click(object sender, EventArgs e) { - lvEncoders.SelectedItems.Cast().Select(x => ((VideoEncoder)x.Tag).Copy()).ToList().ForEach(x => AddVideoEncoder(x)); + var encoders = lvEncoders.SelectedItems.Cast().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) diff --git a/ShareX/Forms/TaskSettingsForm.Designer.cs b/ShareX/Forms/TaskSettingsForm.Designer.cs index 7c72e0c12..03cffe004 100644 --- a/ShareX/Forms/TaskSettingsForm.Designer.cs +++ b/ShareX/Forms/TaskSettingsForm.Designer.cs @@ -148,6 +148,7 @@ private void InitializeComponent() this.tpAdvanced = new System.Windows.Forms.TabPage(); this.pgTaskSettings = new System.Windows.Forms.PropertyGrid(); this.chkUseDefaultAdvancedSettings = new System.Windows.Forms.CheckBox(); + this.btnEncoderConfig = new System.Windows.Forms.Button(); this.tcHotkeySettings.SuspendLayout(); this.tpTask.SuspendLayout(); this.cmsDestinations.SuspendLayout(); @@ -1003,6 +1004,7 @@ private void InitializeComponent() // // tpScreenRecorder // + this.tpScreenRecorder.Controls.Add(this.btnEncoderConfig); this.tpScreenRecorder.Controls.Add(this.cboEncoder); this.tpScreenRecorder.Controls.Add(this.nudScreenRecorderDuration); this.tpScreenRecorder.Controls.Add(this.lblScreenRecorderStartDelay); @@ -1026,7 +1028,7 @@ private void InitializeComponent() this.cboEncoder.FormattingEnabled = true; this.cboEncoder.Location = new System.Drawing.Point(200, 12); this.cboEncoder.Name = "cboEncoder"; - this.cboEncoder.Size = new System.Drawing.Size(336, 21); + this.cboEncoder.Size = new System.Drawing.Size(296, 21); this.cboEncoder.TabIndex = 10; this.cboEncoder.SelectedIndexChanged += new System.EventHandler(this.cboEncoder_SelectedIndexChanged); // @@ -1558,6 +1560,16 @@ private void InitializeComponent() this.chkUseDefaultAdvancedSettings.UseVisualStyleBackColor = true; this.chkUseDefaultAdvancedSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultAdvancedSettings_CheckedChanged); // + // btnEncoderConfig + // + this.btnEncoderConfig.Location = new System.Drawing.Point(504, 12); + this.btnEncoderConfig.Name = "btnEncoderConfig"; + this.btnEncoderConfig.Size = new System.Drawing.Size(40, 23); + this.btnEncoderConfig.TabIndex = 11; + this.btnEncoderConfig.Text = "..."; + this.btnEncoderConfig.UseVisualStyleBackColor = true; + this.btnEncoderConfig.Click += new System.EventHandler(this.btnEncoderConfig_Click); + // // TaskSettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1745,6 +1757,7 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox cbImageFileExist; private System.Windows.Forms.Label lblImageFileExist; private System.Windows.Forms.ComboBox cboEncoder; + private System.Windows.Forms.Button btnEncoderConfig; diff --git a/ShareX/Forms/TaskSettingsForm.cs b/ShareX/Forms/TaskSettingsForm.cs index 90247a175..81db830b3 100644 --- a/ShareX/Forms/TaskSettingsForm.cs +++ b/ShareX/Forms/TaskSettingsForm.cs @@ -43,7 +43,7 @@ public partial class TaskSettingsForm : Form private ToolStripDropDownItem tsmiImageFileUploaders, tsmiTextFileUploaders; private bool loaded; - private readonly string ConfigureEncoder = "<--- configure video encoders --->"; + private readonly string ConfigureEncoder = "Configure video encoders --->"; public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false) { @@ -208,7 +208,7 @@ private void UpdateVideoEncoders() Program.Settings.VideoEncoders.ForEach(x => cboEncoder.Items.Add(x)); cboEncoder.SelectedIndex = TaskSettings.CaptureSettings.VideoEncoderSelected.BetweenOrDefault(0, Program.Settings.VideoEncoders.Count - 1); } - if (!cboEncoder.Items.Contains(ConfigureEncoder)) + else if (!cboEncoder.Items.Contains(ConfigureEncoder)) { cboEncoder.Items.Add(ConfigureEncoder); } @@ -620,19 +620,7 @@ private void cbScreenRecorderOutput_SelectedIndexChanged(object sender, EventArg private void cboEncoder_SelectedIndexChanged(object sender, EventArgs e) { - if (cboEncoder.SelectedIndex == cboEncoder.Items.Count - 1) - { - using (ApplicationSettingsForm form = new ApplicationSettingsForm()) - { - form.SelectProfilesTab(); - form.ShowDialog(); - UpdateVideoEncoders(); - } - } - else - { - TaskSettings.CaptureSettings.VideoEncoderSelected = cboEncoder.SelectedIndex; - } + TaskSettings.CaptureSettings.VideoEncoderSelected = cboEncoder.SelectedIndex; } private void nudScreenRecorderFPS_ValueChanged(object sender, EventArgs e) @@ -656,6 +644,16 @@ private void nudScreenRecorderStartDelay_ValueChanged(object sender, EventArgs e TaskSettings.CaptureSettings.ScreenRecordStartDelay = (float)nudScreenRecorderStartDelay.Value; } + private void btnEncoderConfig_Click(object sender, EventArgs e) + { + using (ApplicationSettingsForm form = new ApplicationSettingsForm()) + { + form.SelectProfilesTab(); + form.ShowDialog(); + UpdateVideoEncoders(); + } + } + #endregion Screen recorder #region Actions