mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
DalamudPluginInterface functions for opening Settings and DevMenu (#1795)
* Add functions for plugins to open the Developer Menu and Dalamud Settings windows * Do not break ABI by instead declaring a new method OpenPluginsInstallerTo Replace OpenDalamudSettings with OpenDalamudSettingsTo
This commit is contained in:
parent
5dd627d18e
commit
00311b4dca
10 changed files with 335 additions and 112 deletions
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.FontIdentifier;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.Interface.Style;
|
||||
|
|
@ -452,7 +453,7 @@ internal sealed class DalamudConfiguration : IInternalDisposableService
|
|||
/// <summary>
|
||||
/// Gets or sets the page of the plugin installer that is shown by default when opened.
|
||||
/// </summary>
|
||||
public PluginInstallerWindow.PluginInstallerOpenKind PluginInstallerOpen { get; set; } = PluginInstallerWindow.PluginInstallerOpenKind.AllPlugins;
|
||||
public PluginInstallerOpenKind PluginInstallerOpen { get; set; } = PluginInstallerOpenKind.AllPlugins;
|
||||
|
||||
/// <summary>
|
||||
/// Load a configuration from the provided path.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using Dalamud.Game.Gui;
|
|||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
|
|
@ -125,7 +126,7 @@ internal class ChatHandlers : IServiceType
|
|||
|
||||
this.openInstallerWindowLink = chatGui.AddChatLinkHandler("Dalamud", 1001, (i, m) =>
|
||||
{
|
||||
Service<DalamudInterface>.GetNullable()?.OpenPluginInstallerTo(PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins);
|
||||
Service<DalamudInterface>.GetNullable()?.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
53
Dalamud/Interface/DalamudWindowOpenKinds.cs
Normal file
53
Dalamud/Interface/DalamudWindowOpenKinds.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
namespace Dalamud.Interface;
|
||||
|
||||
/// <summary>
|
||||
/// Enum describing pages the plugin installer can be opened to.
|
||||
/// </summary>
|
||||
public enum PluginInstallerOpenKind
|
||||
{
|
||||
/// <summary>
|
||||
/// Open to the "All Plugins" page.
|
||||
/// </summary>
|
||||
AllPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Installed Plugins" page.
|
||||
/// </summary>
|
||||
InstalledPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Changelogs" page.
|
||||
/// </summary>
|
||||
Changelogs,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum describing tabs the settings window can be opened to.
|
||||
/// </summary>
|
||||
public enum SettingsOpenKind
|
||||
{
|
||||
/// <summary>
|
||||
/// Open to the "General" page.
|
||||
/// </summary>
|
||||
General,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Look & Feel" page.
|
||||
/// </summary>
|
||||
LookAndFeel,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Server Info Bar" page.
|
||||
/// </summary>
|
||||
ServerInfoBar,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Experimental" page.
|
||||
/// </summary>
|
||||
Experimental,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "About" page.
|
||||
/// </summary>
|
||||
About,
|
||||
}
|
||||
|
|
@ -290,10 +290,10 @@ internal class DalamudInterface : IInternalDisposableService
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="PluginInstallerWindow"/> on the plugin installed.
|
||||
/// Opens the <see cref="PluginInstallerWindow"/> on the specified page.
|
||||
/// </summary>
|
||||
/// <param name="kind">The page of the installer to open.</param>
|
||||
public void OpenPluginInstallerTo(PluginInstallerWindow.PluginInstallerOpenKind kind)
|
||||
public void OpenPluginInstallerTo(PluginInstallerOpenKind kind)
|
||||
{
|
||||
this.pluginWindow.OpenTo(kind);
|
||||
this.pluginWindow.BringToFront();
|
||||
|
|
@ -308,6 +308,16 @@ internal class DalamudInterface : IInternalDisposableService
|
|||
this.settingsWindow.BringToFront();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="SettingsWindow"/> on the specified tab.
|
||||
/// </summary>
|
||||
/// <param name="kind">The tab of the settings to open.</param>
|
||||
public void OpenSettingsTo(SettingsOpenKind kind)
|
||||
{
|
||||
this.settingsWindow.OpenTo(kind);
|
||||
this.settingsWindow.BringToFront();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="SelfTestWindow"/>.
|
||||
/// </summary>
|
||||
|
|
@ -418,7 +428,7 @@ internal class DalamudInterface : IInternalDisposableService
|
|||
/// Toggles the <see cref="PluginInstallerWindow"/>.
|
||||
/// </summary>
|
||||
/// <param name="kind">The page of the installer to open.</param>
|
||||
public void TogglePluginInstallerWindowTo(PluginInstallerWindow.PluginInstallerOpenKind kind) => this.pluginWindow.ToggleTo(kind);
|
||||
public void TogglePluginInstallerWindowTo(PluginInstallerOpenKind kind) => this.pluginWindow.ToggleTo(kind);
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the <see cref="SettingsWindow"/>.
|
||||
|
|
@ -456,6 +466,15 @@ internal class DalamudInterface : IInternalDisposableService
|
|||
this.pluginWindow.SetSearchText(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current search text for the settings window.
|
||||
/// </summary>
|
||||
/// <param name="text">The search term.</param>
|
||||
public void SetSettingsSearchText(string text)
|
||||
{
|
||||
this.settingsWindow.SetSearchText(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle the screen darkening effect used for the credits.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using CheapLoc;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface.Animation.EasingFunctions;
|
||||
|
|
@ -29,6 +30,7 @@ using Dalamud.Plugin.Internal.Types;
|
|||
using Dalamud.Plugin.Internal.Types.Manifest;
|
||||
using Dalamud.Support;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
|
|
@ -175,27 +177,6 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.profileManagerWidget = new(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum describing pages the plugin installer can be opened to.
|
||||
/// </summary>
|
||||
public enum PluginInstallerOpenKind
|
||||
{
|
||||
/// <summary>
|
||||
/// Open to the "All Plugins" page.
|
||||
/// </summary>
|
||||
AllPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Installed Plugins" page.
|
||||
/// </summary>
|
||||
InstalledPlugins,
|
||||
|
||||
/// <summary>
|
||||
/// Open to the "Changelogs" page.
|
||||
/// </summary>
|
||||
Changelogs,
|
||||
}
|
||||
|
||||
private enum OperationStatus
|
||||
{
|
||||
Idle,
|
||||
|
|
@ -329,8 +310,16 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
/// <param name="text">The search term.</param>
|
||||
public void SetSearchText(string text)
|
||||
{
|
||||
this.isSearchTextPrefilled = true;
|
||||
this.searchText = text;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
this.isSearchTextPrefilled = false;
|
||||
this.searchText = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.isSearchTextPrefilled = true;
|
||||
this.searchText = text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -591,7 +580,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
var isProfileManager =
|
||||
this.categoryManager.CurrentGroupIdx == 1 && this.categoryManager.CurrentCategoryIdx == 2;
|
||||
|
||||
|
||||
// Disable search if profile editor
|
||||
using (ImRaii.Disabled(isProfileManager))
|
||||
{
|
||||
|
|
@ -637,7 +626,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
lock (this.listLock)
|
||||
{
|
||||
this.ResortPlugins();
|
||||
|
||||
|
||||
// Positions of plugins within the list is likely to change
|
||||
this.openPluginCollapsibles.Clear();
|
||||
}
|
||||
|
|
@ -742,7 +731,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var errorMessage = this.updatePluginCount > 0
|
||||
? Locs.ErrorModal_UpdaterFailPartial(this.updatePluginCount, errorPluginCount)
|
||||
: Locs.ErrorModal_UpdaterFail(errorPluginCount);
|
||||
|
||||
|
||||
var hintInsert = errorPlugins
|
||||
.Aggregate(string.Empty, (current, pluginUpdateStatus) => $"{current}* {pluginUpdateStatus.InternalName} ({PluginUpdateStatus.LocalizeUpdateStatusKind(pluginUpdateStatus.Status)})\n")
|
||||
.TrimEnd();
|
||||
|
|
@ -887,7 +876,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.deletePluginConfigWarningModalTaskCompletionSource = new TaskCompletionSource<bool>();
|
||||
return this.deletePluginConfigWarningModalTaskCompletionSource.Task;
|
||||
}
|
||||
|
||||
|
||||
private void DrawDeletePluginConfigWarningModal()
|
||||
{
|
||||
var modalTitle = Locs.DeletePluginConfigWarningModal_Title;
|
||||
|
|
@ -913,7 +902,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.CloseCurrentPopup();
|
||||
this.deletePluginConfigWarningModalTaskCompletionSource?.SetResult(false);
|
||||
}
|
||||
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
|
|
@ -1135,7 +1124,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
private IEnumerable<PluginInstallerAvailablePluginProxy> GatherProxies()
|
||||
{
|
||||
var proxies = new List<PluginInstallerAvailablePluginProxy>();
|
||||
|
||||
|
||||
var availableManifests = this.pluginListAvailable;
|
||||
var installedPlugins = this.pluginListInstalled.ToList(); // Copy intended
|
||||
|
||||
|
|
@ -1162,27 +1151,27 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
.FirstOrDefault(plugin => plugin.Manifest.InternalName == availableManifest.InternalName &&
|
||||
plugin.Manifest.RepoUrl == availableManifest.RepoUrl &&
|
||||
!plugin.IsDev);
|
||||
|
||||
|
||||
// We "consumed" this plugin from the pile and remove it.
|
||||
if (plugin != null)
|
||||
{
|
||||
installedPlugins.Remove(plugin);
|
||||
proxies.Add(new PluginInstallerAvailablePluginProxy(availableManifest, plugin));
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
proxies.Add(new PluginInstallerAvailablePluginProxy(availableManifest, null));
|
||||
}
|
||||
|
||||
|
||||
// Now, add all applicable local plugins that haven't been "used up", in most cases either dev or orphaned plugins.
|
||||
foreach (var installedPlugin in installedPlugins)
|
||||
{
|
||||
if (this.IsManifestFiltered(installedPlugin.Manifest))
|
||||
continue;
|
||||
|
||||
|
||||
// TODO: We should also check categories here, for good measure
|
||||
|
||||
|
||||
proxies.Add(new PluginInstallerAvailablePluginProxy(null, installedPlugin));
|
||||
}
|
||||
|
||||
|
|
@ -1199,7 +1188,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (applicableManifest == null)
|
||||
throw new Exception("Could not determine manifest for available plugin");
|
||||
|
||||
|
||||
ImGui.PushID($"{applicableManifest.InternalName}{applicableManifest.AssemblyVersion}");
|
||||
|
||||
if (proxy.LocalPlugin != null)
|
||||
|
|
@ -1246,7 +1235,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var remoteManifest = this.pluginListAvailable
|
||||
.FirstOrDefault(rm => rm.InternalName == plugin.Manifest.InternalName &&
|
||||
rm.RepoUrl == plugin.Manifest.RepoUrl);
|
||||
|
||||
|
||||
this.DrawInstalledPlugin(plugin, i++, remoteManifest);
|
||||
}
|
||||
}
|
||||
|
|
@ -1291,7 +1280,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (installerMainChild)
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.CellPadding, ImGuiHelpers.ScaledVector2(5, 0));
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (var categoriesChild = ImRaii.Child("InstallerCategoriesSelector", new Vector2(useMenuWidth * ImGuiHelpers.GlobalScale, -1), false))
|
||||
|
|
@ -1832,17 +1821,17 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
iconTex = cachedIconTex;
|
||||
}
|
||||
|
||||
|
||||
const float fadeTime = 0.3f;
|
||||
var iconAlpha = 1f;
|
||||
|
||||
if (loadedSince.HasValue)
|
||||
{
|
||||
float EaseOutCubic(float t) => 1 - MathF.Pow(1 - t, 3);
|
||||
|
||||
|
||||
var secondsSinceLoad = (float)DateTime.Now.Subtract(loadedSince.Value).TotalSeconds;
|
||||
var fadeTo = pluginDisabled || installableOutdated ? 0.4f : 1f;
|
||||
|
||||
|
||||
float Interp(float to) => Math.Clamp(EaseOutCubic(Math.Min(secondsSinceLoad, fadeTime) / fadeTime) * to, 0, 1);
|
||||
iconAlpha = Interp(fadeTo);
|
||||
overlayAlpha = Interp(1f);
|
||||
|
|
@ -1878,7 +1867,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
else
|
||||
ImGui.Dummy(iconSize);
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
|
@ -1888,7 +1877,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
// Name
|
||||
ImGui.TextUnformatted(label);
|
||||
|
||||
|
||||
// Verified Checkmark or dev plugin wrench
|
||||
{
|
||||
ImGui.SameLine();
|
||||
|
|
@ -1946,7 +1935,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
bodyText += Locs.PluginBody_Outdated_CanNowUpdate;
|
||||
else
|
||||
bodyText += Locs.PluginBody_Outdated_WaitForUpdate;
|
||||
|
||||
|
||||
ImGui.TextWrapped(bodyText);
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
|
|
@ -1954,17 +1943,17 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
// Banned warning
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
|
||||
|
||||
var bodyText = plugin.BanReason.IsNullOrEmpty()
|
||||
? Locs.PluginBody_Banned
|
||||
: Locs.PluginBody_BannedReason(plugin.BanReason);
|
||||
bodyText += " ";
|
||||
|
||||
|
||||
if (updateAvailable)
|
||||
bodyText += Locs.PluginBody_Outdated_CanNowUpdate;
|
||||
else
|
||||
bodyText += Locs.PluginBody_Outdated_WaitForUpdate;
|
||||
|
||||
|
||||
ImGuiHelpers.SafeTextWrapped(bodyText);
|
||||
|
||||
ImGui.PopStyleColor();
|
||||
|
|
@ -2189,13 +2178,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy(3);
|
||||
}
|
||||
|
||||
|
||||
if (!manifest.SourceRepo.IsThirdParty && manifest.AcceptsFeedback)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
this.DrawSendFeedbackButton(manifest, false, true);
|
||||
}
|
||||
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
if (this.DrawPluginImages(null, manifest, isThirdParty, index))
|
||||
|
|
@ -2323,11 +2312,11 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
var availablePluginUpdate = this.pluginListUpdatable.FirstOrDefault(up => up.InstalledPlugin == plugin);
|
||||
|
||||
|
||||
// Dev plugins can never update
|
||||
if (plugin.IsDev)
|
||||
availablePluginUpdate = null;
|
||||
|
||||
|
||||
// Update available
|
||||
if (availablePluginUpdate != default)
|
||||
{
|
||||
|
|
@ -2388,7 +2377,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
|
||||
|
||||
|
||||
var applicableChangelog = plugin.IsTesting ? remoteManifest?.Changelog : remoteManifest?.TestingChangelog;
|
||||
var hasChangelog = !applicableChangelog.IsNullOrWhitespace();
|
||||
var didDrawChangelogInsideCollapsible = false;
|
||||
|
|
@ -2457,7 +2446,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (plugin.IsLoaded)
|
||||
{
|
||||
var commands = commandManager.Commands
|
||||
.Where(cInfo =>
|
||||
.Where(cInfo =>
|
||||
cInfo.Value is { ShowInHelp: true } &&
|
||||
cInfo.Value.LoaderAssemblyName == plugin.Manifest.InternalName)
|
||||
.ToArray();
|
||||
|
|
@ -2469,7 +2458,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
ImGuiHelpers.SafeTextWrapped($"{command.Key} → {command.Value.HelpMessage}");
|
||||
}
|
||||
|
||||
|
||||
ImGuiHelpers.ScaledDummy(3);
|
||||
}
|
||||
}
|
||||
|
|
@ -2749,7 +2738,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var applicableProfile = profilesThatWantThisPlugin.First();
|
||||
Log.Verbose("Switching {InternalName} in {Profile} to {State}",
|
||||
plugin.InternalName, applicableProfile, isLoadedAndUnloadable);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Reload the devPlugin manifest if it's a dev plugin
|
||||
|
|
@ -2763,7 +2752,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
Log.Error(ex, "Could not reload DevPlugin manifest");
|
||||
}
|
||||
|
||||
|
||||
// NOTE: We don't use the profile manager to actually handle loading/unloading here,
|
||||
// because that might cause us to show an error if a plugin we don't actually care about
|
||||
// fails to load/unload. Instead, we just do it ourselves and then update the profile.
|
||||
|
|
@ -2842,7 +2831,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
// Only if the plugin isn't broken.
|
||||
this.DrawOpenPluginSettingsButton(plugin);
|
||||
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy(5, 0);
|
||||
}
|
||||
|
|
@ -2891,7 +2880,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
Locs.ErrorModal_SingleUpdateFail(update.UpdateManifest.Name, PluginUpdateStatus.LocalizeUpdateStatusKind(task.Result.Status)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return this.DisplayErrorContinuation(task, Locs.ErrorModal_SingleUpdateFail(update.UpdateManifest.Name, "Exception"));
|
||||
});
|
||||
}
|
||||
|
|
@ -2944,7 +2933,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy(5, 0);
|
||||
}
|
||||
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Cog, Locs.PluginButton_OpenSettings))
|
||||
{
|
||||
|
|
@ -2967,10 +2956,10 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
private void DrawSendFeedbackButton(IPluginManifest manifest, bool isTesting, bool big)
|
||||
{
|
||||
var clicked = big ?
|
||||
var clicked = big ?
|
||||
ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Comment, Locs.FeedbackModal_Title) :
|
||||
ImGuiComponents.IconButton(FontAwesomeIcon.Comment);
|
||||
|
||||
|
||||
if (clicked)
|
||||
{
|
||||
this.feedbackPlugin = manifest;
|
||||
|
|
@ -3009,7 +2998,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var validationIssuesText = shouldBother ?
|
||||
$"Found {problems.Count} validation issue{(problems.Count > 1 ? "s" : string.Empty)} in this plugin!" :
|
||||
$"{problems.Count} dismissed validation issue{(problems.Count > 1 ? "s" : string.Empty)} in this plugin.";
|
||||
|
||||
|
||||
using var col = ImRaii.PushColor(ImGuiCol.Text, shouldBother ? ImGuiColors.DalamudOrange : ImGuiColors.DalamudGrey);
|
||||
using var tree = ImRaii.TreeNode($"{validationIssuesText}###validationIssueCollapsible");
|
||||
if (tree.Success)
|
||||
|
|
@ -3029,7 +3018,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
devPlugin.DismissedValidationProblems.Add(problem.GetType().Name);
|
||||
Service<DalamudConfiguration>.Get().QueueSave();
|
||||
}
|
||||
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip("Dismiss this issue");
|
||||
|
|
@ -3065,7 +3054,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, thisProblemIsDismissed ? ImGuiColors.DalamudGrey : ImGuiColors.DalamudWhite))
|
||||
|
|
@ -3216,7 +3205,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (!string.IsNullOrEmpty(repoUrl) && repoUrl.StartsWith("https://"))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
|
||||
|
||||
var clicked = big ?
|
||||
ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Globe, "Open website") :
|
||||
ImGuiComponents.IconButton(FontAwesomeIcon.Globe);
|
||||
|
|
@ -3403,7 +3392,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
// not the actual time of the last update, as the plugin may be pending an update
|
||||
IPluginManifest? p2Considered = this.pluginListAvailable.FirstOrDefault(x => x.InternalName == p2.InternalName);
|
||||
p2Considered ??= p2.Manifest;
|
||||
|
||||
|
||||
IPluginManifest? p1Considered = this.pluginListAvailable.FirstOrDefault(x => x.InternalName == p1.InternalName);
|
||||
p1Considered ??= p1.Manifest;
|
||||
|
||||
|
|
@ -3435,7 +3424,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
break;
|
||||
case PluginSortKind.ProfileOrNot:
|
||||
this.pluginListAvailable.Sort((p1, p2) => p1.Name.CompareTo(p2.Name));
|
||||
|
||||
|
||||
var profman = Service<ProfileManager>.Get();
|
||||
this.pluginListInstalled.Sort((p1, p2) => profman.IsInDefaultProfile(p1.Manifest.WorkingPluginId).CompareTo(profman.IsInDefaultProfile(p2.Manifest.WorkingPluginId)));
|
||||
break;
|
||||
|
|
@ -3469,14 +3458,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (string.IsNullOrEmpty(this.searchText))
|
||||
{
|
||||
this.categoryManager.SetCategoryHighlightsForPlugins(null);
|
||||
|
||||
|
||||
// Reset here for good measure, as we're returning from a search
|
||||
this.openPluginCollapsibles.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
var pluginsMatchingSearch = this.pluginListAvailable.Where(rm => !this.IsManifestFiltered(rm)).ToArray();
|
||||
|
||||
|
||||
// Check if the search results are different, and clear the open collapsibles if they are
|
||||
if (previousSearchText != null)
|
||||
{
|
||||
|
|
@ -3484,7 +3473,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (!previousSearchResults.SequenceEqual(pluginsMatchingSearch))
|
||||
this.openPluginCollapsibles.Clear();
|
||||
}
|
||||
|
||||
|
||||
this.categoryManager.SetCategoryHighlightsForPlugins(pluginsMatchingSearch);
|
||||
}
|
||||
}
|
||||
|
|
@ -3507,38 +3496,38 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
foreach (var y in Enumerable.Range(-1, 3))
|
||||
{
|
||||
if (x is 0 && y is 0) continue;
|
||||
|
||||
|
||||
ImGui.SetCursorPos(cursorStart + new Vector2(x, y));
|
||||
ImGui.Text(icon.ToIconString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, iconColor);
|
||||
ImGui.SetCursorPos(cursorStart);
|
||||
ImGui.Text(icon.ToIconString());
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
|
||||
ImGui.PopFont();
|
||||
|
||||
|
||||
ImGui.SetCursorPos(ImGui.GetCursorPos() - positionOffset);
|
||||
}
|
||||
|
||||
|
||||
// Animates a tooltip when hovering over the ImGui Item before this call.
|
||||
private void VerifiedCheckmarkFadeTooltip(string source, string tooltip)
|
||||
{
|
||||
const float fadeInStartDelay = 250.0f;
|
||||
|
||||
|
||||
var isHoveringSameItem = this.verifiedCheckmarkHoveredPlugin == source;
|
||||
|
||||
|
||||
// If we just started a hover, start the timer
|
||||
if (ImGui.IsItemHovered() && !this.tooltipFadeInStopwatch.IsRunning)
|
||||
{
|
||||
this.verifiedCheckmarkHoveredPlugin = source;
|
||||
this.tooltipFadeInStopwatch.Restart();
|
||||
}
|
||||
|
||||
|
||||
// If we were last hovering this plugins item and are no longer hovered over that item, reset the timer
|
||||
if (!ImGui.IsItemHovered() && isHoveringSameItem)
|
||||
{
|
||||
|
|
@ -3546,13 +3535,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.tooltipFadeInStopwatch.Stop();
|
||||
this.tooltipFadeEasing.Reset();
|
||||
}
|
||||
|
||||
|
||||
// If we have been hovering this item for > fadeInStartDelay milliseconds, fade in tooltip over fadeInTime milliseconds
|
||||
if (ImGui.IsItemHovered() && isHoveringSameItem && this.tooltipFadeInStopwatch.ElapsedMilliseconds >= fadeInStartDelay)
|
||||
{
|
||||
if (!this.tooltipFadeEasing.IsRunning)
|
||||
this.tooltipFadeEasing.Start();
|
||||
|
||||
|
||||
this.tooltipFadeEasing.Update();
|
||||
var fadePercent = this.tooltipFadeEasing.EasedPoint.X;
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int)ImGuiCol.Text] with { W = fadePercent });
|
||||
|
|
@ -3697,9 +3686,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
public static string PluginBody_Plugin3rdPartyRepo(string url) => Loc.Localize("InstallerPlugin3rdPartyRepo", "From custom plugin repository {0}").Format(url);
|
||||
|
||||
public static string PluginBody_Outdated => Loc.Localize("InstallerOutdatedPluginBody ", "This plugin is outdated and incompatible.");
|
||||
|
||||
|
||||
public static string PluginBody_Outdated_WaitForUpdate => Loc.Localize("InstallerOutdatedWaitForUpdate", "Please wait for it to be updated by its author.");
|
||||
|
||||
|
||||
public static string PluginBody_Outdated_CanNowUpdate => Loc.Localize("InstallerOutdatedCanNowUpdate", "An update is available for installation.");
|
||||
|
||||
public static string PluginBody_Orphaned => Loc.Localize("InstallerOrphanedPluginBody ", "This plugin's source repository is no longer available. You may need to reinstall it from its repository, or re-add the repository.");
|
||||
|
|
@ -3732,15 +3721,15 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
public static string PluginButton_Unload => Loc.Localize("InstallerUnload", "Unload");
|
||||
|
||||
public static string PluginButton_SafeMode => Loc.Localize("InstallerSafeModeButton", "Can't change in safe mode");
|
||||
|
||||
|
||||
public static string PluginButton_OpenUi => Loc.Localize("InstallerOpenPluginUi", "Open");
|
||||
|
||||
|
||||
public static string PluginButton_OpenSettings => Loc.Localize("InstallerOpenPluginSettings", "Settings");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Plugin button tooltips
|
||||
|
||||
|
||||
public static string PluginButtonToolTip_OpenUi => Loc.Localize("InstallerTooltipOpenUi", "Open this plugin's interface");
|
||||
|
||||
public static string PluginButtonToolTip_OpenConfiguration => Loc.Localize("InstallerTooltipOpenConfig", "Open this plugin's settings");
|
||||
|
|
@ -3770,9 +3759,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
public static string PluginButtonToolTip_UnloadFailed => Loc.Localize("InstallerLoadUnloadFailedTooltip", "Plugin load/unload failed, please restart your game and try again.");
|
||||
|
||||
public static string PluginButtonToolTip_NeedsToBeInDefault => Loc.Localize("InstallerUnloadNeedsToBeInDefault", "This plugin is in one or more collections. If you want to enable or disable it, please do so by enabling or disabling the collections it is in.\nIf you want to manage it manually, remove it from all collections.");
|
||||
|
||||
|
||||
public static string PluginButtonToolTip_NeedsToBeInSingleProfile => Loc.Localize("InstallerUnloadNeedsToBeInSingleProfile", "This plugin is in more than one collection. If you want to enable or disable it, please do so by enabling or disabling the collections it is in.\nIf you want to manage it here, make sure it is only in a single collection.");
|
||||
|
||||
|
||||
public static string PluginButtonToolTip_SingleProfileDisabled(string name) => Loc.Localize("InstallerSingleProfileDisabled", "The collection '{0}' which contains this plugin is disabled.\nPlease enable it in the collections manager to toggle the plugin individually.").Format(name);
|
||||
|
||||
#endregion
|
||||
|
|
@ -3930,7 +3919,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
public static string DeletePluginConfirmWarningModal_No => Loc.Localize("InstallerDeletePluginConfigWarningNo", "No");
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Plugin Update chatbox
|
||||
|
||||
public static string PluginUpdateHeader_Chatbox => Loc.Localize("DalamudPluginUpdates", "Updates:");
|
||||
|
|
@ -3963,7 +3952,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
Loc.Localize("InstallerProfilesRemoveFromAll", "Remove from all collections");
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region VerifiedCheckmark
|
||||
|
||||
public static string VerifiedCheckmark_VerifiedTooltip =>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
|
||||
using CheapLoc;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||
|
|
@ -10,6 +11,7 @@ using Dalamud.Interface.Utility;
|
|||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Settings;
|
||||
|
|
@ -22,6 +24,9 @@ internal class SettingsWindow : Window
|
|||
private SettingsTab[]? tabs;
|
||||
|
||||
private string searchInput = string.Empty;
|
||||
private bool isSearchInputPrefilled = false;
|
||||
|
||||
private SettingsTab setActiveTab = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SettingsWindow"/> class.
|
||||
|
|
@ -39,6 +44,34 @@ internal class SettingsWindow : Window
|
|||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the settings window to the tab specified by <paramref name="kind"/>.
|
||||
/// </summary>
|
||||
/// <param name="kind">The tab of the settings window to open.</param>
|
||||
public void OpenTo(SettingsOpenKind kind)
|
||||
{
|
||||
this.IsOpen = true;
|
||||
this.SetOpenTab(kind);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current search text and marks it as prefilled.
|
||||
/// </summary>
|
||||
/// <param name="text">The search term.</param>
|
||||
public void SetSearchText(string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
this.isSearchInputPrefilled = false;
|
||||
this.searchInput = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.isSearchInputPrefilled = true;
|
||||
this.searchInput = text;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void OnOpen()
|
||||
{
|
||||
|
|
@ -56,7 +89,7 @@ internal class SettingsWindow : Window
|
|||
settingsTab.Load();
|
||||
}
|
||||
|
||||
this.searchInput = string.Empty;
|
||||
if (!this.isSearchInputPrefilled) this.searchInput = string.Empty;
|
||||
|
||||
base.OnOpen();
|
||||
}
|
||||
|
|
@ -84,6 +117,12 @@ internal class SettingsWindow : Window
|
|||
|
||||
settingsTab.IsOpen = false;
|
||||
}
|
||||
|
||||
if (this.isSearchInputPrefilled)
|
||||
{
|
||||
this.isSearchInputPrefilled = false;
|
||||
this.searchInput = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -97,7 +136,15 @@ internal class SettingsWindow : Window
|
|||
{
|
||||
foreach (var settingsTab in this.tabs.Where(x => x.IsVisible))
|
||||
{
|
||||
if (ImGui.BeginTabItem(settingsTab.Title))
|
||||
var flags = ImGuiTabItemFlags.NoCloseWithMiddleMouseButton;
|
||||
if (this.setActiveTab == settingsTab)
|
||||
{
|
||||
flags |= ImGuiTabItemFlags.SetSelected;
|
||||
this.setActiveTab = null;
|
||||
}
|
||||
|
||||
using var tab = ImRaii.TabItem(settingsTab.Title, flags);
|
||||
if (tab)
|
||||
{
|
||||
if (!settingsTab.IsOpen)
|
||||
{
|
||||
|
|
@ -231,4 +278,28 @@ internal class SettingsWindow : Window
|
|||
|
||||
Service<InterfaceManager>.Get().RebuildFonts();
|
||||
}
|
||||
|
||||
private void SetOpenTab(SettingsOpenKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case SettingsOpenKind.General:
|
||||
this.setActiveTab = this.tabs[0];
|
||||
break;
|
||||
case SettingsOpenKind.LookAndFeel:
|
||||
this.setActiveTab = this.tabs[1];
|
||||
break;
|
||||
case SettingsOpenKind.ServerInfoBar:
|
||||
this.setActiveTab = this.tabs[2];
|
||||
break;
|
||||
case SettingsOpenKind.Experimental:
|
||||
this.setActiveTab = this.tabs[3];
|
||||
break;
|
||||
case SettingsOpenKind.About:
|
||||
this.setActiveTab = this.tabs[4];
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(kind), kind, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,8 +128,8 @@ public class SettingsTabLook : SettingsTab
|
|||
new SettingsEntry<bool>(
|
||||
Loc.Localize("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"),
|
||||
Loc.Localize("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."),
|
||||
c => c.PluginInstallerOpen == PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins,
|
||||
(v, c) => c.PluginInstallerOpen = v ? PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins : PluginInstallerWindow.PluginInstallerOpenKind.AllPlugins),
|
||||
c => c.PluginInstallerOpen == PluginInstallerOpenKind.InstalledPlugins,
|
||||
(v, c) => c.PluginInstallerOpen = v ? PluginInstallerOpenKind.InstalledPlugins : PluginInstallerOpenKind.AllPlugins),
|
||||
|
||||
new SettingsEntry<bool>(
|
||||
Loc.Localize("DalamudSettingReducedMotion", "Reduce motions"),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ public static partial class ImRaii
|
|||
|
||||
public static IEndObject Popup(string id, ImGuiWindowFlags flags)
|
||||
=> new EndConditionally(ImGui.EndPopup, ImGui.BeginPopup(id, flags));
|
||||
|
||||
|
||||
public static IEndObject PopupModal(string id)
|
||||
=> new EndConditionally(ImGui.EndPopup, ImGui.BeginPopupModal(id));
|
||||
|
||||
|
|
@ -103,8 +104,43 @@ public static partial class ImRaii
|
|||
public static IEndObject TabItem(string label)
|
||||
=> new EndConditionally(ImGui.EndTabItem, ImGui.BeginTabItem(label));
|
||||
|
||||
public static unsafe IEndObject TabItem(byte* label, ImGuiTabItemFlags flags)
|
||||
=> new EndConditionally(ImGuiNative.igEndTabItem, ImGuiNative.igBeginTabItem(label, null, flags) != 0);
|
||||
public static unsafe IEndObject TabItem(string label, ImGuiTabItemFlags flags)
|
||||
{
|
||||
// I am so sorry for this.
|
||||
const int ImGuiNET_Util_StackAllocationSizeLimit = 2048;
|
||||
|
||||
byte* native_label;
|
||||
int label_byteCount = 0;
|
||||
if (label != null)
|
||||
{
|
||||
label_byteCount = Encoding.UTF8.GetByteCount(label);
|
||||
|
||||
if (label_byteCount > ImGuiNET_Util_StackAllocationSizeLimit)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("label", "Label is too long. (Longer than 2048 bytes)");
|
||||
}
|
||||
|
||||
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1];
|
||||
native_label = native_label_stackBytes;
|
||||
|
||||
int native_label_offset;
|
||||
fixed (char* utf16Ptr = label)
|
||||
{
|
||||
native_label_offset = Encoding.UTF8.GetBytes(utf16Ptr, label.Length, native_label, label_byteCount);
|
||||
}
|
||||
|
||||
native_label[native_label_offset] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
native_label = null;
|
||||
}
|
||||
|
||||
byte* p_open = null;
|
||||
byte ret = ImGuiNative.igBeginTabItem(native_label, p_open, flags);
|
||||
|
||||
return new EndUnconditionally(ImGuiNative.igEndTabItem, ret != 0);
|
||||
}
|
||||
|
||||
public static IEndObject TabItem(string label, ref bool open)
|
||||
=> new EndConditionally(ImGui.EndTabItem, ImGui.BeginTabItem(label, ref open));
|
||||
|
|
@ -174,7 +210,7 @@ public static partial class ImRaii
|
|||
return new EndUnconditionally(Widget.EndFramedGroup, true);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Used to avoid tree pops when flag for no push is set.
|
||||
private static void Nop()
|
||||
{
|
||||
|
|
@ -210,15 +246,15 @@ public static partial class ImRaii
|
|||
{
|
||||
private Action EndAction { get; }
|
||||
|
||||
public bool Success { get; }
|
||||
public bool Success { get; }
|
||||
|
||||
public bool Disposed { get; private set; }
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
public EndUnconditionally(Action endAction, bool success)
|
||||
{
|
||||
this.EndAction = endAction;
|
||||
this.Success = success;
|
||||
this.Disposed = false;
|
||||
this.Success = success;
|
||||
this.Disposed = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
@ -240,11 +276,11 @@ public static partial class ImRaii
|
|||
this.Success = success;
|
||||
this.Disposed = false;
|
||||
}
|
||||
|
||||
|
||||
public bool Success { get; }
|
||||
|
||||
public bool Disposed { get; private set; }
|
||||
|
||||
|
||||
private Action EndAction { get; }
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -18,12 +18,16 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.Interface.Internal.Windows.Settings;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Plugin.Internal.Types.Manifest;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
using Dalamud.Plugin.Ipc.Internal;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using static Dalamud.Interface.Internal.Windows.PluginInstaller.PluginInstallerWindow;
|
||||
|
||||
namespace Dalamud.Plugin;
|
||||
|
||||
|
|
@ -218,7 +222,19 @@ public sealed class DalamudPluginInterface : IDisposable
|
|||
/// Opens the <see cref="PluginInstallerWindow"/> with the plugin name set as search target.
|
||||
/// </summary>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
[Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
|
||||
public bool OpenPluginInstaller()
|
||||
{
|
||||
return this.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins, this.plugin.InternalName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="PluginInstallerWindow"/>, with an optional search term.
|
||||
/// </summary>
|
||||
/// <param name="openTo">The page to open the installer to. Defaults to the "All Plugins" page.</param>
|
||||
/// <param name="searchText">An optional search text to input in the search box.</param>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
public bool OpenPluginInstallerTo(PluginInstallerOpenKind openTo = PluginInstallerOpenKind.AllPlugins, string searchText = null)
|
||||
{
|
||||
var dalamudInterface = Service<DalamudInterface>.GetNullable(); // Can be null during boot
|
||||
if (dalamudInterface == null)
|
||||
|
|
@ -226,12 +242,48 @@ public sealed class DalamudPluginInterface : IDisposable
|
|||
return false;
|
||||
}
|
||||
|
||||
dalamudInterface.OpenPluginInstallerTo(PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins);
|
||||
dalamudInterface.SetPluginInstallerSearchText(this.plugin.InternalName);
|
||||
dalamudInterface.OpenPluginInstallerTo(openTo);
|
||||
dalamudInterface.SetPluginInstallerSearchText(searchText);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="SettingsWindow"/>, with an optional search term.
|
||||
/// </summary>
|
||||
/// <param name="openTo">The tab to open the settings to. Defaults to the "General" tab.</param>
|
||||
/// <param name="searchText">An optional search text to input in the search box.</param>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
public bool OpenDalamudSettingsTo(SettingsOpenKind openTo = SettingsOpenKind.General, string searchText = null)
|
||||
{
|
||||
var dalamudInterface = Service<DalamudInterface>.GetNullable(); // Can be null during boot
|
||||
if (dalamudInterface == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dalamudInterface.OpenSettingsTo(openTo);
|
||||
dalamudInterface.SetSettingsSearchText(searchText);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the dev menu bar.
|
||||
/// </summary>
|
||||
/// <returns>Returns false if the DalamudInterface was null.</returns>
|
||||
public bool OpenDeveloperMenu()
|
||||
{
|
||||
var dalamudInterface = Service<DalamudInterface>.GetNullable(); // Can be null during boot
|
||||
if (dalamudInterface == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dalamudInterface.OpenDevMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
#region IPC
|
||||
|
||||
/// <inheritdoc cref="DataShare.GetOrCreateData{T}"/>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ using Dalamud.Game.Gui.Dtr;
|
|||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.IoC;
|
||||
|
|
@ -129,7 +130,7 @@ internal class PluginManager : IInternalDisposableService
|
|||
(_, _) =>
|
||||
{
|
||||
Service<DalamudInterface>.GetNullable()?.OpenPluginInstallerTo(
|
||||
PluginInstallerWindow.PluginInstallerOpenKind.Changelogs);
|
||||
PluginInstallerOpenKind.Changelogs);
|
||||
}));
|
||||
|
||||
this.configuration.PluginTestingOptIns ??= new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue