Added "Auto open folder" option to video converter

This commit is contained in:
Jaex 2019-11-27 19:10:49 +03:00
parent 4d14026e59
commit c5828c9992
4 changed files with 28 additions and 2 deletions

View file

@ -50,10 +50,12 @@ private void InitializeComponent()
this.tpArguments = new System.Windows.Forms.TabPage();
this.tpAdvanced = new System.Windows.Forms.TabPage();
this.pbProgress = new ShareX.HelpersLib.BlackStyleProgressBar();
this.cbAutoOpenFolder = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.tbVideoQuality)).BeginInit();
this.tcMain.SuspendLayout();
this.tpOptions.SuspendLayout();
this.tpArguments.SuspendLayout();
this.tpAdvanced.SuspendLayout();
this.SuspendLayout();
//
// lblInputFilePath
@ -254,6 +256,7 @@ private void InitializeComponent()
//
// tpAdvanced
//
this.tpAdvanced.Controls.Add(this.cbAutoOpenFolder);
this.tpAdvanced.Location = new System.Drawing.Point(4, 22);
this.tpAdvanced.Name = "tpAdvanced";
this.tpAdvanced.Padding = new System.Windows.Forms.Padding(3);
@ -273,6 +276,17 @@ private void InitializeComponent()
this.pbProgress.TabIndex = 19;
this.pbProgress.Text = null;
//
// cbAutoOpenFolder
//
this.cbAutoOpenFolder.AutoSize = true;
this.cbAutoOpenFolder.Location = new System.Drawing.Point(16, 16);
this.cbAutoOpenFolder.Name = "cbAutoOpenFolder";
this.cbAutoOpenFolder.Size = new System.Drawing.Size(151, 17);
this.cbAutoOpenFolder.TabIndex = 0;
this.cbAutoOpenFolder.Text = "After encoding open folder";
this.cbAutoOpenFolder.UseVisualStyleBackColor = true;
this.cbAutoOpenFolder.CheckedChanged += new System.EventHandler(this.cbAutoOpenFolder_CheckedChanged);
//
// VideoConverterForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -302,6 +316,8 @@ private void InitializeComponent()
this.tpOptions.PerformLayout();
this.tpArguments.ResumeLayout(false);
this.tpArguments.PerformLayout();
this.tpAdvanced.ResumeLayout(false);
this.tpAdvanced.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -331,5 +347,6 @@ private void InitializeComponent()
private System.Windows.Forms.TabPage tpArguments;
private System.Windows.Forms.TabPage tpAdvanced;
private HelpersLib.BlackStyleProgressBar pbProgress;
private System.Windows.Forms.CheckBox cbAutoOpenFolder;
}
}

View file

@ -56,6 +56,8 @@ public VideoConverterForm(string ffmpegFilePath, VideoConverterOptions options)
cbVideoCodec.SelectedIndex = (int)Options.VideoCodec;
tbVideoQuality.SetValue(tbVideoQuality.Minimum + tbVideoQuality.Maximum - Options.VideoQuality);
cbAutoOpenFolder.Checked = Options.AutoOpenFolder;
formReady = true;
}
@ -131,7 +133,7 @@ private bool StartEncoding()
string args = Options.GetFFmpegArgs();
result = ffmpeg.Run(args);
if (result && !ffmpeg.StopRequested)
if (Options.AutoOpenFolder && result && !ffmpeg.StopRequested)
{
Helpers.OpenFolderWithFile(outputFilePath);
}
@ -206,6 +208,11 @@ private void tbVideoQuality_ValueChanged(object sender, EventArgs e)
UpdateOptions();
}
private void cbAutoOpenFolder_CheckedChanged(object sender, EventArgs e)
{
Options.AutoOpenFolder = cbAutoOpenFolder.Checked;
}
private async void btnEncode_Click(object sender, EventArgs e)
{
if (!encoding)

View file

@ -53,6 +53,8 @@ public string OutputFilePath
public ConverterVideoCodecs VideoCodec { get; set; } = ConverterVideoCodecs.x264;
public int VideoQuality { get; set; } = 23;
public bool AutoOpenFolder { get; set; } = true;
public string GetFFmpegArgs()
{
StringBuilder args = new StringBuilder();

View file

@ -305,7 +305,7 @@ public void ChangeState(ScreenRecordState state)
public void ChangeStateProgress(int progress)
{
niTray.Text = string.Format("ShareX - {0} ({1}%)", Resources.ScreenRecordForm_StartRecording_Encoding___, progress);
niTray.Text = $"ShareX - {Resources.ScreenRecordForm_StartRecording_Encoding___} {progress}%";
}
}
}