Task settings window auto fill description when changing tasks

This commit is contained in:
Jaex 2014-09-13 09:10:36 +03:00
parent 5cbae85c05
commit c290c546d8
4 changed files with 133 additions and 134 deletions

View file

@ -39,15 +39,18 @@ private void InitializeComponent()
this.cmsTask = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tcHotkeySettings = new System.Windows.Forms.TabControl();
this.tpTask = new System.Windows.Forms.TabPage();
this.btnDescriptionAutoFill = new System.Windows.Forms.Button();
this.chkOverrideFTP = new System.Windows.Forms.CheckBox();
this.cboFTPaccounts = new System.Windows.Forms.ComboBox();
this.btnAfterCapture = new HelpersLib.MenuButton();
this.btnAfterUpload = new HelpersLib.MenuButton();
this.btnDestinations = new HelpersLib.MenuButton();
this.cmsDestinations = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiImageUploaders = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiTextUploaders = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiFileUploaders = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiURLShorteners = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiURLSharingServices = new System.Windows.Forms.ToolStripMenuItem();
this.btnTask = new HelpersLib.MenuButton();
this.tpGeneral = new System.Windows.Forms.TabPage();
this.panelGeneral = new System.Windows.Forms.Panel();
this.chkShowBeforeUploadForm = new System.Windows.Forms.CheckBox();
@ -128,7 +131,13 @@ private void InitializeComponent()
this.chkUseDefaultCaptureSettings = new System.Windows.Forms.CheckBox();
this.tpActions = new System.Windows.Forms.TabPage();
this.pActions = new System.Windows.Forms.Panel();
this.btnActionsDuplicate = new System.Windows.Forms.Button();
this.btnActionsAdd = new System.Windows.Forms.Button();
this.lvActions = new HelpersLib.MyListView();
this.chActionsName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chActionsPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chActionsArgs = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chActionsExtensions = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnActionsEdit = new System.Windows.Forms.Button();
this.btnActionsRemove = new System.Windows.Forms.Button();
this.chkUseDefaultActions = new System.Windows.Forms.CheckBox();
@ -163,16 +172,6 @@ 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.btnAfterCapture = new HelpersLib.MenuButton();
this.btnAfterUpload = new HelpersLib.MenuButton();
this.btnDestinations = new HelpersLib.MenuButton();
this.btnTask = new HelpersLib.MenuButton();
this.lvActions = new HelpersLib.MyListView();
this.chActionsName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chActionsPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chActionsArgs = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chActionsExtensions = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnActionsDuplicate = new System.Windows.Forms.Button();
this.tcHotkeySettings.SuspendLayout();
this.tpTask.SuspendLayout();
this.cmsDestinations.SuspendLayout();
@ -267,7 +266,7 @@ private void InitializeComponent()
//
this.tbDescription.Location = new System.Drawing.Point(78, 9);
this.tbDescription.Name = "tbDescription";
this.tbDescription.Size = new System.Drawing.Size(362, 20);
this.tbDescription.Size = new System.Drawing.Size(434, 20);
this.tbDescription.TabIndex = 1;
this.tbDescription.TextChanged += new System.EventHandler(this.tbDescription_TextChanged);
//
@ -296,7 +295,6 @@ private void InitializeComponent()
//
// tpTask
//
this.tpTask.Controls.Add(this.btnDescriptionAutoFill);
this.tpTask.Controls.Add(this.chkOverrideFTP);
this.tpTask.Controls.Add(this.cboFTPaccounts);
this.tpTask.Controls.Add(this.tbDescription);
@ -316,16 +314,6 @@ private void InitializeComponent()
this.tpTask.Text = "Task";
this.tpTask.UseVisualStyleBackColor = true;
//
// btnDescriptionAutoFill
//
this.btnDescriptionAutoFill.Location = new System.Drawing.Point(448, 7);
this.btnDescriptionAutoFill.Name = "btnDescriptionAutoFill";
this.btnDescriptionAutoFill.Size = new System.Drawing.Size(64, 24);
this.btnDescriptionAutoFill.TabIndex = 2;
this.btnDescriptionAutoFill.Text = "Auto fill";
this.btnDescriptionAutoFill.UseVisualStyleBackColor = true;
this.btnDescriptionAutoFill.Click += new System.EventHandler(this.btnDescriptionAutoFill_Click);
//
// chkOverrideFTP
//
this.chkOverrideFTP.AutoSize = true;
@ -348,6 +336,42 @@ private void InitializeComponent()
this.cboFTPaccounts.TabIndex = 11;
this.cboFTPaccounts.SelectedIndexChanged += new System.EventHandler(this.cboFTPaccounts_SelectedIndexChanged);
//
// btnAfterCapture
//
this.btnAfterCapture.Location = new System.Drawing.Point(6, 93);
this.btnAfterCapture.Menu = this.cmsAfterCapture;
this.btnAfterCapture.Name = "btnAfterCapture";
this.btnAfterCapture.Size = new System.Drawing.Size(506, 23);
this.btnAfterCapture.TabIndex = 5;
this.btnAfterCapture.Text = "After capture...";
this.btnAfterCapture.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAfterCapture.UseMnemonic = false;
this.btnAfterCapture.UseVisualStyleBackColor = true;
//
// btnAfterUpload
//
this.btnAfterUpload.Location = new System.Drawing.Point(6, 149);
this.btnAfterUpload.Menu = this.cmsAfterUpload;
this.btnAfterUpload.Name = "btnAfterUpload";
this.btnAfterUpload.Size = new System.Drawing.Size(506, 23);
this.btnAfterUpload.TabIndex = 7;
this.btnAfterUpload.Text = "After upload...";
this.btnAfterUpload.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAfterUpload.UseMnemonic = false;
this.btnAfterUpload.UseVisualStyleBackColor = true;
//
// btnDestinations
//
this.btnDestinations.Location = new System.Drawing.Point(6, 205);
this.btnDestinations.Menu = this.cmsDestinations;
this.btnDestinations.Name = "btnDestinations";
this.btnDestinations.Size = new System.Drawing.Size(506, 23);
this.btnDestinations.TabIndex = 9;
this.btnDestinations.Text = "Destinations...";
this.btnDestinations.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDestinations.UseMnemonic = false;
this.btnDestinations.UseVisualStyleBackColor = true;
//
// cmsDestinations
//
this.cmsDestinations.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -394,6 +418,18 @@ private void InitializeComponent()
this.tsmiURLSharingServices.Size = new System.Drawing.Size(181, 22);
this.tsmiURLSharingServices.Text = "URL sharing services";
//
// btnTask
//
this.btnTask.Location = new System.Drawing.Point(6, 37);
this.btnTask.Menu = this.cmsTask;
this.btnTask.Name = "btnTask";
this.btnTask.Size = new System.Drawing.Size(506, 23);
this.btnTask.TabIndex = 3;
this.btnTask.Text = "Task...";
this.btnTask.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnTask.UseMnemonic = false;
this.btnTask.UseVisualStyleBackColor = true;
//
// tpGeneral
//
this.tpGeneral.Controls.Add(this.panelGeneral);
@ -1403,6 +1439,16 @@ private void InitializeComponent()
this.pActions.Size = new System.Drawing.Size(517, 327);
this.pActions.TabIndex = 1;
//
// btnActionsDuplicate
//
this.btnActionsDuplicate.Location = new System.Drawing.Point(168, 8);
this.btnActionsDuplicate.Name = "btnActionsDuplicate";
this.btnActionsDuplicate.Size = new System.Drawing.Size(75, 23);
this.btnActionsDuplicate.TabIndex = 2;
this.btnActionsDuplicate.Text = "Duplicate";
this.btnActionsDuplicate.UseVisualStyleBackColor = true;
this.btnActionsDuplicate.Click += new System.EventHandler(this.btnActionsDuplicate_Click);
//
// btnActionsAdd
//
this.btnActionsAdd.Location = new System.Drawing.Point(8, 8);
@ -1413,6 +1459,48 @@ private void InitializeComponent()
this.btnActionsAdd.UseVisualStyleBackColor = true;
this.btnActionsAdd.Click += new System.EventHandler(this.btnActionsAdd_Click);
//
// lvActions
//
this.lvActions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvActions.AutoFillColumn = true;
this.lvActions.CheckBoxes = true;
this.lvActions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chActionsName,
this.chActionsPath,
this.chActionsArgs,
this.chActionsExtensions});
this.lvActions.FullRowSelect = true;
this.lvActions.Location = new System.Drawing.Point(8, 40);
this.lvActions.MultiSelect = false;
this.lvActions.Name = "lvActions";
this.lvActions.Size = new System.Drawing.Size(504, 280);
this.lvActions.TabIndex = 4;
this.lvActions.UseCompatibleStateImageBehavior = false;
this.lvActions.View = System.Windows.Forms.View.Details;
this.lvActions.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvActions_ItemChecked);
//
// chActionsName
//
this.chActionsName.Text = "Name";
this.chActionsName.Width = 90;
//
// chActionsPath
//
this.chActionsPath.Text = "Path";
this.chActionsPath.Width = 220;
//
// chActionsArgs
//
this.chActionsArgs.Text = "Args";
this.chActionsArgs.Width = 114;
//
// chActionsExtensions
//
this.chActionsExtensions.Text = "Extensions";
this.chActionsExtensions.Width = 75;
//
// btnActionsEdit
//
this.btnActionsEdit.Location = new System.Drawing.Point(88, 8);
@ -1784,106 +1872,6 @@ private void InitializeComponent()
this.chkUseDefaultAdvancedSettings.UseVisualStyleBackColor = true;
this.chkUseDefaultAdvancedSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultAdvancedSettings_CheckedChanged);
//
// btnAfterCapture
//
this.btnAfterCapture.Location = new System.Drawing.Point(6, 93);
this.btnAfterCapture.Menu = this.cmsAfterCapture;
this.btnAfterCapture.Name = "btnAfterCapture";
this.btnAfterCapture.Size = new System.Drawing.Size(506, 23);
this.btnAfterCapture.TabIndex = 5;
this.btnAfterCapture.Text = "After capture...";
this.btnAfterCapture.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAfterCapture.UseMnemonic = false;
this.btnAfterCapture.UseVisualStyleBackColor = true;
//
// btnAfterUpload
//
this.btnAfterUpload.Location = new System.Drawing.Point(6, 149);
this.btnAfterUpload.Menu = this.cmsAfterUpload;
this.btnAfterUpload.Name = "btnAfterUpload";
this.btnAfterUpload.Size = new System.Drawing.Size(506, 23);
this.btnAfterUpload.TabIndex = 7;
this.btnAfterUpload.Text = "After upload...";
this.btnAfterUpload.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAfterUpload.UseMnemonic = false;
this.btnAfterUpload.UseVisualStyleBackColor = true;
//
// btnDestinations
//
this.btnDestinations.Location = new System.Drawing.Point(6, 205);
this.btnDestinations.Menu = this.cmsDestinations;
this.btnDestinations.Name = "btnDestinations";
this.btnDestinations.Size = new System.Drawing.Size(506, 23);
this.btnDestinations.TabIndex = 9;
this.btnDestinations.Text = "Destinations...";
this.btnDestinations.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDestinations.UseMnemonic = false;
this.btnDestinations.UseVisualStyleBackColor = true;
//
// btnTask
//
this.btnTask.Location = new System.Drawing.Point(6, 37);
this.btnTask.Menu = this.cmsTask;
this.btnTask.Name = "btnTask";
this.btnTask.Size = new System.Drawing.Size(506, 23);
this.btnTask.TabIndex = 3;
this.btnTask.Text = "Task...";
this.btnTask.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnTask.UseMnemonic = false;
this.btnTask.UseVisualStyleBackColor = true;
//
// lvActions
//
this.lvActions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvActions.AutoFillColumn = true;
this.lvActions.CheckBoxes = true;
this.lvActions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chActionsName,
this.chActionsPath,
this.chActionsArgs,
this.chActionsExtensions});
this.lvActions.FullRowSelect = true;
this.lvActions.Location = new System.Drawing.Point(8, 40);
this.lvActions.MultiSelect = false;
this.lvActions.Name = "lvActions";
this.lvActions.Size = new System.Drawing.Size(504, 280);
this.lvActions.TabIndex = 4;
this.lvActions.UseCompatibleStateImageBehavior = false;
this.lvActions.View = System.Windows.Forms.View.Details;
this.lvActions.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvActions_ItemChecked);
//
// chActionsName
//
this.chActionsName.Text = "Name";
this.chActionsName.Width = 90;
//
// chActionsPath
//
this.chActionsPath.Text = "Path";
this.chActionsPath.Width = 220;
//
// chActionsArgs
//
this.chActionsArgs.Text = "Args";
this.chActionsArgs.Width = 114;
//
// chActionsExtensions
//
this.chActionsExtensions.Text = "Extensions";
this.chActionsExtensions.Width = 75;
//
// btnActionsDuplicate
//
this.btnActionsDuplicate.Location = new System.Drawing.Point(168, 8);
this.btnActionsDuplicate.Name = "btnActionsDuplicate";
this.btnActionsDuplicate.Size = new System.Drawing.Size(75, 23);
this.btnActionsDuplicate.TabIndex = 2;
this.btnActionsDuplicate.Text = "Duplicate";
this.btnActionsDuplicate.UseVisualStyleBackColor = true;
this.btnActionsDuplicate.Click += new System.EventHandler(this.btnActionsDuplicate_Click);
//
// TaskSettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -2094,7 +2082,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblScreenRecordFPS;
private System.Windows.Forms.CheckBox chkShowBeforeUploadForm;
private System.Windows.Forms.Label lblScreenRecorderFixedDuration;
private System.Windows.Forms.Button btnDescriptionAutoFill;
private System.Windows.Forms.CheckBox cbScreenRecordAutoDisableAero;
private System.Windows.Forms.CheckBox cbClipboardUploadShareURL;
private System.Windows.Forms.TabPage tpRectangleAnnotate;

