mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-14 20:54:16 +01:00
Notify on repo list changed
This commit is contained in:
parent
d6fbe7a837
commit
2bb7f93b65
2 changed files with 35 additions and 5 deletions
|
|
@ -45,6 +45,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
private bool doViewport;
|
private bool doViewport;
|
||||||
private bool doGamepad;
|
private bool doGamepad;
|
||||||
private List<ThirdPartyRepoSettings> thirdRepoList;
|
private List<ThirdPartyRepoSettings> thirdRepoList;
|
||||||
|
private bool thirdRepoListChanged;
|
||||||
|
|
||||||
private bool printPluginsWelcomeMsg;
|
private bool printPluginsWelcomeMsg;
|
||||||
private bool autoUpdatePlugins;
|
private bool autoUpdatePlugins;
|
||||||
|
|
@ -142,6 +143,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void OnOpen()
|
public override void OnOpen()
|
||||||
{
|
{
|
||||||
|
this.thirdRepoListChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -337,6 +339,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
if (toRemove != null)
|
if (toRemove != null)
|
||||||
{
|
{
|
||||||
this.thirdRepoList.Remove(toRemove);
|
this.thirdRepoList.Remove(toRemove);
|
||||||
|
this.thirdRepoListChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 8 - (ImGui.CalcTextSize(repoNumber.ToString()).X / 2));
|
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetColumnWidth() / 2) - 8 - (ImGui.CalcTextSize(repoNumber.ToString()).X / 2));
|
||||||
|
|
@ -361,7 +364,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
Url = this.thirdRepoTempUrl,
|
Url = this.thirdRepoTempUrl,
|
||||||
IsEnabled = true,
|
IsEnabled = true,
|
||||||
});
|
});
|
||||||
|
this.thirdRepoListChanged = true;
|
||||||
this.thirdRepoTempUrl = string.Empty;
|
this.thirdRepoTempUrl = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,6 +387,12 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
if (ImGui.Button(Loc.Localize("Save", "Save")))
|
if (ImGui.Button(Loc.Localize("Save", "Save")))
|
||||||
{
|
{
|
||||||
this.Save();
|
this.Save();
|
||||||
|
|
||||||
|
if (this.thirdRepoListChanged)
|
||||||
|
{
|
||||||
|
this.dalamud.PluginManager.SetPluginReposFromConfig(true);
|
||||||
|
this.thirdRepoListChanged = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
@ -391,6 +400,13 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close")))
|
if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close")))
|
||||||
{
|
{
|
||||||
this.Save();
|
this.Save();
|
||||||
|
|
||||||
|
if (this.thirdRepoListChanged)
|
||||||
|
{
|
||||||
|
this.dalamud.PluginManager.SetPluginReposFromConfig(true);
|
||||||
|
this.thirdRepoListChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
this.IsOpen = false;
|
this.IsOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,7 @@ namespace Dalamud.Plugin.Internal
|
||||||
var bannedPluginsJson = File.ReadAllText(Path.Combine(this.dalamud.StartInfo.AssetDirectory, "UIRes", "bannedplugin.json"));
|
var bannedPluginsJson = File.ReadAllText(Path.Combine(this.dalamud.StartInfo.AssetDirectory, "UIRes", "bannedplugin.json"));
|
||||||
this.bannedPlugins = JsonConvert.DeserializeObject<BannedPlugin[]>(bannedPluginsJson);
|
this.bannedPlugins = JsonConvert.DeserializeObject<BannedPlugin[]>(bannedPluginsJson);
|
||||||
|
|
||||||
this.Repos.Add(PluginRepository.MainRepo);
|
this.SetPluginReposFromConfig(false);
|
||||||
this.Repos.AddRange(this.dalamud.Configuration.ThirdRepoList
|
|
||||||
.Select(repo => new PluginRepository(repo.Url, repo.IsEnabled)));
|
|
||||||
|
|
||||||
this.ApplyPatches();
|
this.ApplyPatches();
|
||||||
}
|
}
|
||||||
|
|
@ -99,7 +97,7 @@ namespace Dalamud.Plugin.Internal
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of all plugin repositories. The main repo should always be first.
|
/// Gets a list of all plugin repositories. The main repo should always be first.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<PluginRepository> Repos { get; } = new();
|
public List<PluginRepository> Repos { get; private set; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether plugins are not still loading from boot.
|
/// Gets a value indicating whether plugins are not still loading from boot.
|
||||||
|
|
@ -137,6 +135,22 @@ namespace Dalamud.Plugin.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the list of repositories to use. Should be called when the Settings window has been updated or at instantiation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notify">Whether the available plugins changed should be evented after.</param>
|
||||||
|
public void SetPluginReposFromConfig(bool notify)
|
||||||
|
{
|
||||||
|
var repos = new List<PluginRepository>() { PluginRepository.MainRepo };
|
||||||
|
repos.AddRange(this.dalamud.Configuration.ThirdRepoList
|
||||||
|
.Select(repo => new PluginRepository(repo.Url, repo.IsEnabled)));
|
||||||
|
|
||||||
|
this.Repos = repos;
|
||||||
|
|
||||||
|
if (notify)
|
||||||
|
this.NotifyAvailablePluginsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load all plugins, sorted by priority. Any plugins with no explicit definition file or a negative priority
|
/// Load all plugins, sorted by priority. Any plugins with no explicit definition file or a negative priority
|
||||||
/// are loaded asynchronously. Should only be called during Dalamud startup.
|
/// are loaded asynchronously. Should only be called during Dalamud startup.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue