mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Support drag n drop file to video converter form
This commit is contained in:
parent
cc8c3fd511
commit
f383e3893c
3 changed files with 42 additions and 14 deletions
|
@ -176,8 +176,8 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// VideoConverterForm
|
// VideoConverterForm
|
||||||
//
|
//
|
||||||
|
this.AllowDrop = true;
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||||
this.BackColor = System.Drawing.SystemColors.Window;
|
this.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.Controls.Add(this.lblVideoQualityValue);
|
this.Controls.Add(this.lblVideoQualityValue);
|
||||||
|
@ -204,6 +204,8 @@ private void InitializeComponent()
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.Name = "VideoConverterForm";
|
this.Name = "VideoConverterForm";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VideoConverterForm_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VideoConverterForm_FormClosing);
|
||||||
|
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.VideoConverterForm_DragDrop);
|
||||||
|
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.VideoConverterForm_DragEnter);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.tbVideoQuality)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.tbVideoQuality)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
|
@ -146,6 +146,21 @@ private void UpdateOptions()
|
||||||
!string.IsNullOrEmpty(Options.OutputFileName);
|
!string.IsNullOrEmpty(Options.OutputFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateInputFilePathTextBox(string filePath)
|
||||||
|
{
|
||||||
|
txtInputFilePath.Text = filePath;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(txtOutputFolder.Text))
|
||||||
|
{
|
||||||
|
txtOutputFolder.Text = Path.GetDirectoryName(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(txtOutputFileName.Text))
|
||||||
|
{
|
||||||
|
txtOutputFileName.Text = Path.GetFileNameWithoutExtension(filePath) + "-output";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool StartEncoding()
|
private bool StartEncoding()
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -198,17 +213,7 @@ private void btnInputFilePathBrowse_Click(object sender, EventArgs e)
|
||||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
if (ofd.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
string filePath = ofd.FileName;
|
string filePath = ofd.FileName;
|
||||||
txtInputFilePath.Text = filePath;
|
UpdateInputFilePathTextBox(filePath);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(txtOutputFolder.Text))
|
|
||||||
{
|
|
||||||
txtOutputFolder.Text = Path.GetDirectoryName(filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(txtOutputFileName.Text))
|
|
||||||
{
|
|
||||||
txtOutputFileName.Text = Path.GetFileNameWithoutExtension(filePath) + "-output";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,6 +293,27 @@ private async void btnEncode_Click(object sender, EventArgs e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void VideoConverterForm_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VideoConverterForm_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop, false) && e.Data.GetData(DataFormats.FileDrop, false) is string[] files && files.Length > 0)
|
||||||
|
{
|
||||||
|
string filePath = files[0];
|
||||||
|
UpdateInputFilePathTextBox(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void VideoConverterForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void VideoConverterForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
formClosing = true;
|
formClosing = true;
|
||||||
|
|
|
@ -594,7 +594,7 @@
|
||||||
<value>pbProgress</value>
|
<value>pbProgress</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>pbProgress.Type" xml:space="preserve">
|
<data name=">>pbProgress.Type" xml:space="preserve">
|
||||||
<value>ShareX.HelpersLib.BlackStyleProgressBar, ShareX.HelpersLib, Version=13.0.2.0, Culture=neutral, PublicKeyToken=null</value>
|
<value>ShareX.HelpersLib.BlackStyleProgressBar, ShareX.HelpersLib, Version=13.6.1.0, Culture=neutral, PublicKeyToken=null</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>pbProgress.Parent" xml:space="preserve">
|
<data name=">>pbProgress.Parent" xml:space="preserve">
|
||||||
<value>$this</value>
|
<value>$this</value>
|
||||||
|
@ -633,7 +633,7 @@
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||||
<value>6, 13</value>
|
<value>96, 96</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>456, 278</value>
|
<value>456, 278</value>
|
||||||
|
|
Loading…
Reference in a new issue