View file

@ -54,7 +54,6 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
if (IsDefault)
{
Text = Application.ProductName + " - Task settings";
tcHotkeySettings.TabPages.Remove(tpTask);
chkUseDefaultGeneralSettings.Visible = chkUseDefaultImageSettings.Visible = chkUseDefaultCaptureSettings.Visible = chkUseDefaultActions.Visible =
chkUseDefaultUploadSettings.Visible = chkUseDefaultIndexerSettings.Visible = chkUseDefaultAdvancedSettings.Visible = false;
@ -62,7 +61,6 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
}
else
{
Text = Application.ProductName + " - Task settings for " + TaskSettings;
tbDescription.Text = TaskSettings.Description;
cbUseDefaultAfterCaptureSettings.Checked = TaskSettings.UseDefaultAfterCaptureJob;
cbUseDefaultAfterUploadSettings.Checked = TaskSettings.UseDefaultAfterUploadJob;
@ -76,7 +74,13 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
chkUseDefaultAdvancedSettings.Checked = TaskSettings.UseDefaultAdvancedSettings;
}
AddEnumItemsContextMenu<HotkeyType>(x => TaskSettings.Job = x, cmsTask);
UpdateWindowTitle();
AddEnumItemsContextMenu<HotkeyType>(x =>
{
TaskSettings.Job = x;
tbDescription.Text = TaskSettings.Job.GetDescription();
}, cmsTask);
AddMultiEnumItemsContextMenu<AfterCaptureTasks>(x => TaskSettings.AfterCaptureJob = TaskSettings.AfterCaptureJob.Swap(x), cmsAfterCapture);
AddMultiEnumItemsContextMenu<AfterUploadTasks>(x => TaskSettings.AfterUploadJob = TaskSettings.AfterUploadJob.Swap(x), cmsAfterUpload);
AddEnumItems<ImageDestination>(x => TaskSettings.ImageDestination = x, tsmiImageUploaders);
@ -219,6 +223,18 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
loaded = true;
}
private void UpdateWindowTitle()
{
if (IsDefault)
{
Text = Application.ProductName + " - Task settings";
}
else
{
Text = Application.ProductName + " - Task settings for " + TaskSettings;
}
}
private void UpdateVideoEncoders()
{
cboEncoder.Items.Clear();
@ -436,11 +452,7 @@ private void UpdateUploaderMenuNames()
private void tbDescription_TextChanged(object sender, EventArgs e)
{
TaskSettings.Description = tbDescription.Text;
}
private void btnDescriptionAutoFill_Click(object sender, EventArgs e)
{
tbDescription.Text = TaskSettings.Job.GetDescription();
UpdateWindowTitle();
}
private void cbUseDefaultAfterCaptureSettings_CheckedChanged(object sender, EventArgs e)

View file

@ -146,7 +146,7 @@ public static TaskSettings GetSafeTaskSettings(TaskSettings taskSettings)
{
TaskSettings safeTaskSettings;
if (taskSettings.IsUsingDefaultSettings)
if (taskSettings.IsUsingDefaultSettings && Program.DefaultTaskSettings != null)
{
safeTaskSettings = Program.DefaultTaskSettings.Copy();
safeTaskSettings.Description = taskSettings.Description;

View file

@ -59,7 +59,7 @@ public enum TextDestination
Paste2,
[Description("Slexy")]
Slexy,
[Description("Pastee")]
[Description("Pastee.org")]
Pastee,
[Description("Paste.ee")]
Paste_ee,