mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 04:13:40 +01:00
pi: add "hidden" tab if there are any hidden plugins
This commit is contained in:
parent
3584f2cf3d
commit
21063217a5
3 changed files with 62 additions and 13 deletions
|
|
@ -118,7 +118,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
private List<LocalPlugin> pluginListInstalled = new();
|
||||
private List<AvailablePluginUpdate> pluginListUpdatable = new();
|
||||
private bool hasDevPlugins = false;
|
||||
|
||||
private bool hasHiddenPlugins = false;
|
||||
|
||||
private string searchText = string.Empty;
|
||||
private bool isSearchTextPrefilled = false;
|
||||
|
||||
|
|
@ -1277,6 +1278,19 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
proxies.Add(new PluginInstallerAvailablePluginProxy(null, installedPlugin));
|
||||
}
|
||||
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
bool IsProxyHidden(PluginInstallerAvailablePluginProxy proxy)
|
||||
{
|
||||
var isHidden =
|
||||
configuration.HiddenPluginInternalName.Contains(proxy.RemoteManifest?.InternalName);
|
||||
if (this.categoryManager.CurrentCategoryKind == PluginCategoryManager.CategoryKind.Hidden)
|
||||
return isHidden;
|
||||
return !isHidden;
|
||||
}
|
||||
|
||||
// Filter out plugins that are not hidden
|
||||
proxies = proxies.Where(IsProxyHidden).ToList();
|
||||
|
||||
return proxies;
|
||||
}
|
||||
#pragma warning restore SA1201
|
||||
|
|
@ -1305,6 +1319,12 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
ImGui.PopID();
|
||||
}
|
||||
|
||||
// Reset the category to "All" if we're on the "Hidden" category and there are no hidden plugins (we removed the last one)
|
||||
if (i == 0 && this.categoryManager.CurrentCategoryKind == PluginCategoryManager.CategoryKind.Hidden)
|
||||
{
|
||||
this.categoryManager.CurrentCategoryKind = PluginCategoryManager.CategoryKind.All;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawInstalledPluginList(InstalledPluginListFilter filter)
|
||||
|
|
@ -1471,6 +1491,10 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (!Service<DalamudConfiguration>.Get().DoPluginTest)
|
||||
continue;
|
||||
break;
|
||||
case PluginCategoryManager.CategoryInfo.AppearCondition.AnyHiddenPlugins:
|
||||
if (!this.hasHiddenPlugins)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
|
@ -2456,12 +2480,19 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
pluginManager.RefilterPluginMasters();
|
||||
}
|
||||
|
||||
if (ImGui.Selectable(Locs.PluginContext_HidePlugin))
|
||||
var isHidden = configuration.HiddenPluginInternalName.Contains(manifest.InternalName);
|
||||
switch (isHidden)
|
||||
{
|
||||
Log.Debug($"Adding {manifest.InternalName} to hidden plugins");
|
||||
configuration.HiddenPluginInternalName.Add(manifest.InternalName);
|
||||
configuration.QueueSave();
|
||||
pluginManager.RefilterPluginMasters();
|
||||
case false when ImGui.Selectable(Locs.PluginContext_HidePlugin):
|
||||
configuration.HiddenPluginInternalName.Add(manifest.InternalName);
|
||||
configuration.QueueSave();
|
||||
pluginManager.RefilterPluginMasters();
|
||||
break;
|
||||
case true when ImGui.Selectable(Locs.PluginContext_UnhidePlugin):
|
||||
configuration.HiddenPluginInternalName.Remove(manifest.InternalName);
|
||||
configuration.QueueSave();
|
||||
pluginManager.RefilterPluginMasters();
|
||||
break;
|
||||
}
|
||||
|
||||
if (ImGui.Selectable(Locs.PluginContext_DeletePluginConfig))
|
||||
|
|
@ -3638,6 +3669,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
private void OnAvailablePluginsChanged()
|
||||
{
|
||||
var pluginManager = Service<PluginManager>.Get();
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
lock (this.listLock)
|
||||
{
|
||||
|
|
@ -3647,6 +3679,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList();
|
||||
this.ResortPlugins();
|
||||
}
|
||||
|
||||
this.hasHiddenPlugins = this.pluginListAvailable.Any(x => configuration.HiddenPluginInternalName.Contains(x.InternalName));
|
||||
|
||||
this.UpdateCategoriesOnPluginsChange();
|
||||
}
|
||||
|
|
@ -3974,6 +4008,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
public static string PluginContext_MarkAllSeen => Loc.Localize("InstallerMarkAllSeen", "Mark all as seen");
|
||||
|
||||
public static string PluginContext_HidePlugin => Loc.Localize("InstallerHidePlugin", "Hide from installer");
|
||||
|
||||
public static string PluginContext_UnhidePlugin => Loc.Localize("InstallerUnhidePlugin", "Unhide from installer");
|
||||
|
||||
public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Reset plugin data");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue