Workflow menu to show customized task settings

This commit is contained in:
McoreD 2014-05-18 10:21:00 +08:00
parent 8f75499b83
commit d5dc7470b3
11 changed files with 80 additions and 30 deletions

View file

@ -88,7 +88,7 @@ private void InitializeComponent()
this.tsbWindowRectangle.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbWindowRectangle.Name = "tsbWindowRectangle";
this.tsbWindowRectangle.Size = new System.Drawing.Size(139, 20);
this.tsbWindowRectangle.Text = "Window && Rectangle";
this.tsbWindowRectangle.Text = "Window and Rectangle";
this.tsbWindowRectangle.Click += new System.EventHandler(this.tsbWindowRectangle_Click);
//
// tsbRectangle

View file

@ -132,7 +132,7 @@ public enum HotkeyType
ClipboardUploadWithContentViewer,
[Description("File upload")]
FileUpload,
[Description("Drag & drop upload")]
[Description("Drag and drop upload")]
DragDropUpload,
[Description("Capture entire screen")]
PrintScreen,

View file

@ -49,6 +49,7 @@ private void InitializeComponent()
this.tsmiLastRegion = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiScreenRecorder = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiAutoCapture = new System.Windows.Forms.ToolStripMenuItem();
this.tsddbWorkflows = new System.Windows.Forms.ToolStripDropDownButton();
this.tsddbAfterCaptureTasks = new System.Windows.Forms.ToolStripDropDownButton();
this.tsddbAfterUploadTasks = new System.Windows.Forms.ToolStripDropDownButton();
this.tsddbDestinations = new System.Windows.Forms.ToolStripDropDownButton();
@ -218,6 +219,7 @@ private void InitializeComponent()
this.tsbFileUpload,
this.tsbDragDropUpload,
this.tsddbCapture,
this.tsddbWorkflows,
this.tsddbAfterCaptureTasks,
this.tsddbAfterUploadTasks,
this.tsddbDestinations,
@ -239,7 +241,7 @@ private void InitializeComponent()
this.tsMain.Name = "tsMain";
this.tsMain.Padding = new System.Windows.Forms.Padding(6);
this.tsMain.ShowItemToolTips = false;
this.tsMain.Size = new System.Drawing.Size(160, 452);
this.tsMain.Size = new System.Drawing.Size(160, 474);
this.tsMain.TabIndex = 0;
//
// tsbClipboardUpload
@ -269,7 +271,7 @@ private void InitializeComponent()
this.tsbDragDropUpload.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbDragDropUpload.Name = "tsbDragDropUpload";
this.tsbDragDropUpload.Size = new System.Drawing.Size(147, 20);
this.tsbDragDropUpload.Text = "Drag && drop upload...";
this.tsbDragDropUpload.Text = "Drag and drop upload...";
this.tsbDragDropUpload.Click += new System.EventHandler(this.tsbDragDropUpload_Click);
//
// tsddbCapture
@ -407,6 +409,15 @@ private void InitializeComponent()
this.tsmiAutoCapture.Text = "Auto capture...";
this.tsmiAutoCapture.Click += new System.EventHandler(this.tsmiAutoCapture_Click);
//
// tsddbWorkflows
//
this.tsddbWorkflows.Image = global::ShareX.Properties.Resources.application_wave;
this.tsddbWorkflows.ImageAlign = System.Drawing.ContentAlignment.BottomLeft;
this.tsddbWorkflows.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsddbWorkflows.Name = "tsddbWorkflows";
this.tsddbWorkflows.Size = new System.Drawing.Size(147, 20);
this.tsddbWorkflows.Text = "Workflows";
//
// tsddbAfterCaptureTasks
//
this.tsddbAfterCaptureTasks.Image = global::ShareX.Properties.Resources.image_export;
@ -758,7 +769,7 @@ private void InitializeComponent()
// scMain.Panel2
//
this.scMain.Panel2.Controls.Add(this.pbPreview);
this.scMain.Size = new System.Drawing.Size(784, 452);
this.scMain.Size = new System.Drawing.Size(784, 474);
this.scMain.SplitterDistance = 400;
this.scMain.SplitterWidth = 6;
this.scMain.TabIndex = 1;
@ -775,7 +786,7 @@ private void InitializeComponent()
this.lblDragAndDropTip.Location = new System.Drawing.Point(8, 92);
this.lblDragAndDropTip.Name = "lblDragAndDropTip";
this.lblDragAndDropTip.Padding = new System.Windows.Forms.Padding(30, 20, 30, 30);
this.lblDragAndDropTip.Size = new System.Drawing.Size(384, 268);
this.lblDragAndDropTip.Size = new System.Drawing.Size(384, 290);
this.lblDragAndDropTip.TabIndex = 2;
this.lblDragAndDropTip.Text = "You can drag and drop files to this window";
this.lblDragAndDropTip.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -787,7 +798,7 @@ private void InitializeComponent()
this.lblSplitter.Dock = System.Windows.Forms.DockStyle.Left;
this.lblSplitter.Location = new System.Drawing.Point(0, 0);
this.lblSplitter.Name = "lblSplitter";
this.lblSplitter.Size = new System.Drawing.Size(1, 452);
this.lblSplitter.Size = new System.Drawing.Size(1, 474);
this.lblSplitter.TabIndex = 0;
//
// lvUploads
@ -812,7 +823,7 @@ private void InitializeComponent()
this.lvUploads.Location = new System.Drawing.Point(0, 0);
this.lvUploads.Name = "lvUploads";
this.lvUploads.ShowItemToolTips = true;
this.lvUploads.Size = new System.Drawing.Size(400, 452);
this.lvUploads.Size = new System.Drawing.Size(400, 474);
this.lvUploads.TabIndex = 1;
this.lvUploads.UseCompatibleStateImageBehavior = false;
this.lvUploads.View = System.Windows.Forms.View.Details;
@ -874,7 +885,7 @@ private void InitializeComponent()
this.pbPreview.FullscreenOnClick = true;
this.pbPreview.Location = new System.Drawing.Point(0, 0);
this.pbPreview.Name = "pbPreview";
this.pbPreview.Size = new System.Drawing.Size(378, 452);
this.pbPreview.Size = new System.Drawing.Size(378, 474);
this.pbPreview.TabIndex = 0;
//
// cmsUploadInfo
@ -1286,7 +1297,7 @@ private void InitializeComponent()
this.tsmiTrayDragDropUpload.Image = global::ShareX.Properties.Resources.inbox_plus;
this.tsmiTrayDragDropUpload.Name = "tsmiTrayDragDropUpload";
this.tsmiTrayDragDropUpload.Size = new System.Drawing.Size(189, 22);
this.tsmiTrayDragDropUpload.Text = "Drag && drop upload...";
this.tsmiTrayDragDropUpload.Text = "Drag and drop upload...";
this.tsmiTrayDragDropUpload.Click += new System.EventHandler(this.tsbDragDropUpload_Click);
//
// tsmiTrayCapture
@ -1688,7 +1699,7 @@ private void InitializeComponent()
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(944, 452);
this.ClientSize = new System.Drawing.Size(944, 474);
this.Controls.Add(this.scMain);
this.Controls.Add(this.tsMain);
this.DoubleBuffered = true;
@ -1884,5 +1895,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem tsmiTrayFTPClient;
private System.Windows.Forms.ToolStripMenuItem tsmiImageEditor;
private System.Windows.Forms.ToolStripMenuItem tsmiTrayImageEditor;
private System.Windows.Forms.ToolStripDropDownButton tsddbWorkflows;
}
}

