mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-20 15:44:18 +01:00
Merge pull request #160 from Caraxi/installer-search
This commit is contained in:
commit
93352b9883
2 changed files with 24 additions and 0 deletions
|
|
@ -43,6 +43,11 @@ namespace Dalamud.Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RepoUrl { get; set; }
|
public string RepoUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of tags defined on the plugin.
|
||||||
|
/// </summary>
|
||||||
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not the plugin is hidden in the plugin installer.
|
/// Whether or not the plugin is hidden in the plugin installer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ namespace Dalamud.Plugin
|
||||||
private int updatePluginCount = 0;
|
private int updatePluginCount = 0;
|
||||||
private List<PluginRepository.PluginUpdateStatus> updatedPlugins;
|
private List<PluginRepository.PluginUpdateStatus> updatedPlugins;
|
||||||
|
|
||||||
|
private string searchText = "";
|
||||||
|
|
||||||
private enum PluginInstallStatus {
|
private enum PluginInstallStatus {
|
||||||
None,
|
None,
|
||||||
InProgress,
|
InProgress,
|
||||||
|
|
@ -55,6 +57,8 @@ namespace Dalamud.Plugin
|
||||||
ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar);
|
ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar);
|
||||||
|
|
||||||
ImGui.Text(Loc.Localize("InstallerHint", "This window allows you install and remove in-game plugins.\nThey are made by third-party developers."));
|
ImGui.Text(Loc.Localize("InstallerHint", "This window allows you install and remove in-game plugins.\nThey are made by third-party developers."));
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.InputTextWithHint("###XPlPluginInstaller_Search", Loc.Localize("InstallerSearch", "Search"), ref this.searchText, 100);
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
ImGui.BeginChild("scrolling", new Vector2(0, 400), true, ImGuiWindowFlags.HorizontalScrollbar);
|
ImGui.BeginChild("scrolling", new Vector2(0, 400), true, ImGuiWindowFlags.HorizontalScrollbar);
|
||||||
|
|
@ -68,6 +72,8 @@ namespace Dalamud.Plugin
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var didAny = false;
|
var didAny = false;
|
||||||
|
var didAnyWithSearch = false;
|
||||||
|
var hasSearchString = !string.IsNullOrWhiteSpace(this.searchText);
|
||||||
|
|
||||||
foreach (var pluginDefinition in this.dalamud.PluginRepository.PluginMaster) {
|
foreach (var pluginDefinition in this.dalamud.PluginRepository.PluginMaster) {
|
||||||
if (pluginDefinition.ApplicableVersion != this.gameVersion &&
|
if (pluginDefinition.ApplicableVersion != this.gameVersion &&
|
||||||
|
|
@ -82,6 +88,17 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
didAny = true;
|
didAny = true;
|
||||||
|
|
||||||
|
if (hasSearchString &&
|
||||||
|
!(pluginDefinition.Name.ToLowerInvariant().Contains(this.searchText.ToLowerInvariant()) ||
|
||||||
|
string.Equals(pluginDefinition.Author, this.searchText, StringComparison.InvariantCultureIgnoreCase) ||
|
||||||
|
pluginDefinition.Tags != null &&
|
||||||
|
pluginDefinition.Tags.Contains(this.searchText.ToLowerInvariant(), StringComparer.InvariantCultureIgnoreCase)
|
||||||
|
)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
didAnyWithSearch = true;
|
||||||
|
|
||||||
ImGui.PushID(pluginDefinition.InternalName + pluginDefinition.AssemblyVersion);
|
ImGui.PushID(pluginDefinition.InternalName + pluginDefinition.AssemblyVersion);
|
||||||
|
|
||||||
var isInstalled = this.dalamud.PluginManager.Plugins.Where(x => x.Definition != null).Any(
|
var isInstalled = this.dalamud.PluginManager.Plugins.Where(x => x.Definition != null).Any(
|
||||||
|
|
@ -179,6 +196,8 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
if (!didAny)
|
if (!didAny)
|
||||||
ImGui.TextColored(new Vector4(0.70f, 0.70f, 0.70f, 1.00f), Loc.Localize("InstallerNoCompatible", "No compatible plugins were found :( Please restart your game and try again."));
|
ImGui.TextColored(new Vector4(0.70f, 0.70f, 0.70f, 1.00f), Loc.Localize("InstallerNoCompatible", "No compatible plugins were found :( Please restart your game and try again."));
|
||||||
|
else if (!didAnyWithSearch)
|
||||||
|
ImGui.TextColored(new Vector4(0.7f, 0.7f, 0.7f, 1.0f), Loc.Localize("InstallNoMatching", "No plugins were found matching your search."));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue