Use workflow task settings instead of default, few renames

This commit is contained in:
Jaex 2018-04-13 10:25:34 +03:00
parent 672b3b6771
commit eb2150ae32
6 changed files with 28 additions and 26 deletions

View file

@ -46,18 +46,20 @@ public partial class ScreenRecordForm : Form
public bool IsStopRequested { get; private set; } public bool IsStopRequested { get; private set; }
public bool IsAbortRequested { get; private set; } public bool IsAbortRequested { get; private set; }
private TaskSettings taskSettings;
private Color borderColor = Color.Red; private Color borderColor = Color.Red;
private Rectangle borderRectangle; private Rectangle borderRectangle;
private Rectangle borderRectangle0Based; private Rectangle borderRectangle0Based;
private bool activateWindow; private bool activateWindow;
private float duration; private float duration;
public ScreenRecordForm(Rectangle regionRectangle, bool activateWindow = true, float duration = 0) public ScreenRecordForm(Rectangle regionRectangle, TaskSettings taskSettings, bool activateWindow = true, float duration = 0)
{ {
InitializeComponent(); InitializeComponent();
Icon = ShareXResources.Icon; Icon = ShareXResources.Icon;
niTray.Icon = ShareXResources.Icon; niTray.Icon = ShareXResources.Icon;
this.taskSettings = taskSettings;
this.activateWindow = activateWindow; this.activateWindow = activateWindow;
this.duration = duration; this.duration = duration;
@ -226,8 +228,8 @@ private void btnAbort_MouseClick(object sender, MouseEventArgs e)
{ {
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
if (!Program.DefaultTaskSettings.CaptureSettings.AskConfirmationOnAbort || if (!taskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort ||
MessageBox.Show(Resources.ScreenRecord_ConfirmCancel, "ShareX", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) MessageBox.Show(Resources.ScreenRecord_ConfirmCancel, "ShareX", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{ {
AbortRecording(); AbortRecording();
} }

View file

@ -161,7 +161,7 @@ private void InitializeComponent()
this.nudRegionCaptureMagnifierPixelCount = new System.Windows.Forms.NumericUpDown(); this.nudRegionCaptureMagnifierPixelCount = new System.Windows.Forms.NumericUpDown();
this.nudRegionCaptureMagnifierPixelSize = new System.Windows.Forms.NumericUpDown(); this.nudRegionCaptureMagnifierPixelSize = new System.Windows.Forms.NumericUpDown();
this.tpScreenRecorder = new System.Windows.Forms.TabPage(); this.tpScreenRecorder = new System.Windows.Forms.TabPage();
this.chkConfirmAbort = new System.Windows.Forms.CheckBox(); this.cbScreenRecorderConfirmAbort = new System.Windows.Forms.CheckBox();
this.cbScreenRecorderShowCursor = new System.Windows.Forms.CheckBox(); this.cbScreenRecorderShowCursor = new System.Windows.Forms.CheckBox();
this.btnScreenRecorderFFmpegOptions = new System.Windows.Forms.Button(); this.btnScreenRecorderFFmpegOptions = new System.Windows.Forms.Button();
this.lblScreenRecorderStartDelay = new System.Windows.Forms.Label(); this.lblScreenRecorderStartDelay = new System.Windows.Forms.Label();
@ -1407,7 +1407,7 @@ private void InitializeComponent()
// tpScreenRecorder // tpScreenRecorder
// //
this.tpScreenRecorder.BackColor = System.Drawing.SystemColors.Window; this.tpScreenRecorder.BackColor = System.Drawing.SystemColors.Window;
this.tpScreenRecorder.Controls.Add(this.chkConfirmAbort); this.tpScreenRecorder.Controls.Add(this.cbScreenRecorderConfirmAbort);
this.tpScreenRecorder.Controls.Add(this.cbScreenRecorderShowCursor); this.tpScreenRecorder.Controls.Add(this.cbScreenRecorderShowCursor);
this.tpScreenRecorder.Controls.Add(this.btnScreenRecorderFFmpegOptions); this.tpScreenRecorder.Controls.Add(this.btnScreenRecorderFFmpegOptions);
this.tpScreenRecorder.Controls.Add(this.lblScreenRecorderStartDelay); this.tpScreenRecorder.Controls.Add(this.lblScreenRecorderStartDelay);
@ -1426,12 +1426,12 @@ private void InitializeComponent()
resources.ApplyResources(this.tpScreenRecorder, "tpScreenRecorder"); resources.ApplyResources(this.tpScreenRecorder, "tpScreenRecorder");
this.tpScreenRecorder.Name = "tpScreenRecorder"; this.tpScreenRecorder.Name = "tpScreenRecorder";
// //
// chkConfirmAbort // cbScreenRecorderConfirmAbort
// //
resources.ApplyResources(this.chkConfirmAbort, "chkConfirmAbort"); resources.ApplyResources(this.cbScreenRecorderConfirmAbort, "cbScreenRecorderConfirmAbort");
this.chkConfirmAbort.Name = "chkConfirmAbort"; this.cbScreenRecorderConfirmAbort.Name = "cbScreenRecorderConfirmAbort";
this.chkConfirmAbort.UseVisualStyleBackColor = true; this.cbScreenRecorderConfirmAbort.UseVisualStyleBackColor = true;
this.chkConfirmAbort.CheckedChanged += new System.EventHandler(this.chkConfirmAbort_CheckedChanged); this.cbScreenRecorderConfirmAbort.CheckedChanged += new System.EventHandler(this.chkConfirmAbort_CheckedChanged);
// //
// cbScreenRecorderShowCursor // cbScreenRecorderShowCursor
// //
@ -2366,6 +2366,6 @@ private void InitializeComponent()
private System.Windows.Forms.ComboBox cbImagePNGBitDepth; private System.Windows.Forms.ComboBox cbImagePNGBitDepth;
private System.Windows.Forms.Label lblImagePNGBitDepth; private System.Windows.Forms.Label lblImagePNGBitDepth;
private System.Windows.Forms.Button btnWatchFolderEdit; private System.Windows.Forms.Button btnWatchFolderEdit;
private System.Windows.Forms.CheckBox chkConfirmAbort; private System.Windows.Forms.CheckBox cbScreenRecorderConfirmAbort;
} }
} }

View file

@ -289,7 +289,7 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
cbScreenRecorderFixedDuration.Checked = nudScreenRecorderDuration.Enabled = TaskSettings.CaptureSettings.ScreenRecordFixedDuration; cbScreenRecorderFixedDuration.Checked = nudScreenRecorderDuration.Enabled = TaskSettings.CaptureSettings.ScreenRecordFixedDuration;
nudScreenRecorderDuration.SetValue((decimal)TaskSettings.CaptureSettings.ScreenRecordDuration); nudScreenRecorderDuration.SetValue((decimal)TaskSettings.CaptureSettings.ScreenRecordDuration);
chkScreenRecordAutoStart.Checked = nudScreenRecorderStartDelay.Enabled = TaskSettings.CaptureSettings.ScreenRecordAutoStart; chkScreenRecordAutoStart.Checked = nudScreenRecorderStartDelay.Enabled = TaskSettings.CaptureSettings.ScreenRecordAutoStart;
chkConfirmAbort.Checked = TaskSettings.CaptureSettings.AskConfirmationOnAbort; cbScreenRecorderConfirmAbort.Checked = TaskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort;
nudScreenRecorderStartDelay.SetValue((decimal)TaskSettings.CaptureSettings.ScreenRecordStartDelay); nudScreenRecorderStartDelay.SetValue((decimal)TaskSettings.CaptureSettings.ScreenRecordStartDelay);
cbScreenRecorderShowCursor.Checked = TaskSettings.CaptureSettings.ScreenRecordShowCursor; cbScreenRecorderShowCursor.Checked = TaskSettings.CaptureSettings.ScreenRecordShowCursor;
chkRunScreencastCLI.Checked = cboEncoder.Enabled = btnEncoderConfig.Enabled = TaskSettings.CaptureSettings.RunScreencastCLI; chkRunScreencastCLI.Checked = cboEncoder.Enabled = btnEncoderConfig.Enabled = TaskSettings.CaptureSettings.RunScreencastCLI;
@ -1103,7 +1103,7 @@ private void cbScreenRecorderShowCursor_CheckedChanged(object sender, EventArgs
private void chkConfirmAbort_CheckedChanged(object sender, EventArgs e) private void chkConfirmAbort_CheckedChanged(object sender, EventArgs e)
{ {
TaskSettings.CaptureSettings.AskConfirmationOnAbort = chkConfirmAbort.Checked; TaskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort = cbScreenRecorderConfirmAbort.Checked;
} }
private void chkRunScreencastCLI_CheckedChanged(object sender, EventArgs e) private void chkRunScreencastCLI_CheckedChanged(object sender, EventArgs e)

View file

@ -3363,34 +3363,34 @@
<data name="&gt;&gt;tpRegionCapture.ZOrder" xml:space="preserve"> <data name="&gt;&gt;tpRegionCapture.ZOrder" xml:space="preserve">
<value>1</value> <value>1</value>
</data> </data>
<data name="chkConfirmAbort.AutoSize" type="System.Boolean, mscorlib"> <data name="cbScreenRecorderConfirmAbort.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="chkConfirmAbort.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <data name="cbScreenRecorderConfirmAbort.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="chkConfirmAbort.Location" type="System.Drawing.Point, System.Drawing"> <data name="cbScreenRecorderConfirmAbort.Location" type="System.Drawing.Point, System.Drawing">
<value>8, 183</value> <value>8, 183</value>
</data> </data>
<data name="chkConfirmAbort.Size" type="System.Drawing.Size, System.Drawing"> <data name="cbScreenRecorderConfirmAbort.Size" type="System.Drawing.Size, System.Drawing">
<value>189, 17</value> <value>189, 17</value>
</data> </data>
<data name="chkConfirmAbort.TabIndex" type="System.Int32, mscorlib"> <data name="cbScreenRecorderConfirmAbort.TabIndex" type="System.Int32, mscorlib">
<value>17</value> <value>17</value>
</data> </data>
<data name="chkConfirmAbort.Text" xml:space="preserve"> <data name="cbScreenRecorderConfirmAbort.Text" xml:space="preserve">
<value>Ask for confirmation when aborting</value> <value>Ask for confirmation when aborting</value>
</data> </data>
<data name="&gt;&gt;chkConfirmAbort.Name" xml:space="preserve"> <data name="&gt;&gt;cbScreenRecorderConfirmAbort.Name" xml:space="preserve">
<value>chkConfirmAbort</value> <value>cbScreenRecorderConfirmAbort</value>
</data> </data>
<data name="&gt;&gt;chkConfirmAbort.Type" xml:space="preserve"> <data name="&gt;&gt;cbScreenRecorderConfirmAbort.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;chkConfirmAbort.Parent" xml:space="preserve"> <data name="&gt;&gt;cbScreenRecorderConfirmAbort.Parent" xml:space="preserve">
<value>tpScreenRecorder</value> <value>tpScreenRecorder</value>
</data> </data>
<data name="&gt;&gt;chkConfirmAbort.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cbScreenRecorderConfirmAbort.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<data name="cbScreenRecorderShowCursor.AutoSize" type="System.Boolean, mscorlib"> <data name="cbScreenRecorderShowCursor.AutoSize" type="System.Boolean, mscorlib">

View file

@ -172,7 +172,7 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t
float duration = taskSettings.CaptureSettings.ScreenRecordFixedDuration ? taskSettings.CaptureSettings.ScreenRecordDuration : 0; float duration = taskSettings.CaptureSettings.ScreenRecordFixedDuration ? taskSettings.CaptureSettings.ScreenRecordDuration : 0;
recordForm = new ScreenRecordForm(captureRectangle, startMethod == ScreenRecordStartMethod.Region, duration); recordForm = new ScreenRecordForm(captureRectangle, taskSettings, startMethod == ScreenRecordStartMethod.Region, duration);
recordForm.StopRequested += StopRecording; recordForm.StopRequested += StopRecording;
recordForm.Show(); recordForm.Show();

View file

@ -344,7 +344,7 @@ public class TaskSettingsCapture
public int GIFFPS = 15; public int GIFFPS = 15;
public bool ScreenRecordShowCursor = true; public bool ScreenRecordShowCursor = true;
public bool ScreenRecordAutoStart = true; public bool ScreenRecordAutoStart = true;
public bool AskConfirmationOnAbort = true; public bool ScreenRecordAskConfirmationOnAbort = false;
public float ScreenRecordStartDelay = 0f; public float ScreenRecordStartDelay = 0f;
public bool ScreenRecordFixedDuration = false; public bool ScreenRecordFixedDuration = false;
public float ScreenRecordDuration = 3f; public float ScreenRecordDuration = 3f;