fixed #7305: Improve icon detection in quick task menu

This commit is contained in:
Jaex 2024-04-03 07:58:35 +03:00
parent 8b96a53262
commit 5e317dc5b2
3 changed files with 11 additions and 12 deletions

View file

@ -114,6 +114,7 @@ private void InitializeComponent()
this.Controls.Add(this.btnAdd); this.Controls.Add(this.btnAdd);
this.Controls.Add(this.lvPresets); this.Controls.Add(this.lvPresets);
this.Name = "QuickTaskMenuEditorForm"; this.Name = "QuickTaskMenuEditorForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View file

@ -142,7 +142,7 @@
<value>lvPresets</value> <value>lvPresets</value>
</data> </data>
<data name="&gt;&gt;lvPresets.Type" xml:space="preserve"> <data name="&gt;&gt;lvPresets.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=15.0.1.0, Culture=neutral, PublicKeyToken=null</value> <value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.0.3.0, Culture=neutral, PublicKeyToken=null</value>
</data> </data>
<data name="&gt;&gt;lvPresets.Parent" xml:space="preserve"> <data name="&gt;&gt;lvPresets.Parent" xml:space="preserve">
<value>$this</value> <value>$this</value>

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib; using ShareX.HelpersLib;
using ShareX.Properties; using ShareX.Properties;
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
namespace ShareX namespace ShareX
@ -123,20 +125,16 @@ protected void OnTaskInfoSelected(QuickTaskInfo taskInfo)
public Image FindSuitableIcon(QuickTaskInfo taskInfo) public Image FindSuitableIcon(QuickTaskInfo taskInfo)
{ {
if (taskInfo.AfterCaptureTasks.HasFlag(AfterCaptureTasks.UploadImageToHost)) IEnumerable<AfterCaptureTasks> afterCaptureTasks = taskInfo.AfterCaptureTasks.GetFlags();
if (afterCaptureTasks.Count() > 0)
{ {
return Resources.upload_cloud; AfterCaptureTasks last = afterCaptureTasks.Last();
}
else if (taskInfo.AfterCaptureTasks.HasFlag(AfterCaptureTasks.CopyImageToClipboard) || taskInfo.AfterCaptureTasks.HasFlag(AfterCaptureTasks.CopyFileToClipboard)) return TaskHelpers.FindMenuIcon(last);
{
return Resources.clipboard;
}
else if (taskInfo.AfterCaptureTasks.HasFlag(AfterCaptureTasks.SaveImageToFile) || taskInfo.AfterCaptureTasks.HasFlag(AfterCaptureTasks.SaveImageToFileWithDialog))
{
return Resources.disk_black;
} }
return Resources.image; return null;
} }
} }
} }