View file

@ -110,6 +110,17 @@ private void InitControls()
uim = new UploadInfoManager(lvUploads);
}
private void UpdateWorkflowsMenu()
{
tsddbWorkflows.DropDownItems.Clear();
Program.HotkeyManager.Hotkeys.ForEach<HotkeySettings>(x =>
{
ToolStripMenuItem tsmi = new ToolStripMenuItem(x.TaskSettings.Description);
tsmi.Click += (sender, e) => HandleHotkeys(x);
tsddbWorkflows.DropDownItems.Add(tsmi);
});
}
private void UpdateDestinationStates()
{
if (Program.UploadersConfig != null)
@ -706,6 +717,7 @@ private void tsbHotkeySettings_Click(object sender, EventArgs e)
hotkeySettingsForm.ShowDialog();
}
UpdateWorkflowsMenu();
Program.HotkeysConfig.SaveAsync(Program.HotkeysConfigFilePath);
}

View file

@ -56,6 +56,8 @@ private void InitHotkeys()
Program.HotkeyManager.HotkeyTrigger += HandleHotkeys;
DebugHelper.WriteLine("HotkeyManager started");
UpdateWorkflowsMenu();
Program.WatchFolderManager = new WatchFolderManager();
DebugHelper.WriteLine("WatchFolderManager started");
}));

View file

@ -50,8 +50,7 @@ public override string ToString()
{
if (HotkeyInfo != null && TaskSettings != null)
{
return string.Format("Hotkey: {0}{1}, Job: {2}", HotkeyInfo,
!string.IsNullOrEmpty(TaskSettings.Description) ? ", Description: " + TaskSettings.Description : "", TaskSettings.Job);
return string.Format("Hotkey: {0}{1}, Job: {2}", HotkeyInfo, ", Description: " + TaskSettings.Description, TaskSettings.Job);
}
return string.Empty;

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -160,6 +160,16 @@ public class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap application_wave {
get {
object obj = ResourceManager.GetObject("application-wave", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -172,9 +172,6 @@
<data name="folder_open_image" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\folder-open-image.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="navigation_090_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\navigation-090-button.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="layers_ungroup" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\layers-ungroup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -199,6 +196,9 @@
<data name="image_export" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\image-export.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="au" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\au.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="keyboard_pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\keyboard--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -208,6 +208,9 @@
<data name="hammer" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\hammer.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Window" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Window.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Polygon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Polygon.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -232,6 +235,9 @@
<data name="application_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\application-blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Greenshot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Greenshot.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Triangle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Triangle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -241,9 +247,6 @@
<data name="address_book_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\address-book-blue.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="block" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\block.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -271,6 +274,9 @@
<data name="ruler_triangle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ruler-triangle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="navigation_090_button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\navigation-090-button.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="upload_cloud" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\upload-cloud.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -313,9 +319,6 @@
<data name="folder_tree" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\folder-tree.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="clock_plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\clock--plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="globe_share" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\globe-share.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -328,11 +331,11 @@
<data name="pipette" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pipette.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Window" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Window.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="au" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\au.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="clock_plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\clock--plus.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="checkbox_uncheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\checkbox_uncheck.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -356,7 +359,7 @@
<value>..\Resources\application-task.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Greenshot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Greenshot.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="application-wave" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\application-wave.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

View file

@ -497,6 +497,7 @@
<Link>7z.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\application-wave.png" />
<Content Include="ShareX_Icon.ico" />
<None Include="Resources\ru.png" />
<None Include="Resources\keyboard--pencil.png" />

View file

@ -39,7 +39,18 @@ namespace ShareX
{
public class TaskSettings
{
public string Description = string.Empty;
private string description = string.Empty;
public string Description
{
get
{
return !string.IsNullOrEmpty(description) ? description : Job.GetDescription();
}
set
{
description = value;
}
}
public HotkeyType Job = HotkeyType.None;
public bool UseDefaultAfterCaptureJob = true;