mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-10-15 07:31:39 +00:00
Order plugins by priority and ensure uniqueness
Changed plugin priority in MediaInfoViewer to int.MinValue. Updated ViewerWindow.Actions to display more menu items from plugins in order of priority and to avoid duplicate plugins by grouping by plugin name.
This commit is contained in:
@@ -32,7 +32,7 @@ public partial class Plugin : IViewer, IMoreMenuExtended
|
||||
{
|
||||
private TextViewerPanel _tvp;
|
||||
|
||||
public int Priority => 0;
|
||||
public int Priority => int.MinValue;
|
||||
|
||||
public IEnumerable<IMenuItem> MenuItems => GetMenuItems();
|
||||
|
||||
|
@@ -203,9 +203,12 @@ public partial class ViewerWindow
|
||||
|
||||
// Initial the more menu
|
||||
ClearMoreMenuUnpin();
|
||||
foreach (var plugin in PluginManager.GetInstance().LoadedPlugins)
|
||||
foreach (var plugin in
|
||||
PluginManager.GetInstance().LoadedPlugins
|
||||
.GroupBy(x => x.ToString()).Select(g => g.First()) // DistinctBy plugin name
|
||||
.OrderBy(p => p.Priority)) // OrderBy plugin priority
|
||||
{
|
||||
if (plugin == Plugin)
|
||||
if (plugin.ToString() == Plugin.ToString())
|
||||
{
|
||||
if (Plugin is IMoreMenu moreMenu && moreMenu.MenuItems is not null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user