diff --git a/Dalamud/Configuration/Internal/DalamudConfiguration.cs b/Dalamud/Configuration/Internal/DalamudConfiguration.cs
index a1c6efe9b..2e9e9df48 100644
--- a/Dalamud/Configuration/Internal/DalamudConfiguration.cs
+++ b/Dalamud/Configuration/Internal/DalamudConfiguration.cs
@@ -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
///
/// Gets or sets the page of the plugin installer that is shown by default when opened.
///
- public PluginInstallerWindow.PluginInstallerOpenKind PluginInstallerOpen { get; set; } = PluginInstallerWindow.PluginInstallerOpenKind.AllPlugins;
+ public PluginInstallerOpenKind PluginInstallerOpen { get; set; } = PluginInstallerOpenKind.AllPlugins;
///
/// Load a configuration from the provided path.
diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs
index 7043068c9..7f93ce6c2 100644
--- a/Dalamud/Game/ChatHandlers.cs
+++ b/Dalamud/Game/ChatHandlers.cs
@@ -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.GetNullable()?.OpenPluginInstallerTo(PluginInstallerWindow.PluginInstallerOpenKind.InstalledPlugins);
+ Service.GetNullable()?.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins);
});
}
diff --git a/Dalamud/Interface/DalamudWindowOpenKinds.cs b/Dalamud/Interface/DalamudWindowOpenKinds.cs
new file mode 100644
index 000000000..18ecf5386
--- /dev/null
+++ b/Dalamud/Interface/DalamudWindowOpenKinds.cs
@@ -0,0 +1,53 @@
+namespace Dalamud.Interface;
+
+///
+/// Enum describing pages the plugin installer can be opened to.
+///
+public enum PluginInstallerOpenKind
+{
+ ///
+ /// Open to the "All Plugins" page.
+ ///
+ AllPlugins,
+
+ ///
+ /// Open to the "Installed Plugins" page.
+ ///
+ InstalledPlugins,
+
+ ///
+ /// Open to the "Changelogs" page.
+ ///
+ Changelogs,
+}
+
+///
+/// Enum describing tabs the settings window can be opened to.
+///
+public enum SettingsOpenKind
+{
+ ///
+ /// Open to the "General" page.
+ ///
+ General,
+
+ ///
+ /// Open to the "Look & Feel" page.
+ ///
+ LookAndFeel,
+
+ ///
+ /// Open to the "Server Info Bar" page.
+ ///
+ ServerInfoBar,
+
+ ///
+ /// Open to the "Experimental" page.
+ ///
+ Experimental,
+
+ ///
+ /// Open to the "About" page.
+ ///
+ About,
+}
diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs
index 834bd9865..54c5e1ba9 100644
--- a/Dalamud/Interface/Internal/DalamudInterface.cs
+++ b/Dalamud/Interface/Internal/DalamudInterface.cs
@@ -290,10 +290,10 @@ internal class DalamudInterface : IInternalDisposableService
}
///
- /// Opens the on the plugin installed.
+ /// Opens the on the specified page.
///
/// The page of the installer to open.
- 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();
}
+ ///
+ /// Opens the on the specified tab.
+ ///
+ /// The tab of the settings to open.
+ public void OpenSettingsTo(SettingsOpenKind kind)
+ {
+ this.settingsWindow.OpenTo(kind);
+ this.settingsWindow.BringToFront();
+ }
+
///
/// Opens the .
///
@@ -418,7 +428,7 @@ internal class DalamudInterface : IInternalDisposableService
/// Toggles the .
///
/// The page of the installer to open.
- public void TogglePluginInstallerWindowTo(PluginInstallerWindow.PluginInstallerOpenKind kind) => this.pluginWindow.ToggleTo(kind);
+ public void TogglePluginInstallerWindowTo(PluginInstallerOpenKind kind) => this.pluginWindow.ToggleTo(kind);
///
/// Toggles the .
@@ -456,6 +466,15 @@ internal class DalamudInterface : IInternalDisposableService
this.pluginWindow.SetSearchText(text);
}
+ ///
+ /// Sets the current search text for the settings window.
+ ///
+ /// The search term.
+ public void SetSettingsSearchText(string text)
+ {
+ this.settingsWindow.SetSearchText(text);
+ }
+
///
/// Toggle the screen darkening effect used for the credits.
///
diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
index 5c897b8fb..40fa852cd 100644
--- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs
@@ -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);
}
- ///
- /// Enum describing pages the plugin installer can be opened to.
- ///
- public enum PluginInstallerOpenKind
- {
- ///
- /// Open to the "All Plugins" page.
- ///
- AllPlugins,
-
- ///
- /// Open to the "Installed Plugins" page.
- ///
- InstalledPlugins,
-
- ///
- /// Open to the "Changelogs" page.
- ///
- Changelogs,
- }
-
private enum OperationStatus
{
Idle,
@@ -329,8 +310,16 @@ internal class PluginInstallerWindow : Window, IDisposable
/// The search term.
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;
+ }
}
///
@@ -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();
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 GatherProxies()
{
var proxies = new List();
-
+
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.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.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 =>
diff --git a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs
index 4c67afce4..2a8e6969a 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs
@@ -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!;
///
/// Initializes a new instance of the class.
@@ -39,6 +44,34 @@ internal class SettingsWindow : Window
this.SizeCondition = ImGuiCond.FirstUseEver;
}
+ ///
+ /// Open the settings window to the tab specified by .
+ ///
+ /// The tab of the settings window to open.
+ public void OpenTo(SettingsOpenKind kind)
+ {
+ this.IsOpen = true;
+ this.SetOpenTab(kind);
+ }
+
+ ///
+ /// Sets the current search text and marks it as prefilled.
+ ///
+ /// The search term.
+ public void SetSearchText(string text)
+ {
+ if (string.IsNullOrEmpty(text))
+ {
+ this.isSearchInputPrefilled = false;
+ this.searchInput = string.Empty;
+ }
+ else
+ {
+ this.isSearchInputPrefilled = true;
+ this.searchInput = text;
+ }
+ }
+
///
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;
+ }
}
///
@@ -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.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);
+ }
+ }
}
diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs
index 1c446f26b..04a05bd76 100644
--- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs
+++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs
@@ -128,8 +128,8 @@ public class SettingsTabLook : SettingsTab
new SettingsEntry(
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(
Loc.Localize("DalamudSettingReducedMotion", "Reduce motions"),
diff --git a/Dalamud/Interface/Utility/Raii/EndObjects.cs b/Dalamud/Interface/Utility/Raii/EndObjects.cs
index 3f2a016b3..082ac217c 100644
--- a/Dalamud/Interface/Utility/Raii/EndObjects.cs
+++ b/Dalamud/Interface/Utility/Raii/EndObjects.cs
@@ -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()
diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs
index 7111fcdc2..7e224919a 100644
--- a/Dalamud/Plugin/DalamudPluginInterface.cs
+++ b/Dalamud/Plugin/DalamudPluginInterface.cs
@@ -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 with the plugin name set as search target.
///
/// Returns false if the DalamudInterface was null.
+ [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
public bool OpenPluginInstaller()
+ {
+ return this.OpenPluginInstallerTo(PluginInstallerOpenKind.InstalledPlugins, this.plugin.InternalName);
+ }
+
+ ///
+ /// Opens the , with an optional search term.
+ ///
+ /// The page to open the installer to. Defaults to the "All Plugins" page.
+ /// An optional search text to input in the search box.
+ /// Returns false if the DalamudInterface was null.
+ public bool OpenPluginInstallerTo(PluginInstallerOpenKind openTo = PluginInstallerOpenKind.AllPlugins, string searchText = null)
{
var dalamudInterface = Service.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;
}
+ ///
+ /// Opens the , with an optional search term.
+ ///
+ /// The tab to open the settings to. Defaults to the "General" tab.
+ /// An optional search text to input in the search box.
+ /// Returns false if the DalamudInterface was null.
+ public bool OpenDalamudSettingsTo(SettingsOpenKind openTo = SettingsOpenKind.General, string searchText = null)
+ {
+ var dalamudInterface = Service.GetNullable(); // Can be null during boot
+ if (dalamudInterface == null)
+ {
+ return false;
+ }
+
+ dalamudInterface.OpenSettingsTo(openTo);
+ dalamudInterface.SetSettingsSearchText(searchText);
+
+ return true;
+ }
+
+ ///
+ /// Opens the dev menu bar.
+ ///
+ /// Returns false if the DalamudInterface was null.
+ public bool OpenDeveloperMenu()
+ {
+ var dalamudInterface = Service.GetNullable(); // Can be null during boot
+ if (dalamudInterface == null)
+ {
+ return false;
+ }
+
+ dalamudInterface.OpenDevMenu();
+ return true;
+ }
+
#region IPC
///
diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs
index 594becf63..d64a3b9b0 100644
--- a/Dalamud/Plugin/Internal/PluginManager.cs
+++ b/Dalamud/Plugin/Internal/PluginManager.cs
@@ -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.GetNullable()?.OpenPluginInstallerTo(
- PluginInstallerWindow.PluginInstallerOpenKind.Changelogs);
+ PluginInstallerOpenKind.Changelogs);
}));
this.configuration.PluginTestingOptIns ??= new();